mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Fix #2197 authority key lookup
Avoid an authority key lookup when it starts with "will be generated::"
This commit is contained in:
@@ -53,7 +53,7 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom
|
||||
*/
|
||||
getInitValueFromModel(): Observable<FormFieldMetadataValueObject> {
|
||||
let initValue$: Observable<FormFieldMetadataValueObject>;
|
||||
if (isNotEmpty(this.model.value) && (this.model.value instanceof FormFieldMetadataValueObject)) {
|
||||
if (isNotEmpty(this.model.value) && (this.model.value instanceof FormFieldMetadataValueObject) && !this.model.value.hasAuthorityToGenerate()) {
|
||||
let initEntry$: Observable<VocabularyEntry>;
|
||||
if (this.model.value.hasAuthority()) {
|
||||
initEntry$ = this.vocabularyService.getVocabularyEntryByID(this.model.value.authority, this.model.vocabularyOptions);
|
||||
|
@@ -11,6 +11,10 @@ export interface OtherInformation {
|
||||
* A class representing a specific input-form field's value
|
||||
*/
|
||||
export class FormFieldMetadataValueObject implements MetadataValueInterface {
|
||||
|
||||
static readonly AUTHORITY_SPLIT: string = '::';
|
||||
static readonly AUTHORITY_GENERATE: string = 'will be generated' + FormFieldMetadataValueObject.AUTHORITY_SPLIT;
|
||||
|
||||
metadata?: string;
|
||||
value: any;
|
||||
display: string;
|
||||
@@ -58,6 +62,13 @@ export class FormFieldMetadataValueObject implements MetadataValueInterface {
|
||||
return isNotEmpty(this.authority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this object has an authority value that needs to be generated
|
||||
*/
|
||||
hasAuthorityToGenerate(): boolean {
|
||||
return isNotEmpty(this.authority) && this.authority.startsWith(FormFieldMetadataValueObject.AUTHORITY_GENERATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this this object has a value
|
||||
*/
|
||||
|
Reference in New Issue
Block a user