diff --git a/deploy/datasets/util.js b/deploy/datasets/util.js index ed6fddccd916c076a8d1818f869c0b90db55938e..cdc9ca91a3905fc72d14e50222342249b38c7e13 100644 --- a/deploy/datasets/util.js +++ b/deploy/datasets/util.js @@ -296,27 +296,6 @@ const init = async () => { getPublicAccessToken = getPublic } -const defaultConfig = { - timeout: 5000, - retries: 3 -} - -const retry = async (fn, { timeout = defaultConfig.timeout, retries = defaultConfig.retries } = defaultConfig) => { - let retryNo = 0 - while (retryNo < retries) { - retryNo ++ - try { - const result = await fn() - return result - } catch (e) { - console.warn(`fn failed, retry after ${timeout} milliseconds`) - await (() => new Promise(rs => setTimeout(rs, timeout)))() - } - } - - throw new Error(`fn failed ${retries} times. Aborting.`) -} - const KG_ROOT = process.env.KG_ROOT || `https://kg.humanbrainproject.eu/query` const KG_SEARCH_VOCAB = process.env.KG_SEARCH_VOCAB || 'https://schema.hbp.eu/myQuery/' diff --git a/src/atlasViewer/atlasViewer.template.html b/src/atlasViewer/atlasViewer.template.html index ab8a531a6fc56484ee8eb7cd503272e42766a303..02a93522455a15dd01e1ee5d6e04764d8a831db9 100644 --- a/src/atlasViewer/atlasViewer.template.html +++ b/src/atlasViewer/atlasViewer.template.html @@ -137,13 +137,8 @@ </mat-icon> - <div class="d-flex flex-column"> - <div *ngIf="labelText.dataset && labelText.dataset.length"> - <span matLine *ngFor="let dataset of labelText.dataset" [innerHTML]="dataset"></span> - </div> - <div matLine *ngFor="let text of labelText.text" [innerHTML]="text"> - </div> - </div> + <div matLine *ngFor="let text of labelText.text" [innerHTML]="text"></div> + </mat-list-item> </mat-list> </ng-container> diff --git a/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html b/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html index 31dbc9a410346bf5abd28a4bf213fa9c1369fdb4..643bda64f9bf6bb9d90089dbe4a5edf430c47f62 100644 --- a/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html +++ b/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html @@ -99,19 +99,6 @@ </button> </a> - <!-- explore with direct external link --> - <a *ngIf="kgExternalLink" - class="m-2" - [href]="kgExternalLink" - target="_blank"> - <button - mat-raised-button - color="primary"> - Explore - <i class="fas fa-external-link-alt"></i> - </button> - </a> - <!-- pin data --> <button mat-button *ngIf="downloadEnabled" @@ -152,7 +139,6 @@ <i class="ml-1 far fa-eye"></i> </button> - <button *ngIf="underEmbargo" mat-button disabled>Under embargo</button> </mat-card-actions> <mat-card-footer></mat-card-footer> diff --git a/src/util/directives/mouseOver.directive.ts b/src/util/directives/mouseOver.directive.ts index c3609e1b173a174e1cbf8b7f39e8f153e4c4ab72..a19ac9d440a5f825c7d1125469222aea5dffc78a 100644 --- a/src/util/directives/mouseOver.directive.ts +++ b/src/util/directives/mouseOver.directive.ts @@ -172,7 +172,15 @@ export class MouseOverTextPipe implements PipeTransform { private renderText = ({ label, obj }): SafeHtml[] => { switch (label) { case 'landmark': - return [this.sanitizer.sanitize(SecurityContext.HTML, obj.landmarkName)] + const { dataset = [] } = obj + return [ + this.sanitizer.sanitize(SecurityContext.HTML, obj.landmarkName), + ...(dataset.map(ds => this.sanitizer.bypassSecurityTrustHtml(` +<span class="text-muted"> + ${this.sanitizer.sanitize(SecurityContext.HTML, ds.name)} +</span> +`))) + ] case 'segments': return obj.map(({ segment }) => this.transformOnHoverSegmentPipe.transform(segment)) case 'userLandmark': @@ -184,15 +192,6 @@ export class MouseOverTextPipe implements PipeTransform { } } - private renderDatasetTitle = ({ label, obj }): SafeHtml[] => { - switch (label) { - case 'landmark': - return obj.dataset.map(d => this.sanitizer.sanitize(SecurityContext.HTML, d.name)) - default: - return null - } - } - public transform(inc: {segments: any, landmark: any, userLandmark: any}): Array<{label: string, text: SafeHtml[]}> { const keys = Object.keys(inc) return keys @@ -203,8 +202,7 @@ export class MouseOverTextPipe implements PipeTransform { .map(key => { return { label: key, - text: this.renderText({ label: key, obj: inc[key] }), - dataset: this.renderDatasetTitle({ label: key, obj: inc[key] }) + text: this.renderText({ label: key, obj: inc[key] }) } }) }