Skip to content

Commit

Permalink
fixing simplied form again
Browse files Browse the repository at this point in the history
  • Loading branch information
NikoAnderson committed Oct 25, 2024
1 parent d56984b commit 41384b3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,16 @@ export class SimplifiedReferenceFormComponent implements OnInit, AfterViewInit,
}

updateAccess(access: Array<string>): 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(getter: () => T | undefined, interval = 100): Promise<T> {
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) {
Expand All @@ -143,6 +158,7 @@ export class SubstanceFormSimplifiedReferencesCardComponent extends SubstanceCar
});

this.substanceFormReferencesService.emitReferencesUpdate();
});
}

applyReference(domain: any, uuid: string): void {
Expand Down

0 comments on commit 41384b3

Please sign in to comment.