Fixes bug: tour opened on empty filters result

This commit is contained in:
apapachristou 2020-10-02 18:25:53 +03:00
parent 1b13b5f0bf
commit c4b3070edb
1 changed files with 21 additions and 15 deletions

View File

@ -215,22 +215,19 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
}
openTour() {
console.log(!this.isPublic && !this.hasListingItems)
// if (!this.isPublic && !this.hasListingItems) {
this.language.get('DMP-LISTING.TEXT-INFO').pipe(takeUntil(this._destroyed)).subscribe((x: string) => {
this.dashboardTour.steps[0].title = x + '\n\n' +
this.language.instant('DMP-LISTING.TEXT-INFO-QUESTION') + ' ' +
this.language.instant('DMP-LISTING.LINK-ZENODO') + ' ' +
this.language.instant('DMP-LISTING.GET-IDEA');
this.language.get('DMP-LISTING.TEXT-INFO').pipe(takeUntil(this._destroyed)).subscribe((x: string) => {
this.dashboardTour.steps[0].title = x + '\n\n' +
this.language.instant('DMP-LISTING.TEXT-INFO-QUESTION') + ' ' +
this.language.instant('DMP-LISTING.LINK-ZENODO') + ' ' +
this.language.instant('DMP-LISTING.GET-IDEA');
this.dashboardTour.steps[1].title = this.language.instant('DATASET-LISTING.TEXT-INFO') +
this.language.instant('DATASET-LISTING.LINK-PUBLIC-DATASETS') + ' ' +
this.language.instant('DATASET-LISTING.TEXT-INFO-REST') + '\n\n' +
this.language.instant('DATASET-LISTING.TEXT-INFO-PAR');
this.dashboardTour.steps[1].title = this.language.instant('DATASET-LISTING.TEXT-INFO') +
this.language.instant('DATASET-LISTING.LINK-PUBLIC-DATASETS') + ' ' +
this.language.instant('DATASET-LISTING.TEXT-INFO-REST') + '\n\n' +
this.language.instant('DATASET-LISTING.TEXT-INFO-PAR');
this.guidedTourService.startTour(this.dashboardTour);
});
// }
this.guidedTourService.startTour(this.dashboardTour);
});
}
public refresh(resetPages = false) {
@ -260,7 +257,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
});
this.listingItems = result.data;
this.hasListingItems = true;
if(!this.isPublic && this.listingItems.length === 0) {
if (!this.isPublic && this.listingItems.length === 0 && !this.hasCriteria()) {
this.openTour();
}
this.totalCount = result.totalCount;
@ -295,6 +292,15 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
this.refresh();
}
hasCriteria(): boolean {
if (this.criteria.organisations && this.criteria.organisations.length > 0 ||
this.criteria.grants && this.criteria.grants.length > 0 ||
this.criteria.collaborators && this.criteria.collaborators.length > 0 ||
this.criteria.datasetTemplates && this.criteria.datasetTemplates.length > 0 ||
this.criteria.onlyPublic === true
) { return true; } else { return false; }
}
controlModified(): void {
// this.clearErrorModel();
// if (this.refreshCallback != null &&