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:
@@ -190,22 +190,29 @@
|
|||||||
"route": "recent-files"
|
"route": "recent-files"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "app.navbar.favorites",
|
"id": "app.navbar.repositoryView",
|
||||||
"order": 500,
|
"order": 500,
|
||||||
|
"title": "APP.BROWSE.REPOSITORY_VIEW.SIDENAV_LINK.LABEL",
|
||||||
|
"description": "APP.BROWSE.REPOSITORY_VIEW.SIDENAV_LINK.TOOLTIP",
|
||||||
|
"route": "repository"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "app.navbar.favorites",
|
||||||
|
"order": 600,
|
||||||
"title": "APP.BROWSE.FAVORITES.SIDENAV_LINK.LABEL",
|
"title": "APP.BROWSE.FAVORITES.SIDENAV_LINK.LABEL",
|
||||||
"description": "APP.BROWSE.FAVORITES.SIDENAV_LINK.TOOLTIP",
|
"description": "APP.BROWSE.FAVORITES.SIDENAV_LINK.TOOLTIP",
|
||||||
"route": "favorites"
|
"route": "favorites"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "app.navbar.shared",
|
"id": "app.navbar.shared",
|
||||||
"order": 600,
|
"order": 700,
|
||||||
"title": "APP.BROWSE.SHARED.SIDENAV_LINK.LABEL",
|
"title": "APP.BROWSE.SHARED.SIDENAV_LINK.LABEL",
|
||||||
"description": "APP.BROWSE.SHARED.SIDENAV_LINK.TOOLTIP",
|
"description": "APP.BROWSE.SHARED.SIDENAV_LINK.TOOLTIP",
|
||||||
"route": "shared"
|
"route": "shared"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "app.navbar.trashcan",
|
"id": "app.navbar.trashcan",
|
||||||
"order": 700,
|
"order": 800,
|
||||||
"title": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.LABEL",
|
"title": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.LABEL",
|
||||||
"description": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.TOOLTIP",
|
"description": "APP.BROWSE.TRASHCAN.SIDENAV_LINK.TOOLTIP",
|
||||||
"route": "trashcan"
|
"route": "trashcan"
|
||||||
|
|||||||
@@ -114,6 +114,13 @@
|
|||||||
"TITLE": "Permissions"
|
"TITLE": "Permissions"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"REPOSITORY_VIEW": {
|
||||||
|
"TITLE": "Repository",
|
||||||
|
"SIDENAV_LINK": {
|
||||||
|
"LABEL": "Repository",
|
||||||
|
"TOOLTIP": "View the repository"
|
||||||
|
}
|
||||||
|
},
|
||||||
"LIBRARIES": {
|
"LIBRARIES": {
|
||||||
"TITLE": "File Libraries",
|
"TITLE": "File Libraries",
|
||||||
"DESCRIPTION": "Access File Libraries",
|
"DESCRIPTION": "Access File Libraries",
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import { ShellLayoutComponent } from '@alfresco/adf-core/shell';
|
|||||||
import { SearchAiResultsComponent } from './components/knowledge-retrieval/search-ai/search-ai-results/search-ai-results.component';
|
import { SearchAiResultsComponent } from './components/knowledge-retrieval/search-ai/search-ai-results/search-ai-results.component';
|
||||||
import { SavedSearchesSmartListComponent } from './components/search/search-save/list/smart-list/saved-searches-smart-list.component';
|
import { SavedSearchesSmartListComponent } from './components/search/search-save/list/smart-list/saved-searches-smart-list.component';
|
||||||
import { LibraryListComponent } from './components/library-list/library-list.component';
|
import { LibraryListComponent } from './components/library-list/library-list.component';
|
||||||
|
import { RepositoryViewComponent } from './components/repository-view/repository-view.component';
|
||||||
|
|
||||||
export const CONTENT_ROUTES: ExtensionRoute[] = [
|
export const CONTENT_ROUTES: ExtensionRoute[] = [
|
||||||
{
|
{
|
||||||
@@ -168,6 +169,35 @@ export const CONTENT_LAYOUT_ROUTES: Route[] = [
|
|||||||
...createViewRoutes('personal-files')
|
...createViewRoutes('personal-files')
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'repository',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: RepositoryViewComponent,
|
||||||
|
data: {
|
||||||
|
sortingPreferenceKey: 'repository',
|
||||||
|
title: 'APP.BROWSE.REPOSITORY_VIEW.TITLE',
|
||||||
|
defaultNodeId: '-root-'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
...createViewRoutes('repository')
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'repository/:folderId',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: RepositoryViewComponent,
|
||||||
|
data: {
|
||||||
|
title: 'APP.BROWSE.REPOSITORY_VIEW.TITLE',
|
||||||
|
sortingPreferenceKey: 'repository'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
...createViewRoutes('repository')
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'libraries',
|
path: 'libraries',
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import {
|
|||||||
PaginationComponent,
|
PaginationComponent,
|
||||||
ShowHeaderMode
|
ShowHeaderMode
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { Component, OnDestroy, OnInit, ViewEncapsulation, inject } from '@angular/core';
|
import { Component, Input, OnDestroy, OnInit, ViewEncapsulation, inject } from '@angular/core';
|
||||||
import { ActivatedRoute, Params } from '@angular/router';
|
import { ActivatedRoute, Params } from '@angular/router';
|
||||||
import { Node, NodeEntry, PathElement } from '@alfresco/js-api';
|
import { Node, NodeEntry, PathElement } from '@alfresco/js-api';
|
||||||
import { NodeActionsService } from '../../services/node-actions.service';
|
import { NodeActionsService } from '../../services/node-actions.service';
|
||||||
@@ -108,6 +108,9 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
|||||||
private nodePath: PathElement[];
|
private nodePath: PathElement[];
|
||||||
private _errorTranslationKey = 'APP.MESSAGES.ERRORS.MISSING_CONTENT';
|
private _errorTranslationKey = 'APP.MESSAGES.ERRORS.MISSING_CONTENT';
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
navigationPath = '/personal-files';
|
||||||
|
|
||||||
get errorTranslationKey(): string {
|
get errorTranslationKey(): string {
|
||||||
return this._errorTranslationKey;
|
return this._errorTranslationKey;
|
||||||
}
|
}
|
||||||
@@ -139,7 +142,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
|||||||
if (node?.entry?.isFolder) {
|
if (node?.entry?.isFolder) {
|
||||||
void this.updateCurrentNode(node.entry);
|
void this.updateCurrentNode(node.entry);
|
||||||
} else {
|
} else {
|
||||||
void this.router.navigate(['/personal-files', node.entry.parentId], {
|
void this.router.navigate([this.navigationPath, node.entry.parentId], {
|
||||||
replaceUrl: true
|
replaceUrl: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<aca-files [navigationPath]="'/repository'" />
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*!
|
||||||
|
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||||
|
*
|
||||||
|
* Alfresco Example Content Application
|
||||||
|
*
|
||||||
|
* This file is part of the Alfresco Example Content Application.
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
*
|
||||||
|
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Component, ViewEncapsulation } from '@angular/core';
|
||||||
|
import { FilesComponent } from '../files/files.component';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
imports: [FilesComponent],
|
||||||
|
templateUrl: './repository-view.component.html',
|
||||||
|
encapsulation: ViewEncapsulation.None,
|
||||||
|
selector: 'aca-repository-view'
|
||||||
|
})
|
||||||
|
export class RepositoryViewComponent {}
|
||||||
@@ -518,6 +518,10 @@ describe('app.evaluators', () => {
|
|||||||
{
|
{
|
||||||
pageName: 'library content',
|
pageName: 'library content',
|
||||||
pageUrl: '/libraries/some-id'
|
pageUrl: '/libraries/some-id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pageName: 'repository view',
|
||||||
|
pageUrl: '/repository'
|
||||||
}
|
}
|
||||||
].forEach((testCase) => {
|
].forEach((testCase) => {
|
||||||
testCanDisplayKnowledgeRetrievalButton(
|
testCanDisplayKnowledgeRetrievalButton(
|
||||||
@@ -863,7 +867,7 @@ describe('app.evaluators', () => {
|
|||||||
expect(app.canCreateFolder(context)).toBeFalse();
|
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.appConfig = { get: () => true } as any;
|
||||||
context.navigation.url = '/favorite/test';
|
context.navigation.url = '/favorite/test';
|
||||||
expect(app.canCreateFolder(context)).toBeFalse();
|
expect(app.canCreateFolder(context)).toBeFalse();
|
||||||
@@ -890,6 +894,9 @@ describe('app.evaluators', () => {
|
|||||||
context.navigation.currentFolder = {} as any;
|
context.navigation.currentFolder = {} as any;
|
||||||
context.permissions = { check: () => true };
|
context.permissions = { check: () => true };
|
||||||
expect(app.canCreateFolder(context)).toBeTrue();
|
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', () => {
|
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`
|
* JSON ref: `app.navigation.folder.canCreate`
|
||||||
*/
|
*/
|
||||||
export function canCreateFolder(context: AcaRuleContext): boolean {
|
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;
|
const { currentFolder } = context.navigation;
|
||||||
|
|
||||||
if (currentFolder) {
|
if (currentFolder) {
|
||||||
@@ -556,6 +556,7 @@ export const areCategoriesEnabled = (context: AcaRuleContext): boolean => contex
|
|||||||
export const canDisplayKnowledgeRetrievalButton = (context: AcaRuleContext): boolean =>
|
export const canDisplayKnowledgeRetrievalButton = (context: AcaRuleContext): boolean =>
|
||||||
context.appConfig.get('plugins.knowledgeRetrievalEnabled', false) &&
|
context.appConfig.get('plugins.knowledgeRetrievalEnabled', false) &&
|
||||||
(navigation.isPersonalFiles(context) ||
|
(navigation.isPersonalFiles(context) ||
|
||||||
|
navigation.isRepositoryView(context) ||
|
||||||
navigation.isSharedFiles(context) ||
|
navigation.isSharedFiles(context) ||
|
||||||
navigation.isRecentFiles(context) ||
|
navigation.isRecentFiles(context) ||
|
||||||
navigation.isFavorites(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', () => {
|
describe('isLibraries', () => {
|
||||||
it('should return [true] if url ends with `/libraries`', () => {
|
it('should return [true] if url ends with `/libraries`', () => {
|
||||||
const context: any = {
|
const context: any = {
|
||||||
|
|||||||
@@ -69,6 +69,15 @@ export function isPersonalFiles(context: RuleContext): boolean {
|
|||||||
return url?.startsWith('/personal-files');
|
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.
|
* Checks if a **Library Files** or **Library Search Result** route is activated.
|
||||||
* JSON ref: `app.navigation.isLibraryFiles`
|
* JSON ref: `app.navigation.isLibraryFiles`
|
||||||
|
|||||||
Reference in New Issue
Block a user