[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

@@ -858,6 +858,72 @@ describe('app.evaluators', () => {
expect(app.canManagePermissions(context)).toBe(true);
});
});
describe('areTagsEnabled', () => {
it('should call context.appConfig.get with correct parameters', () => {
const context: any = {
appConfig: {
get: jasmine.createSpy()
}
};
app.areTagsEnabled(context);
expect(context.appConfig.get).toHaveBeenCalledWith('plugins.tags', true);
});
it('should return true if get from appConfig returns true', () => {
expect(
app.areTagsEnabled({
appConfig: {
get: () => true
}
} as any)
).toBeTrue();
});
it('should return false if get from appConfig returns false', () => {
expect(
app.areTagsEnabled({
appConfig: {
get: () => false
}
} as any)
).toBeFalse();
});
});
describe('areCategoriesEnabled', () => {
it('should call context.appConfig.get with correct parameters', () => {
const context: any = {
appConfig: {
get: jasmine.createSpy()
}
};
app.areCategoriesEnabled(context);
expect(context.appConfig.get).toHaveBeenCalledWith('plugins.categories', true);
});
it('should return true if get from appConfig returns true', () => {
expect(
app.areCategoriesEnabled({
appConfig: {
get: () => true
}
} as any)
).toBeTrue();
});
it('should return false if get from appConfig returns false', () => {
expect(
app.areCategoriesEnabled({
appConfig: {
get: () => false
}
} as any)
).toBeFalse();
});
});
});
function createTestContext(): TestRuleContext {

View File

@@ -636,3 +636,7 @@ export function isSmartFolder(context: RuleContext): boolean {
}
return false;
}
export const areTagsEnabled = (context: AcaRuleContext): boolean => context.appConfig.get('plugins.tags', true);
export const areCategoriesEnabled = (context: AcaRuleContext): boolean => context.appConfig.get('plugins.categories', true);