From e74b7ea7832eef40669e2b3669631e47b10dff29 Mon Sep 17 00:00:00 2001 From: Xiao Gui <xgui3783@gmail.com> Date: Tue, 27 Jul 2021 13:22:21 +0200 Subject: [PATCH] chore: fix busy signal in regional features --- .../kgRegList/kgReglist.directive.ts | 13 +++++-------- .../regionalFeatureWrapper.component.ts | 13 ++++--------- .../regionalFeatureWrapper.template.html | 11 ++++++++++- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/atlasComponents/regionalFeatures/bsFeatures/kgRegionalFeature/kgRegList/kgReglist.directive.ts b/src/atlasComponents/regionalFeatures/bsFeatures/kgRegionalFeature/kgRegList/kgReglist.directive.ts index 9c183003a..df51bbb7f 100644 --- a/src/atlasComponents/regionalFeatures/bsFeatures/kgRegionalFeature/kgRegList/kgReglist.directive.ts +++ b/src/atlasComponents/regionalFeatures/bsFeatures/kgRegionalFeature/kgRegList/kgReglist.directive.ts @@ -18,14 +18,11 @@ export class KgRegionalFeaturesListDirective extends BsRegionInputBase implement // must not use switchmapto here switchMap(() => { this.busyEmitter.emit(true) - return merge( - of([]), - this.getFeatureInstancesList(KG_REGIONAL_FEATURE_KEY).pipe( - catchError(() => of([])), - tap(() => { - this.busyEmitter.emit(false) - }), - ) + return this.getFeatureInstancesList(KG_REGIONAL_FEATURE_KEY).pipe( + catchError(() => of([])), + tap(() => { + this.busyEmitter.emit(false) + }), ) }), startWith([]) diff --git a/src/atlasComponents/regionalFeatures/bsFeatures/regionalFeatureWrapper/regionalFeatureWrapper.component.ts b/src/atlasComponents/regionalFeatures/bsFeatures/regionalFeatureWrapper/regionalFeatureWrapper.component.ts index 58b8d9a44..672e8aca7 100644 --- a/src/atlasComponents/regionalFeatures/bsFeatures/regionalFeatureWrapper/regionalFeatureWrapper.component.ts +++ b/src/atlasComponents/regionalFeatures/bsFeatures/regionalFeatureWrapper/regionalFeatureWrapper.component.ts @@ -164,15 +164,10 @@ export class RegionalFeatureWrapperCmp implements OnChanges, OnDestroy{ arg['name'] = contextedFeature.result['name'] arg['description'] = ' ' arg['isGdprProtected'] = true - /** - * todo use actual fetched data - */ - const re = /\(dataset:([a-f0-9-]+)\)/.exec(arg['name']) - if (re) { - arg['urls'] = [{ - doi: `https://search.kg.ebrains.eu/instances/${re[1]}` - }] - } + arg['urls'] = [] + for (const info of contextedFeature.result['origin_datainfos']) { + arg['urls'].push(...(info.urls || [])) + } } if (contextedFeature.featureName === EbrainsRegionalFeatureName) { diff --git a/src/atlasComponents/regionalFeatures/bsFeatures/regionalFeatureWrapper/regionalFeatureWrapper.template.html b/src/atlasComponents/regionalFeatures/bsFeatures/regionalFeatureWrapper/regionalFeatureWrapper.template.html index 9882dbc4e..6a62ae958 100644 --- a/src/atlasComponents/regionalFeatures/bsFeatures/regionalFeatureWrapper/regionalFeatureWrapper.template.html +++ b/src/atlasComponents/regionalFeatures/bsFeatures/regionalFeatureWrapper/regionalFeatureWrapper.template.html @@ -1,4 +1,9 @@ -<spinner-cmp *ngIf="busy$ | async; else resultTmpl"></spinner-cmp> +<ng-template [ngTemplateOutlet]="resultTmpl"> +</ng-template> + +<ng-template #busyTmpl> + <spinner-cmp></spinner-cmp> +</ng-template> <ng-template #resultTmpl> @@ -27,6 +32,10 @@ <div class="feature-container" [attr.aria-label]="ARIA_LABELS.LIST_OF_DATASETS_ARIA_LABEL"> + <!-- if busy, show spinner --> + <ng-template [ngIf]="busy$ | async"> + <ng-template [ngTemplateOutlet]="busyTmpl"></ng-template> + </ng-template> <div *ngFor="let feature of registeredFeatures; let index = index" class="overflow-hidden"> -- GitLab