diff --git a/src/app/core/substance-form/simplified-references/simplified-reference-form.component.ts b/src/app/core/substance-form/simplified-references/simplified-reference-form.component.ts index 13b3da5fb..53201b148 100644 --- a/src/app/core/substance-form/simplified-references/simplified-reference-form.component.ts +++ b/src/app/core/substance-form/simplified-references/simplified-reference-form.component.ts @@ -52,7 +52,16 @@ export class SimplifiedReferenceFormComponent implements OnInit, AfterViewInit, } updateAccess(access: Array): void { + this.reference.access = access; + if(access && access.length == 0) { + this.reference.tags = ["PUBLIC_DOMAIN_RELEASE"]; + this.reference.publicDomain = true; + } else { + delete this.reference.tags; + this.reference.publicDomain = false; + + } } setSourceType(event?: any): void { diff --git a/src/app/core/substance-form/simplified-references/substance-form-simplified-references-card.component.ts b/src/app/core/substance-form/simplified-references/substance-form-simplified-references-card.component.ts index ba266a60a..563b32d33 100644 --- a/src/app/core/substance-form/simplified-references/substance-form-simplified-references-card.component.ts +++ b/src/app/core/substance-form/simplified-references/substance-form-simplified-references-card.component.ts @@ -123,16 +123,31 @@ export class SubstanceFormSimplifiedReferencesCardComponent extends SubstanceCar } applyAllReferencesToAll(): void { - for(const ref of this.references){ - this.applyToAll(ref.uuid) - } + if (this.references && this.references.length > 0) { + for(let ref of this.references){ + this.applyToAll(ref.uuid) + } + } } deleteReference(reference: SubstanceReference): void { this.substanceFormReferencesService.deleteSubstanceReference(reference); } + executeOnceNotUndefined(getter: () => T | undefined, interval = 100): Promise { + return new Promise((resolve) => { + const checkInterval = setInterval(() => { + const result = getter(); + if (result !== undefined) { + clearInterval(checkInterval); + resolve(result); + } + }, interval); + }); +} + applyToAll(uuid: string): void { + this.executeOnceNotUndefined(() => this.domainsWithReferences).then((value) => { this.applyReference(this.domainsWithReferences.definition.domain, uuid); this.domainKeys.map(key => this.domainsWithReferences[key]?.domains).forEach(domains => { if (domains) { @@ -143,6 +158,7 @@ export class SubstanceFormSimplifiedReferencesCardComponent extends SubstanceCar }); this.substanceFormReferencesService.emitReferencesUpdate(); + }); } applyReference(domain: any, uuid: string): void { diff --git a/src/app/core/substance-form/submit-success-dialog/submit-success-dialog.component.html b/src/app/core/substance-form/submit-success-dialog/submit-success-dialog.component.html index 585d199df..d74d392b8 100644 --- a/src/app/core/substance-form/submit-success-dialog/submit-success-dialog.component.html +++ b/src/app/core/substance-form/submit-success-dialog/submit-success-dialog.component.html @@ -1,7 +1,7 @@

{{dialogTitle}}

-
+
{{dialogMessage}}
diff --git a/src/app/core/substance-form/submit-success-dialog/submit-success-dialog.component.scss b/src/app/core/substance-form/submit-success-dialog/submit-success-dialog.component.scss index 6c4b2ba41..9744330f9 100644 --- a/src/app/core/substance-form/submit-success-dialog/submit-success-dialog.component.scss +++ b/src/app/core/substance-form/submit-success-dialog/submit-success-dialog.component.scss @@ -1,3 +1,8 @@ .dialog-actions { margin-top: 12px; } + +.submit-message { + padding-bottom: 5px; + padding-top: 5px; +} \ No newline at end of file