Skip to content
Snippets Groups Projects
Commit 2c9dc923 authored by Xiao Gui's avatar Xiao Gui
Browse files

fixed dataset has preview. no longer uses name, but id

parent 0a3c2e09
No related branches found
No related tags found
No related merge requests found
......@@ -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>
......
......@@ -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 })
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment