Skip to content

Commit f4b1ebe

Browse files
authored
[ENG-9802] Users unable to create a NEW CEDAR metadata template, and existing templates not able to be viewed #814
- Ticket: [ENG-9802] - Feature flag: n/a ## Summary of Changes 1. Fixed loading of cedar libraries.
1 parent 6a362c5 commit f4b1ebe

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/app/features/metadata/components/cedar-template-form/cedar-template-form.component.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { ActivatedRoute } from '@angular/router';
2626
import { ENVIRONMENT } from '@core/provider/environment.provider';
2727

2828
import 'cedar-artifact-viewer';
29-
import 'cedar-embeddable-editor';
3029

3130
import { CEDAR_CONFIG, CEDAR_VIEWER_CONFIG } from '../../constants';
3231
import { CedarMetadataHelper } from '../../helpers';
@@ -71,6 +70,8 @@ export class CedarTemplateFormComponent {
7170
readonly downloadUrl = signal<string>('');
7271
readonly schemaName = signal<string>('');
7372

73+
readonly fileGuid = toSignal(this.route.params.pipe(map((params) => params['fileGuid'])) ?? of(undefined));
74+
7475
shareItems = [
7576
{
7677
label: 'files.detail.actions.share.email',
@@ -123,7 +124,17 @@ export class CedarTemplateFormComponent {
123124
this.validateCedarMetadata();
124125
}
125126

126-
readonly fileGuid = toSignal(this.route.params.pipe(map((params) => params['fileGuid'])) ?? of(undefined));
127+
private initializeFormData(): void {
128+
const template = this.template()?.attributes?.template;
129+
if (!template) return;
130+
const metadata = this.existingRecord()?.attributes?.metadata;
131+
if (this.existingRecord()) {
132+
const structuredMetadata = CedarMetadataHelper.buildStructuredMetadata(metadata);
133+
this.formData.set(structuredMetadata);
134+
} else {
135+
this.formData.set(CedarMetadataHelper.buildEmptyMetadata());
136+
}
137+
}
127138

128139
downloadMetadadaRecord() {
129140
if (this.fileGuid()) {
@@ -174,18 +185,6 @@ export class CedarTemplateFormComponent {
174185
}
175186
}
176187

177-
private initializeFormData(): void {
178-
const template = this.template()?.attributes?.template;
179-
if (!template) return;
180-
const metadata = this.existingRecord()?.attributes?.metadata;
181-
if (this.existingRecord()) {
182-
const structuredMetadata = CedarMetadataHelper.buildStructuredMetadata(metadata);
183-
this.formData.set(structuredMetadata);
184-
} else {
185-
this.formData.set(CedarMetadataHelper.buildEmptyMetadata());
186-
}
187-
}
188-
189188
handleEmailShare(): void {
190189
const url = window.location.href;
191190
window.location.href = `mailto:?subject=${this.schemaName()}&body=${url}`;

src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { bootstrapApplication } from '@angular/platform-browser';
33
import { AppComponent } from '@osf/app.component';
44
import { appConfig } from '@osf/app.config';
55

6+
import 'cedar-embeddable-editor';
7+
68
bootstrapApplication(AppComponent, {
79
providers: [...appConfig.providers],
810
}).catch((err) =>

0 commit comments

Comments
 (0)