Skip to content

Commit

Permalink
Merge pull request #250 from swisstopo/bug/asset-248-reference-link-n…
Browse files Browse the repository at this point in the history
…ot-working

fix reference link not updating the display of the asset detail
  • Loading branch information
TIL-EBP authored Jul 31, 2024
2 parents 3e47f6c + 990cbf6 commit efdf9ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
<tr>
<th translate="search.content"></th>
<td>
<ng-container *ngIf="assetDetail.assetFormatCompositions.length === 0">&ndash; </ng-container>
<ng-container *ngIf="assetDetail.assetFormatCompositions.length === 0">&ndash;</ng-container>
<ng-container *rxFor="let assetFormatComposition of assetDetail.assetFormatCompositions; let last = last">
{{ (assetFormatComposition | valueItemName) + (last ? "" : ", ") }}
</ng-container>
Expand All @@ -158,14 +158,13 @@
<tr>
<th translate="search.reference"></th>
<td>
<ng-container *ngIf="assetDetail.referenceAssets.length === 0">&ndash; </ng-container>
<ng-container *ngIf="assetDetail.referenceAssets.length === 0">&ndash;</ng-container>
<ul [class.single-entry]="assetDetail.referenceAssets.length === 1">
<li *rxFor="let referenceAsset of assetDetail.referenceAssets">
<a
asset-sg-reset
class="line"
[routerLink]="['.']"
[queryParams]="{ searchParams: undefined, assetId: referenceAsset.assetId }"
(click)="searchForReferenceAsset(referenceAsset.assetId)"
queryParamsHandling="merge"
>
{{ referenceAsset.titlePublic }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ export class AssetSearchDetailComponent {

constructor(private httpClient: HttpClient) {}

isActiveFileDownload(file: Omit<AssetFile, 'fileSize'>, isDownload = true): boolean {
public isActiveFileDownload(file: Omit<AssetFile, 'fileSize'>, isDownload = true): boolean {
const download = this.activeFileDownloads.get(file.fileId);
return download != null && download.isDownload == isDownload;
}

downloadFile(file: Omit<AssetFile, 'fileSize'>, isDownload = true): void {
public searchForReferenceAsset(assetId: number) {
this._store.dispatch(actions.assetClicked({ assetId }));
}

public downloadFile(file: Omit<AssetFile, 'fileSize'>, isDownload = true): void {
this.activeFileDownloads.set(file.fileId, { isDownload });
this.httpClient.get(`/api/files/${file.fileId}`, { responseType: 'blob' }).subscribe({
next: (blob) => {
Expand Down

0 comments on commit efdf9ed

Please sign in to comment.