diff --git a/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html b/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html index 5871fdd9f58deb3fb43dc4f541c53448a060d2cf..6ee815e3f3fb6cb680f0ee01fc40ed311af19228 100644 --- a/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html +++ b/src/ui/databrowserModule/singleDataset/detailedView/singleDataset.template.html @@ -5,57 +5,6 @@ </mat-card-subtitle> <mat-card-content mat-dialog-content> - <mat-grid-list *ngIf="false" [cols]="kgReference.length + (preview ? 1 : 0) + (downloadEnabled ? 2 : 0)" rowHeight="4em"> - - <!-- explore --> - <mat-grid-tile *ngFor="let kgRef of kgReference"> - <a [href]="kgRef | doiParserPipe" - matTooltip="Explore" - iav-stop="click mousedown" - mat-icon-button - target="_blank"> - <i class="fas fa-external-link-alt"></i> - </a> - </mat-grid-tile> - - <!-- pin --> - <mat-grid-tile *ngIf="downloadEnabled"> - - <button - iav-stop="click mousedown" - (click)="toggleFav()" - matTooltip="Pin" - mat-icon-button - [color]="(favedDataentries$ | async | datasetIsFaved : dataset) ? 'primary' : 'basic'"> - <i class="fas fa-thumbtack"></i> - </button> - </mat-grid-tile> - - <!-- preview --> - <mat-grid-tile *ngIf="preview"> - <button - iav-stop="click mousedown" - (click)="showPreviewList(previewFilesListTemplate)" - matTooltip="Preview" - mat-icon-button> - <i class="far fa-eye"></i> - </button> - </mat-grid-tile> - - <!-- download --> - <mat-grid-tile *ngIf="downloadEnabled"> - <a [href]="dlFromKgHref" - target="_blank" - iav-stop="click mousedown"> - <button - matTooltip="Download" - [disabled]="downloadInProgress" - mat-icon-button> - <i class="ml-1 fas" [ngClass]="!downloadInProgress? 'fa-download' :'fa-spinner fa-pulse'"></i> - </button> - </a> - </mat-grid-tile> - </mat-grid-list> <!-- description --> <small> @@ -125,9 +74,20 @@ </button> </a> + + <!-- check if has preview --> + <kg-dataset-list + class="d-none" + [backendUrl]="DS_PREVIEW_URL" + *ngIf="kgId" + (kgDsPrvUpdated)="handleKgDsPrvUpdate($event)" + [kgId]="kgId"> + + </kg-dataset-list> + <button mat-button mat-dialog-close - *ngIf="preview" + *ngIf="hasPreview" (click)="showPreviewList(previewFilesListTemplate)" color="basic"> <span> diff --git a/src/ui/databrowserModule/singleDataset/singleDataset.base.ts b/src/ui/databrowserModule/singleDataset/singleDataset.base.ts index 510232f2495fd069c13e931b2938773603e981e1..0fd223cbffeb562b30db2245e4a9c11306ce3374 100644 --- a/src/ui/databrowserModule/singleDataset/singleDataset.base.ts +++ b/src/ui/databrowserModule/singleDataset/singleDataset.base.ts @@ -73,6 +73,20 @@ export class SingleDatasetBase implements OnInit { } } + public hasPreview = false + public previewFiles = [] + + handleKgDsPrvUpdate(event:CustomEvent){ + this.hasPreview = false + this.previewFiles = [] + const { detail } = event + const { datasetFiles } = detail + if (datasetFiles && Array.isArray(datasetFiles) && datasetFiles.length > 0) { + this.hasPreview = true + this.previewFiles = datasetFiles + } + } + public ngOnInit() { const { kgId, kgSchema, dataset } = this this.dlFromKgHref = this.singleDatasetService.getDownloadZipFromKgHref({ kgSchema, kgId })