[ACS-6252] support disabling the tags and categories feature in the applications (#3533)

* ACS-6252 Allow to hide tags and categories from metadata panel and to hide tags column from personal files

* ACS-6252 Allow to hide tags column from all other lists

* ACS-6252 Allow to hide tags and categories from search filters

* ACS-6252 Set type for search field

* ACS-6252 Hide displaying tags and categories related operators, properties and aspects in folder rules when that feature is disabled

* ACS-6252 Get from service information if tags and categories are disabled

* ACS-6252 Handled case when tags and categories configuration is missing in app.config.json

* ACS-6252 Unit tests for changes for RuleActionUiComponent

* ACS-6252 Unit tests for changes for RuleSimpleConditionUiComponent

* ACS-6252 Unit tests for changes for MetadataTabComponent

* ACS-6252 Unit tests for changes for app rules

* ACS-6252 Unit tests for changes for AppExtensionService

* ACS-6252 Removed redundant private from constructor parameter and corrected unit test title

* ACS-6252 Hide link to category action if categories feature is disabled

* ACS-6252 Move to beforeEach
This commit is contained in:
AleksanderSklorz
2023-11-28 14:09:00 +01:00
committed by GitHub
parent 6a326f776a
commit 2c69887e08
16 changed files with 535 additions and 64 deletions

View File

@@ -29,7 +29,13 @@ import { AppStore, EditOfflineAction, infoDrawerMetadataAspect, NodeActionTypes
import { AppConfigService, NotificationService } from '@alfresco/adf-core';
import { Observable, Subject } from 'rxjs';
import { Store } from '@ngrx/store';
import { ContentMetadataModule, ContentMetadataService, ContentMetadataCustomPanel } from '@alfresco/adf-content-services';
import {
ContentMetadataModule,
ContentMetadataService,
ContentMetadataCustomPanel,
TagService,
CategoryService
} from '@alfresco/adf-content-services';
import { filter, map, takeUntil } from 'rxjs/operators';
import { CommonModule } from '@angular/common';
import { Actions, ofType } from '@ngrx/effects';
@@ -46,6 +52,8 @@ import { Actions, ofType } from '@ngrx/effects';
[displayAspect]="displayAspect$ | async"
[customPanels]="customPanels | async"
[(editable)]="editable"
[displayCategories]="displayCategories"
[displayTags]="displayTags"
>
</adf-content-metadata-card>
`,
@@ -54,6 +62,8 @@ import { Actions, ofType } from '@ngrx/effects';
})
export class MetadataTabComponent implements OnInit, OnDestroy {
protected onDestroy$ = new Subject<boolean>();
private _displayCategories = true;
private _displayTags = true;
@Input()
node: Node;
@@ -63,6 +73,14 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
editable = false;
customPanels: Observable<ContentMetadataCustomPanel[]>;
get displayCategories(): boolean {
return this._displayCategories;
}
get displayTags(): boolean {
return this._displayTags;
}
constructor(
private permission: NodePermissionService,
protected extensions: AppExtensionService,
@@ -70,7 +88,9 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
private store: Store<AppStore>,
private notificationService: NotificationService,
private contentMetadataService: ContentMetadataService,
private actions$: Actions
private actions$: Actions,
private tagService: TagService,
private categoryService: CategoryService
) {
if (this.extensions.contentMetadata) {
this.appConfig.config['content-metadata'].presets = this.extensions.contentMetadata.presets;
@@ -79,6 +99,8 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this._displayTags = this.tagService.areTagsEnabled();
this._displayCategories = this.categoryService.areCategoriesEnabled();
this.contentMetadataService.error.pipe(takeUntil(this.onDestroy$)).subscribe((err: { message: string }) => {
this.notificationService.showError(err.message);
});