[CST-3090] fix services name and dropdown

This commit is contained in:
Danilo Di Nuzzo
2020-06-17 10:47:46 +02:00
parent efc476ab31
commit 294f5e5f31
3 changed files with 4 additions and 43 deletions

View File

@@ -78,7 +78,7 @@ export class CollectionDataService extends ComColDataService<Collection> {
* collection list * collection list
*/ */
getAuthorizedCollection(query: string, options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<Collection>>): Observable<RemoteData<PaginatedList<Collection>>> { getAuthorizedCollection(query: string, options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<Collection>>): Observable<RemoteData<PaginatedList<Collection>>> {
const searchHref = 'findAuthorized'; const searchHref = 'findSubmitAuthorized';
options = Object.assign({}, options, { options = Object.assign({}, options, {
searchParams: [new RequestParam('query', query)] searchParams: [new RequestParam('query', query)]
}); });
@@ -97,7 +97,7 @@ export class CollectionDataService extends ComColDataService<Collection> {
* collection list * collection list
*/ */
getAuthorizedCollectionByCommunity(communityId: string, query: string, options: FindListOptions = {}): Observable<RemoteData<PaginatedList<Collection>>> { getAuthorizedCollectionByCommunity(communityId: string, query: string, options: FindListOptions = {}): Observable<RemoteData<PaginatedList<Collection>>> {
const searchHref = 'findAuthorizedByCommunity'; const searchHref = 'findSubmitAuthorizedByCommunity';
options = Object.assign({}, options, { options = Object.assign({}, options, {
searchParams: [ searchParams: [
new RequestParam('uuid', communityId), new RequestParam('uuid', communityId),
@@ -116,7 +116,7 @@ export class CollectionDataService extends ComColDataService<Collection> {
* true if the user has at least one collection to submit to * true if the user has at least one collection to submit to
*/ */
hasAuthorizedCollection(): Observable<boolean> { hasAuthorizedCollection(): Observable<boolean> {
const searchHref = 'findAuthorized'; const searchHref = 'findSubmitAuthorized';
const options = new FindListOptions(); const options = new FindListOptions();
options.elementsPerPage = 1; options.elementsPerPage = 1;

View File

@@ -123,7 +123,7 @@ export class CollectionDropdownComponent implements OnInit, OnDestroy {
startWith('') startWith('')
).subscribe( ).subscribe(
(next) => { (next) => {
if (hasValue(next)) { if (hasValue(next) && next !== this.currentQuery) {
this.resetPagination(); this.resetPagination();
this.currentQuery = next; this.currentQuery = next;
this.populateCollectionList(this.currentQuery, this.currentPage); this.populateCollectionList(this.currentQuery, this.currentPage);

View File

@@ -87,18 +87,6 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
*/ */
protected pathCombiner: JsonPatchOperationPathCombiner; protected pathCombiner: JsonPatchOperationPathCombiner;
/**
* A boolean representing if dropdown list is scrollable to the bottom
* @type {boolean}
*/
private scrollableBottom = false;
/**
* A boolean representing if dropdown list is scrollable to the top
* @type {boolean}
*/
private scrollableTop = false;
/** /**
* Array to track all subscriptions and unsubscribe them onDestroy * Array to track all subscriptions and unsubscribe them onDestroy
* @type {Array} * @type {Array}
@@ -121,39 +109,12 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
* @param {SubmissionService} submissionService * @param {SubmissionService} submissionService
*/ */
constructor(protected cdr: ChangeDetectorRef, constructor(protected cdr: ChangeDetectorRef,
private communityDataService: CommunityDataService,
private collectionDataService: CollectionDataService, private collectionDataService: CollectionDataService,
private operationsBuilder: JsonPatchOperationsBuilder, private operationsBuilder: JsonPatchOperationsBuilder,
private operationsService: SubmissionJsonPatchOperationsService, private operationsService: SubmissionJsonPatchOperationsService,
private submissionService: SubmissionService) { private submissionService: SubmissionService) {
} }
/**
* Method called on mousewheel event, it prevent the page scroll
* when arriving at the top/bottom of dropdown menu
*
* @param event
* mousewheel event
*/
@HostListener('mousewheel', ['$event']) onMousewheel(event) {
if (event.wheelDelta > 0 && this.scrollableTop) {
event.preventDefault();
}
if (event.wheelDelta < 0 && this.scrollableBottom) {
event.preventDefault();
}
}
/**
* Check if dropdown scrollbar is at the top or bottom of the dropdown list
*
* @param event
*/
onScroll(event) {
this.scrollableBottom = (event.target.scrollTop + event.target.clientHeight === event.target.scrollHeight);
this.scrollableTop = (event.target.scrollTop === 0);
}
/** /**
* Initialize collection list * Initialize collection list
*/ */