[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

@@ -23,9 +23,9 @@ Allows the user to handle AI predictions by confirming or rejecting changes.
### Properties
| Name | Type | Default value | Description |
|------------|------------------------------------------------------------------------------------------------------------------------------------------|---------------|-----------------------------------|
| prediction | [`Prediction`](https://github.com/Alfresco/alfresco-ng2-components/blob/develop/lib/js-api/src/api/hxi-connector-api/docs/Prediction.md) | | Prediction for the node property. |
| Name | Type | Default value | Description |
|------------|----------------------------------------------------------------------------------|---------------|-----------------------------------|
| prediction | [`Prediction`](../../../lib/js-api/src/api/hxi-connector-api/docs/Prediction.md) | | Prediction for the node property. |
## See also

View File

@@ -12,6 +12,7 @@ backend services have been tested with each released version of ADF.
## Versions
- [v6.10.0](#v6100)
- [v6.8.0](#v680)
- [v6.7.0](#v670)
- [v6.4.0](#v640)

View File

@@ -1759,7 +1759,7 @@ describe('ContentMetadataComponent', () => {
});
});
it('should not map predictions when reviewStatus other then UNREVIEWED', (done) => {
it('should not map predictions when reviewStatus other than UNREVIEWED', (done) => {
getPredictionsSpy.and.returnValue(
of(getMockPredictionPaging([getMockPrediction(ReviewStatus.REJECTED), getMockPrediction(ReviewStatus.CONFIRMED)]))
);

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;
}
}