Skip to content

Commit

Permalink
Remove CondidenceIconComponent and use AuthorityConfidenceStateDirect…
Browse files Browse the repository at this point in the history
…ive instead
  • Loading branch information
toniprieto committed Dec 12, 2023
1 parent 7fbdfee commit 630f130
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 93 deletions.

This file was deleted.

Empty file.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
[model]="getModel() | async"
(change)="onChangeAuthorityField($event)">
</ds-dynamic-onebox>

<div *ngIf="!isVirtual && !mdValue.editing && mdValue.newValue.authority && mdValue.newValue.confidence !== ConfidenceTypeEnum.CF_NOVALUE && mdValue.newValue.confidence !== ConfidenceTypeEnum.CF_UNSET">
<span class="badge badge-secondary">
<div *ngIf="!isVirtual && !mdValue.editing && mdValue.newValue.authority">
<span class="badge badge-secondary" >
{{ dsoType + '.edit.metadata.authority.label' | translate }} {{ mdValue.newValue.authority }}
</span>
<ds-confidence-icon class="confidence-icon" [mdValue]="mdValue.newValue" ></ds-confidence-icon>
<i dsAuthorityConfidenceState
class="fas fa-circle fa-fw position-absolute mt-1 p-0"
aria-hidden="true"
[authorityValue]="mdValue.newValue"
></i>
</div>

<div class="mt-2" *ngIf=" mdValue.editing && (isAuthorityControlled() | async) && (isSuggesterVocabulary() | async)">
Expand All @@ -44,7 +47,6 @@
<i class="fas fa-lock-open fa-fw"></i>
</button>
</div>
<ds-confidence-icon [mdValue]="mdValue.newValue" ></ds-confidence-icon>
</div>

<div class="d-flex" *ngIf="mdRepresentation">
Expand Down
3 changes: 0 additions & 3 deletions src/app/dso-shared/dso-shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { DsoEditMetadataHeadersComponent } from './dso-edit-metadata/dso-edit-me
import { DsoEditMetadataValueHeadersComponent } from './dso-edit-metadata/dso-edit-metadata-value-headers/dso-edit-metadata-value-headers.component';
import { ThemedDsoEditMetadataComponent } from './dso-edit-metadata/themed-dso-edit-metadata.component';
import { FormModule } from '../shared/form/form.module';
import { ConfidenceIconComponent } from './dso-edit-metadata/confidence-icon/confidence-icon.component';

@NgModule({
imports: [
Expand All @@ -23,7 +22,6 @@ import { ConfidenceIconComponent } from './dso-edit-metadata/confidence-icon/con
DsoEditMetadataValueComponent,
DsoEditMetadataHeadersComponent,
DsoEditMetadataValueHeadersComponent,
ConfidenceIconComponent
],
exports: [
DsoEditMetadataComponent,
Expand All @@ -33,7 +31,6 @@ import { ConfidenceIconComponent } from './dso-edit-metadata/confidence-icon/con
DsoEditMetadataValueComponent,
DsoEditMetadataHeadersComponent,
DsoEditMetadataValueHeadersComponent,
ConfidenceIconComponent
],
})
export class DsoSharedModule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { isNotEmpty, isNull } from '../../empty.util';
import { ConfidenceIconConfig } from '../../../../config/submission-config.interface';
import { environment } from '../../../../environments/environment';
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
Expand All @@ -40,7 +41,7 @@ export class AuthorityConfidenceStateDirective implements OnChanges, AfterViewIn
/**
* 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
Expand Down Expand Up @@ -131,6 +132,10 @@ export class AuthorityConfidenceStateDirective implements OnChanges, AfterViewIn
confidence = value.confidence;
}

if (isNotEmpty(value) && value instanceof MetadataValue) {
confidence = value.confidence;

Check warning on line 136 in src/app/shared/form/directives/authority-confidence-state.directive.ts

View check run for this annotation

Codecov / codecov/patch

src/app/shared/form/directives/authority-confidence-state.directive.ts#L136

Added line #L136 was not covered by tests
}

return confidence;
}

Expand Down

0 comments on commit 630f130

Please sign in to comment.