From 9e21e73d5924bd6e38ff2fd47dbf930f6dec70b9 Mon Sep 17 00:00:00 2001 From: apapachristou Date: Thu, 1 Oct 2020 16:05:38 +0300 Subject: [PATCH] Tour opens automatically on empty DMP listing --- .../ui/dmp/listing/dmp-listing.component.html | 1 + .../ui/dmp/listing/dmp-listing.component.ts | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html index dc77de1d3..9290e507b 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html +++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html @@ -7,6 +7,7 @@

{{'DMP-LISTING.TEXT-INFO' | translate}}

{{'DMP-LISTING.TEXT-INFO-QUESTION' | translate}} {{'DMP-LISTING.LINK-ZENODO' | translate}} {{'DMP-LISTING.GET-IDEA' | translate}}

+
{{ 'GENERAL.ACTIONS.TAKE-A-TOUR'| translate }}

{{(isPublic ? 'GENERAL.TITLES.EXPLORE-PLANS' : 'GENERAL.TITLES.PLANS') | translate}}

diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts index 05bf1a0cc..3dd4c3f93 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts @@ -214,6 +214,25 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread this.scrollbar = this.hasScrollbar(); } + 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.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); + }); + // } + } + public refresh(resetPages = false) { // if (this._paginator.pageSize === undefined) this._paginator.pageSize = 10; // if (resetPages) this._paginator.pageIndex = 0; @@ -241,6 +260,9 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread }); this.listingItems = result.data; this.hasListingItems = true; + if(!this.isPublic && this.listingItems.length === 0) { + this.openTour(); + } this.totalCount = result.totalCount; }); }