[ACS-8001] display AI preditcions

This commit is contained in:
Mykyta Maliarchuk
2024-06-11 18:58:26 +02:00
parent baeba22e8f
commit 27100da5de
2 changed files with 18 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ import { By } from '@angular/platform-browser';
import { AppExtensionService, NodePermissionService } from '@alfresco/aca-shared'; import { AppExtensionService, NodePermissionService } from '@alfresco/aca-shared';
import { Actions } from '@ngrx/effects'; import { Actions } from '@ngrx/effects';
import { of, Subject } from 'rxjs'; import { of, Subject } from 'rxjs';
import { Store } from '@ngrx/store';
import { ContentActionType } from '@alfresco/adf-extensions'; import { ContentActionType } from '@alfresco/adf-extensions';
import { CategoryService, ContentMetadataComponent, ContentMetadataService, TagService } from '@alfresco/adf-content-services'; import { CategoryService, ContentMetadataComponent, ContentMetadataService, TagService } from '@alfresco/adf-content-services';
@@ -244,6 +245,14 @@ describe('MetadataTabComponent', () => {
expect(getContentMetadata().displayTags).toBeFalse(); expect(getContentMetadata().displayTags).toBeFalse();
}); });
}); });
it('should set displayPredictions to true if HXIConnector is enabled', () => {
const store = TestBed.inject(Store);
spyOn(store, 'select').and.returnValue(of(true));
fixture.detectChanges();
expect(component.isHXIConnectorEnabled).toBeTrue();
expect(getContentMetadata().displayPredictions).toBeTrue();
});
}); });
describe('Custom metadata panels', () => { describe('Custom metadata panels', () => {

View File

@@ -25,7 +25,7 @@
import { Component, Input, ViewEncapsulation, OnInit, OnDestroy } from '@angular/core'; import { Component, Input, ViewEncapsulation, OnInit, OnDestroy } from '@angular/core';
import { Node } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { NodePermissionService, isLocked, AppExtensionService } from '@alfresco/aca-shared'; import { NodePermissionService, isLocked, AppExtensionService } from '@alfresco/aca-shared';
import { AppStore, EditOfflineAction, NodeActionTypes, infoDrawerMetadataAspect } from '@alfresco/aca-shared/store'; import { AppStore, EditOfflineAction, NodeActionTypes, infoDrawerMetadataAspect, isHXIConnectorEnabled } from '@alfresco/aca-shared/store';
import { AppConfigService, NotificationService } from '@alfresco/adf-core'; import { AppConfigService, NotificationService } from '@alfresco/adf-core';
import { Observable, Subject } from 'rxjs'; import { Observable, Subject } from 'rxjs';
import { import {
@@ -53,6 +53,7 @@ import { Store } from '@ngrx/store';
[displayCategories]="displayCategories" [displayCategories]="displayCategories"
[displayTags]="displayTags" [displayTags]="displayTags"
[displayAspect]="metadataAspect" [displayAspect]="metadataAspect"
[displayPredictions]="isHXIConnectorEnabled"
> >
</adf-content-metadata> </adf-content-metadata>
`, `,
@@ -70,6 +71,7 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
readOnly = false; readOnly = false;
customPanels: Observable<ContentMetadataCustomPanel[]>; customPanels: Observable<ContentMetadataCustomPanel[]>;
metadataAspect: string; metadataAspect: string;
isHXIConnectorEnabled = false;
get displayCategories(): boolean { get displayCategories(): boolean {
return this._displayCategories; return this._displayCategories;
@@ -123,6 +125,12 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
.select(infoDrawerMetadataAspect) .select(infoDrawerMetadataAspect)
.pipe(takeUntil(this.onDestroy$)) .pipe(takeUntil(this.onDestroy$))
.subscribe((metadataAspect) => (this.metadataAspect = metadataAspect)); .subscribe((metadataAspect) => (this.metadataAspect = metadataAspect));
this.store
.select(isHXIConnectorEnabled)
.pipe(takeUntil(this.onDestroy$))
.subscribe((isEnabled) => {
this.isHXIConnectorEnabled = isEnabled;
});
} }
ngOnDestroy() { ngOnDestroy() {