mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +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> {
|
getInitValueFromModel(): Observable<FormFieldMetadataValueObject> {
|
||||||
let initValue$: 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>;
|
let initEntry$: Observable<VocabularyEntry>;
|
||||||
if (this.model.value.hasAuthority()) {
|
if (this.model.value.hasAuthority()) {
|
||||||
initEntry$ = this.vocabularyService.getVocabularyEntryByID(this.model.value.authority, this.model.vocabularyOptions);
|
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
|
* A class representing a specific input-form field's value
|
||||||
*/
|
*/
|
||||||
export class FormFieldMetadataValueObject implements MetadataValueInterface {
|
export class FormFieldMetadataValueObject implements MetadataValueInterface {
|
||||||
|
|
||||||
|
static readonly AUTHORITY_SPLIT: string = '::';
|
||||||
|
static readonly AUTHORITY_GENERATE: string = 'will be generated' + FormFieldMetadataValueObject.AUTHORITY_SPLIT;
|
||||||
|
|
||||||
metadata?: string;
|
metadata?: string;
|
||||||
value: any;
|
value: any;
|
||||||
display: string;
|
display: string;
|
||||||
@@ -58,6 +62,13 @@ export class FormFieldMetadataValueObject implements MetadataValueInterface {
|
|||||||
return isNotEmpty(this.authority);
|
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
|
* Returns true if this this object has a value
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user