From 1f2b87d7202b64a841f9aa56438c3c2e453b1219 Mon Sep 17 00:00:00 2001 From: mkovalua Date: Tue, 7 Oct 2025 22:46:07 +0300 Subject: [PATCH 1/2] fix( file metadata ): download file metadata for community metadata record --- .../cedar-template-form.component.html | 41 +++++++++++-------- .../cedar-template-form.component.ts | 10 ++++- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.html b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.html index e3ed84192..8ba2fdbfe 100644 --- a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.html +++ b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.html @@ -17,13 +17,16 @@

{{ 'project.metadata.addMetadata.notPublishedTe > } - + + @if (!fileGuid()) { + + } {{ 'project.metadata.addMetadata.notPublishedTe (onClick)="downloadFile()" /> - + @if (!fileGuid()) { + - - - {{ item.label | translate }} - - + + + {{ item.label | translate }} + + + } } diff --git a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts index 5cf594b32..0f52a5f67 100644 --- a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts +++ b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts @@ -31,6 +31,8 @@ import { } from '@osf/features/metadata/models'; import 'cedar-artifact-viewer'; +import { toSignal } from '@angular/core/rxjs-interop'; +import { map, of } from 'rxjs'; @Component({ selector: 'osf-cedar-template-form', @@ -118,8 +120,14 @@ export class CedarTemplateFormComponent { this.validateCedarMetadata(); } + readonly fileGuid = toSignal(this.route.params.pipe(map((params) => params['fileGuid'])) ?? of(undefined)); + downloadFile() { - window.open(this.downloadUrl(), '_blank'); + if (this.fileGuid()) { + window.open(`${this.environment.webUrl}/metadata/${this.fileGuid()}`)?.focus(); + } else { + window.open(this.downloadUrl(), '_blank'); + } } copyUrl() { From d95c9e958d6c5eb75be2b2361ec06a4d56c8a2af Mon Sep 17 00:00:00 2001 From: mkovalua Date: Tue, 7 Oct 2025 22:55:06 +0300 Subject: [PATCH 2/2] fix( file metadata ): set more correct method name --- .../cedar-template-form/cedar-template-form.component.html | 2 +- .../cedar-template-form/cedar-template-form.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.html b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.html index 8ba2fdbfe..5450a0a2b 100644 --- a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.html +++ b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.html @@ -33,7 +33,7 @@

{{ 'project.metadata.addMetadata.notPublishedTe class="btn-icon-only px-2 flex align-self-center" icon="fas fa-download" [pTooltip]="'project.metadata.addMetadata.downloadRecordMetadata' | translate" - (onClick)="downloadFile()" + (onClick)="downloadMetadadaRecord()" /> @if (!fileGuid()) { diff --git a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts index 0f52a5f67..b3b4d55d3 100644 --- a/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts +++ b/src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts @@ -122,7 +122,7 @@ export class CedarTemplateFormComponent { readonly fileGuid = toSignal(this.route.params.pipe(map((params) => params['fileGuid'])) ?? of(undefined)); - downloadFile() { + downloadMetadadaRecord() { if (this.fileGuid()) { window.open(`${this.environment.webUrl}/metadata/${this.fileGuid()}`)?.focus(); } else {