mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[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:
@@ -37,9 +37,15 @@ import {
|
||||
} from '@alfresco/adf-core';
|
||||
import { ActionParameterDefinition, Node } from '@alfresco/js-api';
|
||||
import { of, Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { ActionParameterConstraint, ConstraintValue } from '../../model/action-parameter-constraint.model';
|
||||
import { ContentNodeSelectorComponent, ContentNodeSelectorComponentData, NodeAction } from '@alfresco/adf-content-services';
|
||||
import {
|
||||
CategoryService,
|
||||
ContentNodeSelectorComponent,
|
||||
ContentNodeSelectorComponentData,
|
||||
NodeAction,
|
||||
TagService
|
||||
} from '@alfresco/adf-content-services';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@@ -82,6 +88,9 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
|
||||
this._parameterConstraints = value.map((obj) => ({ ...obj, constraints: this.parseConstraintsToSelectOptions(obj.constraints) }));
|
||||
}
|
||||
|
||||
private readonly tagsRelatedPropertiesAndAspects = ['cm:tagscope', 'cm:tagScopeCache', 'cm:taggable'];
|
||||
private readonly categoriesRelatedPropertiesAndAspects = ['cm:categories', 'cm:generalclassifiable'];
|
||||
|
||||
isFullWidth = false;
|
||||
|
||||
form = new FormGroup({
|
||||
@@ -107,7 +116,13 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
|
||||
onChange: (action: RuleAction) => void = () => undefined;
|
||||
onTouch: () => void = () => undefined;
|
||||
|
||||
constructor(private cardViewUpdateService: CardViewUpdateService, private dialog: MatDialog, private translate: TranslateService) {}
|
||||
constructor(
|
||||
private cardViewUpdateService: CardViewUpdateService,
|
||||
private dialog: MatDialog,
|
||||
private translate: TranslateService,
|
||||
private tagService: TagService,
|
||||
private categoryService: CategoryService
|
||||
) {}
|
||||
|
||||
writeValue(action: RuleAction) {
|
||||
this.form.setValue({
|
||||
@@ -170,6 +185,8 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
|
||||
}
|
||||
|
||||
setCardViewProperties() {
|
||||
const disabledTags = !this.tagService.areTagsEnabled();
|
||||
const disabledCategories = !this.categoryService.areCategoriesEnabled();
|
||||
this.cardViewItems = (this.selectedActionDefinition?.parameterDefinitions ?? []).map((paramDef) => {
|
||||
this.isFullWidth = false;
|
||||
const constraintsForDropdownBox = this._parameterConstraints.find((obj) => obj.name === paramDef.name);
|
||||
@@ -212,7 +229,17 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
|
||||
return new CardViewSelectItemModel({
|
||||
...cardViewPropertiesModel,
|
||||
value: (this.parameters[paramDef.name] as string) ?? '',
|
||||
options$: of(constraintsForDropdownBox.constraints)
|
||||
options$: of(constraintsForDropdownBox.constraints).pipe(
|
||||
map((options) => {
|
||||
return options.filter(
|
||||
(option) =>
|
||||
!(
|
||||
(disabledTags && this.tagsRelatedPropertiesAndAspects.includes(option.key)) ||
|
||||
(disabledCategories && this.categoriesRelatedPropertiesAndAspects.includes(option.key))
|
||||
)
|
||||
);
|
||||
})
|
||||
)
|
||||
});
|
||||
}
|
||||
return new CardViewTextItemModel({
|
||||
|
Reference in New Issue
Block a user