[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

@@ -24,8 +24,8 @@ Allows the user to handle AI predictions by confirming or rejecting changes.
### Properties ### Properties
| Name | Type | Default value | Description | | 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. | | prediction | [`Prediction`](../../../lib/js-api/src/api/hxi-connector-api/docs/Prediction.md) | | Prediction for the node property. |
## See also ## See also

View File

@@ -12,6 +12,7 @@ backend services have been tested with each released version of ADF.
## Versions ## Versions
- [v6.10.0](#v6100)
- [v6.8.0](#v680) - [v6.8.0](#v680)
- [v6.7.0](#v670) - [v6.7.0](#v670)
- [v6.4.0](#v640) - [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( getPredictionsSpy.and.returnValue(
of(getMockPredictionPaging([getMockPrediction(ReviewStatus.REJECTED), getMockPrediction(ReviewStatus.CONFIRMED)])) 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> <adf-icon [value]="'adf:ai-sparkles'"></adf-icon>
</button> </button>
<mat-menu #menu="matMenu" class="adf-ai-mat-menu" (closed)="onClosed()"> <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">
<div class="adf-content-enrichment-menu__accuracy__title"> <div class="adf-content-enrichment-menu__accuracy__title">
<span>{{ 'CORE.METADATA.CONTENT_ENRICHMENT.ACCURACY_LEVEL' | translate }}</span> <span>{{ 'CORE.METADATA.CONTENT_ENRICHMENT.ACCURACY_LEVEL' | translate }}</span>

View File

@@ -34,10 +34,18 @@ import { PredictionService } from '../../services';
templateUrl: './content-enrichment-menu.component.html', templateUrl: './content-enrichment-menu.component.html',
styleUrls: ['./content-enrichment-menu.component.scss'], styleUrls: ['./content-enrichment-menu.component.scss'],
encapsulation: ViewEncapsulation.None, 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 { export class ContentEnrichmentMenuComponent implements OnInit {
@Input() @Input()
prediction: Prediction; prediction: Prediction;
@@ -70,14 +78,14 @@ export class ContentEnrichmentMenuComponent implements OnInit {
onRevert() { onRevert() {
this.predictionService.reviewPrediction(this.prediction.id, ReviewStatus.REJECTED).subscribe(() => { 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(); this.menuTrigger.closeMenu();
}); });
} }
onConfirm() { onConfirm() {
this.predictionService.reviewPrediction(this.prediction.id, ReviewStatus.CONFIRMED).subscribe(() => { 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(); this.menuTrigger.closeMenu();
}); });
} }
@@ -87,7 +95,7 @@ export class ContentEnrichmentMenuComponent implements OnInit {
this.focusTrap = null; this.focusTrap = null;
} }
private isDefined(value: string): boolean { private isDefined(value: any): boolean {
return value !== undefined && value !== null; return value !== undefined && value !== null;
} }
} }