[AAE-8201] - Add a way to hide libraries and secondary navbar sections (#2492)

* [AAE-8201] - Add a way to hide libraries and secondary navbar sections

* Add new variable

* Rename variable for toggling content service sections

* Fix lint errors

* Remove unnecessary or condition
This commit is contained in:
arditdomi
2022-04-06 14:20:10 +01:00
committed by GitHub
parent 9f0f4cc61f
commit bacd9e5c10
11 changed files with 137 additions and 4 deletions

View File

@@ -530,4 +530,21 @@ describe('app.evaluators', () => {
expect(app.isLibraryManager(context)).toBe(false);
});
});
describe('isContentServiceEnabled', () => {
it('should return true when local storage has contentService set to true', () => {
localStorage.setItem('contentService', 'true');
expect(app.isContentServiceEnabled()).toBe(true);
});
it('should return false when local storage has contentService set to false', () => {
localStorage.setItem('contentService', 'false');
expect(app.isContentServiceEnabled()).toBe(false);
});
it('should return true when contentService is not defined in local storage', () => {
localStorage.clear();
expect(app.isContentServiceEnabled()).toBe(true);
});
});
});

View File

@@ -32,6 +32,12 @@ export interface AcaRuleContext extends RuleContext {
withCredentials: boolean;
}
/**
* Checks if the content plugin is enabled.
* JSON ref: `app.isContentServiceEnabled`
*/
export const isContentServiceEnabled = (): boolean => localStorage && localStorage.getItem('contentService') !== 'false';
/**
* Checks if user can copy selected node.
* JSON ref: `app.canCopyNode`