[ACS-8001] cr fixes

This commit is contained in:
Mykyta Maliarchuk
2024-06-12 09:37:41 +02:00
committed by Mykyta Maliarchuk
parent b5877e6faa
commit 80e9616bb0
5 changed files with 28 additions and 12 deletions

View File

@@ -1,9 +1,16 @@
<button mat-icon-button [attr.aria-label]="'CORE.METADATA.CONTENT_ENRICHMENT.ACTIONS.CONFIRM' | translate" #menuTrigger="matMenuTrigger" class="adf-ai-button" [matMenuTriggerFor]="menu" (menuOpened)="onMenuOpen()">
<button
mat-icon-button
[attr.aria-label]="'CORE.METADATA.CONTENT_ENRICHMENT.ACTIONS.CONFIRM' | translate"
#menuTrigger="matMenuTrigger"
class="adf-ai-button"
[matMenuTriggerFor]="menu"
(menuOpened)="onMenuOpen()">
<adf-icon [value]="'adf:ai-sparkles'"></adf-icon>
</button>
<mat-menu #menu="matMenu" class="adf-ai-mat-menu" (closed)="onClosed()">
<div class="adf-content-enrichment-menu" #menuContainer (click)="$event.stopPropagation()" (keydown.tab)="$event.stopPropagation()" (keydown.shift.tab)="$event.stopPropagation()" tabindex="-1">
<div class="adf-content-enrichment-menu" #menuContainer (click)="$event.stopPropagation()"
(keydown.tab)="$event.stopPropagation()" (keydown.shift.tab)="$event.stopPropagation()" tabindex="-1">
<div class="adf-content-enrichment-menu__accuracy">
<div class="adf-content-enrichment-menu__accuracy__title">
<span>{{ 'CORE.METADATA.CONTENT_ENRICHMENT.ACCURACY_LEVEL' | translate }}</span>
@@ -39,7 +46,7 @@
</div>
<div class="adf-content-enrichment-menu__footer">
<button mat-flat-button (click)="onRevert()">
{{ 'CORE.METADATA.CONTENT_ENRICHMENT.ACTIONS.REVERT' | translate }}
{{ 'CORE.METADATA.CONTENT_ENRICHMENT.ACTIONS.REVERT' | translate }}
</button>
<button mat-button color="primary" (click)="onConfirm()" class="adf-confirm-button">
{{ 'CORE.METADATA.CONTENT_ENRICHMENT.ACTIONS.CONFIRM' | translate }}

View File

@@ -34,10 +34,18 @@ import { PredictionService } from '../../services';
templateUrl: './content-enrichment-menu.component.html',
styleUrls: ['./content-enrichment-menu.component.scss'],
encapsulation: ViewEncapsulation.None,
imports: [MatProgressSpinnerModule, MatTooltipModule, MatButtonModule, IconComponent, MatMenuModule, MatIconModule, TranslateModule, LocalizedDatePipe]
imports: [
MatProgressSpinnerModule,
MatTooltipModule,
MatButtonModule,
IconComponent,
MatMenuModule,
MatIconModule,
TranslateModule,
LocalizedDatePipe
]
})
export class ContentEnrichmentMenuComponent implements OnInit {
@Input()
prediction: Prediction;
@@ -70,14 +78,14 @@ export class ContentEnrichmentMenuComponent implements OnInit {
onRevert() {
this.predictionService.reviewPrediction(this.prediction.id, ReviewStatus.REJECTED).subscribe(() => {
this.predictionService.predictionStatusUpdated$.next({key: this.prediction.property, previousValue: this.previousValue});
this.predictionService.predictionStatusUpdated$.next({ key: this.prediction.property, previousValue: this.previousValue });
this.menuTrigger.closeMenu();
});
}
onConfirm() {
this.predictionService.reviewPrediction(this.prediction.id, ReviewStatus.CONFIRMED).subscribe(() => {
this.predictionService.predictionStatusUpdated$.next({key: this.prediction.property});
this.predictionService.predictionStatusUpdated$.next({ key: this.prediction.property });
this.menuTrigger.closeMenu();
});
}
@@ -87,7 +95,7 @@ export class ContentEnrichmentMenuComponent implements OnInit {
this.focusTrap = null;
}
private isDefined(value: string): boolean {
private isDefined(value: any): boolean {
return value !== undefined && value !== null;
}
}