Add support for MetadataValue class to AuthorityConfidenceStateDirective

This commit is contained in:
Toni Prieto
2024-01-03 11:10:09 +01:00
parent c596c6eb14
commit 439739ab42

View File

@@ -28,6 +28,7 @@ import { isNotEmpty, isNull } from '../../empty.util';
import { ConfidenceIconConfig } from '../../../../config/submission-config.interface'; import { ConfidenceIconConfig } from '../../../../config/submission-config.interface';
import { environment } from '../../../../environments/environment'; import { environment } from '../../../../environments/environment';
import { VocabularyEntryDetail } from '../../../core/submission/vocabularies/models/vocabulary-entry-detail.model'; import { VocabularyEntryDetail } from '../../../core/submission/vocabularies/models/vocabulary-entry-detail.model';
import { MetadataValue } from '../../../core/shared/metadata.models';
/** /**
* Directive to add to the element a bootstrap utility class based on metadata confidence value * Directive to add to the element a bootstrap utility class based on metadata confidence value
@@ -40,7 +41,7 @@ export class AuthorityConfidenceStateDirective implements OnChanges, AfterViewIn
/** /**
* The metadata value * The metadata value
*/ */
@Input() authorityValue: VocabularyEntry | FormFieldMetadataValueObject | string; @Input() authorityValue: VocabularyEntry | FormFieldMetadataValueObject | MetadataValue | string;
/** /**
* A boolean representing if to show html icon if authority value is empty * A boolean representing if to show html icon if authority value is empty
@@ -131,6 +132,10 @@ export class AuthorityConfidenceStateDirective implements OnChanges, AfterViewIn
confidence = value.confidence; confidence = value.confidence;
} }
if (isNotEmpty(value) && value instanceof MetadataValue) {
confidence = value.confidence;
}
return confidence; return confidence;
} }