From e0e3c5096f7087555a228d2deba7fe04e20385bd Mon Sep 17 00:00:00 2001 From: Xiao Gui <xgui3783@gmail.com> Date: Thu, 23 Jun 2022 14:55:43 +0200 Subject: [PATCH] chore: add restricted access warning --- .../core/datasets/dataset/dataset.component.ts | 17 +++++++++++++++-- .../core/datasets/dataset/dataset.template.html | 7 +++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.component.ts b/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.component.ts index 08bdb9d55..88614d619 100644 --- a/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.component.ts +++ b/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.component.ts @@ -1,5 +1,8 @@ -import { Component, Input } from "@angular/core"; +import { Component, Input, OnChanges, SimpleChanges } from "@angular/core"; import { SapiDatasetModel } from "src/atlasComponents/sapi"; +import { CONST } from "common/constants" + +const RESTRICTED_ACCESS_ID = "https://nexus.humanbrainproject.org/v0/data/minds/core/embargostatus/v1.0.0/3054f80d-96a8-4dce-9b92-55c68a8b5efd" @Component({ selector: `sxplr-sapiviews-core-datasets-dataset`, @@ -9,7 +12,17 @@ import { SapiDatasetModel } from "src/atlasComponents/sapi"; ] }) -export class DatasetView { +export class DatasetView implements OnChanges{ @Input('sxplr-sapiviews-core-datasets-dataset-input') dataset: SapiDatasetModel + + public isRestricted = false + public CONST = CONST + + ngOnChanges(changes: SimpleChanges): void { + const { dataset } = changes + if (dataset) { + this.isRestricted = (dataset.currentValue as SapiDatasetModel)?.metadata?.accessibility?.["@id"] === RESTRICTED_ACCESS_ID + } + } } diff --git a/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.template.html b/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.template.html index 68ce4f9a8..f9c37f990 100644 --- a/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.template.html +++ b/src/atlasComponents/sapiViews/core/datasets/dataset/dataset.template.html @@ -24,6 +24,13 @@ <span class="sxplr-m-a"> EBRAINS dataset </span> + + <button *ngIf="isRestricted" + [matTooltip]="CONST.GDPR_TEXT" + mat-icon-button color="warn"> + <i class="fas fa-exclamation-triangle"></i> + </button> + <mat-divider class="sxplr-pl-1" [vertical]="true"></mat-divider> <a mat-icon-button *ngFor="let url of dataset.urls" [href]="url.doi | parseDoi" target="_blank"> -- GitLab