mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[MNT-25615] Add repository view (#5114)
* [MNT-25615] Add repository view * [MNT-25615] CR fixes
This commit is contained in:
@@ -518,6 +518,10 @@ describe('app.evaluators', () => {
|
||||
{
|
||||
pageName: 'library content',
|
||||
pageUrl: '/libraries/some-id'
|
||||
},
|
||||
{
|
||||
pageName: 'repository view',
|
||||
pageUrl: '/repository'
|
||||
}
|
||||
].forEach((testCase) => {
|
||||
testCanDisplayKnowledgeRetrievalButton(
|
||||
@@ -863,7 +867,7 @@ describe('app.evaluators', () => {
|
||||
expect(app.canCreateFolder(context)).toBeFalse();
|
||||
});
|
||||
|
||||
it('should return false when user is outside personal files or libraries', () => {
|
||||
it('should return false when user is outside personal files, libraries or repository view', () => {
|
||||
context.appConfig = { get: () => true } as any;
|
||||
context.navigation.url = '/favorite/test';
|
||||
expect(app.canCreateFolder(context)).toBeFalse();
|
||||
@@ -890,6 +894,9 @@ describe('app.evaluators', () => {
|
||||
context.navigation.currentFolder = {} as any;
|
||||
context.permissions = { check: () => true };
|
||||
expect(app.canCreateFolder(context)).toBeTrue();
|
||||
|
||||
context.navigation.url = '/repository/test';
|
||||
expect(app.canCreateFolder(context)).toBeTrue();
|
||||
});
|
||||
|
||||
it('should verify is user has create permission on current folder', () => {
|
||||
|
||||
@@ -193,7 +193,7 @@ export const hasSelection = (context: RuleContext): boolean => !context.selectio
|
||||
* JSON ref: `app.navigation.folder.canCreate`
|
||||
*/
|
||||
export function canCreateFolder(context: AcaRuleContext): boolean {
|
||||
if (navigation.isPersonalFiles(context) || navigation.isLibraryContent(context)) {
|
||||
if (navigation.isPersonalFiles(context) || navigation.isLibraryContent(context) || navigation.isRepositoryView(context)) {
|
||||
const { currentFolder } = context.navigation;
|
||||
|
||||
if (currentFolder) {
|
||||
@@ -556,6 +556,7 @@ export const areCategoriesEnabled = (context: AcaRuleContext): boolean => contex
|
||||
export const canDisplayKnowledgeRetrievalButton = (context: AcaRuleContext): boolean =>
|
||||
context.appConfig.get('plugins.knowledgeRetrievalEnabled', false) &&
|
||||
(navigation.isPersonalFiles(context) ||
|
||||
navigation.isRepositoryView(context) ||
|
||||
navigation.isSharedFiles(context) ||
|
||||
navigation.isRecentFiles(context) ||
|
||||
navigation.isFavorites(context) ||
|
||||
|
||||
@@ -125,6 +125,28 @@ describe('navigation.evaluators', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isRepositoryView', () => {
|
||||
it('should return [true] if url starts with `/repository`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/repository'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isRepositoryView(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if url does not start with `/repository`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/path/repository'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isRepositoryView(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isLibraries', () => {
|
||||
it('should return [true] if url ends with `/libraries`', () => {
|
||||
const context: any = {
|
||||
|
||||
@@ -69,6 +69,15 @@ export function isPersonalFiles(context: RuleContext): boolean {
|
||||
return url?.startsWith('/personal-files');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Repository View** route is activated.
|
||||
* JSON ref: `app.navigation.isRepositoryView`
|
||||
*/
|
||||
export function isRepositoryView(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url?.startsWith('/repository');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Library Files** or **Library Search Result** route is activated.
|
||||
* JSON ref: `app.navigation.isLibraryFiles`
|
||||
|
||||
Reference in New Issue
Block a user