mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-24 14:31:41 +00:00
[ci:force] - Fixed lint
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
"createDefaultProgram": true
|
"createDefaultProgram": true
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"jsdoc/newline-after-description": "warn",
|
"jsdoc/tag-lines": [1],
|
||||||
"@typescript-eslint/naming-convention": "warn",
|
"@typescript-eslint/naming-convention": "warn",
|
||||||
"@typescript-eslint/consistent-type-assertions": "warn",
|
"@typescript-eslint/consistent-type-assertions": "warn",
|
||||||
"@typescript-eslint/prefer-for-of": "warn",
|
"@typescript-eslint/prefer-for-of": "warn",
|
||||||
|
@@ -39,7 +39,6 @@ export class AgentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all agents from cache. If cache is empty, fetches agents from backend.
|
* Gets all agents from cache. If cache is empty, fetches agents from backend.
|
||||||
*
|
|
||||||
* @returns Agent[] list containing agents.
|
* @returns Agent[] list containing agents.
|
||||||
*/
|
*/
|
||||||
getAgents(): Observable<Agent[]> {
|
getAgents(): Observable<Agent[]> {
|
||||||
|
@@ -23,18 +23,17 @@ import { AlfrescoApiService } from '../services/alfresco-api.service';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlfrescoApiNoAuthService extends AlfrescoApiService {
|
export class AlfrescoApiNoAuthService extends AlfrescoApiService {
|
||||||
constructor(
|
constructor(storage: StorageService, appConfig: AppConfigService, private readonly adfHttpClient: AdfHttpClient) {
|
||||||
storage: StorageService,
|
|
||||||
appConfig: AppConfigService,
|
|
||||||
private readonly adfHttpClient: AdfHttpClient
|
|
||||||
) {
|
|
||||||
super(appConfig, storage);
|
super(appConfig, storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
override createInstance(config: AlfrescoApiConfig) {
|
override createInstance(config: AlfrescoApiConfig) {
|
||||||
return new AlfrescoApi({
|
return new AlfrescoApi(
|
||||||
...config,
|
{
|
||||||
oauthInit: false
|
...config,
|
||||||
}, this.adfHttpClient);
|
oauthInit: false
|
||||||
|
},
|
||||||
|
this.adfHttpClient
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,11 +18,10 @@
|
|||||||
import { AlfrescoApiConfig } from '@alfresco/js-api';
|
import { AlfrescoApiConfig } from '@alfresco/js-api';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AppConfigService, AppConfigValues, StorageService } from '@alfresco/adf-core';
|
import { AppConfigService, AppConfigValues, StorageService } from '@alfresco/adf-core';
|
||||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a factory to resolve an api service instance
|
* Create a factory to resolve an api service instance
|
||||||
*
|
|
||||||
* @param angularAlfrescoApiService loader service
|
* @param angularAlfrescoApiService loader service
|
||||||
* @returns factory function
|
* @returns factory function
|
||||||
*/
|
*/
|
||||||
@@ -34,10 +33,11 @@ export function createAlfrescoApiInstance(angularAlfrescoApiService: AlfrescoApi
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class AlfrescoApiLoaderService {
|
export class AlfrescoApiLoaderService {
|
||||||
constructor(private readonly appConfig: AppConfigService,
|
constructor(
|
||||||
private readonly apiService: AlfrescoApiService,
|
private readonly appConfig: AppConfigService,
|
||||||
private storageService: StorageService) {
|
private readonly apiService: AlfrescoApiService,
|
||||||
}
|
private storageService: StorageService
|
||||||
|
) {}
|
||||||
|
|
||||||
async init(): Promise<any> {
|
async init(): Promise<any> {
|
||||||
await this.appConfig.load();
|
await this.appConfig.load();
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
import { AppConfigService } from '@alfresco/adf-core';
|
import { AppConfigService } from '@alfresco/adf-core';
|
||||||
import { from, Observable, of, zip } from 'rxjs';
|
import { from, Observable, of, zip } from 'rxjs';
|
||||||
import { catchError, map } from 'rxjs/operators';
|
import { catchError, map } from 'rxjs/operators';
|
||||||
|
@@ -25,12 +25,12 @@ import { TagService } from '../../tag/services/tag.service';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class NodeAspectService {
|
export class NodeAspectService {
|
||||||
|
constructor(
|
||||||
constructor(private nodesApiService: NodesApiService,
|
private nodesApiService: NodesApiService,
|
||||||
private dialogAspectListService: DialogAspectListService,
|
private dialogAspectListService: DialogAspectListService,
|
||||||
private cardViewContentUpdateService: CardViewContentUpdateService,
|
private cardViewContentUpdateService: CardViewContentUpdateService,
|
||||||
private tagService: TagService) {
|
private tagService: TagService
|
||||||
}
|
) {}
|
||||||
|
|
||||||
updateNodeAspects(nodeId: string, selectorAutoFocusedOnClose?: string) {
|
updateNodeAspects(nodeId: string, selectorAutoFocusedOnClose?: string) {
|
||||||
this.dialogAspectListService.openAspectListDialog(nodeId, selectorAutoFocusedOnClose).subscribe((aspectList) => {
|
this.dialogAspectListService.openAspectListDialog(nodeId, selectorAutoFocusedOnClose).subscribe((aspectList) => {
|
||||||
|
@@ -19,7 +19,6 @@ import { ContentAuthLoaderService } from './content-auth-loader.service';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a content auth factory
|
* Create a content auth factory
|
||||||
*
|
|
||||||
* @param authLoaderService service dependency
|
* @param authLoaderService service dependency
|
||||||
* @returns factory function
|
* @returns factory function
|
||||||
*/
|
*/
|
||||||
|
@@ -54,7 +54,6 @@ describe('ContentAuthLoaderService', () => {
|
|||||||
basicAlfrescoAuthService = TestBed.inject(BasicAlfrescoAuthService);
|
basicAlfrescoAuthService = TestBed.inject(BasicAlfrescoAuthService);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should require Alf ticket on login if OAuth and provider is ALL or ECM', fakeAsync(() => {
|
it('should require Alf ticket on login if OAuth and provider is ALL or ECM', fakeAsync(() => {
|
||||||
spyOn(authService, 'isOauth').and.returnValue(true);
|
spyOn(authService, 'isOauth').and.returnValue(true);
|
||||||
spyOn(authService, 'isALLProvider').and.returnValue(true);
|
spyOn(authService, 'isALLProvider').and.returnValue(true);
|
||||||
|
@@ -21,22 +21,15 @@ import { take } from 'rxjs/operators';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ContentAuthLoaderService {
|
export class ContentAuthLoaderService {
|
||||||
|
constructor(private readonly basicAlfrescoAuthService: BasicAlfrescoAuthService, private readonly authService: AuthenticationService) {}
|
||||||
constructor(
|
|
||||||
private readonly basicAlfrescoAuthService: BasicAlfrescoAuthService,
|
|
||||||
private readonly authService: AuthenticationService
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
init(): void {
|
init(): void {
|
||||||
this.authService.onLogin
|
this.authService.onLogin.pipe(take(1)).subscribe({
|
||||||
.pipe(take(1))
|
next: async () => {
|
||||||
.subscribe({
|
if (this.authService.isOauth() && (this.authService.isALLProvider() || this.authService.isECMProvider())) {
|
||||||
next: async () => {
|
await this.basicAlfrescoAuthService.requireAlfTicket();
|
||||||
if (this.authService.isOauth() && (this.authService.isALLProvider() || this.authService.isECMProvider())) {
|
|
||||||
await this.basicAlfrescoAuthService.requireAlfTicket();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,8 +33,7 @@ describe('Breadcrumb', () => {
|
|||||||
});
|
});
|
||||||
let documentListComponent: DocumentListComponent;
|
let documentListComponent: DocumentListComponent;
|
||||||
|
|
||||||
const getBreadcrumbActionText = (): string =>
|
const getBreadcrumbActionText = (): string => fixture.debugElement.nativeElement.querySelector('.adf-breadcrumb-item-current').textContent.trim();
|
||||||
fixture.debugElement.nativeElement.querySelector('.adf-breadcrumb-item-current').textContent.trim();
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
|
@@ -62,7 +62,6 @@ export class DropdownBreadcrumbComponent extends BreadcrumbComponent implements
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if route has more than one element (means: we are not in the root directory)
|
* Check if route has more than one element (means: we are not in the root directory)
|
||||||
*
|
|
||||||
* @returns `true` if there are previous nodes, otherwise `false`
|
* @returns `true` if there are previous nodes, otherwise `false`
|
||||||
*/
|
*/
|
||||||
hasPreviousNodes(): boolean {
|
hasPreviousNodes(): boolean {
|
||||||
|
@@ -68,7 +68,6 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get no categories message
|
* Get no categories message
|
||||||
*
|
|
||||||
* @returns message text
|
* @returns message text
|
||||||
*/
|
*/
|
||||||
function getNoCategoriesMessage(): string {
|
function getNoCategoriesMessage(): string {
|
||||||
@@ -77,7 +76,6 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get assigned categories list
|
* Get assigned categories list
|
||||||
*
|
|
||||||
* @returns list of native elements
|
* @returns list of native elements
|
||||||
*/
|
*/
|
||||||
function getAssignedCategoriesList(): HTMLSpanElement[] {
|
function getAssignedCategoriesList(): HTMLSpanElement[] {
|
||||||
@@ -86,7 +84,6 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the exiting categories list
|
* Get the exiting categories list
|
||||||
*
|
|
||||||
* @returns list of material option element
|
* @returns list of material option element
|
||||||
*/
|
*/
|
||||||
function getExistingCategoriesList(): HTMLElement[] {
|
function getExistingCategoriesList(): HTMLElement[] {
|
||||||
@@ -95,7 +92,6 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new category
|
* Create new category
|
||||||
*
|
|
||||||
* @param name name of the category
|
* @param name name of the category
|
||||||
* @param addUsingEnter use Enter key
|
* @param addUsingEnter use Enter key
|
||||||
* @param typingTimeout typing timeout in milliseconds (default 300)
|
* @param typingTimeout typing timeout in milliseconds (default 300)
|
||||||
@@ -115,7 +111,6 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get first error
|
* Get first error
|
||||||
*
|
|
||||||
* @returns error text
|
* @returns error text
|
||||||
*/
|
*/
|
||||||
function getFirstError(): string {
|
function getFirstError(): string {
|
||||||
@@ -124,7 +119,6 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get selection list
|
* Get selection list
|
||||||
*
|
|
||||||
* @returns material selection list
|
* @returns material selection list
|
||||||
*/
|
*/
|
||||||
function getSelectionList(): MatList {
|
function getSelectionList(): MatList {
|
||||||
@@ -133,7 +127,6 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get remove category buttons
|
* Get remove category buttons
|
||||||
*
|
|
||||||
* @returns list of native elements
|
* @returns list of native elements
|
||||||
*/
|
*/
|
||||||
function getRemoveCategoryButtons(): HTMLButtonElement[] {
|
function getRemoveCategoryButtons(): HTMLButtonElement[] {
|
||||||
@@ -144,7 +137,6 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get category control input
|
* Get category control input
|
||||||
*
|
|
||||||
* @returns native input element
|
* @returns native input element
|
||||||
*/
|
*/
|
||||||
function getCategoryControlInput(): HTMLInputElement {
|
function getCategoryControlInput(): HTMLInputElement {
|
||||||
@@ -153,7 +145,6 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get create category label
|
* Get create category label
|
||||||
*
|
|
||||||
* @returns native element
|
* @returns native element
|
||||||
*/
|
*/
|
||||||
function getCreateCategoryLabel(): HTMLSpanElement {
|
function getCreateCategoryLabel(): HTMLSpanElement {
|
||||||
@@ -162,7 +153,6 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Type new category
|
* Type new category
|
||||||
*
|
|
||||||
* @param name name of the category
|
* @param name name of the category
|
||||||
* @param timeout typing timeout in milliseconds (default 300)
|
* @param timeout typing timeout in milliseconds (default 300)
|
||||||
*/
|
*/
|
||||||
|
@@ -91,7 +91,6 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* Decides if categoryNameControl should be visible. Sets also existing categories panel visibility
|
* Decides if categoryNameControl should be visible. Sets also existing categories panel visibility
|
||||||
* and scrolls control into view when visible.
|
* and scrolls control into view when visible.
|
||||||
*
|
|
||||||
* @param categoryNameControlVisible control visibility.
|
* @param categoryNameControlVisible control visibility.
|
||||||
*/
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
@@ -245,7 +244,6 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds existing category to categories list and removes it from existing categories list.
|
* Adds existing category to categories list and removes it from existing categories list.
|
||||||
*
|
|
||||||
* @param category - selection list change containing selected category
|
* @param category - selection list change containing selected category
|
||||||
*/
|
*/
|
||||||
addCategoryToAssign(category: Category) {
|
addCategoryToAssign(category: Category) {
|
||||||
@@ -260,7 +258,6 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the category from categories list and adds it to existing categories list in ASSIGN mode.
|
* Removes the category from categories list and adds it to existing categories list in ASSIGN mode.
|
||||||
*
|
|
||||||
* @param category - category to remove
|
* @param category - category to remove
|
||||||
*/
|
*/
|
||||||
removeCategory(category: Category) {
|
removeCategory(category: Category) {
|
||||||
|
@@ -18,7 +18,10 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
CategoryEntry,
|
CategoryEntry,
|
||||||
CategoryPaging, Pagination, PathInfo, ResultNode,
|
CategoryPaging,
|
||||||
|
Pagination,
|
||||||
|
PathInfo,
|
||||||
|
ResultNode,
|
||||||
ResultSetPaging,
|
ResultSetPaging,
|
||||||
ResultSetPagingList,
|
ResultSetPagingList,
|
||||||
ResultSetRowEntry
|
ResultSetRowEntry
|
||||||
@@ -27,7 +30,6 @@ import { Observable, of } from 'rxjs';
|
|||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class CategoryServiceMock {
|
export class CategoryServiceMock {
|
||||||
|
|
||||||
public getSubcategories(parentNodeId: string, skipCount?: number, maxItems?: number): Observable<CategoryPaging> {
|
public getSubcategories(parentNodeId: string, skipCount?: number, maxItems?: number): Observable<CategoryPaging> {
|
||||||
return parentNodeId ? of(this.getChildrenLevelResponse(skipCount, maxItems)) : of(this.getRootLevelResponse(skipCount, maxItems));
|
return parentNodeId ? of(this.getChildrenLevelResponse(skipCount, maxItems)) : of(this.getRootLevelResponse(skipCount, maxItems));
|
||||||
}
|
}
|
||||||
@@ -66,12 +68,12 @@ export class CategoryServiceMock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getRootLevelResponse(skipCount?: number, maxItems?: number): CategoryPaging {
|
private getRootLevelResponse(skipCount?: number, maxItems?: number): CategoryPaging {
|
||||||
const rootCategoryEntry: CategoryEntry = {entry: {id: 'testId', name: 'testNode', parentId: '-root-', hasChildren: true}};
|
const rootCategoryEntry: CategoryEntry = { entry: { id: 'testId', name: 'testNode', parentId: '-root-', hasChildren: true } };
|
||||||
return {list: {pagination: {skipCount, maxItems, hasMoreItems: false}, entries: [rootCategoryEntry]}};
|
return { list: { pagination: { skipCount, maxItems, hasMoreItems: false }, entries: [rootCategoryEntry] } };
|
||||||
}
|
}
|
||||||
|
|
||||||
private getChildrenLevelResponse(skipCount?: number, maxItems?: number): CategoryPaging {
|
private getChildrenLevelResponse(skipCount?: number, maxItems?: number): CategoryPaging {
|
||||||
const childCategoryEntry: CategoryEntry = {entry: {id: 'childId', name: 'childNode', parentId: 'testId', hasChildren: false}};
|
const childCategoryEntry: CategoryEntry = { entry: { id: 'childId', name: 'childNode', parentId: 'testId', hasChildren: false } };
|
||||||
return {list: {pagination: {skipCount, maxItems, hasMoreItems: true}, entries: [childCategoryEntry]}};
|
return { list: { pagination: { skipCount, maxItems, hasMoreItems: true }, entries: [childCategoryEntry] } };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,59 +24,65 @@ import { from, Observable } from 'rxjs';
|
|||||||
import { map, mergeMap, toArray } from 'rxjs/operators';
|
import { map, mergeMap, toArray } from 'rxjs/operators';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class CategoryTreeDatasourceService extends TreeService<CategoryNode> {
|
export class CategoryTreeDatasourceService extends TreeService<CategoryNode> {
|
||||||
|
|
||||||
constructor(private categoryService: CategoryService) {
|
constructor(private categoryService: CategoryService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSubNodes(parentNodeId: string, skipCount?: number, maxItems?: number, name?: string): Observable<TreeResponse<CategoryNode>> {
|
public getSubNodes(parentNodeId: string, skipCount?: number, maxItems?: number, name?: string): Observable<TreeResponse<CategoryNode>> {
|
||||||
return !name ? this.categoryService.getSubcategories(parentNodeId, skipCount, maxItems).pipe(map((response: CategoryPaging) => {
|
return !name
|
||||||
const parentNode: CategoryNode = this.getParentNode(parentNodeId);
|
? this.categoryService.getSubcategories(parentNodeId, skipCount, maxItems).pipe(
|
||||||
const nodesList: CategoryNode[] = response.list.entries.map((entry: CategoryEntry) => ({
|
map((response: CategoryPaging) => {
|
||||||
id: entry.entry.id,
|
const parentNode: CategoryNode = this.getParentNode(parentNodeId);
|
||||||
nodeName: entry.entry.name,
|
const nodesList: CategoryNode[] = response.list.entries.map((entry: CategoryEntry) => ({
|
||||||
parentId: entry.entry.parentId,
|
id: entry.entry.id,
|
||||||
hasChildren: entry.entry.hasChildren,
|
nodeName: entry.entry.name,
|
||||||
level: parentNode ? parentNode.level + 1 : 0,
|
parentId: entry.entry.parentId,
|
||||||
isLoading: false,
|
hasChildren: entry.entry.hasChildren,
|
||||||
nodeType: TreeNodeType.RegularNode
|
level: parentNode ? parentNode.level + 1 : 0,
|
||||||
}));
|
isLoading: false,
|
||||||
if (response.list.pagination.hasMoreItems && parentNode) {
|
nodeType: TreeNodeType.RegularNode
|
||||||
const loadMoreNode: CategoryNode = {
|
}));
|
||||||
id: 'loadMore',
|
if (response.list.pagination.hasMoreItems && parentNode) {
|
||||||
nodeName: '',
|
const loadMoreNode: CategoryNode = {
|
||||||
parentId: parentNode.id,
|
id: 'loadMore',
|
||||||
hasChildren: false,
|
nodeName: '',
|
||||||
level: parentNode.level + 1,
|
parentId: parentNode.id,
|
||||||
isLoading: false,
|
hasChildren: false,
|
||||||
nodeType: TreeNodeType.LoadMoreNode
|
level: parentNode.level + 1,
|
||||||
};
|
isLoading: false,
|
||||||
nodesList.push(loadMoreNode);
|
nodeType: TreeNodeType.LoadMoreNode
|
||||||
}
|
};
|
||||||
const treeResponse: TreeResponse<CategoryNode> = {entries: nodesList, pagination: response.list.pagination};
|
nodesList.push(loadMoreNode);
|
||||||
return treeResponse;
|
}
|
||||||
})) : this.categoryService.searchCategories(name, skipCount, maxItems).pipe(mergeMap((pagingResult) => {
|
const treeResponse: TreeResponse<CategoryNode> = { entries: nodesList, pagination: response.list.pagination };
|
||||||
const nextAfterGeneralPathPartIndex = 3;
|
return treeResponse;
|
||||||
const pathSeparator = '/';
|
})
|
||||||
return from(pagingResult.list.entries).pipe(mergeMap((category) => {
|
)
|
||||||
const path = category.entry.path.name.split(pathSeparator).slice(nextAfterGeneralPathPartIndex)
|
: this.categoryService.searchCategories(name, skipCount, maxItems).pipe(
|
||||||
.join(pathSeparator);
|
mergeMap((pagingResult) => {
|
||||||
|
const nextAfterGeneralPathPartIndex = 3;
|
||||||
|
const pathSeparator = '/';
|
||||||
|
return from(pagingResult.list.entries).pipe(
|
||||||
|
mergeMap((category) => {
|
||||||
|
const path = category.entry.path.name.split(pathSeparator).slice(nextAfterGeneralPathPartIndex).join(pathSeparator);
|
||||||
|
|
||||||
return this.categoryService.getCategory(category.entry.id).pipe(
|
return this.categoryService.getCategory(category.entry.id).pipe(
|
||||||
map((res) => ({
|
map((res) => ({
|
||||||
id: category.entry.id,
|
id: category.entry.id,
|
||||||
nodeName: path ? `${path}/${category.entry.name}` : category.entry.name,
|
nodeName: path ? `${path}/${category.entry.name}` : category.entry.name,
|
||||||
parentId: category.entry.parentId,
|
parentId: category.entry.parentId,
|
||||||
level: 0,
|
level: 0,
|
||||||
nodeType: TreeNodeType.RegularNode,
|
nodeType: TreeNodeType.RegularNode,
|
||||||
hasChildren: res.entry.hasChildren,
|
hasChildren: res.entry.hasChildren,
|
||||||
isLoading: false
|
isLoading: false
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
toArray(),
|
toArray(),
|
||||||
map(res => ({entries: res, pagination: pagingResult.list.pagination})));
|
map((res) => ({ entries: res, pagination: pagingResult.list.pagination }))
|
||||||
}));
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -53,7 +53,6 @@ export class CategoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get subcategories of a given parent category
|
* Get subcategories of a given parent category
|
||||||
*
|
|
||||||
* @param parentCategoryId The identifier of a parent category.
|
* @param parentCategoryId The identifier of a parent category.
|
||||||
* @param skipCount Number of top categories to skip.
|
* @param skipCount Number of top categories to skip.
|
||||||
* @param maxItems Maximum number of subcategories returned from Observable.
|
* @param maxItems Maximum number of subcategories returned from Observable.
|
||||||
@@ -65,7 +64,6 @@ export class CategoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a category by ID
|
* Get a category by ID
|
||||||
*
|
|
||||||
* @param categoryId The identifier of a category.
|
* @param categoryId The identifier of a category.
|
||||||
* @param opts Optional parameters.
|
* @param opts Optional parameters.
|
||||||
* @param opts.fields A list of field names.
|
* @param opts.fields A list of field names.
|
||||||
@@ -80,7 +78,6 @@ export class CategoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates subcategories under category with provided categoryId
|
* Creates subcategories under category with provided categoryId
|
||||||
*
|
|
||||||
* @param parentCategoryId The identifier of a parent category.
|
* @param parentCategoryId The identifier of a parent category.
|
||||||
* @param payload List of categories to be created.
|
* @param payload List of categories to be created.
|
||||||
* @returns Observable<CategoryPaging | CategoryEntry>
|
* @returns Observable<CategoryPaging | CategoryEntry>
|
||||||
@@ -91,7 +88,6 @@ export class CategoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates category
|
* Updates category
|
||||||
*
|
|
||||||
* @param categoryId The identifier of a category.
|
* @param categoryId The identifier of a category.
|
||||||
* @param payload Updated category body
|
* @param payload Updated category body
|
||||||
* @returns Observable<CategoryEntry>
|
* @returns Observable<CategoryEntry>
|
||||||
@@ -102,7 +98,6 @@ export class CategoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes category
|
* Deletes category
|
||||||
*
|
|
||||||
* @param categoryId The identifier of a category.
|
* @param categoryId The identifier of a category.
|
||||||
* @returns Observable<void>
|
* @returns Observable<void>
|
||||||
*/
|
*/
|
||||||
@@ -112,7 +107,6 @@ export class CategoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches categories by their name.
|
* Searches categories by their name.
|
||||||
*
|
|
||||||
* @param name Value for name which should be used during searching categories.
|
* @param name Value for name which should be used during searching categories.
|
||||||
* @param skipCount Specify how many first results should be skipped. Default 0.
|
* @param skipCount Specify how many first results should be skipped. Default 0.
|
||||||
* @param maxItems Specify max number of returned categories. Default is specified by UserPreferencesService.
|
* @param maxItems Specify max number of returned categories. Default is specified by UserPreferencesService.
|
||||||
@@ -137,7 +131,6 @@ export class CategoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List of categories that node is assigned to
|
* List of categories that node is assigned to
|
||||||
*
|
|
||||||
* @param nodeId The identifier of a node.
|
* @param nodeId The identifier of a node.
|
||||||
* @returns Observable<CategoryPaging> Categories that node is assigned to
|
* @returns Observable<CategoryPaging> Categories that node is assigned to
|
||||||
*/
|
*/
|
||||||
@@ -147,7 +140,6 @@ export class CategoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlink category from a node
|
* Unlink category from a node
|
||||||
*
|
|
||||||
* @param nodeId The identifier of a node.
|
* @param nodeId The identifier of a node.
|
||||||
* @param categoryId The identifier of a category.
|
* @param categoryId The identifier of a category.
|
||||||
* @returns Observable<void>
|
* @returns Observable<void>
|
||||||
@@ -158,7 +150,6 @@ export class CategoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Link node to a category
|
* Link node to a category
|
||||||
*
|
|
||||||
* @param nodeId The identifier of a node.
|
* @param nodeId The identifier of a node.
|
||||||
* @param categoryLinkBodyCreate Array of a categories that node will be linked to.
|
* @param categoryLinkBodyCreate Array of a categories that node will be linked to.
|
||||||
* @returns Observable<CategoryEntry>
|
* @returns Observable<CategoryEntry>
|
||||||
@@ -169,7 +160,6 @@ export class CategoryService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if categories plugin is enabled.
|
* Checks if categories plugin is enabled.
|
||||||
*
|
|
||||||
* @returns boolean true if categories plugin is enabled, false otherwise.
|
* @returns boolean true if categories plugin is enabled, false otherwise.
|
||||||
*/
|
*/
|
||||||
areCategoriesEnabled(): boolean {
|
areCategoriesEnabled(): boolean {
|
||||||
|
@@ -18,35 +18,27 @@
|
|||||||
import { FileModel, FileUploadStatus } from '../models/file.model';
|
import { FileModel, FileUploadStatus } from '../models/file.model';
|
||||||
|
|
||||||
export class FileUploadEvent {
|
export class FileUploadEvent {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public readonly file: FileModel,
|
public readonly file: FileModel,
|
||||||
public readonly status: FileUploadStatus = FileUploadStatus.Pending,
|
public readonly status: FileUploadStatus = FileUploadStatus.Pending,
|
||||||
public readonly error: any = null) {
|
public readonly error: any = null
|
||||||
}
|
) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FileUploadCompleteEvent extends FileUploadEvent {
|
export class FileUploadCompleteEvent extends FileUploadEvent {
|
||||||
|
|
||||||
constructor(file: FileModel, public totalComplete: number = 0, public data?: any, public totalAborted: number = 0) {
|
constructor(file: FileModel, public totalComplete: number = 0, public data?: any, public totalAborted: number = 0) {
|
||||||
super(file, FileUploadStatus.Complete);
|
super(file, FileUploadStatus.Complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FileUploadDeleteEvent extends FileUploadEvent {
|
export class FileUploadDeleteEvent extends FileUploadEvent {
|
||||||
|
|
||||||
constructor(file: FileModel, public totalComplete: number = 0) {
|
constructor(file: FileModel, public totalComplete: number = 0) {
|
||||||
super(file, FileUploadStatus.Deleted);
|
super(file, FileUploadStatus.Deleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FileUploadErrorEvent extends FileUploadEvent {
|
export class FileUploadErrorEvent extends FileUploadEvent {
|
||||||
|
|
||||||
constructor(file: FileModel, public error: any, public totalError: number = 0) {
|
constructor(file: FileModel, public error: any, public totalError: number = 0) {
|
||||||
super(file, FileUploadStatus.Error);
|
super(file, FileUploadStatus.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,6 @@ import { SearchRequest } from '@alfresco/js-api';
|
|||||||
export interface SearchConfigurationInterface {
|
export interface SearchConfigurationInterface {
|
||||||
/**
|
/**
|
||||||
* Generates a query object with custom search parameters.
|
* Generates a query object with custom search parameters.
|
||||||
*
|
|
||||||
* @param searchTerm Term text to search for
|
* @param searchTerm Term text to search for
|
||||||
* @param maxResults Maximum number of search results to show in a page
|
* @param maxResults Maximum number of search results to show in a page
|
||||||
* @param skipCount The offset of the start of the page within the results list
|
* @param skipCount The offset of the start of the page within the results list
|
||||||
|
@@ -18,9 +18,7 @@
|
|||||||
import { FileModel } from './file.model';
|
import { FileModel } from './file.model';
|
||||||
|
|
||||||
describe('FileModel', () => {
|
describe('FileModel', () => {
|
||||||
|
|
||||||
describe('extension', () => {
|
describe('extension', () => {
|
||||||
|
|
||||||
it('should return the extension if file has it', () => {
|
it('should return the extension if file has it', () => {
|
||||||
const file = new FileModel({ name: 'tyrion-lannister.doc' } as File);
|
const file = new FileModel({ name: 'tyrion-lannister.doc' } as File);
|
||||||
|
|
||||||
@@ -33,7 +31,7 @@ describe('FileModel', () => {
|
|||||||
expect(file.extension).toBe('');
|
expect(file.extension).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the empty string if file is starting with . and doesn\'t have extension', () => {
|
it("should return the empty string if file is starting with . and doesn't have extension", () => {
|
||||||
const file = new FileModel({ name: '.white-walkers' } as File);
|
const file = new FileModel({ name: '.white-walkers' } as File);
|
||||||
|
|
||||||
expect(file.extension).toBe('');
|
expect(file.extension).toBe('');
|
||||||
|
@@ -21,7 +21,7 @@ import { Subject } from 'rxjs';
|
|||||||
import { AuthenticationService, ThumbnailService } from '@alfresco/adf-core';
|
import { AuthenticationService, ThumbnailService } from '@alfresco/adf-core';
|
||||||
import { PermissionsEnum } from '../models/permissions.enum';
|
import { PermissionsEnum } from '../models/permissions.enum';
|
||||||
import { AllowableOperationsEnum } from '../models/allowable-operations.enum';
|
import { AllowableOperationsEnum } from '../models/allowable-operations.enum';
|
||||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
|
|
||||||
export interface FolderCreatedEvent {
|
export interface FolderCreatedEvent {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -48,7 +48,6 @@ export class ContentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a content URL for the given node.
|
* Gets a content URL for the given node.
|
||||||
*
|
|
||||||
* @param node Node or Node ID to get URL for.
|
* @param node Node or Node ID to get URL for.
|
||||||
* @param attachment Toggles whether to retrieve content as an attachment for download
|
* @param attachment Toggles whether to retrieve content as an attachment for download
|
||||||
* @param ticket Custom ticket to use for authentication
|
* @param ticket Custom ticket to use for authentication
|
||||||
@@ -76,7 +75,6 @@ export class ContentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the user has permission on that node
|
* Checks if the user has permission on that node
|
||||||
*
|
|
||||||
* @param node Node to check permissions
|
* @param node Node to check permissions
|
||||||
* @param permission Required permission type
|
* @param permission Required permission type
|
||||||
* @param userId Optional current user id will be taken by default
|
* @param userId Optional current user id will be taken by default
|
||||||
@@ -110,7 +108,6 @@ export class ContentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the user has permissions on that node
|
* Checks if the user has permissions on that node
|
||||||
*
|
|
||||||
* @param node Node to check allowableOperations
|
* @param node Node to check allowableOperations
|
||||||
* @param allowableOperation Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions
|
* @param allowableOperation Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions
|
||||||
* @returns True if the user has the required permissions, false otherwise
|
* @returns True if the user has the required permissions, false otherwise
|
||||||
|
@@ -52,7 +52,6 @@ export class DiscoveryApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets product information for Content Services.
|
* Gets product information for Content Services.
|
||||||
*
|
|
||||||
* @returns ProductVersionModel containing product details
|
* @returns ProductVersionModel containing product details
|
||||||
*/
|
*/
|
||||||
getEcmProductInfo(): Observable<RepositoryInfo> {
|
getEcmProductInfo(): Observable<RepositoryInfo> {
|
||||||
@@ -64,7 +63,6 @@ export class DiscoveryApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets product information for Process Services.
|
* Gets product information for Process Services.
|
||||||
*
|
|
||||||
* @returns ProductVersionModel containing product details
|
* @returns ProductVersionModel containing product details
|
||||||
*/
|
*/
|
||||||
getBpmProductInfo(): Observable<BpmProductVersionModel> {
|
getBpmProductInfo(): Observable<BpmProductVersionModel> {
|
||||||
|
@@ -26,7 +26,6 @@ import { catchError } from 'rxjs/operators';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class FavoritesApiService {
|
export class FavoritesApiService {
|
||||||
|
|
||||||
private _favoritesApi: FavoritesApi;
|
private _favoritesApi: FavoritesApi;
|
||||||
get favoritesApi(): FavoritesApi {
|
get favoritesApi(): FavoritesApi {
|
||||||
this._favoritesApi = this._favoritesApi ?? new FavoritesApi(this.apiService.getInstance());
|
this._favoritesApi = this._favoritesApi ?? new FavoritesApi(this.apiService.getInstance());
|
||||||
@@ -42,16 +41,11 @@ export class FavoritesApiService {
|
|||||||
return { entry };
|
return { entry };
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(private apiService: AlfrescoApiService, private preferences: UserPreferencesService) {}
|
||||||
private apiService: AlfrescoApiService,
|
|
||||||
private preferences: UserPreferencesService
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
remapFavoritesData(data: FavoritePaging = {}): NodePaging {
|
remapFavoritesData(data: FavoritePaging = {}): NodePaging {
|
||||||
const pagination = (data?.list?.pagination || {});
|
const pagination = data?.list?.pagination || {};
|
||||||
const entries: any[] = this
|
const entries: any[] = this.remapFavoriteEntries(data?.list?.entries || []);
|
||||||
.remapFavoriteEntries(data?.list?.entries || []);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
list: { entries, pagination }
|
list: { entries, pagination }
|
||||||
@@ -63,13 +57,12 @@ export class FavoritesApiService {
|
|||||||
.map(({ entry: { target } }: any) => ({
|
.map(({ entry: { target } }: any) => ({
|
||||||
entry: target.file || target.folder
|
entry: target.file || target.folder
|
||||||
}))
|
}))
|
||||||
.filter(({ entry }) => (!!entry))
|
.filter(({ entry }) => !!entry)
|
||||||
.map(FavoritesApiService.remapEntry);
|
.map(FavoritesApiService.remapEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the favorites for a user.
|
* Gets the favorites for a user.
|
||||||
*
|
|
||||||
* @param personId ID of the user
|
* @param personId ID of the user
|
||||||
* @param options Options supported by JS-API
|
* @param options Options supported by JS-API
|
||||||
* @returns List of favorites
|
* @returns List of favorites
|
||||||
@@ -82,12 +75,8 @@ export class FavoritesApiService {
|
|||||||
include: ['properties', 'allowableOperations']
|
include: ['properties', 'allowableOperations']
|
||||||
};
|
};
|
||||||
const queryOptions = Object.assign(defaultOptions, options);
|
const queryOptions = Object.assign(defaultOptions, options);
|
||||||
const promise = this.favoritesApi
|
const promise = this.favoritesApi.listFavorites(personId, queryOptions).then(this.remapFavoritesData);
|
||||||
.listFavorites(personId, queryOptions)
|
|
||||||
.then(this.remapFavoritesData);
|
|
||||||
|
|
||||||
return from(promise).pipe(
|
return from(promise).pipe(catchError((err) => of(err)));
|
||||||
catchError((err) => of(err))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the stored information about a node.
|
* Gets the stored information about a node.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @param options Optional parameters supported by JS-API
|
* @param options Optional parameters supported by JS-API
|
||||||
* @returns Node information
|
* @returns Node information
|
||||||
@@ -71,7 +70,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the items contained in a folder node.
|
* Gets the items contained in a folder node.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @param options Optional parameters supported by JS-API
|
* @param options Optional parameters supported by JS-API
|
||||||
* @returns List of child items from the folder
|
* @returns List of child items from the folder
|
||||||
@@ -89,7 +87,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new document node inside a folder.
|
* Creates a new document node inside a folder.
|
||||||
*
|
|
||||||
* @param parentNodeId ID of the parent folder node
|
* @param parentNodeId ID of the parent folder node
|
||||||
* @param nodeBody Data for the new node
|
* @param nodeBody Data for the new node
|
||||||
* @param options Optional parameters supported by JS-API
|
* @param options Optional parameters supported by JS-API
|
||||||
@@ -104,7 +101,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new folder node inside a parent folder.
|
* Creates a new folder node inside a parent folder.
|
||||||
*
|
|
||||||
* @param parentNodeId ID of the parent folder node
|
* @param parentNodeId ID of the parent folder node
|
||||||
* @param nodeBody Data for the new folder
|
* @param nodeBody Data for the new folder
|
||||||
* @param options Optional parameters supported by JS-API
|
* @param options Optional parameters supported by JS-API
|
||||||
@@ -117,7 +113,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the information about a node.
|
* Updates the information about a node.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @param nodeBody New data for the node
|
* @param nodeBody New data for the node
|
||||||
* @param options Optional parameters supported by JS-API
|
* @param options Optional parameters supported by JS-API
|
||||||
@@ -137,7 +132,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves a node to the trashcan.
|
* Moves a node to the trashcan.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @param options Optional parameters supported by JS-API
|
* @param options Optional parameters supported by JS-API
|
||||||
* @returns Empty result that notifies when the deletion is complete
|
* @returns Empty result that notifies when the deletion is complete
|
||||||
@@ -148,7 +142,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Restores a node previously moved to the trashcan.
|
* Restores a node previously moved to the trashcan.
|
||||||
*
|
|
||||||
* @param nodeId ID of the node to restore
|
* @param nodeId ID of the node to restore
|
||||||
* @returns Details of the restored node
|
* @returns Details of the restored node
|
||||||
*/
|
*/
|
||||||
@@ -161,7 +154,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the metadata and the nodeType for a nodeId cleaned by the prefix.
|
* Get the metadata and the nodeType for a nodeId cleaned by the prefix.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @returns Node metadata
|
* @returns Node metadata
|
||||||
*/
|
*/
|
||||||
@@ -171,7 +163,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of holds assigned to the node.
|
* Gets the list of holds assigned to the node.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @param options Optional parameters supported by JS-API
|
* @param options Optional parameters supported by JS-API
|
||||||
* @param options.includeSource Also include **source** (in addition to **entries**) with folder information on **nodeId**
|
* @param options.includeSource Also include **source** (in addition to **entries**) with folder information on **nodeId**
|
||||||
@@ -198,7 +189,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets content for the given node.
|
* Gets content for the given node.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @returns Content data
|
* @returns Content data
|
||||||
*/
|
*/
|
||||||
@@ -208,7 +198,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Node inside `-root-` folder
|
* Create a new Node inside `-root-` folder
|
||||||
*
|
|
||||||
* @param name Node name
|
* @param name Node name
|
||||||
* @param nodeType Node type
|
* @param nodeType Node type
|
||||||
* @param properties Node body properties
|
* @param properties Node body properties
|
||||||
@@ -227,7 +216,6 @@ export class NodesApiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Node from form metadata.
|
* Create a new Node from form metadata.
|
||||||
*
|
|
||||||
* @param nodeType Node type
|
* @param nodeType Node type
|
||||||
* @param nameSpace Namespace for properties
|
* @param nameSpace Namespace for properties
|
||||||
* @param data Property data to store in the node under namespace
|
* @param data Property data to store in the node under namespace
|
||||||
|
@@ -60,7 +60,6 @@ export class PeopleContentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets information about a user identified by their username.
|
* Gets information about a user identified by their username.
|
||||||
*
|
|
||||||
* @param personId ID of the target user
|
* @param personId ID of the target user
|
||||||
* @returns User information
|
* @returns User information
|
||||||
*/
|
*/
|
||||||
@@ -74,7 +73,6 @@ export class PeopleContentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets information about the current user alias -me-
|
* Gets information about the current user alias -me-
|
||||||
*
|
|
||||||
* @returns User information
|
* @returns User information
|
||||||
*/
|
*/
|
||||||
getCurrentUserInfo(): Observable<EcmUserModel> {
|
getCurrentUserInfo(): Observable<EcmUserModel> {
|
||||||
@@ -86,7 +84,6 @@ export class PeopleContentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to know if the current user has the admin capability
|
* Used to know if the current user has the admin capability
|
||||||
*
|
|
||||||
* @returns true or false
|
* @returns true or false
|
||||||
*/
|
*/
|
||||||
isCurrentUserAdmin(): boolean {
|
isCurrentUserAdmin(): boolean {
|
||||||
@@ -102,7 +99,6 @@ export class PeopleContentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of people.
|
* Gets a list of people.
|
||||||
*
|
|
||||||
* @param requestQuery maxItems and skipCount parameters supported by JS-API
|
* @param requestQuery maxItems and skipCount parameters supported by JS-API
|
||||||
* @returns Response containing pagination and list of entries
|
* @returns Response containing pagination and list of entries
|
||||||
*/
|
*/
|
||||||
@@ -124,7 +120,6 @@ export class PeopleContentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new person.
|
* Creates new person.
|
||||||
*
|
|
||||||
* @param newPerson Object containing the new person details.
|
* @param newPerson Object containing the new person details.
|
||||||
* @param opts Optional parameters
|
* @param opts Optional parameters
|
||||||
* @returns Created new person
|
* @returns Created new person
|
||||||
@@ -135,7 +130,6 @@ export class PeopleContentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the person details
|
* Updates the person details
|
||||||
*
|
|
||||||
* @param personId The identifier of a person
|
* @param personId The identifier of a person
|
||||||
* @param details The person details
|
* @param details The person details
|
||||||
* @param opts Optional parameters
|
* @param opts Optional parameters
|
||||||
@@ -147,7 +141,6 @@ export class PeopleContentService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a profile image as a URL.
|
* Returns a profile image as a URL.
|
||||||
*
|
|
||||||
* @param avatarId Target avatar
|
* @param avatarId Target avatar
|
||||||
* @returns Image URL
|
* @returns Image URL
|
||||||
*/
|
*/
|
||||||
|
@@ -253,7 +253,6 @@ export class RenditionService {
|
|||||||
* This method takes a url to trigger the print dialog against, and the type of artifact that it
|
* This method takes a url to trigger the print dialog against, and the type of artifact that it
|
||||||
* is.
|
* is.
|
||||||
* This URL should be one that can be rendered in the browser, for example PDF, Image, or Text
|
* This URL should be one that can be rendered in the browser, for example PDF, Image, or Text
|
||||||
*
|
|
||||||
* @param url url to print
|
* @param url url to print
|
||||||
* @param type type of the rendition
|
* @param type type of the rendition
|
||||||
*/
|
*/
|
||||||
@@ -278,7 +277,6 @@ export class RenditionService {
|
|||||||
* These are: images, PDF files, or PDF rendition of files.
|
* These are: images, PDF files, or PDF rendition of files.
|
||||||
* We also force PDF rendition for TEXT type objects, otherwise the default URL is to download.
|
* We also force PDF rendition for TEXT type objects, otherwise the default URL is to download.
|
||||||
* TODO there are different TEXT type objects, (HTML, plaintext, xml, etc. we should determine how these are handled)
|
* TODO there are different TEXT type objects, (HTML, plaintext, xml, etc. we should determine how these are handled)
|
||||||
*
|
|
||||||
* @param objectId object it
|
* @param objectId object it
|
||||||
* @param mimeType mime type
|
* @param mimeType mime type
|
||||||
*/
|
*/
|
||||||
|
@@ -47,7 +47,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a site
|
* Create a site
|
||||||
*
|
|
||||||
* @param siteBody SiteBodyCreate to create site
|
* @param siteBody SiteBodyCreate to create site
|
||||||
* @returns site SiteEntry
|
* @returns site SiteEntry
|
||||||
*/
|
*/
|
||||||
@@ -57,7 +56,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of all sites in the repository.
|
* Gets a list of all sites in the repository.
|
||||||
*
|
|
||||||
* @param opts Options supported by JS-API
|
* @param opts Options supported by JS-API
|
||||||
* @returns List of sites
|
* @returns List of sites
|
||||||
*/
|
*/
|
||||||
@@ -72,7 +70,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the details for a site.
|
* Gets the details for a site.
|
||||||
*
|
|
||||||
* @param siteId ID of the target site
|
* @param siteId ID of the target site
|
||||||
* @param opts Options supported by JS-API
|
* @param opts Options supported by JS-API
|
||||||
* @returns Information about the site
|
* @returns Information about the site
|
||||||
@@ -83,7 +80,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a site.
|
* Deletes a site.
|
||||||
*
|
|
||||||
* @param siteId Site to delete
|
* @param siteId Site to delete
|
||||||
* @param permanentFlag True: deletion is permanent; False: site is moved to the trash
|
* @param permanentFlag True: deletion is permanent; False: site is moved to the trash
|
||||||
* @returns Null response notifying when the operation is complete
|
* @returns Null response notifying when the operation is complete
|
||||||
@@ -96,7 +92,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a site's content.
|
* Gets a site's content.
|
||||||
*
|
|
||||||
* @param siteId ID of the target site
|
* @param siteId ID of the target site
|
||||||
* @returns Site content
|
* @returns Site content
|
||||||
*/
|
*/
|
||||||
@@ -106,7 +101,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of all a site's members.
|
* Gets a list of all a site's members.
|
||||||
*
|
|
||||||
* @param siteId ID of the target site
|
* @param siteId ID of the target site
|
||||||
* @returns Site members
|
* @returns Site members
|
||||||
*/
|
*/
|
||||||
@@ -116,7 +110,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of all a site's members.
|
* Gets a list of all a site's members.
|
||||||
*
|
|
||||||
* @param siteId ID of the target site
|
* @param siteId ID of the target site
|
||||||
* @param opts Optional parameters supported by JS-API
|
* @param opts Optional parameters supported by JS-API
|
||||||
* @returns Observable<SiteMemberPaging>
|
* @returns Observable<SiteMemberPaging>
|
||||||
@@ -128,7 +121,6 @@ export class SitesService {
|
|||||||
/**
|
/**
|
||||||
* Looks for a site inside the path of a Node and returns its guid if it finds one.
|
* Looks for a site inside the path of a Node and returns its guid if it finds one.
|
||||||
* (return an empty string if no site is found)
|
* (return an empty string if no site is found)
|
||||||
*
|
|
||||||
* @param node Node to look for parent site
|
* @param node Node to look for parent site
|
||||||
* @returns Site guid
|
* @returns Site guid
|
||||||
*/
|
*/
|
||||||
@@ -143,7 +135,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of site membership requests.
|
* Gets a list of site membership requests.
|
||||||
*
|
|
||||||
* @param opts Options supported by JS-API
|
* @param opts Options supported by JS-API
|
||||||
* @returns Site membership requests
|
* @returns Site membership requests
|
||||||
*/
|
*/
|
||||||
@@ -153,7 +144,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a site membership for person **personId** on site **siteId**.
|
* Creates a site membership for person **personId** on site **siteId**.
|
||||||
*
|
|
||||||
* @param siteId The identifier of a site
|
* @param siteId The identifier of a site
|
||||||
* @param siteMembershipBodyCreate The person to add and their role
|
* @param siteMembershipBodyCreate The person to add and their role
|
||||||
* @param opts Optional parameters
|
* @param opts Optional parameters
|
||||||
@@ -165,7 +155,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a site membership
|
* Update a site membership
|
||||||
*
|
|
||||||
* @param siteId The identifier of a site.
|
* @param siteId The identifier of a site.
|
||||||
* @param personId The identifier of a person.
|
* @param personId The identifier of a person.
|
||||||
* @param siteMembershipBodyUpdate The persons new role
|
* @param siteMembershipBodyUpdate The persons new role
|
||||||
@@ -183,7 +172,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a site membership
|
* Delete a site membership
|
||||||
*
|
|
||||||
* @param siteId The identifier of a site.
|
* @param siteId The identifier of a site.
|
||||||
* @param personId The identifier of a person.
|
* @param personId The identifier of a person.
|
||||||
* @returns Null response notifying when the operation is complete
|
* @returns Null response notifying when the operation is complete
|
||||||
@@ -194,7 +182,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Accept site membership requests.
|
* Accept site membership requests.
|
||||||
*
|
|
||||||
* @param siteId The identifier of a site.
|
* @param siteId The identifier of a site.
|
||||||
* @param inviteeId The invitee user name.
|
* @param inviteeId The invitee user name.
|
||||||
* @param opts Options supported by JS-API
|
* @param opts Options supported by JS-API
|
||||||
@@ -206,7 +193,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reject site membership requests.
|
* Reject site membership requests.
|
||||||
*
|
|
||||||
* @param siteId The identifier of a site.
|
* @param siteId The identifier of a site.
|
||||||
* @param inviteeId The invitee user name.
|
* @param inviteeId The invitee user name.
|
||||||
* @param opts Options supported by JS-API
|
* @param opts Options supported by JS-API
|
||||||
@@ -218,7 +204,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* List group membership for site
|
* List group membership for site
|
||||||
*
|
|
||||||
* @param siteId The identifier of a site.
|
* @param siteId The identifier of a site.
|
||||||
* @param opts Options supported by JS-API
|
* @param opts Options supported by JS-API
|
||||||
* @returns Observable<SiteGroupPaging>
|
* @returns Observable<SiteGroupPaging>
|
||||||
@@ -229,7 +214,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a site membership for group
|
* Create a site membership for group
|
||||||
*
|
|
||||||
* @param siteId The identifier of a site.
|
* @param siteId The identifier of a site.
|
||||||
* @param siteMembershipBodyCreate The Group to add and its role
|
* @param siteMembershipBodyCreate The Group to add and its role
|
||||||
* @returns Observable<SiteGroupEntry>
|
* @returns Observable<SiteGroupEntry>
|
||||||
@@ -240,7 +224,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get information about site membership of group
|
* Get information about site membership of group
|
||||||
*
|
|
||||||
* @param siteId The identifier of a site.
|
* @param siteId The identifier of a site.
|
||||||
* @param groupId The authorityId of a group.
|
* @param groupId The authorityId of a group.
|
||||||
* @returns Observable<SiteGroupEntry>
|
* @returns Observable<SiteGroupEntry>
|
||||||
@@ -251,7 +234,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update site membership of group
|
* Update site membership of group
|
||||||
*
|
|
||||||
* @param siteId The identifier of a site.
|
* @param siteId The identifier of a site.
|
||||||
* @param groupId The authorityId of a group.
|
* @param groupId The authorityId of a group.
|
||||||
* @param siteMembershipBodyUpdate The group new role
|
* @param siteMembershipBodyUpdate The group new role
|
||||||
@@ -263,7 +245,6 @@ export class SitesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a group membership for site
|
* Delete a group membership for site
|
||||||
*
|
|
||||||
* @param siteId The identifier of a site.
|
* @param siteId The identifier of a site.
|
||||||
* @param groupId The authorityId of a group.
|
* @param groupId The authorityId of a group.
|
||||||
* @returns Observable<void>
|
* @returns Observable<void>
|
||||||
|
@@ -90,7 +90,6 @@ export class UploadService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of concurrent threads for uploading.
|
* Returns the number of concurrent threads for uploading.
|
||||||
*
|
|
||||||
* @returns Number of concurrent threads (default 1)
|
* @returns Number of concurrent threads (default 1)
|
||||||
*/
|
*/
|
||||||
getThreadsCount(): number {
|
getThreadsCount(): number {
|
||||||
@@ -99,7 +98,6 @@ export class UploadService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the service still has files uploading or awaiting upload.
|
* Checks whether the service still has files uploading or awaiting upload.
|
||||||
*
|
|
||||||
* @returns True if files in the queue are still uploading, false otherwise
|
* @returns True if files in the queue are still uploading, false otherwise
|
||||||
*/
|
*/
|
||||||
isUploading(): boolean {
|
isUploading(): boolean {
|
||||||
@@ -118,7 +116,6 @@ export class UploadService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the file Queue
|
* Gets the file Queue
|
||||||
*
|
|
||||||
* @returns Array of files that form the queue
|
* @returns Array of files that form the queue
|
||||||
*/
|
*/
|
||||||
getQueue(): FileModel[] {
|
getQueue(): FileModel[] {
|
||||||
@@ -127,7 +124,6 @@ export class UploadService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds files to the uploading queue to be uploaded
|
* Adds files to the uploading queue to be uploaded
|
||||||
*
|
|
||||||
* @param files One or more separate parameters or an array of files to queue
|
* @param files One or more separate parameters or an array of files to queue
|
||||||
* @returns Array of files that were not blocked from upload by the ignore list
|
* @returns Array of files that were not blocked from upload by the ignore list
|
||||||
*/
|
*/
|
||||||
@@ -140,7 +136,6 @@ export class UploadService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
|
* Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
|
||||||
*
|
|
||||||
* @param successEmitter Emitter to invoke on file success status change
|
* @param successEmitter Emitter to invoke on file success status change
|
||||||
* @param errorEmitter Emitter to invoke on file error status change
|
* @param errorEmitter Emitter to invoke on file error status change
|
||||||
*/
|
*/
|
||||||
@@ -172,7 +167,6 @@ export class UploadService {
|
|||||||
* Cancels uploading of files.
|
* Cancels uploading of files.
|
||||||
* If the file is smaller than 1 MB the file will be uploaded and then the node deleted
|
* If the file is smaller than 1 MB the file will be uploaded and then the node deleted
|
||||||
* to prevent having files that were aborted but still uploaded.
|
* to prevent having files that were aborted but still uploaded.
|
||||||
*
|
|
||||||
* @param files One or more separate parameters or an array of files specifying uploads to cancel
|
* @param files One or more separate parameters or an array of files specifying uploads to cancel
|
||||||
*/
|
*/
|
||||||
cancelUpload(...files: FileModel[]) {
|
cancelUpload(...files: FileModel[]) {
|
||||||
@@ -206,7 +200,6 @@ export class UploadService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an upload promise for a file.
|
* Gets an upload promise for a file.
|
||||||
*
|
|
||||||
* @param file The target file
|
* @param file The target file
|
||||||
* @returns Promise that is resolved if the upload is successful or error otherwise
|
* @returns Promise that is resolved if the upload is successful or error otherwise
|
||||||
*/
|
*/
|
||||||
|
@@ -150,7 +150,6 @@ describe('ContentMetadataComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get metadata categories
|
* Get metadata categories
|
||||||
*
|
|
||||||
* @returns list of native elements
|
* @returns list of native elements
|
||||||
*/
|
*/
|
||||||
function getCategories(): HTMLParagraphElement[] {
|
function getCategories(): HTMLParagraphElement[] {
|
||||||
@@ -159,7 +158,6 @@ describe('ContentMetadataComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a categories management component
|
* Get a categories management component
|
||||||
*
|
|
||||||
* @returns angular component
|
* @returns angular component
|
||||||
*/
|
*/
|
||||||
function getCategoriesManagementComponent(): CategoriesManagementComponent {
|
function getCategoriesManagementComponent(): CategoriesManagementComponent {
|
||||||
|
@@ -309,7 +309,6 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* Register all tags which should be assigned to node. Please note that they are just in "register" state and are not yet saved
|
* Register all tags which should be assigned to node. Please note that they are just in "register" state and are not yet saved
|
||||||
* until button for saving data is clicked. Calling that function causes that save button is enabled.
|
* until button for saving data is clicked. Calling that function causes that save button is enabled.
|
||||||
*
|
|
||||||
* @param tags array of tags to register, they are not saved yet until we click save button.
|
* @param tags array of tags to register, they are not saved yet until we click save button.
|
||||||
*/
|
*/
|
||||||
storeTagsToAssign(tags: string[]) {
|
storeTagsToAssign(tags: string[]) {
|
||||||
@@ -320,7 +319,6 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* Store all categories that node should be assigned to. Please note that they are just in "stored" state and are not yet saved
|
* Store all categories that node should be assigned to. Please note that they are just in "stored" state and are not yet saved
|
||||||
* until button for saving data is clicked. Calling that function causes that save button is enabled.
|
* until button for saving data is clicked. Calling that function causes that save button is enabled.
|
||||||
*
|
|
||||||
* @param categoriesToAssign array of categories to store.
|
* @param categoriesToAssign array of categories to store.
|
||||||
*/
|
*/
|
||||||
storeCategoriesToAssign(categoriesToAssign: Category[]) {
|
storeCategoriesToAssign(categoriesToAssign: Category[]) {
|
||||||
|
@@ -17,13 +17,7 @@
|
|||||||
|
|
||||||
import { inject, Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { Node } from '@alfresco/js-api';
|
import { Node } from '@alfresco/js-api';
|
||||||
import {
|
import { CardViewDateItemModel, CardViewItemMatchValidator, CardViewTextItemModel, FileSizePipe, TranslationService } from '@alfresco/adf-core';
|
||||||
CardViewDateItemModel,
|
|
||||||
CardViewItemMatchValidator,
|
|
||||||
CardViewTextItemModel,
|
|
||||||
FileSizePipe,
|
|
||||||
TranslationService
|
|
||||||
} from '@alfresco/adf-core';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -44,9 +38,7 @@ export class BasicPropertiesService {
|
|||||||
value: node.name,
|
value: node.name,
|
||||||
key: 'properties.cm:name',
|
key: 'properties.cm:name',
|
||||||
editable: true,
|
editable: true,
|
||||||
validators: [
|
validators: [new CardViewItemMatchValidator('[\\/\\*\\\\"\\\\]')]
|
||||||
new CardViewItemMatchValidator('[\\/\\*\\\\"\\\\]')
|
|
||||||
]
|
|
||||||
}),
|
}),
|
||||||
new CardViewTextItemModel({
|
new CardViewTextItemModel({
|
||||||
label: 'CORE.METADATA.BASIC.TITLE',
|
label: 'CORE.METADATA.BASIC.TITLE',
|
||||||
|
@@ -19,13 +19,11 @@ import { AspectOrientedConfigService } from './aspect-oriented-config.service';
|
|||||||
import { AspectOrientedConfig, Property, OrganisedPropertyGroup, PropertyGroupContainer } from '../../interfaces/content-metadata.interfaces';
|
import { AspectOrientedConfig, Property, OrganisedPropertyGroup, PropertyGroupContainer } from '../../interfaces/content-metadata.interfaces';
|
||||||
|
|
||||||
describe('AspectOrientedConfigService', () => {
|
describe('AspectOrientedConfigService', () => {
|
||||||
|
|
||||||
let configService: AspectOrientedConfigService;
|
let configService: AspectOrientedConfigService;
|
||||||
|
|
||||||
const createConfigService = (configObj: AspectOrientedConfig) => new AspectOrientedConfigService(configObj);
|
const createConfigService = (configObj: AspectOrientedConfig) => new AspectOrientedConfigService(configObj);
|
||||||
|
|
||||||
describe('reorganiseByConfig', () => {
|
describe('reorganiseByConfig', () => {
|
||||||
|
|
||||||
interface TestCase {
|
interface TestCase {
|
||||||
name: string;
|
name: string;
|
||||||
config: AspectOrientedConfig;
|
config: AspectOrientedConfig;
|
||||||
@@ -51,54 +49,58 @@ describe('AspectOrientedConfigService', () => {
|
|||||||
{
|
{
|
||||||
name: 'One property from One group',
|
name: 'One property from One group',
|
||||||
config: {
|
config: {
|
||||||
berseria: [ 'property1' ]
|
berseria: ['property1']
|
||||||
},
|
|
||||||
expectations: [{
|
|
||||||
title: 'Berseria',
|
|
||||||
properties: [ property1 ]
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'More properties from One group',
|
|
||||||
config: {
|
|
||||||
berseria: [ 'property1', 'property2' ]
|
|
||||||
},
|
|
||||||
expectations: [{
|
|
||||||
title: 'Berseria',
|
|
||||||
properties: [ property1, property2 ]
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'One-one properties from More group',
|
|
||||||
config: {
|
|
||||||
berseria: [ 'property1' ],
|
|
||||||
zestiria: [ 'property3' ]
|
|
||||||
},
|
},
|
||||||
expectations: [
|
expectations: [
|
||||||
{
|
{
|
||||||
title: 'Berseria',
|
title: 'Berseria',
|
||||||
properties: [ property1 ]
|
properties: [property1]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'More properties from One group',
|
||||||
|
config: {
|
||||||
|
berseria: ['property1', 'property2']
|
||||||
|
},
|
||||||
|
expectations: [
|
||||||
|
{
|
||||||
|
title: 'Berseria',
|
||||||
|
properties: [property1, property2]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'One-one properties from More group',
|
||||||
|
config: {
|
||||||
|
berseria: ['property1'],
|
||||||
|
zestiria: ['property3']
|
||||||
|
},
|
||||||
|
expectations: [
|
||||||
|
{
|
||||||
|
title: 'Berseria',
|
||||||
|
properties: [property1]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Zestiria',
|
title: 'Zestiria',
|
||||||
properties: [ property3 ]
|
properties: [property3]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'More properties from More groups',
|
name: 'More properties from More groups',
|
||||||
config: {
|
config: {
|
||||||
zestiria: [ 'property4', 'property3' ],
|
zestiria: ['property4', 'property3'],
|
||||||
berseria: [ 'property2', 'property1' ]
|
berseria: ['property2', 'property1']
|
||||||
},
|
},
|
||||||
expectations: [
|
expectations: [
|
||||||
{
|
{
|
||||||
title: 'Zestiria',
|
title: 'Zestiria',
|
||||||
properties: [ property4, property3 ]
|
properties: [property4, property3]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Berseria',
|
title: 'Berseria',
|
||||||
properties: [ property2, property1 ]
|
properties: [property2, property1]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -106,16 +108,16 @@ describe('AspectOrientedConfigService', () => {
|
|||||||
name: 'Wildcard',
|
name: 'Wildcard',
|
||||||
config: {
|
config: {
|
||||||
berseria: '*',
|
berseria: '*',
|
||||||
zestiria: [ 'property4' ]
|
zestiria: ['property4']
|
||||||
},
|
},
|
||||||
expectations: [
|
expectations: [
|
||||||
{
|
{
|
||||||
title: 'Berseria',
|
title: 'Berseria',
|
||||||
properties: [ property1, property2 ]
|
properties: [property1, property2]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Zestiria',
|
title: 'Zestiria',
|
||||||
properties: [ property4 ]
|
properties: [property4]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -124,29 +126,29 @@ describe('AspectOrientedConfigService', () => {
|
|||||||
config: {
|
config: {
|
||||||
berseria: '*',
|
berseria: '*',
|
||||||
'not-existing-group': '*',
|
'not-existing-group': '*',
|
||||||
zestiria: [ 'property4' ]
|
zestiria: ['property4']
|
||||||
},
|
},
|
||||||
expectations: [
|
expectations: [
|
||||||
{
|
{
|
||||||
title: 'Berseria',
|
title: 'Berseria',
|
||||||
properties: [ property1, property2 ]
|
properties: [property1, property2]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Zestiria',
|
title: 'Zestiria',
|
||||||
properties: [ property4 ]
|
properties: [property4]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Not existing property',
|
name: 'Not existing property',
|
||||||
config: {
|
config: {
|
||||||
berseria: [ 'not-existing-property' ],
|
berseria: ['not-existing-property'],
|
||||||
zestiria: [ 'property4' ]
|
zestiria: ['property4']
|
||||||
},
|
},
|
||||||
expectations: [
|
expectations: [
|
||||||
{
|
{
|
||||||
title: 'Zestiria',
|
title: 'Zestiria',
|
||||||
properties: [ property4 ]
|
properties: [property4]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -160,7 +162,7 @@ describe('AspectOrientedConfigService', () => {
|
|||||||
|
|
||||||
expect(organisedPropertyGroups.length).toBe(testCase.expectations.length, 'Group count should match');
|
expect(organisedPropertyGroups.length).toBe(testCase.expectations.length, 'Group count should match');
|
||||||
testCase.expectations.forEach((expectation, i) => {
|
testCase.expectations.forEach((expectation, i) => {
|
||||||
expect(organisedPropertyGroups[i].title).toBe(expectation.title, 'Group\'s title should match' );
|
expect(organisedPropertyGroups[i].title).toBe(expectation.title, "Group's title should match");
|
||||||
expect(organisedPropertyGroups[i].properties.length).toBe(
|
expect(organisedPropertyGroups[i].properties.length).toBe(
|
||||||
expectation.properties.length,
|
expectation.properties.length,
|
||||||
`Property count for '${organisedPropertyGroups[i].title}' group should match.`
|
`Property count for '${organisedPropertyGroups[i].title}' group should match.`
|
||||||
@@ -194,11 +196,11 @@ describe('AspectOrientedConfigService', () => {
|
|||||||
expectations: [
|
expectations: [
|
||||||
{
|
{
|
||||||
title: 'Berseria',
|
title: 'Berseria',
|
||||||
properties: [ property1, property2 ]
|
properties: [property1, property2]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Zestiria',
|
title: 'Zestiria',
|
||||||
properties: [ property3, property4 ]
|
properties: [property3, property4]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@@ -208,7 +210,7 @@ describe('AspectOrientedConfigService', () => {
|
|||||||
|
|
||||||
expect(organisedPropertyGroups.length).toBe(testCase.expectations.length, 'Group count should match');
|
expect(organisedPropertyGroups.length).toBe(testCase.expectations.length, 'Group count should match');
|
||||||
testCase.expectations.forEach((expectation, i) => {
|
testCase.expectations.forEach((expectation, i) => {
|
||||||
expect(organisedPropertyGroups[i].title).toBe(expectation.title, 'Group\'s title should match' );
|
expect(organisedPropertyGroups[i].title).toBe(expectation.title, "Group's title should match");
|
||||||
expect(organisedPropertyGroups[i].properties.length).toBe(
|
expect(organisedPropertyGroups[i].properties.length).toBe(
|
||||||
expectation.properties.length,
|
expectation.properties.length,
|
||||||
`Property count for '${organisedPropertyGroups[i].title}' group should match.`
|
`Property count for '${organisedPropertyGroups[i].title}' group should match.`
|
||||||
@@ -231,11 +233,11 @@ describe('AspectOrientedConfigService', () => {
|
|||||||
expectations: [
|
expectations: [
|
||||||
{
|
{
|
||||||
title: 'Berseria',
|
title: 'Berseria',
|
||||||
properties: [ property1, property2 ]
|
properties: [property1, property2]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Zestiria',
|
title: 'Zestiria',
|
||||||
properties: [ property3, property4 ]
|
properties: [property3, property4]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
@@ -19,8 +19,7 @@ import { ContentMetadataConfig, OrganisedPropertyGroup, PropertyGroupContainer,
|
|||||||
import { getGroup, getProperty } from './property-group-reader';
|
import { getGroup, getProperty } from './property-group-reader';
|
||||||
|
|
||||||
export class AspectOrientedConfigService implements ContentMetadataConfig {
|
export class AspectOrientedConfigService implements ContentMetadataConfig {
|
||||||
|
constructor(private config: any) {}
|
||||||
constructor(private config: any) { }
|
|
||||||
|
|
||||||
public isGroupAllowed(groupName: string): boolean {
|
public isGroupAllowed(groupName: string): boolean {
|
||||||
if (this.isIncludeAllEnabled()) {
|
if (this.isIncludeAllEnabled()) {
|
||||||
@@ -43,24 +42,23 @@ export class AspectOrientedConfigService implements ContentMetadataConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
||||||
const groups = Object.keys(propertyGroups)
|
const groups = Object.keys(propertyGroups).map((groupName) => {
|
||||||
.map((groupName) => {
|
const propertyGroup = propertyGroups[groupName];
|
||||||
const propertyGroup = propertyGroups[groupName];
|
const properties = propertyGroup.properties;
|
||||||
const properties = propertyGroup.properties;
|
|
||||||
|
|
||||||
if (this.isAspectReadOnly(groupName)) {
|
if (this.isAspectReadOnly(groupName)) {
|
||||||
Object.keys(properties).map((propertyName) => this.setReadOnlyProperty(properties[propertyName]));
|
Object.keys(properties).map((propertyName) => this.setReadOnlyProperty(properties[propertyName]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object.assign({}, propertyGroup, {
|
return Object.assign({}, propertyGroup, {
|
||||||
properties: Object.keys(properties).map((propertyName) => {
|
properties: Object.keys(properties).map((propertyName) => {
|
||||||
if (this.isPropertyReadOnly(propertyName)) {
|
if (this.isPropertyReadOnly(propertyName)) {
|
||||||
this.setReadOnlyProperty(properties[propertyName]);
|
this.setReadOnlyProperty(properties[propertyName]);
|
||||||
}
|
}
|
||||||
return properties[propertyName];
|
return properties[propertyName];
|
||||||
})
|
})
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
@@ -87,7 +85,6 @@ export class AspectOrientedConfigService implements ContentMetadataConfig {
|
|||||||
} else {
|
} else {
|
||||||
return readOnlyAspects === propertyGroupName;
|
return readOnlyAspects === propertyGroupName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public filterExcludedPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
|
public filterExcludedPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
|
||||||
|
@@ -25,19 +25,17 @@ import { ContentMetadataConfig } from '../../interfaces/content-metadata.interfa
|
|||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
|
|
||||||
describe('ContentMetadataConfigFactory', () => {
|
describe('ContentMetadataConfigFactory', () => {
|
||||||
|
|
||||||
let factory: ContentMetadataConfigFactory;
|
let factory: ContentMetadataConfigFactory;
|
||||||
let appConfig: AppConfigService;
|
let appConfig: AppConfigService;
|
||||||
let config: ContentMetadataConfig;
|
let config: ContentMetadataConfig;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [HttpClientModule],
|
||||||
HttpClientModule
|
|
||||||
],
|
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: LogService, useValue: {
|
provide: LogService,
|
||||||
|
useValue: {
|
||||||
error: () => {}
|
error: () => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,7 +46,6 @@ describe('ContentMetadataConfigFactory', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('get', () => {
|
describe('get', () => {
|
||||||
|
|
||||||
let logService: LogService;
|
let logService: LogService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -57,7 +54,6 @@ describe('ContentMetadataConfigFactory', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('get', () => {
|
describe('get', () => {
|
||||||
|
|
||||||
it('should get back to default preset if no preset is provided as parameter', () => {
|
it('should get back to default preset if no preset is provided as parameter', () => {
|
||||||
config = factory.get();
|
config = factory.get();
|
||||||
|
|
||||||
@@ -85,7 +81,6 @@ describe('ContentMetadataConfigFactory', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('set', () => {
|
describe('set', () => {
|
||||||
|
|
||||||
const setConfig = (presetName: string, presetConfig: any) => {
|
const setConfig = (presetName: string, presetConfig: any) => {
|
||||||
appConfig.config['content-metadata'] = {
|
appConfig.config['content-metadata'] = {
|
||||||
presets: {
|
presets: {
|
||||||
@@ -118,5 +113,5 @@ describe('ContentMetadataConfigFactory', () => {
|
|||||||
expect(config).toEqual(jasmine.any(LayoutOrientedConfigService));
|
expect(config).toEqual(jasmine.any(LayoutOrientedConfigService));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -15,26 +15,22 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ContentMetadataConfig, OrganisedPropertyGroup,
|
import { ContentMetadataConfig, OrganisedPropertyGroup, PropertyGroupContainer } from '../../interfaces/content-metadata.interfaces';
|
||||||
PropertyGroupContainer
|
|
||||||
} from '../../interfaces/content-metadata.interfaces';
|
|
||||||
|
|
||||||
export class IndifferentConfigService implements ContentMetadataConfig {
|
export class IndifferentConfigService implements ContentMetadataConfig {
|
||||||
|
|
||||||
isGroupAllowed(): boolean {
|
isGroupAllowed(): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
||||||
return Object.keys(propertyGroups)
|
return Object.keys(propertyGroups).map((groupName) => {
|
||||||
.map((groupName) => {
|
const propertyGroup = propertyGroups[groupName];
|
||||||
const propertyGroup = propertyGroups[groupName];
|
const properties = propertyGroup.properties;
|
||||||
const properties = propertyGroup.properties;
|
|
||||||
|
|
||||||
return Object.assign({}, propertyGroup, {
|
return Object.assign({}, propertyGroup, {
|
||||||
properties: Object.keys(properties).map((propertyName) => properties[propertyName])
|
properties: Object.keys(properties).map((propertyName) => properties[propertyName])
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
filterExcludedPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
|
filterExcludedPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
|
||||||
@@ -42,7 +38,7 @@ export class IndifferentConfigService implements ContentMetadataConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
appendAllPreset(): OrganisedPropertyGroup[] {
|
appendAllPreset(): OrganisedPropertyGroup[] {
|
||||||
return[];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
isIncludeAllEnabled(): boolean {
|
isIncludeAllEnabled(): boolean {
|
||||||
|
@@ -25,8 +25,7 @@ import {
|
|||||||
import { getProperty } from './property-group-reader';
|
import { getProperty } from './property-group-reader';
|
||||||
|
|
||||||
export class LayoutOrientedConfigService implements ContentMetadataConfig {
|
export class LayoutOrientedConfigService implements ContentMetadataConfig {
|
||||||
|
constructor(private config: any) {}
|
||||||
constructor(private config: any) { }
|
|
||||||
|
|
||||||
public isGroupAllowed(groupName: string): boolean {
|
public isGroupAllowed(groupName: string): boolean {
|
||||||
if (this.isIncludeAllEnabled()) {
|
if (this.isIncludeAllEnabled()) {
|
||||||
@@ -41,9 +40,9 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig {
|
|||||||
const organisedPropertyGroup = layoutBlocks.map((layoutBlock) => {
|
const organisedPropertyGroup = layoutBlocks.map((layoutBlock) => {
|
||||||
const flattenedItems = this.flattenItems(layoutBlock.items);
|
const flattenedItems = this.flattenItems(layoutBlock.items);
|
||||||
const properties = flattenedItems.reduce((props, explodedItem) => {
|
const properties = flattenedItems.reduce((props, explodedItem) => {
|
||||||
const isProperty = typeof explodedItem.property === 'object';
|
const isProperty = typeof explodedItem.property === 'object';
|
||||||
const propertyName = isProperty ? explodedItem.property.name : explodedItem.property;
|
const propertyName = isProperty ? explodedItem.property.name : explodedItem.property;
|
||||||
let property = getProperty(propertyGroups, explodedItem.groupName, propertyName) || [];
|
let property = getProperty(propertyGroups, explodedItem.groupName, propertyName) || [];
|
||||||
if (isProperty) {
|
if (isProperty) {
|
||||||
property = this.setPropertyTitle(property, explodedItem.property);
|
property = this.setPropertyTitle(property, explodedItem.property);
|
||||||
}
|
}
|
||||||
@@ -61,15 +60,14 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
||||||
return Object.keys(propertyGroups)
|
return Object.keys(propertyGroups).map((groupName) => {
|
||||||
.map((groupName) => {
|
const propertyGroup = propertyGroups[groupName];
|
||||||
const propertyGroup = propertyGroups[groupName];
|
const properties = propertyGroup.properties;
|
||||||
const properties = propertyGroup.properties;
|
|
||||||
|
|
||||||
return Object.assign({}, propertyGroup, {
|
return Object.assign({}, propertyGroup, {
|
||||||
properties: Object.keys(properties).map((propertyName) => properties[propertyName])
|
properties: Object.keys(properties).map((propertyName) => properties[propertyName])
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public filterExcludedPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
|
public filterExcludedPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
|
||||||
@@ -88,16 +86,14 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public isIncludeAllEnabled() {
|
public isIncludeAllEnabled() {
|
||||||
const includeAllProperty = this.config
|
const includeAllProperty = this.config.map((config) => config.includeAll).find((includeAll) => includeAll !== undefined);
|
||||||
.map((config) => config.includeAll)
|
|
||||||
.find((includeAll) => includeAll !== undefined);
|
|
||||||
|
|
||||||
return includeAllProperty !== undefined ? includeAllProperty : false;
|
return includeAllProperty !== undefined ? includeAllProperty : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private setEditableProperty(propertyGroup: Property | Property[], itemConfig): Property | Property[] {
|
private setEditableProperty(propertyGroup: Property | Property[], itemConfig): Property | Property[] {
|
||||||
if (Array.isArray(propertyGroup)) {
|
if (Array.isArray(propertyGroup)) {
|
||||||
propertyGroup.map((property) => property.editable = itemConfig.editable !== undefined ? itemConfig.editable : true);
|
propertyGroup.map((property) => (property.editable = itemConfig.editable !== undefined ? itemConfig.editable : true));
|
||||||
} else {
|
} else {
|
||||||
propertyGroup.editable = itemConfig.editable !== undefined ? itemConfig.editable : true;
|
propertyGroup.editable = itemConfig.editable !== undefined ? itemConfig.editable : true;
|
||||||
}
|
}
|
||||||
@@ -107,7 +103,7 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig {
|
|||||||
|
|
||||||
private setPropertyTitle(item: Property | Property[], property: Property): Property | Property[] {
|
private setPropertyTitle(item: Property | Property[], property: Property): Property | Property[] {
|
||||||
if (!Array.isArray(item)) {
|
if (!Array.isArray(item)) {
|
||||||
return { ...item, ...(item.name === property.name && !!property.title) && { title: property.title } };
|
return { ...item, ...(item.name === property.name && !!property.title && { title: property.title }) };
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
@@ -30,15 +30,15 @@ import { ContentTypePropertiesService } from './content-type-property.service';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class ContentMetadataService {
|
export class ContentMetadataService {
|
||||||
|
|
||||||
error = new Subject<{ statusCode: number; message: string }>();
|
error = new Subject<{ statusCode: number; message: string }>();
|
||||||
|
|
||||||
constructor(private basicPropertiesService: BasicPropertiesService,
|
constructor(
|
||||||
private contentMetadataConfigFactory: ContentMetadataConfigFactory,
|
private basicPropertiesService: BasicPropertiesService,
|
||||||
private propertyGroupTranslatorService: PropertyGroupTranslatorService,
|
private contentMetadataConfigFactory: ContentMetadataConfigFactory,
|
||||||
private propertyDescriptorsService: PropertyDescriptorsService,
|
private propertyGroupTranslatorService: PropertyGroupTranslatorService,
|
||||||
private contentTypePropertyService: ContentTypePropertiesService) {
|
private propertyDescriptorsService: PropertyDescriptorsService,
|
||||||
}
|
private contentTypePropertyService: ContentTypePropertiesService
|
||||||
|
) {}
|
||||||
|
|
||||||
getBasicProperties(node: Node): Observable<CardViewItem[]> {
|
getBasicProperties(node: Node): Observable<CardViewItem[]> {
|
||||||
return of(this.basicPropertiesService.getProperties(node));
|
return of(this.basicPropertiesService.getProperties(node));
|
||||||
@@ -63,9 +63,7 @@ export class ContentMetadataService {
|
|||||||
contentMetadataConfig = this.contentMetadataConfigFactory.createConfig(preset);
|
contentMetadataConfig = this.contentMetadataConfigFactory.createConfig(preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
const groupNames = node.aspectNames
|
const groupNames = node.aspectNames.concat(node.nodeType).filter((groupName) => contentMetadataConfig.isGroupAllowed(groupName));
|
||||||
.concat(node.nodeType)
|
|
||||||
.filter((groupName) => contentMetadataConfig.isGroupAllowed(groupName));
|
|
||||||
|
|
||||||
if (groupNames.length > 0) {
|
if (groupNames.length > 0) {
|
||||||
groupedProperties = this.propertyDescriptorsService.load(groupNames).pipe(
|
groupedProperties = this.propertyDescriptorsService.load(groupNames).pipe(
|
||||||
@@ -74,7 +72,8 @@ export class ContentMetadataService {
|
|||||||
() => contentMetadataConfig.isIncludeAllEnabled(),
|
() => contentMetadataConfig.isIncludeAllEnabled(),
|
||||||
of(contentMetadataConfig.appendAllPreset(groups).concat(contentMetadataConfig.reorganiseByConfig(groups))),
|
of(contentMetadataConfig.appendAllPreset(groups).concat(contentMetadataConfig.reorganiseByConfig(groups))),
|
||||||
of(contentMetadataConfig.reorganiseByConfig(groups))
|
of(contentMetadataConfig.reorganiseByConfig(groups))
|
||||||
)),
|
)
|
||||||
|
),
|
||||||
map((groups) => contentMetadataConfig.filterExcludedPreset(groups)),
|
map((groups) => contentMetadataConfig.filterExcludedPreset(groups)),
|
||||||
map((groups) => this.filterEmptyPreset(groups)),
|
map((groups) => this.filterEmptyPreset(groups)),
|
||||||
map((groups) => this.setTitleToNameIfNotSet(groups)),
|
map((groups) => this.setTitleToNameIfNotSet(groups)),
|
||||||
@@ -93,7 +92,7 @@ export class ContentMetadataService {
|
|||||||
return propertyGroups;
|
return propertyGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
filterEmptyPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
|
filterEmptyPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
|
||||||
return propertyGroups.filter((props) => props.properties.length);
|
return propertyGroups.filter((props) => props.properties.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,24 +31,24 @@ import { VersionCompatibilityService } from '../../version-compatibility/version
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class ContentTypePropertiesService {
|
export class ContentTypePropertiesService {
|
||||||
|
constructor(
|
||||||
constructor(private contentTypeService: ContentTypeService,
|
private contentTypeService: ContentTypeService,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
private versionCompatibilityService: VersionCompatibilityService,
|
private versionCompatibilityService: VersionCompatibilityService,
|
||||||
private propertyGroupTranslatorService: PropertyGroupTranslatorService) {
|
private propertyGroupTranslatorService: PropertyGroupTranslatorService
|
||||||
}
|
) {}
|
||||||
|
|
||||||
getContentTypeCardItem(node: Node): Observable<CardViewItem[]> {
|
getContentTypeCardItem(node: Node): Observable<CardViewItem[]> {
|
||||||
if (this.versionCompatibilityService.isVersionSupported('7')) {
|
if (this.versionCompatibilityService.isVersionSupported('7')) {
|
||||||
return this.contentTypeService.getContentTypeByPrefix(node.nodeType).
|
return this.contentTypeService.getContentTypeByPrefix(node.nodeType).pipe(
|
||||||
pipe(
|
map((contentType) => {
|
||||||
map((contentType) => {
|
const contentTypesOptions$ = this.getContentTypesAsSelectOption(contentType);
|
||||||
const contentTypesOptions$ = this.getContentTypesAsSelectOption(contentType);
|
const contentTypeCard = this.buildContentTypeSelectCardModel(contentType.entry.id, contentTypesOptions$);
|
||||||
const contentTypeCard = this.buildContentTypeSelectCardModel(contentType.entry.id, contentTypesOptions$);
|
const filteredProperties = this.getContentTypeSpecificProperties(contentType);
|
||||||
const filteredProperties = this.getContentTypeSpecificProperties(contentType);
|
const propertiesCard = this.buildCardItemsFromPropertyList(filteredProperties, node.properties);
|
||||||
const propertiesCard = this.buildCardItemsFromPropertyList(filteredProperties, node.properties);
|
return [contentTypeCard, ...propertiesCard];
|
||||||
return [contentTypeCard, ...propertiesCard];
|
})
|
||||||
}));
|
);
|
||||||
} else {
|
} else {
|
||||||
return of([this.buildContentTypeTextCardModel(node.nodeType)]);
|
return of([this.buildContentTypeTextCardModel(node.nodeType)]);
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,10 @@ export class ContentTypePropertiesService {
|
|||||||
return contentTypeCard;
|
return contentTypeCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildContentTypeSelectCardModel(currentValue: string, options$: Observable<CardViewSelectItemOption<string>[]>): CardViewSelectItemModel<string> {
|
private buildContentTypeSelectCardModel(
|
||||||
|
currentValue: string,
|
||||||
|
options$: Observable<CardViewSelectItemOption<string>[]>
|
||||||
|
): CardViewSelectItemModel<string> {
|
||||||
const contentTypeCard = new CardViewSelectItemModel({
|
const contentTypeCard = new CardViewSelectItemModel({
|
||||||
label: 'CORE.METADATA.BASIC.CONTENT_TYPE',
|
label: 'CORE.METADATA.BASIC.CONTENT_TYPE',
|
||||||
value: currentValue,
|
value: currentValue,
|
||||||
@@ -100,7 +103,8 @@ export class ContentTypePropertiesService {
|
|||||||
map(([contentTypesEntries, currentContentType]) => {
|
map(([contentTypesEntries, currentContentType]) => {
|
||||||
const updatedTypes = this.appendCurrentType(currentContentType, contentTypesEntries);
|
const updatedTypes = this.appendCurrentType(currentContentType, contentTypesEntries);
|
||||||
return updatedTypes.map((contentType) => ({ key: contentType.entry.id, label: contentType.entry.title ?? contentType.entry.id }));
|
return updatedTypes.map((contentType) => ({ key: contentType.entry.id, label: contentType.entry.title ?? contentType.entry.id }));
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private appendCurrentType(currentType: TypeEntry, contentTypesEntries: TypeEntry[]): TypeEntry[] {
|
private appendCurrentType(currentType: TypeEntry, contentTypesEntries: TypeEntry[]): TypeEntry[] {
|
||||||
|
@@ -36,14 +36,13 @@ describe('PropertyDescriptorLoaderService', () => {
|
|||||||
it('should load the groups passed by paramter', (done) => {
|
it('should load the groups passed by paramter', (done) => {
|
||||||
spyOn(classesApi, 'getClass').and.returnValue(Promise.resolve({}));
|
spyOn(classesApi, 'getClass').and.returnValue(Promise.resolve({}));
|
||||||
|
|
||||||
service.load(['exif:exif', 'cm:content', 'custom:custom'])
|
service.load(['exif:exif', 'cm:content', 'custom:custom']).subscribe(() => {
|
||||||
.subscribe(() => {
|
expect(classesApi.getClass).toHaveBeenCalledTimes(3);
|
||||||
expect(classesApi.getClass).toHaveBeenCalledTimes(3);
|
expect(classesApi.getClass).toHaveBeenCalledWith('exif_exif');
|
||||||
expect(classesApi.getClass).toHaveBeenCalledWith('exif_exif');
|
expect(classesApi.getClass).toHaveBeenCalledWith('cm_content');
|
||||||
expect(classesApi.getClass).toHaveBeenCalledWith('cm_content');
|
expect(classesApi.getClass).toHaveBeenCalledWith('custom_custom');
|
||||||
expect(classesApi.getClass).toHaveBeenCalledWith('custom_custom');
|
done();
|
||||||
done();
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should merge the forked values', (done) => {
|
it('should merge the forked values', (done) => {
|
||||||
|
@@ -26,29 +26,29 @@ import { ClassesApi } from '@alfresco/js-api';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PropertyDescriptorsService {
|
export class PropertyDescriptorsService {
|
||||||
|
|
||||||
private _classesApi: ClassesApi;
|
private _classesApi: ClassesApi;
|
||||||
get classesApi(): ClassesApi {
|
get classesApi(): ClassesApi {
|
||||||
this._classesApi = this._classesApi ?? new ClassesApi(this.alfrescoApiService.getInstance());
|
this._classesApi = this._classesApi ?? new ClassesApi(this.alfrescoApiService.getInstance());
|
||||||
return this._classesApi;
|
return this._classesApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
constructor(private alfrescoApiService: AlfrescoApiService) {}
|
||||||
}
|
|
||||||
|
|
||||||
load(groupNames: string[]): Observable<PropertyGroupContainer> {
|
load(groupNames: string[]): Observable<PropertyGroupContainer> {
|
||||||
const groupFetchStreams = groupNames
|
const groupFetchStreams = groupNames
|
||||||
.map((groupName) => groupName.replace(':', '_'))
|
.map((groupName) => groupName.replace(':', '_'))
|
||||||
.map((groupName) => defer(() => this.classesApi.getClass(groupName)));
|
.map((groupName) => defer(() => this.classesApi.getClass(groupName)));
|
||||||
|
|
||||||
return forkJoin(groupFetchStreams).pipe(
|
return forkJoin(groupFetchStreams).pipe(map(this.convertToObject));
|
||||||
map(this.convertToObject)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private convertToObject(propertyGroupsArray: PropertyGroup[]): PropertyGroupContainer {
|
private convertToObject(propertyGroupsArray: PropertyGroup[]): PropertyGroupContainer {
|
||||||
return propertyGroupsArray.reduce((propertyGroups, propertyGroup) => Object.assign({}, propertyGroups, {
|
return propertyGroupsArray.reduce(
|
||||||
[propertyGroup.name]: propertyGroup
|
(propertyGroups, propertyGroup) =>
|
||||||
}), {});
|
Object.assign({}, propertyGroups, {
|
||||||
|
[propertyGroup.name]: propertyGroup
|
||||||
|
}),
|
||||||
|
{}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,6 @@ export class ContentNodeDialogService {
|
|||||||
/**
|
/**
|
||||||
* Opens a file browser at a chosen folder location.
|
* Opens a file browser at a chosen folder location.
|
||||||
* shows files and folders in the dialog search result.
|
* shows files and folders in the dialog search result.
|
||||||
*
|
|
||||||
* @param folderNodeId ID of the folder to use
|
* @param folderNodeId ID of the folder to use
|
||||||
* @returns Information about the selected file(s)
|
* @returns Information about the selected file(s)
|
||||||
*/
|
*/
|
||||||
@@ -66,7 +65,6 @@ export class ContentNodeDialogService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a lock node dialog.
|
* Opens a lock node dialog.
|
||||||
*
|
|
||||||
* @param contentEntry Node to lock
|
* @param contentEntry Node to lock
|
||||||
* @returns Error/status message (if any)
|
* @returns Error/status message (if any)
|
||||||
*/
|
*/
|
||||||
@@ -94,7 +92,6 @@ export class ContentNodeDialogService {
|
|||||||
/**
|
/**
|
||||||
* Opens a file browser at a chosen site location.
|
* Opens a file browser at a chosen site location.
|
||||||
* shows files and folders in the dialog search result.
|
* shows files and folders in the dialog search result.
|
||||||
*
|
|
||||||
* @returns Information about the selected file(s)
|
* @returns Information about the selected file(s)
|
||||||
*/
|
*/
|
||||||
openFileBrowseDialogBySite(): Observable<Node[]> {
|
openFileBrowseDialogBySite(): Observable<Node[]> {
|
||||||
@@ -106,7 +103,6 @@ export class ContentNodeDialogService {
|
|||||||
/**
|
/**
|
||||||
* Opens a file browser at a default myFile location.
|
* Opens a file browser at a default myFile location.
|
||||||
* shows files and folders in the dialog search result.
|
* shows files and folders in the dialog search result.
|
||||||
*
|
|
||||||
* @returns Information about the selected file(s)
|
* @returns Information about the selected file(s)
|
||||||
*/
|
*/
|
||||||
openFileBrowseDialogByDefaultLocation(): Observable<Node[]> {
|
openFileBrowseDialogByDefaultLocation(): Observable<Node[]> {
|
||||||
@@ -115,7 +111,6 @@ export class ContentNodeDialogService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a folder browser at a chosen site location.
|
* Opens a folder browser at a chosen site location.
|
||||||
*
|
|
||||||
* @returns Information about the selected folder(s)
|
* @returns Information about the selected folder(s)
|
||||||
*/
|
*/
|
||||||
openFolderBrowseDialogBySite(): Observable<Node[]> {
|
openFolderBrowseDialogBySite(): Observable<Node[]> {
|
||||||
@@ -124,7 +119,6 @@ export class ContentNodeDialogService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a folder browser at a chosen folder location.
|
* Opens a folder browser at a chosen folder location.
|
||||||
*
|
|
||||||
* @param folderNodeId ID of the folder to use
|
* @param folderNodeId ID of the folder to use
|
||||||
* @returns Information about the selected folder(s)
|
* @returns Information about the selected folder(s)
|
||||||
*/
|
*/
|
||||||
@@ -136,7 +130,6 @@ export class ContentNodeDialogService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a dialog to copy or move an item to a new location.
|
* Opens a dialog to copy or move an item to a new location.
|
||||||
*
|
|
||||||
* @param action Name of the action (eg, "Copy" or "Move") to show in the title
|
* @param action Name of the action (eg, "Copy" or "Move") to show in the title
|
||||||
* @param contentEntry Item to be copied or moved
|
* @param contentEntry Item to be copied or moved
|
||||||
* @param permission Permission for the operation
|
* @param permission Permission for the operation
|
||||||
@@ -171,7 +164,6 @@ export class ContentNodeDialogService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the translation of the dialog title.
|
* Gets the translation of the dialog title.
|
||||||
*
|
|
||||||
* @param action Name of the action to display in the dialog title
|
* @param action Name of the action to display in the dialog title
|
||||||
* @param name Name of the item on which the action is being performed
|
* @param name Name of the item on which the action is being performed
|
||||||
* @returns Translated version of the title
|
* @returns Translated version of the title
|
||||||
@@ -182,7 +174,6 @@ export class ContentNodeDialogService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a dialog to choose folders to upload.
|
* Opens a dialog to choose folders to upload.
|
||||||
*
|
|
||||||
* @param action Name of the action to show in the title
|
* @param action Name of the action to show in the title
|
||||||
* @param contentEntry Item to upload
|
* @param contentEntry Item to upload
|
||||||
* @returns Information about the chosen folder(s)
|
* @returns Information about the chosen folder(s)
|
||||||
@@ -209,7 +200,6 @@ export class ContentNodeDialogService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a dialog to choose a file to upload.
|
* Opens a dialog to choose a file to upload.
|
||||||
*
|
|
||||||
* @param action Name of the action to show in the title
|
* @param action Name of the action to show in the title
|
||||||
* @param contentEntry Item to upload
|
* @param contentEntry Item to upload
|
||||||
* @param showFilesInResult Show files in dialog search result
|
* @param showFilesInResult Show files in dialog search result
|
||||||
|
@@ -441,7 +441,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private isExcludedSiteContent(row: ShareDataRow): boolean {
|
private isExcludedSiteContent(row: ShareDataRow): boolean {
|
||||||
const entry = row.node.entry;
|
const entry = row.node.entry;
|
||||||
if (this._excludeSiteContent?.length && entry && entry.properties?.['st:componentId']) {
|
if (this._excludeSiteContent?.length && entry?.properties?.['st:componentId']) {
|
||||||
const excludedItem = this._excludeSiteContent.find((id: string) => entry.properties['st:componentId'] === id);
|
const excludedItem = this._excludeSiteContent.find((id: string) => entry.properties['st:componentId'] === id);
|
||||||
return !!excludedItem;
|
return !!excludedItem;
|
||||||
}
|
}
|
||||||
@@ -450,7 +450,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the site attribute and starts a new search
|
* Updates the site attribute and starts a new search
|
||||||
*
|
|
||||||
* @param chosenSite SiteEntry to search within
|
* @param chosenSite SiteEntry to search within
|
||||||
*/
|
*/
|
||||||
siteChanged(chosenSite: SiteEntry): void {
|
siteChanged(chosenSite: SiteEntry): void {
|
||||||
@@ -462,7 +461,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current breadcrumb folder node
|
* Get current breadcrumb folder node
|
||||||
*
|
|
||||||
* @returns the actually selected|entered folder node or null in case of searching for the breadcrumb
|
* @returns the actually selected|entered folder node or null in case of searching for the breadcrumb
|
||||||
*/
|
*/
|
||||||
get breadcrumbFolderNode(): Node | null {
|
get breadcrumbFolderNode(): Node | null {
|
||||||
@@ -479,7 +477,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares the dialog for a new search
|
* Prepares the dialog for a new search
|
||||||
*
|
|
||||||
* @param searchRequest request options
|
* @param searchRequest request options
|
||||||
*/
|
*/
|
||||||
prepareDialogForNewSearch(searchRequest: SearchRequest): void {
|
prepareDialogForNewSearch(searchRequest: SearchRequest): void {
|
||||||
@@ -552,7 +549,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the results of the search
|
* Show the results of the search
|
||||||
*
|
|
||||||
* @param results Search results
|
* @param results Search results
|
||||||
*/
|
*/
|
||||||
private showSearchResults(results: NodePaging): void {
|
private showSearchResults(results: NodePaging): void {
|
||||||
@@ -565,7 +561,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets showingSearchResults state to be able to differentiate between search results or folder results
|
* Sets showingSearchResults state to be able to differentiate between search results or folder results
|
||||||
*
|
|
||||||
* @param $event node event
|
* @param $event node event
|
||||||
*/
|
*/
|
||||||
onFolderChange($event: NodeEntryEvent): void {
|
onFolderChange($event: NodeEntryEvent): void {
|
||||||
@@ -580,7 +575,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to set the currently loaded node
|
* Attempts to set the currently loaded node
|
||||||
*
|
|
||||||
* @param nodePaging pagination model
|
* @param nodePaging pagination model
|
||||||
*/
|
*/
|
||||||
onFolderLoaded(nodePaging: NodePaging): void {
|
onFolderLoaded(nodePaging: NodePaging): void {
|
||||||
@@ -596,7 +590,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates pagination.hasMoreItems to false after filtering only folders during 'COPY' and 'MOVE' action
|
* Updates pagination.hasMoreItems to false after filtering only folders during 'COPY' and 'MOVE' action
|
||||||
*
|
|
||||||
* @param nodePaging pagination model
|
* @param nodePaging pagination model
|
||||||
*/
|
*/
|
||||||
updatePaginationAfterRowFilter(nodePaging: NodePaging): void {
|
updatePaginationAfterRowFilter(nodePaging: NodePaging): void {
|
||||||
@@ -607,7 +600,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether breadcrumb has to be shown or not
|
* Returns whether breadcrumb has to be shown or not
|
||||||
*
|
|
||||||
* @returns `true` if needs to show the breadcrumb, otherwise `false`
|
* @returns `true` if needs to show the breadcrumb, otherwise `false`
|
||||||
*/
|
*/
|
||||||
showBreadcrumbs() {
|
showBreadcrumbs() {
|
||||||
@@ -616,7 +608,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the next batch of search results
|
* Loads the next batch of search results
|
||||||
*
|
|
||||||
* @param pagination Pagination object
|
* @param pagination Pagination object
|
||||||
*/
|
*/
|
||||||
getNextPageOfSearch(pagination: Pagination): void {
|
getNextPageOfSearch(pagination: Pagination): void {
|
||||||
@@ -631,7 +622,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects node as chosen if it has the right permission, clears the selection otherwise
|
* Selects node as chosen if it has the right permission, clears the selection otherwise
|
||||||
*
|
|
||||||
* @param entry node entry
|
* @param entry node entry
|
||||||
*/
|
*/
|
||||||
private attemptNodeSelection(entry: Node): void {
|
private attemptNodeSelection(entry: Node): void {
|
||||||
@@ -649,7 +639,6 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* It filters and emit the selection coming from the document list
|
* It filters and emit the selection coming from the document list
|
||||||
*
|
|
||||||
* @param nodesEntries selected nodes
|
* @param nodesEntries selected nodes
|
||||||
*/
|
*/
|
||||||
onCurrentSelection(nodesEntries: NodeEntry[]): void {
|
onCurrentSelection(nodesEntries: NodeEntry[]): void {
|
||||||
|
@@ -26,7 +26,6 @@ import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class SharedLinksApiService {
|
export class SharedLinksApiService {
|
||||||
|
|
||||||
error = new Subject<{ statusCode: number; message: string }>();
|
error = new Subject<{ statusCode: number; message: string }>();
|
||||||
|
|
||||||
private _sharedLinksApi: SharedlinksApi;
|
private _sharedLinksApi: SharedlinksApi;
|
||||||
@@ -35,13 +34,10 @@ export class SharedLinksApiService {
|
|||||||
return this._sharedLinksApi;
|
return this._sharedLinksApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService,
|
constructor(private apiService: AlfrescoApiService, private preferences: UserPreferencesService) {}
|
||||||
private preferences: UserPreferencesService) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets shared links available to the current user.
|
* Gets shared links available to the current user.
|
||||||
*
|
|
||||||
* @param options Options supported by JS-API
|
* @param options Options supported by JS-API
|
||||||
* @returns List of shared links
|
* @returns List of shared links
|
||||||
*/
|
*/
|
||||||
@@ -54,38 +50,30 @@ export class SharedLinksApiService {
|
|||||||
const queryOptions = Object.assign({}, defaultOptions, options);
|
const queryOptions = Object.assign({}, defaultOptions, options);
|
||||||
const promise = this.sharedLinksApi.listSharedLinks(queryOptions);
|
const promise = this.sharedLinksApi.listSharedLinks(queryOptions);
|
||||||
|
|
||||||
return from(promise).pipe(
|
return from(promise).pipe(catchError((err) => of(err)));
|
||||||
catchError((err) => of(err))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a shared link available to the current user.
|
* Creates a shared link available to the current user.
|
||||||
*
|
|
||||||
* @param nodeId ID of the node to link to
|
* @param nodeId ID of the node to link to
|
||||||
* @param sharedLinkWithExpirySettings shared link with nodeId and expiryDate
|
* @param sharedLinkWithExpirySettings shared link with nodeId and expiryDate
|
||||||
* @param options Options supported by JS-API
|
* @param options Options supported by JS-API
|
||||||
* @returns The shared link just created
|
* @returns The shared link just created
|
||||||
*/
|
*/
|
||||||
createSharedLinks(nodeId: string, sharedLinkWithExpirySettings?: SharedLinkBodyCreate, options: any = {}): Observable<SharedLinkEntry> {
|
createSharedLinks(nodeId: string, sharedLinkWithExpirySettings?: SharedLinkBodyCreate, options: any = {}): Observable<SharedLinkEntry> {
|
||||||
const promise = this.sharedLinksApi.createSharedLink(sharedLinkWithExpirySettings? sharedLinkWithExpirySettings : { nodeId }, options);
|
const promise = this.sharedLinksApi.createSharedLink(sharedLinkWithExpirySettings ? sharedLinkWithExpirySettings : { nodeId }, options);
|
||||||
|
|
||||||
return from(promise).pipe(
|
return from(promise).pipe(catchError((err) => of(err)));
|
||||||
catchError((err) => of(err))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a shared link.
|
* Deletes a shared link.
|
||||||
*
|
|
||||||
* @param sharedId ID of the link to delete
|
* @param sharedId ID of the link to delete
|
||||||
* @returns Null response notifying when the operation is complete
|
* @returns Null response notifying when the operation is complete
|
||||||
*/
|
*/
|
||||||
deleteSharedLink(sharedId: string): Observable<any | Error> {
|
deleteSharedLink(sharedId: string): Observable<any | Error> {
|
||||||
const promise = this.sharedLinksApi.deleteSharedLink(sharedId);
|
const promise = this.sharedLinksApi.deleteSharedLink(sharedId);
|
||||||
|
|
||||||
return from(promise).pipe(
|
return from(promise).pipe(catchError((err: Error) => of(err)));
|
||||||
catchError((err: Error) => of(err))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,15 +25,13 @@ import { map } from 'rxjs/operators';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class ContentTypeService {
|
export class ContentTypeService {
|
||||||
|
|
||||||
private _typesApi: TypesApi;
|
private _typesApi: TypesApi;
|
||||||
get typesApi(): TypesApi {
|
get typesApi(): TypesApi {
|
||||||
this._typesApi = this._typesApi ?? new TypesApi(this.alfrescoApiService.getInstance());
|
this._typesApi = this._typesApi ?? new TypesApi(this.alfrescoApiService.getInstance());
|
||||||
return this._typesApi;
|
return this._typesApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private alfrescoApiService: AlfrescoApiService) {
|
constructor(private alfrescoApiService: AlfrescoApiService) {}
|
||||||
}
|
|
||||||
|
|
||||||
getContentTypeByPrefix(prefixedType: string): Observable<TypeEntry> {
|
getContentTypeByPrefix(prefixedType: string): Observable<TypeEntry> {
|
||||||
return from(this.typesApi.getType(prefixedType));
|
return from(this.typesApi.getType(prefixedType));
|
||||||
@@ -45,8 +43,6 @@ export class ContentTypeService {
|
|||||||
where,
|
where,
|
||||||
include: ['properties']
|
include: ['properties']
|
||||||
};
|
};
|
||||||
return from(this.typesApi.listTypes(opts)).pipe(
|
return from(this.typesApi.listTypes(opts)).pipe(map((result: TypePaging) => result.list.entries));
|
||||||
map((result: TypePaging) => result.list.entries)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,19 +24,16 @@ import { AlfrescoApiService } from '../../../services/alfresco-api.service';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class DownloadZipService {
|
export class DownloadZipService {
|
||||||
|
|
||||||
private _downloadsApi: DownloadsApi;
|
private _downloadsApi: DownloadsApi;
|
||||||
get downloadsApi(): DownloadsApi {
|
get downloadsApi(): DownloadsApi {
|
||||||
this._downloadsApi = this._downloadsApi ?? new DownloadsApi(this.apiService.getInstance());
|
this._downloadsApi = this._downloadsApi ?? new DownloadsApi(this.apiService.getInstance());
|
||||||
return this._downloadsApi;
|
return this._downloadsApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService) {
|
constructor(private apiService: AlfrescoApiService) {}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new download.
|
* Creates a new download.
|
||||||
*
|
|
||||||
* @param payload Object containing the node IDs of the items to add to the ZIP file
|
* @param payload Object containing the node IDs of the items to add to the ZIP file
|
||||||
* @returns Status object for the download
|
* @returns Status object for the download
|
||||||
*/
|
*/
|
||||||
@@ -46,7 +43,6 @@ export class DownloadZipService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets status information for a download node.
|
* Gets status information for a download node.
|
||||||
*
|
|
||||||
* @param downloadId ID of the download node
|
* @param downloadId ID of the download node
|
||||||
* @returns Status object for the download
|
* @returns Status object for the download
|
||||||
*/
|
*/
|
||||||
@@ -56,7 +52,6 @@ export class DownloadZipService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels a download.
|
* Cancels a download.
|
||||||
*
|
|
||||||
* @param downloadId ID of the target download node
|
* @param downloadId ID of the target download node
|
||||||
*/
|
*/
|
||||||
cancelDownload(downloadId: string) {
|
cancelDownload(downloadId: string) {
|
||||||
|
@@ -59,7 +59,6 @@ export class CheckAllowableOperationDirective implements OnChanges {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates disabled state for the decorated element
|
* Updates disabled state for the decorated element
|
||||||
*
|
|
||||||
* @returns the new state
|
* @returns the new state
|
||||||
*/
|
*/
|
||||||
updateElement(): boolean {
|
updateElement(): boolean {
|
||||||
@@ -94,8 +93,6 @@ export class CheckAllowableOperationDirective implements OnChanges {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables decorated element
|
* Enables decorated element
|
||||||
*
|
|
||||||
* @memberof CheckAllowableOperationDirective
|
|
||||||
*/
|
*/
|
||||||
enableElement(): void {
|
enableElement(): void {
|
||||||
this.renderer.removeAttribute(this.elementRef.nativeElement, 'disabled');
|
this.renderer.removeAttribute(this.elementRef.nativeElement, 'disabled');
|
||||||
@@ -103,8 +100,6 @@ export class CheckAllowableOperationDirective implements OnChanges {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables decorated element
|
* Disables decorated element
|
||||||
*
|
|
||||||
* @memberof CheckAllowableOperationDirective
|
|
||||||
*/
|
*/
|
||||||
disableElement(): void {
|
disableElement(): void {
|
||||||
this.renderer.setAttribute(this.elementRef.nativeElement, 'disabled', 'true');
|
this.renderer.setAttribute(this.elementRef.nativeElement, 'disabled', 'true');
|
||||||
@@ -112,7 +107,6 @@ export class CheckAllowableOperationDirective implements OnChanges {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether all nodes have a particular permission
|
* Checks whether all nodes have a particular permission
|
||||||
*
|
|
||||||
* @param nodes Node collection to check
|
* @param nodes Node collection to check
|
||||||
* @param permission Permission to check for each node
|
* @param permission Permission to check for each node
|
||||||
* @returns `true` if there are allowable operations, otherwise `false`
|
* @returns `true` if there are allowable operations, otherwise `false`
|
||||||
|
@@ -55,7 +55,6 @@ export class NodeDownloadDirective {
|
|||||||
/**
|
/**
|
||||||
* Downloads multiple selected nodes.
|
* Downloads multiple selected nodes.
|
||||||
* Packs result into a .ZIP archive if there is more than one node selected.
|
* Packs result into a .ZIP archive if there is more than one node selected.
|
||||||
*
|
|
||||||
* @param selection Multiple selected nodes to download
|
* @param selection Multiple selected nodes to download
|
||||||
*/
|
*/
|
||||||
downloadNodes(selection: NodeEntry | Array<NodeEntry>) {
|
downloadNodes(selection: NodeEntry | Array<NodeEntry>) {
|
||||||
@@ -76,7 +75,6 @@ export class NodeDownloadDirective {
|
|||||||
/**
|
/**
|
||||||
* Downloads a single node.
|
* Downloads a single node.
|
||||||
* Packs result into a .ZIP archive is the node is a Folder.
|
* Packs result into a .ZIP archive is the node is a Folder.
|
||||||
*
|
|
||||||
* @param node Node to download
|
* @param node Node to download
|
||||||
*/
|
*/
|
||||||
downloadNode(node: NodeEntry) {
|
downloadNode(node: NodeEntry) {
|
||||||
|
@@ -31,7 +31,6 @@ export class ContentActionListComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers action handler within the parent document list component.
|
* Registers action handler within the parent document list component.
|
||||||
*
|
|
||||||
* @param action Action model to register.
|
* @param action Action model to register.
|
||||||
* @returns `true` if actions was registered, otherwise `false`
|
* @returns `true` if actions was registered, otherwise `false`
|
||||||
*/
|
*/
|
||||||
|
@@ -733,7 +733,7 @@ export class DocumentListComponent extends DataTableSchema implements OnInit, On
|
|||||||
}
|
}
|
||||||
|
|
||||||
private isLinkFolder(node: Node) {
|
private isLinkFolder(node: Node) {
|
||||||
return node.nodeType === 'app:folderlink' && node.properties && node.properties['cm:destination'];
|
return node.nodeType === 'app:folderlink' && node.properties?.['cm:destination'];
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateCustomSourceData(nodeId: string): void {
|
private updateCustomSourceData(nodeId: string): void {
|
||||||
@@ -742,7 +742,6 @@ export class DocumentListComponent extends DataTableSchema implements OnInit, On
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked when executing content action for a document or folder.
|
* Invoked when executing content action for a document or folder.
|
||||||
*
|
|
||||||
* @param node Node to be the context of the execution.
|
* @param node Node to be the context of the execution.
|
||||||
* @param action Action to be executed against the context.
|
* @param action Action to be executed against the context.
|
||||||
*/
|
*/
|
||||||
|
@@ -15,13 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import { DataColumn, DataRow, DataSorting, DataTableAdapter, ThumbnailService } from '@alfresco/adf-core';
|
||||||
DataColumn,
|
|
||||||
DataRow,
|
|
||||||
DataSorting,
|
|
||||||
DataTableAdapter,
|
|
||||||
ThumbnailService
|
|
||||||
} from '@alfresco/adf-core';
|
|
||||||
import { NodePaging, NodeEntry } from '@alfresco/js-api';
|
import { NodePaging, NodeEntry } from '@alfresco/js-api';
|
||||||
import { PermissionStyleModel } from './../models/permissions-style.model';
|
import { PermissionStyleModel } from './../models/permissions-style.model';
|
||||||
import { ShareDataRow } from './share-data-row.model';
|
import { ShareDataRow } from './share-data-row.model';
|
||||||
@@ -57,12 +51,14 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
return this._sortingMode;
|
return this._sortingMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private thumbnailService: ThumbnailService,
|
constructor(
|
||||||
private contentService: ContentService,
|
private thumbnailService: ThumbnailService,
|
||||||
schema: DataColumn[] = [],
|
private contentService: ContentService,
|
||||||
sorting?: DataSorting,
|
schema: DataColumn[] = [],
|
||||||
sortingMode: string = 'client',
|
sorting?: DataSorting,
|
||||||
allowDropFiles: boolean = false) {
|
sortingMode: string = 'client',
|
||||||
|
allowDropFiles: boolean = false
|
||||||
|
) {
|
||||||
this.rows = [];
|
this.rows = [];
|
||||||
this.columns = schema || [];
|
this.columns = schema || [];
|
||||||
this.sorting = sorting;
|
this.sorting = sorting;
|
||||||
@@ -106,7 +102,6 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (col.key === '$thumbnail') {
|
if (col.key === '$thumbnail') {
|
||||||
|
|
||||||
if (this.imageResolver) {
|
if (this.imageResolver) {
|
||||||
const resolved = this.imageResolver(row, col);
|
const resolved = this.imageResolver(row, col);
|
||||||
if (resolved) {
|
if (resolved) {
|
||||||
@@ -137,7 +132,6 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (col.type === 'image') {
|
if (col.type === 'image') {
|
||||||
|
|
||||||
if (this.imageResolver) {
|
if (this.imageResolver) {
|
||||||
const resolved = this.imageResolver(row, col);
|
const resolved = this.imageResolver(row, col);
|
||||||
if (resolved) {
|
if (resolved) {
|
||||||
@@ -149,10 +143,8 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
return dataRow.cacheValue(col.key, value);
|
return dataRow.cacheValue(col.key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a thumbnail URL for the given document node.
|
* Gets a thumbnail URL for the given document node.
|
||||||
*
|
|
||||||
* @param node Node or Node ID to get URL for.
|
* @param node Node or Node ID to get URL for.
|
||||||
* @param attachment Toggles whether to retrieve content as an attachment for download
|
* @param attachment Toggles whether to retrieve content as an attachment for download
|
||||||
* @param ticket Custom ticket to use for authentication
|
* @param ticket Custom ticket to use for authentication
|
||||||
@@ -217,14 +209,12 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
|
|
||||||
isSmartFolder(node: any) {
|
isSmartFolder(node: any) {
|
||||||
const nodeAspects = this.getNodeAspectNames(node);
|
const nodeAspects = this.getNodeAspectNames(node);
|
||||||
return nodeAspects.indexOf('smf:customConfigSmartFolder') > -1 ||
|
return nodeAspects.indexOf('smf:customConfigSmartFolder') > -1 || nodeAspects.indexOf('smf:systemConfigSmartFolder') > -1;
|
||||||
(nodeAspects.indexOf('smf:systemConfigSmartFolder') > -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isRuleFolder(node: any) {
|
isRuleFolder(node: any) {
|
||||||
const nodeAspects = this.getNodeAspectNames(node);
|
const nodeAspects = this.getNodeAspectNames(node);
|
||||||
return nodeAspects.indexOf('rule:rules') > -1 ||
|
return nodeAspects.indexOf('rule:rules') > -1 || nodeAspects.indexOf('rule:rules') > -1;
|
||||||
(nodeAspects.indexOf('rule:rules') > -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isALinkFolder(node: any) {
|
isALinkFolder(node: any) {
|
||||||
@@ -233,7 +223,7 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getNodeAspectNames(node: any): any[] {
|
private getNodeAspectNames(node: any): any[] {
|
||||||
return node.entry?.aspectNames ? node.entry.aspectNames : (node.aspectNames ? node.aspectNames : []);
|
return node.entry?.aspectNames ? node.entry.aspectNames : node.aspectNames ? node.aspectNames : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
private sortRows(rows: DataRow[], sorting: DataSorting) {
|
private sortRows(rows: DataRow[], sorting: DataSorting) {
|
||||||
@@ -244,7 +234,6 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
const options: Intl.CollatorOptions = {};
|
const options: Intl.CollatorOptions = {};
|
||||||
|
|
||||||
if (sorting?.key && rows?.length) {
|
if (sorting?.key && rows?.length) {
|
||||||
|
|
||||||
if (sorting.key.includes('sizeInBytes') || sorting.key === 'name') {
|
if (sorting.key.includes('sizeInBytes') || sorting.key === 'name') {
|
||||||
options.numeric = true;
|
options.numeric = true;
|
||||||
}
|
}
|
||||||
@@ -256,21 +245,19 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
|
|
||||||
let left = a.getValue(sorting.key);
|
let left = a.getValue(sorting.key);
|
||||||
if (left) {
|
if (left) {
|
||||||
left = (left instanceof Date) ? left.valueOf().toString() : left.toString();
|
left = left instanceof Date ? left.valueOf().toString() : left.toString();
|
||||||
} else {
|
} else {
|
||||||
left = '';
|
left = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
let right = b.getValue(sorting.key);
|
let right = b.getValue(sorting.key);
|
||||||
if (right) {
|
if (right) {
|
||||||
right = (right instanceof Date) ? right.valueOf().toString() : right.toString();
|
right = right instanceof Date ? right.valueOf().toString() : right.toString();
|
||||||
} else {
|
} else {
|
||||||
right = '';
|
right = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return sorting.direction === 'asc'
|
return sorting.direction === 'asc' ? left.localeCompare(right, undefined, options) : right.localeCompare(left, undefined, options);
|
||||||
? left.localeCompare(right, undefined, options)
|
|
||||||
: right.localeCompare(left, undefined, options);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -283,7 +270,9 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
if (nodePaging?.list) {
|
if (nodePaging?.list) {
|
||||||
const nodeEntries: NodeEntry[] = nodePaging.list.entries;
|
const nodeEntries: NodeEntry[] = nodePaging.list.entries;
|
||||||
if (nodeEntries?.length) {
|
if (nodeEntries?.length) {
|
||||||
shareDataRows = nodeEntries.map((item) => new ShareDataRow(item, this.contentService, this.permissionsStyle, this.thumbnailService, this.allowDropFiles));
|
shareDataRows = nodeEntries.map(
|
||||||
|
(item) => new ShareDataRow(item, this.contentService, this.permissionsStyle, this.thumbnailService, this.allowDropFiles)
|
||||||
|
);
|
||||||
|
|
||||||
if (this.filter) {
|
if (this.filter) {
|
||||||
shareDataRows = shareDataRows.filter(this.filter);
|
shareDataRows = shareDataRows.filter(this.filter);
|
||||||
@@ -326,6 +315,6 @@ export class ShareDataTableAdapter implements DataTableAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRowByNodeId(nodeId: string): DataRow {
|
getRowByNodeId(nodeId: string): DataRow {
|
||||||
return this.rows.find((row: DataRow) => row.node.entry.id === nodeId);
|
return this.rows.find((row: DataRow) => row.node.entry.id === nodeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -59,14 +59,14 @@ export enum ContentActionTarget {
|
|||||||
export type ContentActionHandler = (obj: any, target?: any, permission?: string) => any;
|
export type ContentActionHandler = (obj: any, target?: any, permission?: string) => any;
|
||||||
|
|
||||||
export class DocumentActionModel extends ContentActionModel {
|
export class DocumentActionModel extends ContentActionModel {
|
||||||
constructor(json?: any) {
|
constructor(json?: any) {
|
||||||
super(json);
|
super(json);
|
||||||
this.target = 'document';
|
this.target = 'document';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FolderActionModel extends ContentActionModel {
|
export class FolderActionModel extends ContentActionModel {
|
||||||
constructor(json?: any) {
|
constructor(json?: any) {
|
||||||
super(json);
|
super(json);
|
||||||
this.target = 'folder';
|
this.target = 'folder';
|
||||||
}
|
}
|
||||||
|
@@ -89,7 +89,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets files recently accessed by a user.
|
* Gets files recently accessed by a user.
|
||||||
*
|
|
||||||
* @param personId ID of the user
|
* @param personId ID of the user
|
||||||
* @param pagination Specifies how to paginate the results
|
* @param pagination Specifies how to paginate the results
|
||||||
* @param filters Specifies additional filters to apply (joined with **AND**)
|
* @param filters Specifies additional filters to apply (joined with **AND**)
|
||||||
@@ -176,7 +175,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets favorite files for the current user.
|
* Gets favorite files for the current user.
|
||||||
*
|
|
||||||
* @param pagination Specifies how to paginate the results
|
* @param pagination Specifies how to paginate the results
|
||||||
* @param includeFields List of data field names to include in the results
|
* @param includeFields List of data field names to include in the results
|
||||||
* @param where A string to restrict the returned objects by using a predicate
|
* @param where A string to restrict the returned objects by using a predicate
|
||||||
@@ -231,7 +229,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets sites that the current user is a member of.
|
* Gets sites that the current user is a member of.
|
||||||
*
|
|
||||||
* @param pagination Specifies how to paginate the results
|
* @param pagination Specifies how to paginate the results
|
||||||
* @param where A string to restrict the returned objects by using a predicate
|
* @param where A string to restrict the returned objects by using a predicate
|
||||||
* @returns List of sites
|
* @returns List of sites
|
||||||
@@ -273,7 +270,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all sites in the repository.
|
* Gets all sites in the repository.
|
||||||
*
|
|
||||||
* @param pagination Specifies how to paginate the results
|
* @param pagination Specifies how to paginate the results
|
||||||
* @param where A string to restrict the returned objects by using a predicate
|
* @param where A string to restrict the returned objects by using a predicate
|
||||||
* @returns List of sites
|
* @returns List of sites
|
||||||
@@ -306,7 +302,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all items currently in the trash.
|
* Gets all items currently in the trash.
|
||||||
*
|
|
||||||
* @param pagination Specifies how to paginate the results
|
* @param pagination Specifies how to paginate the results
|
||||||
* @param includeFields List of data field names to include in the results
|
* @param includeFields List of data field names to include in the results
|
||||||
* @returns List of deleted items
|
* @returns List of deleted items
|
||||||
@@ -325,7 +320,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets shared links for the current user.
|
* Gets shared links for the current user.
|
||||||
*
|
|
||||||
* @param pagination Specifies how to paginate the results
|
* @param pagination Specifies how to paginate the results
|
||||||
* @param includeFields List of data field names to include in the results
|
* @param includeFields List of data field names to include in the results
|
||||||
* @param where A string to restrict the returned objects by using a predicate
|
* @param where A string to restrict the returned objects by using a predicate
|
||||||
@@ -346,7 +340,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the folder ID one of the well-known aliases?
|
* Is the folder ID one of the well-known aliases?
|
||||||
*
|
|
||||||
* @param folderId Folder ID name to check
|
* @param folderId Folder ID name to check
|
||||||
* @returns True if the ID is a well-known name, false otherwise
|
* @returns True if the ID is a well-known name, false otherwise
|
||||||
*/
|
*/
|
||||||
@@ -363,7 +356,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the folder ID a "-my", "-root-", or "-shared-" alias?
|
* Is the folder ID a "-my", "-root-", or "-shared-" alias?
|
||||||
*
|
|
||||||
* @param folderId Folder ID name to check
|
* @param folderId Folder ID name to check
|
||||||
* @returns True if the ID is one of the supported sources, false otherwise
|
* @returns True if the ID is one of the supported sources, false otherwise
|
||||||
*/
|
*/
|
||||||
@@ -380,7 +372,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a folder's contents.
|
* Gets a folder's contents.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target folder node
|
* @param nodeId ID of the target folder node
|
||||||
* @param pagination Specifies how to paginate the results
|
* @param pagination Specifies how to paginate the results
|
||||||
* @param includeFields List of data field names to include in the results
|
* @param includeFields List of data field names to include in the results
|
||||||
@@ -407,7 +398,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the contents of one of the well-known aliases in the form of node ID strings.
|
* Gets the contents of one of the well-known aliases in the form of node ID strings.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target folder node
|
* @param nodeId ID of the target folder node
|
||||||
* @param pagination Specifies how to paginate the results
|
* @param pagination Specifies how to paginate the results
|
||||||
* @returns List of node IDs
|
* @returns List of node IDs
|
||||||
@@ -427,7 +417,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Chooses the correct ID for a node entry.
|
* Chooses the correct ID for a node entry.
|
||||||
*
|
|
||||||
* @param node Node object
|
* @param node Node object
|
||||||
* @param nodeId ID of the node object
|
* @param nodeId ID of the node object
|
||||||
* @returns ID value
|
* @returns ID value
|
||||||
@@ -446,7 +435,6 @@ export class CustomResourcesService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the well-known alias have a corresponding node ID?
|
* Does the well-known alias have a corresponding node ID?
|
||||||
*
|
|
||||||
* @param nodeId Node to check
|
* @param nodeId Node to check
|
||||||
* @returns True if the alias has a corresponding node ID, false otherwise
|
* @returns True if the alias has a corresponding node ID, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@@ -48,7 +48,6 @@ export class DocumentActionsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the handler for an action.
|
* Gets the handler for an action.
|
||||||
*
|
|
||||||
* @param key Identifier of the action
|
* @param key Identifier of the action
|
||||||
* @returns The handler for the action
|
* @returns The handler for the action
|
||||||
*/
|
*/
|
||||||
@@ -62,7 +61,6 @@ export class DocumentActionsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a new handler for an action.
|
* Sets a new handler for an action.
|
||||||
*
|
|
||||||
* @param key Identifier of the action
|
* @param key Identifier of the action
|
||||||
* @param handler Handler for the action
|
* @param handler Handler for the action
|
||||||
* @returns False if the key was an empty/null string, true otherwise
|
* @returns False if the key was an empty/null string, true otherwise
|
||||||
@@ -78,7 +76,6 @@ export class DocumentActionsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if actions can be executed for an item.
|
* Checks if actions can be executed for an item.
|
||||||
*
|
|
||||||
* @param nodeEntry Item to receive an action
|
* @param nodeEntry Item to receive an action
|
||||||
* @returns True if the action can be executed on this item, false otherwise
|
* @returns True if the action can be executed on this item, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@@ -63,7 +63,6 @@ export class DocumentListService implements DocumentListLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a node.
|
* Deletes a node.
|
||||||
*
|
|
||||||
* @param nodeId ID of the node to delete
|
* @param nodeId ID of the node to delete
|
||||||
* @returns Empty response when the operation is complete
|
* @returns Empty response when the operation is complete
|
||||||
*/
|
*/
|
||||||
@@ -73,7 +72,6 @@ export class DocumentListService implements DocumentListLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy a node to destination node
|
* Copy a node to destination node
|
||||||
*
|
|
||||||
* @param nodeId The id of the node to be copied
|
* @param nodeId The id of the node to be copied
|
||||||
* @param targetParentId The id of the folder where the node will be copied
|
* @param targetParentId The id of the folder where the node will be copied
|
||||||
* @returns NodeEntry for the copied node
|
* @returns NodeEntry for the copied node
|
||||||
@@ -84,7 +82,6 @@ export class DocumentListService implements DocumentListLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves a node to destination node.
|
* Moves a node to destination node.
|
||||||
*
|
|
||||||
* @param nodeId The id of the node to be moved
|
* @param nodeId The id of the node to be moved
|
||||||
* @param targetParentId The id of the folder where the node will be moved
|
* @param targetParentId The id of the folder where the node will be moved
|
||||||
* @returns NodeEntry for the moved node
|
* @returns NodeEntry for the moved node
|
||||||
@@ -95,7 +92,6 @@ export class DocumentListService implements DocumentListLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the folder node with the specified relative name path below the root node.
|
* Gets the folder node with the specified relative name path below the root node.
|
||||||
*
|
|
||||||
* @param folder Path to folder.
|
* @param folder Path to folder.
|
||||||
* @param opts Options.
|
* @param opts Options.
|
||||||
* @param includeFields Extra information to include (available options are "aspectNames", "isLink" and "association")
|
* @param includeFields Extra information to include (available options are "aspectNames", "isLink" and "association")
|
||||||
@@ -140,7 +136,6 @@ export class DocumentListService implements DocumentListLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a node via its node ID.
|
* Gets a node via its node ID.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @param includeFields Extra information to include (available options are "aspectNames", "isLink" and "association")
|
* @param includeFields Extra information to include (available options are "aspectNames", "isLink" and "association")
|
||||||
* @returns Details of the folder
|
* @returns Details of the folder
|
||||||
@@ -160,7 +155,6 @@ export class DocumentListService implements DocumentListLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a folder node via its node ID.
|
* Gets a folder node via its node ID.
|
||||||
*
|
|
||||||
* @param nodeId ID of the folder node
|
* @param nodeId ID of the folder node
|
||||||
* @param includeFields Extra information to include (available options are "aspectNames", "isLink" and "association")
|
* @param includeFields Extra information to include (available options are "aspectNames", "isLink" and "association")
|
||||||
* @returns Details of the folder
|
* @returns Details of the folder
|
||||||
@@ -184,7 +178,6 @@ export class DocumentListService implements DocumentListLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a folder by Node Id.
|
* Load a folder by Node Id.
|
||||||
*
|
|
||||||
* @param nodeId ID of the folder node
|
* @param nodeId ID of the folder node
|
||||||
* @param pagination pagination model
|
* @param pagination pagination model
|
||||||
* @param includeFields List of data field names to include in the results
|
* @param includeFields List of data field names to include in the results
|
||||||
|
@@ -29,23 +29,23 @@ import { NodeActionsService } from './node-actions.service';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class FolderActionsService {
|
export class FolderActionsService {
|
||||||
|
|
||||||
permissionEvent = new Subject<PermissionModel>();
|
permissionEvent = new Subject<PermissionModel>();
|
||||||
error = new Subject<Error>();
|
error = new Subject<Error>();
|
||||||
success = new Subject<string>();
|
success = new Subject<string>();
|
||||||
|
|
||||||
private handlers: { [id: string]: ContentActionHandler } = {};
|
private handlers: { [id: string]: ContentActionHandler } = {};
|
||||||
|
|
||||||
constructor(private nodeActionsService: NodeActionsService,
|
constructor(
|
||||||
private documentListService: DocumentListService,
|
private nodeActionsService: NodeActionsService,
|
||||||
private contentService: ContentService,
|
private documentListService: DocumentListService,
|
||||||
private translation: TranslationService) {
|
private contentService: ContentService,
|
||||||
|
private translation: TranslationService
|
||||||
|
) {
|
||||||
this.setupActionHandlers();
|
this.setupActionHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the handler function for an action.
|
* Gets the handler function for an action.
|
||||||
*
|
|
||||||
* @param key Identifier for the action
|
* @param key Identifier for the action
|
||||||
* @returns The handler function
|
* @returns The handler function
|
||||||
*/
|
*/
|
||||||
@@ -59,7 +59,6 @@ export class FolderActionsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a new handler function for an action.
|
* Sets a new handler function for an action.
|
||||||
*
|
|
||||||
* @param key Identifier for the action
|
* @param key Identifier for the action
|
||||||
* @param handler The new handler function
|
* @param handler The new handler function
|
||||||
* @returns True if the key was a valid action identifier, false otherwise
|
* @returns True if the key was a valid action identifier, false otherwise
|
||||||
@@ -75,7 +74,6 @@ export class FolderActionsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an action is available for a particular item.
|
* Checks if an action is available for a particular item.
|
||||||
*
|
|
||||||
* @param nodeEntry Item to check
|
* @param nodeEntry Item to check
|
||||||
* @returns True if the action is available, false otherwise
|
* @returns True if the action is available, false otherwise
|
||||||
*/
|
*/
|
||||||
@@ -107,36 +105,36 @@ export class FolderActionsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private prepareHandlers(actionObservable: Observable<any>, target?: any): void {
|
private prepareHandlers(actionObservable: Observable<any>, target?: any): void {
|
||||||
actionObservable.subscribe(
|
actionObservable.subscribe((fileOperationMessage) => {
|
||||||
(fileOperationMessage) => {
|
if (target && typeof target.reload === 'function') {
|
||||||
if (target && typeof target.reload === 'function') {
|
target.reload();
|
||||||
target.reload();
|
}
|
||||||
}
|
this.success.next(fileOperationMessage);
|
||||||
this.success.next(fileOperationMessage);
|
}, this.error.next.bind(this.error));
|
||||||
},
|
|
||||||
this.error.next.bind(this.error)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private deleteNode(node: NodeEntry, target?: any, permission?: string): Observable<any> {
|
private deleteNode(node: NodeEntry, target?: any, permission?: string): Observable<any> {
|
||||||
if (this.canExecuteAction(node)) {
|
if (this.canExecuteAction(node)) {
|
||||||
if (this.contentService.hasAllowableOperations(node.entry, permission)) {
|
if (this.contentService.hasAllowableOperations(node.entry, permission)) {
|
||||||
const handlerObservable = this.documentListService.deleteNode(node.entry.id);
|
const handlerObservable = this.documentListService.deleteNode(node.entry.id);
|
||||||
handlerObservable.subscribe(() => {
|
handlerObservable.subscribe(
|
||||||
if (target && typeof target.reload === 'function') {
|
() => {
|
||||||
target.reload();
|
if (target && typeof target.reload === 'function') {
|
||||||
}
|
target.reload();
|
||||||
|
}
|
||||||
|
|
||||||
const message = this.translation.instant('CORE.DELETE_NODE.SINGULAR', { name: node.entry.name });
|
const message = this.translation.instant('CORE.DELETE_NODE.SINGULAR', { name: node.entry.name });
|
||||||
this.success.next(message);
|
this.success.next(message);
|
||||||
}, () => {
|
},
|
||||||
const message = this.translation.instant('CORE.DELETE_NODE.ERROR_SINGULAR', { name: node.entry.name });
|
() => {
|
||||||
this.error.next(message);
|
const message = this.translation.instant('CORE.DELETE_NODE.ERROR_SINGULAR', { name: node.entry.name });
|
||||||
});
|
this.error.next(message);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
return handlerObservable;
|
return handlerObservable;
|
||||||
} else {
|
} else {
|
||||||
this.permissionEvent.next(new PermissionModel({type: 'folder', action: 'delete', permission}));
|
this.permissionEvent.next(new PermissionModel({ type: 'folder', action: 'delete', permission }));
|
||||||
return throwError(new Error('No permission to delete'));
|
return throwError(new Error('No permission to delete'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,9 +24,7 @@ import { isAfter } from 'date-fns';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class LockService {
|
export class LockService {
|
||||||
|
constructor(private authService: AuthenticationService) {}
|
||||||
constructor(private authService: AuthenticationService) {
|
|
||||||
}
|
|
||||||
|
|
||||||
isLocked(node: Node): boolean {
|
isLocked(node: Node): boolean {
|
||||||
let isLocked = false;
|
let isLocked = false;
|
||||||
|
@@ -52,7 +52,6 @@ export class NodeActionsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy content node
|
* Copy content node
|
||||||
*
|
|
||||||
* @param contentEntry node to copy
|
* @param contentEntry node to copy
|
||||||
* @param permission permission which is needed to apply the action
|
* @param permission permission which is needed to apply the action
|
||||||
* @returns operation result
|
* @returns operation result
|
||||||
@@ -63,7 +62,6 @@ export class NodeActionsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy folder node
|
* Copy folder node
|
||||||
*
|
|
||||||
* @param contentEntry node to copy
|
* @param contentEntry node to copy
|
||||||
* @param permission permission which is needed to apply the action
|
* @param permission permission which is needed to apply the action
|
||||||
* @returns operation result
|
* @returns operation result
|
||||||
@@ -74,7 +72,6 @@ export class NodeActionsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Move content node
|
* Move content node
|
||||||
*
|
|
||||||
* @param contentEntry node to move
|
* @param contentEntry node to move
|
||||||
* @param permission permission which is needed to apply the action
|
* @param permission permission which is needed to apply the action
|
||||||
* @returns operation result
|
* @returns operation result
|
||||||
@@ -85,7 +82,6 @@ export class NodeActionsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Move folder node
|
* Move folder node
|
||||||
*
|
|
||||||
* @param contentEntry node to move
|
* @param contentEntry node to move
|
||||||
* @param permission permission which is needed to apply the action
|
* @param permission permission which is needed to apply the action
|
||||||
* @returns operation result
|
* @returns operation result
|
||||||
@@ -96,7 +92,6 @@ export class NodeActionsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* General method for performing the given operation (copy|move)
|
* General method for performing the given operation (copy|move)
|
||||||
*
|
|
||||||
* @param action the action to perform (copy|move)
|
* @param action the action to perform (copy|move)
|
||||||
* @param type type of the content (content|folder)
|
* @param type type of the content (content|folder)
|
||||||
* @param contentEntry the contentEntry which has to have the action performed on
|
* @param contentEntry the contentEntry which has to have the action performed on
|
||||||
|
@@ -25,27 +25,27 @@ import { map } from 'rxjs/operators';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class GroupService {
|
export class GroupService {
|
||||||
|
|
||||||
private _groupsApi: GroupsApi;
|
private _groupsApi: GroupsApi;
|
||||||
get groupsApi(): GroupsApi {
|
get groupsApi(): GroupsApi {
|
||||||
this._groupsApi = this._groupsApi ?? new GroupsApi(this.alfrescoApiService.getInstance());
|
this._groupsApi = this._groupsApi ?? new GroupsApi(this.alfrescoApiService.getInstance());
|
||||||
return this._groupsApi;
|
return this._groupsApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(private alfrescoApiService: AlfrescoApiService) {}
|
||||||
private alfrescoApiService: AlfrescoApiService
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
async listAllGroupMembershipsForPerson(personId: string, opts?: any, accumulator = []): Promise<GroupEntry[]> {
|
async listAllGroupMembershipsForPerson(personId: string, opts?: any, accumulator = []): Promise<GroupEntry[]> {
|
||||||
const groupsPaginated = await this.groupsApi.listGroupMembershipsForPerson(personId, opts);
|
const groupsPaginated = await this.groupsApi.listGroupMembershipsForPerson(personId, opts);
|
||||||
accumulator = [...accumulator, ...groupsPaginated.list.entries];
|
accumulator = [...accumulator, ...groupsPaginated.list.entries];
|
||||||
if (groupsPaginated.list.pagination.hasMoreItems) {
|
if (groupsPaginated.list.pagination.hasMoreItems) {
|
||||||
const skip = groupsPaginated.list.pagination.skipCount + groupsPaginated.list.pagination.count;
|
const skip = groupsPaginated.list.pagination.skipCount + groupsPaginated.list.pagination.count;
|
||||||
return this.listAllGroupMembershipsForPerson(personId, {
|
return this.listAllGroupMembershipsForPerson(
|
||||||
maxItems: opts.maxItems,
|
personId,
|
||||||
skipCount: skip
|
{
|
||||||
}, accumulator);
|
maxItems: opts.maxItems,
|
||||||
|
skipCount: skip
|
||||||
|
},
|
||||||
|
accumulator
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return accumulator;
|
return accumulator;
|
||||||
}
|
}
|
||||||
@@ -53,32 +53,40 @@ export class GroupService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns group for specified id.
|
* Returns group for specified id.
|
||||||
*
|
|
||||||
* @param id id of group to return.
|
* @param id id of group to return.
|
||||||
* @param opts additional query parameters
|
* @param opts additional query parameters
|
||||||
* @returns Observable<GroupEntry> group for specified id.
|
* @returns Observable<GroupEntry> group for specified id.
|
||||||
*/
|
*/
|
||||||
getGroup(id: string, opts?: ContentIncludeQuery): Observable<GroupEntry> {
|
getGroup(id: string, opts?: ContentIncludeQuery): Observable<GroupEntry> {
|
||||||
return from(this.groupsApi.getGroup(id, opts)).pipe(map((group) => {
|
return from(this.groupsApi.getGroup(id, opts)).pipe(
|
||||||
group.entry.description ||= '';
|
map((group) => {
|
||||||
return group;
|
group.entry.description ||= '';
|
||||||
}));
|
return group;
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates specified group.
|
* Updates specified group.
|
||||||
*
|
|
||||||
* @param group group to update.
|
* @param group group to update.
|
||||||
* @param opts additional query parameters
|
* @param opts additional query parameters
|
||||||
* @returns Observable<GroupEntry> updated group.
|
* @returns Observable<GroupEntry> updated group.
|
||||||
*/
|
*/
|
||||||
updateGroup(group: Group, opts?: ContentIncludeQuery): Observable<GroupEntry> {
|
updateGroup(group: Group, opts?: ContentIncludeQuery): Observable<GroupEntry> {
|
||||||
return from(this.groupsApi.updateGroup(group.id, {
|
return from(
|
||||||
displayName: group.displayName,
|
this.groupsApi.updateGroup(
|
||||||
description: group.description
|
group.id,
|
||||||
}, opts)).pipe(map((updatedGroup) => {
|
{
|
||||||
updatedGroup.entry.description ||= '';
|
displayName: group.displayName,
|
||||||
return updatedGroup;
|
description: group.description
|
||||||
}));
|
},
|
||||||
|
opts
|
||||||
|
)
|
||||||
|
).pipe(
|
||||||
|
map((updatedGroup) => {
|
||||||
|
updatedGroup.entry.description ||= '';
|
||||||
|
return updatedGroup;
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,6 @@ export class LegalHoldService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of holds available in the file plan.
|
* Gets the list of holds available in the file plan.
|
||||||
*
|
|
||||||
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
|
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
|
||||||
* @param options Optional parameters supported by JS-API
|
* @param options Optional parameters supported by JS-API
|
||||||
* @returns List of holds Observable<Hold[]>
|
* @returns List of holds Observable<Hold[]>
|
||||||
@@ -56,7 +55,6 @@ export class LegalHoldService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a node to a hold.
|
* Assign a node to a hold.
|
||||||
*
|
|
||||||
* @param nodeId The Id of the node which will be assigned to a hold
|
* @param nodeId The Id of the node which will be assigned to a hold
|
||||||
* @param holdId The Id of the hold to which nodes will be assigned
|
* @param holdId The Id of the hold to which nodes will be assigned
|
||||||
* @returns Observable<HoldEntry>
|
* @returns Observable<HoldEntry>
|
||||||
@@ -67,7 +65,6 @@ export class LegalHoldService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign multiple nodes to a hold.
|
* Assign multiple nodes to a hold.
|
||||||
*
|
|
||||||
* @param nodeIds The list of managed node Ids
|
* @param nodeIds The list of managed node Ids
|
||||||
* @param holdId The Id of the hold to which nodes will be assigned
|
* @param holdId The Id of the hold to which nodes will be assigned
|
||||||
* @returns Observable<HoldPaging>
|
* @returns Observable<HoldPaging>
|
||||||
@@ -78,7 +75,6 @@ export class LegalHoldService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unassign the relationship between a child with id nodeId and a parent hold with id holdId.
|
* Unassign the relationship between a child with id nodeId and a parent hold with id holdId.
|
||||||
*
|
|
||||||
* @param holdId The hold Id
|
* @param holdId The hold Id
|
||||||
* @param nodeId The Id of the node which is unassigned
|
* @param nodeId The Id of the node which is unassigned
|
||||||
* @returns Empty response
|
* @returns Empty response
|
||||||
@@ -89,7 +85,6 @@ export class LegalHoldService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create hold.
|
* Create hold.
|
||||||
*
|
|
||||||
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
|
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
|
||||||
* @param hold Hold to create
|
* @param hold Hold to create
|
||||||
* @returns List of created holds Observable<HoldEntry>
|
* @returns List of created holds Observable<HoldEntry>
|
||||||
@@ -100,7 +95,6 @@ export class LegalHoldService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create list of holds.
|
* Create list of holds.
|
||||||
*
|
|
||||||
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
|
* @param filePlanId The identifier of a file plan. You can also use the -filePlan- alias.
|
||||||
* @param holds Array of holds to create
|
* @param holds Array of holds to create
|
||||||
* @returns List of created holds Observable<HoldPaging>
|
* @returns List of created holds Observable<HoldPaging>
|
||||||
@@ -111,7 +105,6 @@ export class LegalHoldService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the asynchronous bulk process for a hold with id holdId based on search query results.
|
* Start the asynchronous bulk process for a hold with id holdId based on search query results.
|
||||||
*
|
|
||||||
* @param holdId The identifier of a hold
|
* @param holdId The identifier of a hold
|
||||||
* @param query Search query
|
* @param query Search query
|
||||||
* @returns Observable<BulkAssignHoldResponseEntry>
|
* @returns Observable<BulkAssignHoldResponseEntry>
|
||||||
@@ -122,7 +115,6 @@ export class LegalHoldService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a folder to a hold.
|
* Assign a folder to a hold.
|
||||||
*
|
|
||||||
* @param holdId The identifier of a hold
|
* @param holdId The identifier of a hold
|
||||||
* @param folderId The identifier of a folder
|
* @param folderId The identifier of a folder
|
||||||
* @param language Language code
|
* @param language Language code
|
||||||
@@ -139,7 +131,6 @@ export class LegalHoldService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get status of bulk operation with **bulkStatusId** for **holdId**.
|
* Get status of bulk operation with **bulkStatusId** for **holdId**.
|
||||||
*
|
|
||||||
* @param bulkStatusId The identifier of a bulk status
|
* @param bulkStatusId The identifier of a bulk status
|
||||||
* @param holdId The identifier of a hold
|
* @param holdId The identifier of a hold
|
||||||
* @returns Promise<HoldsBulkStatusEntry>
|
* @returns Promise<HoldsBulkStatusEntry>
|
||||||
|
@@ -17,128 +17,126 @@
|
|||||||
|
|
||||||
/* spellchecker: disable */
|
/* spellchecker: disable */
|
||||||
|
|
||||||
export const fakeAuthorityResults: any[] = [{
|
export const fakeAuthorityResults: any[] = [
|
||||||
entry: {
|
{
|
||||||
aspectNames: [
|
entry: {
|
||||||
'cm:personDisabled',
|
aspectNames: ['cm:personDisabled', 'cm:ownable', 'cm:preferences'],
|
||||||
'cm:ownable',
|
isFolder: false,
|
||||||
'cm:preferences'
|
search: {
|
||||||
],
|
score: 4.014668
|
||||||
isFolder: false,
|
|
||||||
search: {
|
|
||||||
score: 4.014668
|
|
||||||
},
|
|
||||||
isFile: false,
|
|
||||||
name: 'dc103838-645f-43c1-8a2a-bc187e13c343',
|
|
||||||
location: 'nodes',
|
|
||||||
id: 'dc103838-645f-43c1-8a2a-bc187e13c343',
|
|
||||||
nodeType: 'cm:person',
|
|
||||||
properties: {
|
|
||||||
'cm:location': 'Tilbury, UK',
|
|
||||||
'cm:persondescription': {
|
|
||||||
contentUrl: 'store://2018/4/18/9/30/514bb261-bc61-4502-ad2f-dfafec9ae4eb.bin',
|
|
||||||
mimetype: 'application/octet-stream',
|
|
||||||
size: 55,
|
|
||||||
encoding: 'UTF-8',
|
|
||||||
locale: 'en_US',
|
|
||||||
id: 148,
|
|
||||||
infoUrl: 'contentUrl=store://2018/4/18/9/30/514bb261-bc61-4502-ad2f-dfafec9ae4eb.bin|mimetype=application/octet-stream|size=55|encoding=UTF-8|locale=en_US_'
|
|
||||||
},
|
},
|
||||||
'cm:owner': {
|
isFile: false,
|
||||||
id: 'abeecher',
|
name: 'dc103838-645f-43c1-8a2a-bc187e13c343',
|
||||||
displayName: 'Alice Beecher'
|
location: 'nodes',
|
||||||
|
id: 'dc103838-645f-43c1-8a2a-bc187e13c343',
|
||||||
|
nodeType: 'cm:person',
|
||||||
|
properties: {
|
||||||
|
'cm:location': 'Tilbury, UK',
|
||||||
|
'cm:persondescription': {
|
||||||
|
contentUrl: 'store://2018/4/18/9/30/514bb261-bc61-4502-ad2f-dfafec9ae4eb.bin',
|
||||||
|
mimetype: 'application/octet-stream',
|
||||||
|
size: 55,
|
||||||
|
encoding: 'UTF-8',
|
||||||
|
locale: 'en_US',
|
||||||
|
id: 148,
|
||||||
|
infoUrl:
|
||||||
|
'contentUrl=store://2018/4/18/9/30/514bb261-bc61-4502-ad2f-dfafec9ae4eb.bin|mimetype=application/octet-stream|size=55|encoding=UTF-8|locale=en_US_'
|
||||||
|
},
|
||||||
|
'cm:owner': {
|
||||||
|
id: 'abeecher',
|
||||||
|
displayName: 'Alice Beecher'
|
||||||
|
},
|
||||||
|
'cm:companyaddress2': 'Tilbury',
|
||||||
|
'cm:userStatus': 'Helping to design the look and feel of the new web site',
|
||||||
|
'cm:companyaddress1': '200 Butterwick Street',
|
||||||
|
'cm:telephone': '0112211001100',
|
||||||
|
'cm:preferenceValues': {
|
||||||
|
contentUrl: 'store://2018/4/18/9/30/afc39bc9-6bac-4f24-8730-9d9f617a322e.bin',
|
||||||
|
mimetype: 'text/plain',
|
||||||
|
size: 709,
|
||||||
|
encoding: 'UTF-8',
|
||||||
|
locale: 'en_US',
|
||||||
|
id: 147,
|
||||||
|
infoUrl:
|
||||||
|
'contentUrl=store://2018/4/18/9/30/afc39bc9-6bac-4f24-8730-9d9f617a322e.bin|mimetype=text/plain|size=709|encoding=UTF-8|locale=en_US_'
|
||||||
|
},
|
||||||
|
'cm:userName': 'abeecher',
|
||||||
|
'cm:companyaddress3': 'UK',
|
||||||
|
'cm:userStatusTime': '2011-02-15T20:20:13.432+0000',
|
||||||
|
'cm:email': 'abeecher@example.com',
|
||||||
|
'cm:skype': 'abeecher',
|
||||||
|
'cm:jobtitle': 'Graphic Designer',
|
||||||
|
'cm:homeFolderProvider': 'userHomesHomeFolderProvider',
|
||||||
|
'cm:homeFolder': '242533d8-68e6-4811-bc3d-61ec63c614aa',
|
||||||
|
'cm:lastName': 'Beecher',
|
||||||
|
'cm:sizeCurrent': 8382006,
|
||||||
|
'cm:sizeQuota': -1,
|
||||||
|
'cm:firstName': 'Alice',
|
||||||
|
'cm:emailFeedId': 440,
|
||||||
|
'cm:authorizationStatus': 'NEVER_AUTHORIZED',
|
||||||
|
'cm:mobile': '0112211001100',
|
||||||
|
'cm:organization': 'Moresby, Garland and Wedge',
|
||||||
|
'cm:companypostcode': 'ALF1 SAM1'
|
||||||
},
|
},
|
||||||
'cm:companyaddress2': 'Tilbury',
|
parentId: '063f5d48-a0b3-4cbf-826c-88a4fbfa3336'
|
||||||
'cm:userStatus': 'Helping to design the look and feel of the new web site',
|
}
|
||||||
'cm:companyaddress1': '200 Butterwick Street',
|
},
|
||||||
'cm:telephone': '0112211001100',
|
{
|
||||||
'cm:preferenceValues': {
|
entry: {
|
||||||
contentUrl: 'store://2018/4/18/9/30/afc39bc9-6bac-4f24-8730-9d9f617a322e.bin',
|
aspectNames: ['cm:ownable', 'cm:preferences'],
|
||||||
mimetype: 'text/plain',
|
isFolder: false,
|
||||||
size: 709,
|
search: {
|
||||||
encoding: 'UTF-8',
|
score: 4.014668
|
||||||
locale: 'en_US',
|
|
||||||
id: 147,
|
|
||||||
infoUrl: 'contentUrl=store://2018/4/18/9/30/afc39bc9-6bac-4f24-8730-9d9f617a322e.bin|mimetype=text/plain|size=709|encoding=UTF-8|locale=en_US_'
|
|
||||||
},
|
},
|
||||||
'cm:userName': 'abeecher',
|
isFile: false,
|
||||||
'cm:companyaddress3': 'UK',
|
name: 'e320c16b-a763-4a4e-9f22-286ff5d8dca2',
|
||||||
'cm:userStatusTime': '2011-02-15T20:20:13.432+0000',
|
location: 'nodes',
|
||||||
'cm:email': 'abeecher@example.com',
|
id: 'e320c16b-a763-4a4e-9f22-286ff5d8dca2',
|
||||||
'cm:skype': 'abeecher',
|
nodeType: 'cm:person',
|
||||||
'cm:jobtitle': 'Graphic Designer',
|
properties: {
|
||||||
'cm:homeFolderProvider': 'userHomesHomeFolderProvider',
|
'cm:homeFolderProvider': 'bootstrapHomeFolderProvider',
|
||||||
'cm:homeFolder': '242533d8-68e6-4811-bc3d-61ec63c614aa',
|
'cm:preferenceValues': {
|
||||||
'cm:lastName': 'Beecher',
|
contentUrl: 'store://2018/4/23/14/42/92bb4aa9-db27-41a4-9804-ddab3cc83d3e.bin',
|
||||||
'cm:sizeCurrent': 8382006,
|
mimetype: 'text/plain',
|
||||||
'cm:sizeQuota': -1,
|
size: 102,
|
||||||
'cm:firstName': 'Alice',
|
encoding: 'UTF-8',
|
||||||
'cm:emailFeedId': 440,
|
locale: 'en',
|
||||||
'cm:authorizationStatus': 'NEVER_AUTHORIZED',
|
id: 313,
|
||||||
'cm:mobile': '0112211001100',
|
infoUrl:
|
||||||
'cm:organization': 'Moresby, Garland and Wedge',
|
'contentUrl=store://2018/4/23/14/42/92bb4aa9-db27-41a4-9804-ddab3cc83d3e.bin|mimetype=text/plain|size=102|encoding=UTF-8|locale=en_'
|
||||||
'cm:companypostcode': 'ALF1 SAM1'
|
},
|
||||||
},
|
'cm:authorizationStatus': 'AUTHORIZED',
|
||||||
parentId: '063f5d48-a0b3-4cbf-826c-88a4fbfa3336'
|
'cm:homeFolder': 'a20cd541-4ada-4525-9807-9fa0a047d9f4',
|
||||||
|
'cm:userName': 'admin',
|
||||||
|
'cm:sizeCurrent': 0,
|
||||||
|
'cm:email': 'admin@alfresco.com',
|
||||||
|
'cm:firstName': 'Administrator',
|
||||||
|
'cm:owner': {
|
||||||
|
id: 'admin',
|
||||||
|
displayName: 'Administrator'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
parentId: '063f5d48-a0b3-4cbf-826c-88a4fbfa3336'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
entry: {
|
||||||
|
isFolder: false,
|
||||||
|
search: {
|
||||||
|
score: 0.3541112
|
||||||
|
},
|
||||||
|
isFile: false,
|
||||||
|
name: 'GROUP_ALFRESCO_ADMINISTRATORS',
|
||||||
|
location: 'nodes',
|
||||||
|
id: 'GROUP_ALFRESCO_ADMINISTRATORS',
|
||||||
|
nodeType: 'cm:authorityContainer',
|
||||||
|
properties: {
|
||||||
|
'cm:authorityName': 'GROUP_ALFRESCO_ADMINISTRATORS'
|
||||||
|
},
|
||||||
|
parentId: '030d833e-da8e-4f5c-8ef9-d809638bd04b'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
];
|
||||||
{
|
|
||||||
entry: {
|
|
||||||
aspectNames: [
|
|
||||||
'cm:ownable',
|
|
||||||
'cm:preferences'
|
|
||||||
],
|
|
||||||
isFolder: false,
|
|
||||||
search: {
|
|
||||||
score: 4.014668
|
|
||||||
},
|
|
||||||
isFile: false,
|
|
||||||
name: 'e320c16b-a763-4a4e-9f22-286ff5d8dca2',
|
|
||||||
location: 'nodes',
|
|
||||||
id: 'e320c16b-a763-4a4e-9f22-286ff5d8dca2',
|
|
||||||
nodeType: 'cm:person',
|
|
||||||
properties: {
|
|
||||||
'cm:homeFolderProvider': 'bootstrapHomeFolderProvider',
|
|
||||||
'cm:preferenceValues': {
|
|
||||||
contentUrl: 'store://2018/4/23/14/42/92bb4aa9-db27-41a4-9804-ddab3cc83d3e.bin',
|
|
||||||
mimetype: 'text/plain',
|
|
||||||
size: 102,
|
|
||||||
encoding: 'UTF-8',
|
|
||||||
locale: 'en',
|
|
||||||
id: 313,
|
|
||||||
infoUrl: 'contentUrl=store://2018/4/23/14/42/92bb4aa9-db27-41a4-9804-ddab3cc83d3e.bin|mimetype=text/plain|size=102|encoding=UTF-8|locale=en_'
|
|
||||||
},
|
|
||||||
'cm:authorizationStatus': 'AUTHORIZED',
|
|
||||||
'cm:homeFolder': 'a20cd541-4ada-4525-9807-9fa0a047d9f4',
|
|
||||||
'cm:userName': 'admin',
|
|
||||||
'cm:sizeCurrent': 0,
|
|
||||||
'cm:email': 'admin@alfresco.com',
|
|
||||||
'cm:firstName': 'Administrator',
|
|
||||||
'cm:owner': {
|
|
||||||
id: 'admin',
|
|
||||||
displayName: 'Administrator'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
parentId: '063f5d48-a0b3-4cbf-826c-88a4fbfa3336'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
entry: {
|
|
||||||
isFolder: false,
|
|
||||||
search: {
|
|
||||||
score: 0.3541112
|
|
||||||
},
|
|
||||||
isFile: false,
|
|
||||||
name: 'GROUP_ALFRESCO_ADMINISTRATORS',
|
|
||||||
location: 'nodes',
|
|
||||||
id: 'GROUP_ALFRESCO_ADMINISTRATORS',
|
|
||||||
nodeType: 'cm:authorityContainer',
|
|
||||||
properties: {
|
|
||||||
'cm:authorityName': 'GROUP_ALFRESCO_ADMINISTRATORS'
|
|
||||||
},
|
|
||||||
parentId: '030d833e-da8e-4f5c-8ef9-d809638bd04b'
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
|
|
||||||
export const fakeAuthorityListResult: any = {
|
export const fakeAuthorityListResult: any = {
|
||||||
list: {
|
list: {
|
||||||
@@ -168,64 +166,67 @@ export const fakeNameListResult: any = {
|
|||||||
lastTxId: 5496
|
lastTxId: 5496
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
entries: [{
|
entries: [
|
||||||
entry: {
|
{
|
||||||
aspectNames: ['cm:ownable'],
|
entry: {
|
||||||
isFolder: false,
|
aspectNames: ['cm:ownable'],
|
||||||
search: {
|
isFolder: false,
|
||||||
score: 1.0
|
search: {
|
||||||
},
|
score: 1.0
|
||||||
isFile: false,
|
},
|
||||||
name: '730cd9b0-5617-4865-aee8-90de1d596997',
|
isFile: false,
|
||||||
location: 'nodes',
|
name: '730cd9b0-5617-4865-aee8-90de1d596997',
|
||||||
id: '730cd9b0-5617-4865-aee8-90de1d596997',
|
location: 'nodes',
|
||||||
nodeType: 'cm:person',
|
id: '730cd9b0-5617-4865-aee8-90de1d596997',
|
||||||
properties: {
|
nodeType: 'cm:person',
|
||||||
'cm:homeFolderProvider': 'userHomesHomeFolderProvider',
|
properties: {
|
||||||
'cm:authorizationStatus': 'NEVER_AUTHORIZED',
|
'cm:homeFolderProvider': 'userHomesHomeFolderProvider',
|
||||||
'cm:homeFolder': '277f505d-6526-45b1-a7b3-c9bdd66f17f6',
|
'cm:authorizationStatus': 'NEVER_AUTHORIZED',
|
||||||
'cm:userName': 'test1',
|
'cm:homeFolder': '277f505d-6526-45b1-a7b3-c9bdd66f17f6',
|
||||||
'cm:lastName': 'lastName1',
|
'cm:userName': 'test1',
|
||||||
'cm:sizeCurrent': 0,
|
'cm:lastName': 'lastName1',
|
||||||
'cm:email': 'test1@gmail.com',
|
'cm:sizeCurrent': 0,
|
||||||
'cm:sizeQuota': 1073741824,
|
'cm:email': 'test1@gmail.com',
|
||||||
'cm:firstName': 'firstName',
|
'cm:sizeQuota': 1073741824,
|
||||||
'cm:owner': {
|
'cm:firstName': 'firstName',
|
||||||
id: 'test1',
|
'cm:owner': {
|
||||||
displayName: 'firstName lastName1'
|
id: 'test1',
|
||||||
}
|
displayName: 'firstName lastName1'
|
||||||
},
|
}
|
||||||
parentId: '3e9ce910-a4a0-4531-8f80-7734bece6342'
|
},
|
||||||
|
parentId: '3e9ce910-a4a0-4531-8f80-7734bece6342'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
entry: {
|
||||||
|
aspectNames: ['cm:ownable'],
|
||||||
|
isFolder: false,
|
||||||
|
search: {
|
||||||
|
score: 1.0
|
||||||
|
},
|
||||||
|
isFile: false,
|
||||||
|
name: '3d1e9e57-505f-431e-bb2b-38ad8d5d2d15',
|
||||||
|
location: 'nodes',
|
||||||
|
id: '3d1e9e57-505f-431e-bb2b-38ad8d5d2d15',
|
||||||
|
nodeType: 'cm:person',
|
||||||
|
properties: {
|
||||||
|
'cm:homeFolderProvider': 'userHomesHomeFolderProvider',
|
||||||
|
'cm:authorizationStatus': 'NEVER_AUTHORIZED',
|
||||||
|
'cm:homeFolder': '81a07ff0-82fb-4bbb-b869-d5fd92e71e17',
|
||||||
|
'cm:userName': 'test11',
|
||||||
|
'cm:lastName': 'lastName2',
|
||||||
|
'cm:sizeCurrent': 0,
|
||||||
|
'cm:email': 'test2@gmail.com',
|
||||||
|
'cm:sizeQuota': -1,
|
||||||
|
'cm:firstName': 'firstName',
|
||||||
|
'cm:owner': {
|
||||||
|
id: 'test11',
|
||||||
|
displayName: 'firstName lastName2'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
parentId: '3e9ce910-a4a0-4531-8f80-7734bece6342'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, {
|
]
|
||||||
entry: {
|
|
||||||
aspectNames: ['cm:ownable'],
|
|
||||||
isFolder: false,
|
|
||||||
search: {
|
|
||||||
score: 1.0
|
|
||||||
},
|
|
||||||
isFile: false,
|
|
||||||
name: '3d1e9e57-505f-431e-bb2b-38ad8d5d2d15',
|
|
||||||
location: 'nodes',
|
|
||||||
id: '3d1e9e57-505f-431e-bb2b-38ad8d5d2d15',
|
|
||||||
nodeType: 'cm:person',
|
|
||||||
properties: {
|
|
||||||
'cm:homeFolderProvider': 'userHomesHomeFolderProvider',
|
|
||||||
'cm:authorizationStatus': 'NEVER_AUTHORIZED',
|
|
||||||
'cm:homeFolder': '81a07ff0-82fb-4bbb-b869-d5fd92e71e17',
|
|
||||||
'cm:userName': 'test11',
|
|
||||||
'cm:lastName': 'lastName2',
|
|
||||||
'cm:sizeCurrent': 0,
|
|
||||||
'cm:email': 'test2@gmail.com',
|
|
||||||
'cm:sizeQuota': -1,
|
|
||||||
'cm:firstName': 'firstName',
|
|
||||||
'cm:owner': {
|
|
||||||
id: 'test11',
|
|
||||||
displayName: 'firstName lastName2'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
parentId: '3e9ce910-a4a0-4531-8f80-7734bece6342'
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -21,9 +21,7 @@ import { AppConfigService, StorageService } from '@alfresco/adf-core';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlfrescoApiServiceMock extends AlfrescoApiService {
|
export class AlfrescoApiServiceMock extends AlfrescoApiService {
|
||||||
|
constructor(protected appConfig: AppConfigService, protected storageService: StorageService) {
|
||||||
constructor(protected appConfig: AppConfigService,
|
|
||||||
protected storageService: StorageService) {
|
|
||||||
super(appConfig, storageService);
|
super(appConfig, storageService);
|
||||||
if (!this.alfrescoApi) {
|
if (!this.alfrescoApi) {
|
||||||
this.initAlfrescoApi();
|
this.initAlfrescoApi();
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
import { SearchCategory } from '../search/models/search-category.interface';
|
import { SearchCategory } from '../search/models/search-category.interface';
|
||||||
|
|
||||||
export const mockSearchFilterWithoutDisplayedLabelsByField: SearchCategory = {
|
export const mockSearchFilterWithoutDisplayedLabelsByField: SearchCategory = {
|
||||||
id : 'test',
|
id: 'test',
|
||||||
name: 'test',
|
name: 'test',
|
||||||
expanded: false,
|
expanded: false,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -33,7 +33,7 @@ export const mockSearchFilterWithoutDisplayedLabelsByField: SearchCategory = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const mockSearchFilterWithWrongDisplayedLabelsByField: SearchCategory = {
|
export const mockSearchFilterWithWrongDisplayedLabelsByField: SearchCategory = {
|
||||||
id : 'test',
|
id: 'test',
|
||||||
name: 'test',
|
name: 'test',
|
||||||
expanded: false,
|
expanded: false,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -51,7 +51,7 @@ export const mockSearchFilterWithWrongDisplayedLabelsByField: SearchCategory = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const mockSearchFilterWithDisplayedLabelsByField: SearchCategory = {
|
export const mockSearchFilterWithDisplayedLabelsByField: SearchCategory = {
|
||||||
id : 'test',
|
id: 'test',
|
||||||
name: 'test',
|
name: 'test',
|
||||||
expanded: false,
|
expanded: false,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
@@ -27,10 +27,13 @@ export const fakeNodeWithCreatePermission = new Node({
|
|||||||
path: {
|
path: {
|
||||||
name: '/Company Home/User Homes',
|
name: '/Company Home/User Homes',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
elements: [{
|
elements: [
|
||||||
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
{
|
||||||
name: 'Company Home'
|
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
||||||
}, { id: '55052317-7e59-4058-8e07-769f41e615e1', name: 'User Homes' }]
|
name: 'Company Home'
|
||||||
|
},
|
||||||
|
{ id: '55052317-7e59-4058-8e07-769f41e615e1', name: 'User Homes' }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
modifiedByUser: { id: 'Test', displayName: 'Test' },
|
modifiedByUser: { id: 'Test', displayName: 'Test' },
|
||||||
@@ -51,10 +54,13 @@ export const fakeNodeWithNoPermission = new Node({
|
|||||||
path: {
|
path: {
|
||||||
name: '/Company Home/User Homes',
|
name: '/Company Home/User Homes',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
elements: [{
|
elements: [
|
||||||
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
{
|
||||||
name: 'Company Home'
|
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
||||||
}, { id: '55052317-7e59-4058-8e07-769f41e615e1', name: 'User Homes' }]
|
name: 'Company Home'
|
||||||
|
},
|
||||||
|
{ id: '55052317-7e59-4058-8e07-769f41e615e1', name: 'User Homes' }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
modifiedByUser: { id: 'Test', displayName: 'Test' },
|
modifiedByUser: { id: 'Test', displayName: 'Test' },
|
||||||
@@ -72,36 +78,41 @@ export const fakeNodeAnswerWithEntries = {
|
|||||||
skipCount: 10,
|
skipCount: 10,
|
||||||
maxItems: 10
|
maxItems: 10
|
||||||
},
|
},
|
||||||
entries: [{
|
entries: [
|
||||||
entry: {
|
{
|
||||||
isFile: true,
|
entry: {
|
||||||
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
isFile: true,
|
||||||
modifiedAt: '2017-05-24T15:08:55.640Z',
|
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
nodeType: 'cm:content',
|
modifiedAt: '2017-05-24T15:08:55.640Z',
|
||||||
content: {
|
nodeType: 'cm:content',
|
||||||
mimeType: 'application/rtf',
|
content: {
|
||||||
mimeTypeName: 'Rich Text Format',
|
mimeType: 'application/rtf',
|
||||||
sizeInBytes: 14530,
|
mimeTypeName: 'Rich Text Format',
|
||||||
encoding: 'UTF-8'
|
sizeInBytes: 14530,
|
||||||
},
|
encoding: 'UTF-8'
|
||||||
parentId: 'd124de26-6ba0-4f40-8d98-4907da2d337a',
|
},
|
||||||
createdAt: '2017-05-24T15:08:55.640Z',
|
parentId: 'd124de26-6ba0-4f40-8d98-4907da2d337a',
|
||||||
path: {
|
createdAt: '2017-05-24T15:08:55.640Z',
|
||||||
name: '/Company Home/Guest Home',
|
path: {
|
||||||
isComplete: true,
|
name: '/Company Home/Guest Home',
|
||||||
elements: [{
|
isComplete: true,
|
||||||
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
elements: [
|
||||||
name: 'Company Home'
|
{
|
||||||
}, { id: 'd124de26-6ba0-4f40-8d98-4907da2d337a', name: 'Guest Home' }]
|
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
||||||
},
|
name: 'Company Home'
|
||||||
isFolder: false,
|
},
|
||||||
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
{ id: 'd124de26-6ba0-4f40-8d98-4907da2d337a', name: 'Guest Home' }
|
||||||
name: 'b_txt_file.rtf',
|
]
|
||||||
id: '67b80f77-dbca-4f58-be6c-71b9dd61ea53',
|
},
|
||||||
properties: { 'cm:versionLabel': '1.0', 'cm:versionType': 'MAJOR' },
|
isFolder: false,
|
||||||
allowableOperations: ['delete', 'update']
|
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
|
name: 'b_txt_file.rtf',
|
||||||
|
id: '67b80f77-dbca-4f58-be6c-71b9dd61ea53',
|
||||||
|
properties: { 'cm:versionLabel': '1.0', 'cm:versionType': 'MAJOR' },
|
||||||
|
allowableOperations: ['delete', 'update']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -127,34 +138,38 @@ export const fakeGetSitesAnswer = {
|
|||||||
skipCount: 0,
|
skipCount: 0,
|
||||||
maxItems: 20
|
maxItems: 20
|
||||||
},
|
},
|
||||||
entries: [{
|
entries: [
|
||||||
entry: {
|
{
|
||||||
role: 'SiteManager',
|
entry: {
|
||||||
visibility: 'PRIVATE',
|
role: 'SiteManager',
|
||||||
guid: 'ac65fdbe-0c79-4f67-bd6a-b89a2768561b',
|
visibility: 'PRIVATE',
|
||||||
id: 'admin-site',
|
guid: 'ac65fdbe-0c79-4f67-bd6a-b89a2768561b',
|
||||||
preset: 'site-dashboard',
|
id: 'admin-site',
|
||||||
title: 'Admin Site'
|
preset: 'site-dashboard',
|
||||||
|
title: 'Admin Site'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
entry: {
|
||||||
|
role: 'SiteManager',
|
||||||
|
visibility: 'PUBLIC',
|
||||||
|
guid: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
||||||
|
description: 'This is a Sample Alfresco Team site.',
|
||||||
|
id: 'swsdp',
|
||||||
|
preset: 'site-dashboard',
|
||||||
|
title: 'Sample: Web Site Design Project'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
entry: {
|
||||||
|
visibility: 'PUBLIC',
|
||||||
|
guid: 'af36cf8f-d43c-4a4b-84e6-d1b03e3a2ce5',
|
||||||
|
id: 'test-site',
|
||||||
|
preset: 'site-dashboard',
|
||||||
|
title: 'Test Site'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, {
|
]
|
||||||
entry: {
|
|
||||||
role: 'SiteManager',
|
|
||||||
visibility: 'PUBLIC',
|
|
||||||
guid: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
|
||||||
description: 'This is a Sample Alfresco Team site.',
|
|
||||||
id: 'swsdp',
|
|
||||||
preset: 'site-dashboard',
|
|
||||||
title: 'Sample: Web Site Design Project'
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
entry: {
|
|
||||||
visibility: 'PUBLIC',
|
|
||||||
guid: 'af36cf8f-d43c-4a4b-84e6-d1b03e3a2ce5',
|
|
||||||
id: 'test-site',
|
|
||||||
preset: 'site-dashboard',
|
|
||||||
title: 'Test Site'
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -167,30 +182,39 @@ export const fakeGetSiteMembership = {
|
|||||||
skipCount: 0,
|
skipCount: 0,
|
||||||
maxItems: 20
|
maxItems: 20
|
||||||
},
|
},
|
||||||
entries: [{
|
entries: [
|
||||||
entry: {
|
{
|
||||||
site: {
|
entry: {
|
||||||
|
site: {
|
||||||
|
role: 'SiteManager',
|
||||||
|
visibility: 'PRIVATE',
|
||||||
|
guid: 'ac65fdbe-0c79-4f67-bd6a-b89a2768561b',
|
||||||
|
id: 'admin-site',
|
||||||
|
preset: 'site-dashboard',
|
||||||
|
title: 'Admin Site'
|
||||||
|
},
|
||||||
role: 'SiteManager',
|
role: 'SiteManager',
|
||||||
visibility: 'PRIVATE',
|
|
||||||
guid: 'ac65fdbe-0c79-4f67-bd6a-b89a2768561b',
|
guid: 'ac65fdbe-0c79-4f67-bd6a-b89a2768561b',
|
||||||
id: 'admin-site',
|
id: 'admin-site'
|
||||||
preset: 'site-dashboard',
|
}
|
||||||
title: 'Admin Site'
|
},
|
||||||
}, role: 'SiteManager', guid: 'ac65fdbe-0c79-4f67-bd6a-b89a2768561b', id: 'admin-site'
|
{
|
||||||
}
|
entry: {
|
||||||
}, {
|
site: {
|
||||||
entry: {
|
role: 'SiteManager',
|
||||||
site: {
|
visibility: 'PUBLIC',
|
||||||
|
guid: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
||||||
|
description: 'This is a Sample Alfresco Team site.',
|
||||||
|
id: 'swsdp',
|
||||||
|
preset: 'site-dashboard',
|
||||||
|
title: 'Sample: Web Site Design Project'
|
||||||
|
},
|
||||||
role: 'SiteManager',
|
role: 'SiteManager',
|
||||||
visibility: 'PUBLIC',
|
|
||||||
guid: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
guid: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
||||||
description: 'This is a Sample Alfresco Team site.',
|
id: 'swsdp'
|
||||||
id: 'swsdp',
|
}
|
||||||
preset: 'site-dashboard',
|
|
||||||
title: 'Sample: Web Site Design Project'
|
|
||||||
}, role: 'SiteManager', guid: 'b4cff62a-664d-4d45-9302-98723eac1319', id: 'swsdp'
|
|
||||||
}
|
}
|
||||||
}]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -202,17 +226,24 @@ export const fakeNodePaging: NodePaging = {
|
|||||||
totalItems: 5,
|
totalItems: 5,
|
||||||
skipCount: 0,
|
skipCount: 0,
|
||||||
maxItems: 100
|
maxItems: 100
|
||||||
}, entries: [{
|
},
|
||||||
entry: fakeNodeWithNoPermission
|
entries: [
|
||||||
}, {
|
{
|
||||||
entry: fakeNodeWithNoPermission
|
entry: fakeNodeWithNoPermission
|
||||||
}, {
|
},
|
||||||
entry: fakeNodeWithNoPermission
|
{
|
||||||
}, {
|
entry: fakeNodeWithNoPermission
|
||||||
entry: fakeNodeWithNoPermission
|
},
|
||||||
}, {
|
{
|
||||||
entry: fakeNodeWithNoPermission
|
entry: fakeNodeWithNoPermission
|
||||||
}]
|
},
|
||||||
|
{
|
||||||
|
entry: fakeNodeWithNoPermission
|
||||||
|
},
|
||||||
|
{
|
||||||
|
entry: fakeNodeWithNoPermission
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -232,10 +263,13 @@ export const mockNode1 = new Node({
|
|||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Guest Home',
|
name: '/Company Home/Guest Home',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
elements: [{
|
elements: [
|
||||||
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
{
|
||||||
name: 'Company Home'
|
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
||||||
}, { id: 'd124de26-6ba0-4f40-8d98-4907da2d337a', name: 'Guest Home' }]
|
name: 'Company Home'
|
||||||
|
},
|
||||||
|
{ id: 'd124de26-6ba0-4f40-8d98-4907da2d337a', name: 'Guest Home' }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
isFolder: false,
|
isFolder: false,
|
||||||
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
@@ -261,10 +295,13 @@ export const mockNode2 = new Node({
|
|||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Guest Home',
|
name: '/Company Home/Guest Home',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
elements: [{
|
elements: [
|
||||||
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
{
|
||||||
name: 'Company Home'
|
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
||||||
}, { id: 'd124de26-6ba0-4f40-8d98-4907da2d337a', name: 'Guest Home' }]
|
name: 'Company Home'
|
||||||
|
},
|
||||||
|
{ id: 'd124de26-6ba0-4f40-8d98-4907da2d337a', name: 'Guest Home' }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
isFolder: false,
|
isFolder: false,
|
||||||
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
@@ -290,10 +327,13 @@ export const mockNode3 = new Node({
|
|||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Guest Home',
|
name: '/Company Home/Guest Home',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
elements: [{
|
elements: [
|
||||||
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
{
|
||||||
name: 'Company Home'
|
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
||||||
}, { id: 'd124de26-6ba0-4f40-8d98-4907da2d337a', name: 'Guest Home' }]
|
name: 'Company Home'
|
||||||
|
},
|
||||||
|
{ id: 'd124de26-6ba0-4f40-8d98-4907da2d337a', name: 'Guest Home' }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
isFolder: false,
|
isFolder: false,
|
||||||
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
@@ -320,12 +360,17 @@ export const mockNodePagingWithPreselectedNodes: NodePaging = {
|
|||||||
totalItems: 5,
|
totalItems: 5,
|
||||||
skipCount: 0,
|
skipCount: 0,
|
||||||
maxItems: 100
|
maxItems: 100
|
||||||
}, entries: [{
|
},
|
||||||
entry: mockNode1
|
entries: [
|
||||||
}, {
|
{
|
||||||
entry: mockNode2
|
entry: mockNode1
|
||||||
}, {
|
},
|
||||||
entry: mockNode3
|
{
|
||||||
}]
|
entry: mockNode2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
entry: mockNode3
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -24,15 +24,12 @@ import { Component } from '@angular/core';
|
|||||||
<span id="update-notification" *ngIf="updatedNode"> NODE UPDATED </span>
|
<span id="update-notification" *ngIf="updatedNode"> NODE UPDATED </span>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
export class SimpleInheritedPermissionTestComponent {
|
export class SimpleInheritedPermissionTestComponent {
|
||||||
|
|
||||||
message: string = '';
|
message: string = '';
|
||||||
nodeId: string = 'fake-node-id';
|
nodeId: string = 'fake-node-id';
|
||||||
updatedNode: boolean = false;
|
updatedNode: boolean = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {}
|
||||||
}
|
|
||||||
|
|
||||||
onUpdate(node: any) {
|
onUpdate(node: any) {
|
||||||
this.updatedNode = node.permissions?.isInheritanceEnabled ?? false;
|
this.updatedNode = node.permissions?.isInheritanceEnabled ?? false;
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const mockNode: any = ({
|
export const mockNode: any = {
|
||||||
isFile: true,
|
isFile: true,
|
||||||
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
modifiedAt: '2017-05-24T15:08:55.640Z',
|
modifiedAt: '2017-05-24T15:08:55.640Z',
|
||||||
@@ -31,10 +31,13 @@ export const mockNode: any = ({
|
|||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Guest Home',
|
name: '/Company Home/Guest Home',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
elements: [{
|
elements: [
|
||||||
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
{
|
||||||
name: 'Company Home'
|
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
|
||||||
}, { id: 'd124de26-6ba0-4f40-8d98-4907da2d337a', name: 'Guest Home' }]
|
name: 'Company Home'
|
||||||
|
},
|
||||||
|
{ id: 'd124de26-6ba0-4f40-8d98-4907da2d337a', name: 'Guest Home' }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
isFolder: false,
|
isFolder: false,
|
||||||
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
modifiedByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
@@ -42,7 +45,7 @@ export const mockNode: any = ({
|
|||||||
id: '70e1cc6a-6918-468a-b84a-1048093b06fd',
|
id: '70e1cc6a-6918-468a-b84a-1048093b06fd',
|
||||||
properties: { 'cm:versionLabel': '1.0', 'cm:versionType': 'MAJOR' },
|
properties: { 'cm:versionLabel': '1.0', 'cm:versionType': 'MAJOR' },
|
||||||
allowableOperations: ['delete', 'update']
|
allowableOperations: ['delete', 'update']
|
||||||
});
|
};
|
||||||
|
|
||||||
export const mockFile = new File(['fakefake'], 'file-fake.png', { type: 'image/png' });
|
export const mockFile = new File(['fakefake'], 'file-fake.png', { type: 'image/png' });
|
||||||
|
|
||||||
@@ -59,21 +62,13 @@ export const mockNewVersionUploaderData: any = {
|
|||||||
modifiedAt: '2022-05-24T10:19:43.544Z',
|
modifiedAt: '2022-05-24T10:19:43.544Z',
|
||||||
nodeType: 'cm:content',
|
nodeType: 'cm:content',
|
||||||
content: {
|
content: {
|
||||||
mimeType:
|
mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
||||||
mimeTypeName: 'Microsoft Word 2007',
|
mimeTypeName: 'Microsoft Word 2007',
|
||||||
sizeInBytes: 11887,
|
sizeInBytes: 11887,
|
||||||
encoding: 'UTF-8'
|
encoding: 'UTF-8'
|
||||||
},
|
},
|
||||||
parentId: '422538ca-ea4b-4086-83f9-b36e4521ec7f',
|
parentId: '422538ca-ea4b-4086-83f9-b36e4521ec7f',
|
||||||
aspectNames: [
|
aspectNames: ['rn:renditioned', 'cm:versionable', 'cm:titled', 'cm:auditable', 'cm:author', 'cm:thumbnailModification'],
|
||||||
'rn:renditioned',
|
|
||||||
'cm:versionable',
|
|
||||||
'cm:titled',
|
|
||||||
'cm:auditable',
|
|
||||||
'cm:author',
|
|
||||||
'cm:thumbnailModification'
|
|
||||||
],
|
|
||||||
createdAt: '2022-05-24T07:26:44.429Z',
|
createdAt: '2022-05-24T07:26:44.429Z',
|
||||||
isFolder: false,
|
isFolder: false,
|
||||||
modifiedByUser: {
|
modifiedByUser: {
|
||||||
@@ -101,21 +96,13 @@ export const mockNewVersionUploaderData: any = {
|
|||||||
modifiedAt: '2022-05-24T07:26:45.337Z',
|
modifiedAt: '2022-05-24T07:26:45.337Z',
|
||||||
nodeType: 'cm:content',
|
nodeType: 'cm:content',
|
||||||
content: {
|
content: {
|
||||||
mimeType:
|
mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
||||||
mimeTypeName: 'Microsoft Word 2007',
|
mimeTypeName: 'Microsoft Word 2007',
|
||||||
sizeInBytes: 11949,
|
sizeInBytes: 11949,
|
||||||
encoding: 'UTF-8'
|
encoding: 'UTF-8'
|
||||||
},
|
},
|
||||||
parentId: '422538ca-ea4b-4086-83f9-b36e4521ec7f',
|
parentId: '422538ca-ea4b-4086-83f9-b36e4521ec7f',
|
||||||
aspectNames: [
|
aspectNames: ['rn:renditioned', 'cm:versionable', 'cm:titled', 'cm:auditable', 'cm:author', 'cm:thumbnailModification'],
|
||||||
'rn:renditioned',
|
|
||||||
'cm:versionable',
|
|
||||||
'cm:titled',
|
|
||||||
'cm:auditable',
|
|
||||||
'cm:author',
|
|
||||||
'cm:thumbnailModification'
|
|
||||||
],
|
|
||||||
createdAt: '2022-05-24T07:26:44.429Z',
|
createdAt: '2022-05-24T07:26:44.429Z',
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/User Homes/hruser',
|
name: '/Company Home/User Homes/hruser',
|
||||||
@@ -155,13 +142,7 @@ export const mockNewVersionUploaderData: any = {
|
|||||||
accessStatus: 'ALLOWED'
|
accessStatus: 'ALLOWED'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
settable: [
|
settable: ['Contributor', 'Collaborator', 'Coordinator', 'Editor', 'Consumer'],
|
||||||
'Contributor',
|
|
||||||
'Collaborator',
|
|
||||||
'Coordinator',
|
|
||||||
'Editor',
|
|
||||||
'Consumer'
|
|
||||||
],
|
|
||||||
isInheritanceEnabled: true
|
isInheritanceEnabled: true
|
||||||
},
|
},
|
||||||
modifiedByUser: {
|
modifiedByUser: {
|
||||||
|
@@ -16,34 +16,28 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export const fakeNodeWithPermissions: any = {
|
export const fakeNodeWithPermissions: any = {
|
||||||
aspectNames: [
|
aspectNames: ['cm:auditable', 'cm:taggable', 'cm:author', 'cm:titled', 'app:uifacets'],
|
||||||
'cm:auditable',
|
|
||||||
'cm:taggable',
|
|
||||||
'cm:author',
|
|
||||||
'cm:titled',
|
|
||||||
'app:uifacets'
|
|
||||||
],
|
|
||||||
createdAt: '2017-11-16T16:29:38.638+0000',
|
createdAt: '2017-11-16T16:29:38.638+0000',
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Sites/testsite/documentLibrary',
|
name: '/Company Home/Sites/testsite/documentLibrary',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
id: '2be275a1-b00d-4e45-83d8-66af43ac2252',
|
id: '2be275a1-b00d-4e45-83d8-66af43ac2252',
|
||||||
name: 'Company Home'
|
name: 'Company Home'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
id: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
||||||
name: 'Sites'
|
name: 'Sites'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'e002c740-b8f9-482a-a554-8fff4e4c9dc0',
|
id: 'e002c740-b8f9-482a-a554-8fff4e4c9dc0',
|
||||||
name: 'testsite'
|
name: 'testsite'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '71626fae-0c04-4d0c-a129-20fa4c178716',
|
id: '71626fae-0c04-4d0c-a129-20fa4c178716',
|
||||||
name: 'documentLibrary'
|
name: 'documentLibrary'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
@@ -73,13 +67,7 @@ export const fakeNodeWithPermissions: any = {
|
|||||||
accessStatus: 'ALLOWED'
|
accessStatus: 'ALLOWED'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
settable: [
|
settable: ['Contributor', 'Collaborator', 'Coordinator', 'Editor', 'Consumer'],
|
||||||
'Contributor',
|
|
||||||
'Collaborator',
|
|
||||||
'Coordinator',
|
|
||||||
'Editor',
|
|
||||||
'Consumer'
|
|
||||||
],
|
|
||||||
isInheritanceEnabled: true
|
isInheritanceEnabled: true
|
||||||
},
|
},
|
||||||
modifiedByUser: {
|
modifiedByUser: {
|
||||||
@@ -92,45 +80,37 @@ export const fakeNodeWithPermissions: any = {
|
|||||||
properties: {
|
properties: {
|
||||||
'cm:title': 'test',
|
'cm:title': 'test',
|
||||||
'cm:author': 'yagud',
|
'cm:author': 'yagud',
|
||||||
'cm:taggable': [
|
'cm:taggable': ['e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'],
|
||||||
'e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'
|
|
||||||
],
|
|
||||||
'cm:description': 'sleepery',
|
'cm:description': 'sleepery',
|
||||||
'app:icon': 'space-icon-default'
|
'app:icon': 'space-icon-default'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fakeNodeInheritedOnly = {
|
export const fakeNodeInheritedOnly = {
|
||||||
allowableOperations: [ 'updatePermissions' ],
|
allowableOperations: ['updatePermissions'],
|
||||||
aspectNames: [
|
aspectNames: ['cm:auditable', 'cm:taggable', 'cm:author', 'cm:titled', 'app:uifacets'],
|
||||||
'cm:auditable',
|
|
||||||
'cm:taggable',
|
|
||||||
'cm:author',
|
|
||||||
'cm:titled',
|
|
||||||
'app:uifacets'
|
|
||||||
],
|
|
||||||
createdAt: '2017-11-16T16:29:38.638+0000',
|
createdAt: '2017-11-16T16:29:38.638+0000',
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Sites/testsite/documentLibrary',
|
name: '/Company Home/Sites/testsite/documentLibrary',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
id: '2be275a1-b00d-4e45-83d8-66af43ac2252',
|
id: '2be275a1-b00d-4e45-83d8-66af43ac2252',
|
||||||
name: 'Company Home'
|
name: 'Company Home'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
id: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
||||||
name: 'Sites'
|
name: 'Sites'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'e002c740-b8f9-482a-a554-8fff4e4c9dc0',
|
id: 'e002c740-b8f9-482a-a554-8fff4e4c9dc0',
|
||||||
name: 'testsite',
|
name: 'testsite',
|
||||||
nodeType: 'st:site'
|
nodeType: 'st:site'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '71626fae-0c04-4d0c-a129-20fa4c178716',
|
id: '71626fae-0c04-4d0c-a129-20fa4c178716',
|
||||||
name: 'documentLibrary'
|
name: 'documentLibrary'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
@@ -153,13 +133,7 @@ export const fakeNodeInheritedOnly = {
|
|||||||
accessStatus: 'ALLOWED'
|
accessStatus: 'ALLOWED'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
settable: [
|
settable: ['Contributor', 'Collaborator', 'Coordinator', 'Editor', 'Consumer'],
|
||||||
'Contributor',
|
|
||||||
'Collaborator',
|
|
||||||
'Coordinator',
|
|
||||||
'Editor',
|
|
||||||
'Consumer'
|
|
||||||
],
|
|
||||||
isInheritanceEnabled: true
|
isInheritanceEnabled: true
|
||||||
},
|
},
|
||||||
modifiedByUser: {
|
modifiedByUser: {
|
||||||
@@ -172,43 +146,35 @@ export const fakeNodeInheritedOnly = {
|
|||||||
properties: {
|
properties: {
|
||||||
'cm:title': 'test',
|
'cm:title': 'test',
|
||||||
'cm:author': 'yagud',
|
'cm:author': 'yagud',
|
||||||
'cm:taggable': [
|
'cm:taggable': ['e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'],
|
||||||
'e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'
|
|
||||||
],
|
|
||||||
'cm:description': 'sleepery',
|
'cm:description': 'sleepery',
|
||||||
'app:icon': 'space-icon-default'
|
'app:icon': 'space-icon-default'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fakeReadOnlyNodeInherited = {
|
export const fakeReadOnlyNodeInherited = {
|
||||||
aspectNames: [
|
aspectNames: ['cm:auditable', 'cm:taggable', 'cm:author', 'cm:titled', 'app:uifacets'],
|
||||||
'cm:auditable',
|
|
||||||
'cm:taggable',
|
|
||||||
'cm:author',
|
|
||||||
'cm:titled',
|
|
||||||
'app:uifacets'
|
|
||||||
],
|
|
||||||
createdAt: '2017-11-16T16:29:38.638+0000',
|
createdAt: '2017-11-16T16:29:38.638+0000',
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Sites/testsite/documentLibrary',
|
name: '/Company Home/Sites/testsite/documentLibrary',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
id: '2be275a1-b00d-4e45-83d8-66af43ac2252',
|
id: '2be275a1-b00d-4e45-83d8-66af43ac2252',
|
||||||
name: 'Company Home'
|
name: 'Company Home'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
id: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
||||||
name: 'Sites'
|
name: 'Sites'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'e002c740-b8f9-482a-a554-8fff4e4c9dc0',
|
id: 'e002c740-b8f9-482a-a554-8fff4e4c9dc0',
|
||||||
name: 'testsite'
|
name: 'testsite'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '71626fae-0c04-4d0c-a129-20fa4c178716',
|
id: '71626fae-0c04-4d0c-a129-20fa4c178716',
|
||||||
name: 'documentLibrary'
|
name: 'documentLibrary'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
@@ -231,13 +197,7 @@ export const fakeReadOnlyNodeInherited = {
|
|||||||
accessStatus: 'ALLOWED'
|
accessStatus: 'ALLOWED'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
settable: [
|
settable: ['Contributor', 'Collaborator', 'Coordinator', 'Editor', 'Consumer'],
|
||||||
'Contributor',
|
|
||||||
'Collaborator',
|
|
||||||
'Coordinator',
|
|
||||||
'Editor',
|
|
||||||
'Consumer'
|
|
||||||
],
|
|
||||||
isInheritanceEnabled: true
|
isInheritanceEnabled: true
|
||||||
},
|
},
|
||||||
modifiedByUser: {
|
modifiedByUser: {
|
||||||
@@ -250,22 +210,14 @@ export const fakeReadOnlyNodeInherited = {
|
|||||||
properties: {
|
properties: {
|
||||||
'cm:title': 'test',
|
'cm:title': 'test',
|
||||||
'cm:author': 'yagud',
|
'cm:author': 'yagud',
|
||||||
'cm:taggable': [
|
'cm:taggable': ['e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'],
|
||||||
'e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'
|
|
||||||
],
|
|
||||||
'cm:description': 'sleepery',
|
'cm:description': 'sleepery',
|
||||||
'app:icon': 'space-icon-default'
|
'app:icon': 'space-icon-default'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fakeNodeWithoutSite: any = {
|
export const fakeNodeWithoutSite: any = {
|
||||||
aspectNames: [
|
aspectNames: ['cm:auditable', 'cm:taggable', 'cm:author', 'cm:titled', 'app:uifacets'],
|
||||||
'cm:auditable',
|
|
||||||
'cm:taggable',
|
|
||||||
'cm:author',
|
|
||||||
'cm:titled',
|
|
||||||
'app:uifacets'
|
|
||||||
],
|
|
||||||
createdAt: '2017-11-16T16:29:38.638+0000',
|
createdAt: '2017-11-16T16:29:38.638+0000',
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/User Homes/user/documentLibrary',
|
name: '/Company Home/User Homes/user/documentLibrary',
|
||||||
@@ -308,13 +260,7 @@ export const fakeNodeWithoutSite: any = {
|
|||||||
accessStatus: 'ALLOWED'
|
accessStatus: 'ALLOWED'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
settable: [
|
settable: ['Contributor', 'Collaborator', 'Coordinator', 'Editor', 'Consumer'],
|
||||||
'Contributor',
|
|
||||||
'Collaborator',
|
|
||||||
'Coordinator',
|
|
||||||
'Editor',
|
|
||||||
'Consumer'
|
|
||||||
],
|
|
||||||
isInheritanceEnabled: false
|
isInheritanceEnabled: false
|
||||||
},
|
},
|
||||||
modifiedByUser: {
|
modifiedByUser: {
|
||||||
@@ -327,47 +273,39 @@ export const fakeNodeWithoutSite: any = {
|
|||||||
properties: {
|
properties: {
|
||||||
'cm:title': 'test',
|
'cm:title': 'test',
|
||||||
'cm:author': 'yagud',
|
'cm:author': 'yagud',
|
||||||
'cm:taggable': [
|
'cm:taggable': ['e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'],
|
||||||
'e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'
|
|
||||||
],
|
|
||||||
'cm:description': 'sleepery',
|
'cm:description': 'sleepery',
|
||||||
'app:icon': 'space-icon-default'
|
'app:icon': 'space-icon-default'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fakeNodeWithOnlyLocally: any = {
|
export const fakeNodeWithOnlyLocally: any = {
|
||||||
aspectNames: [
|
aspectNames: ['cm:auditable', 'cm:taggable', 'cm:author', 'cm:titled', 'app:uifacets'],
|
||||||
'cm:auditable',
|
|
||||||
'cm:taggable',
|
|
||||||
'cm:author',
|
|
||||||
'cm:titled',
|
|
||||||
'app:uifacets'
|
|
||||||
],
|
|
||||||
createdAt: '2017-11-16T16:29:38.638+0000',
|
createdAt: '2017-11-16T16:29:38.638+0000',
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Sites/testsite/documentLibrary',
|
name: '/Company Home/Sites/testsite/documentLibrary',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
id: '2be275a1-b00d-4e45-83d8-66af43ac2252',
|
id: '2be275a1-b00d-4e45-83d8-66af43ac2252',
|
||||||
name: 'Company Home',
|
name: 'Company Home',
|
||||||
nodeType: 'cm:folder'
|
nodeType: 'cm:folder'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
id: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
||||||
name: 'Sites',
|
name: 'Sites',
|
||||||
nodeType: 'st:sites'
|
nodeType: 'st:sites'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'e002c740-b8f9-482a-a554-8fff4e4c9dc0',
|
id: 'e002c740-b8f9-482a-a554-8fff4e4c9dc0',
|
||||||
name: 'testsite',
|
name: 'testsite',
|
||||||
nodeType: 'st:site'
|
nodeType: 'st:site'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '71626fae-0c04-4d0c-a129-20fa4c178716',
|
id: '71626fae-0c04-4d0c-a129-20fa4c178716',
|
||||||
name: 'documentLibrary',
|
name: 'documentLibrary',
|
||||||
nodeType: 'cm:folder'
|
nodeType: 'cm:folder'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
@@ -385,13 +323,7 @@ export const fakeNodeWithOnlyLocally: any = {
|
|||||||
accessStatus: 'ALLOWED'
|
accessStatus: 'ALLOWED'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
settable: [
|
settable: ['Contributor', 'Collaborator', 'Coordinator', 'Editor', 'Consumer'],
|
||||||
'Contributor',
|
|
||||||
'Collaborator',
|
|
||||||
'Coordinator',
|
|
||||||
'Editor',
|
|
||||||
'Consumer'
|
|
||||||
],
|
|
||||||
isInheritanceEnabled: false
|
isInheritanceEnabled: false
|
||||||
},
|
},
|
||||||
modifiedByUser: {
|
modifiedByUser: {
|
||||||
@@ -404,43 +336,35 @@ export const fakeNodeWithOnlyLocally: any = {
|
|||||||
properties: {
|
properties: {
|
||||||
'cm:title': 'test',
|
'cm:title': 'test',
|
||||||
'cm:author': 'yagud',
|
'cm:author': 'yagud',
|
||||||
'cm:taggable': [
|
'cm:taggable': ['e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'],
|
||||||
'e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'
|
|
||||||
],
|
|
||||||
'cm:description': 'sleepery',
|
'cm:description': 'sleepery',
|
||||||
'app:icon': 'space-icon-default'
|
'app:icon': 'space-icon-default'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fakeNodeToRemovePermission: any = {
|
export const fakeNodeToRemovePermission: any = {
|
||||||
aspectNames: [
|
aspectNames: ['cm:auditable', 'cm:taggable', 'cm:author', 'cm:titled', 'app:uifacets'],
|
||||||
'cm:auditable',
|
|
||||||
'cm:taggable',
|
|
||||||
'cm:author',
|
|
||||||
'cm:titled',
|
|
||||||
'app:uifacets'
|
|
||||||
],
|
|
||||||
createdAt: '2017-11-16T16:29:38.638+0000',
|
createdAt: '2017-11-16T16:29:38.638+0000',
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Sites/testsite/documentLibrary',
|
name: '/Company Home/Sites/testsite/documentLibrary',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
id: '2be275a1-b00d-4e45-83d8-66af43ac2252',
|
id: '2be275a1-b00d-4e45-83d8-66af43ac2252',
|
||||||
name: 'Company Home'
|
name: 'Company Home'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
id: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
||||||
name: 'Sites'
|
name: 'Sites'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'e002c740-b8f9-482a-a554-8fff4e4c9dc0',
|
id: 'e002c740-b8f9-482a-a554-8fff4e4c9dc0',
|
||||||
name: 'testsite'
|
name: 'testsite'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '71626fae-0c04-4d0c-a129-20fa4c178716',
|
id: '71626fae-0c04-4d0c-a129-20fa4c178716',
|
||||||
name: 'documentLibrary'
|
name: 'documentLibrary'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
@@ -468,13 +392,7 @@ export const fakeNodeToRemovePermission: any = {
|
|||||||
accessStatus: 'ALLOWED'
|
accessStatus: 'ALLOWED'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
settable: [
|
settable: ['Contributor', 'Collaborator', 'Coordinator', 'Editor', 'Consumer'],
|
||||||
'Contributor',
|
|
||||||
'Collaborator',
|
|
||||||
'Coordinator',
|
|
||||||
'Editor',
|
|
||||||
'Consumer'
|
|
||||||
],
|
|
||||||
isInheritanceEnabled: true
|
isInheritanceEnabled: true
|
||||||
},
|
},
|
||||||
modifiedByUser: {
|
modifiedByUser: {
|
||||||
@@ -487,22 +405,14 @@ export const fakeNodeToRemovePermission: any = {
|
|||||||
properties: {
|
properties: {
|
||||||
'cm:title': 'test',
|
'cm:title': 'test',
|
||||||
'cm:author': 'yagud',
|
'cm:author': 'yagud',
|
||||||
'cm:taggable': [
|
'cm:taggable': ['e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'],
|
||||||
'e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'
|
|
||||||
],
|
|
||||||
'cm:description': 'sleepery',
|
'cm:description': 'sleepery',
|
||||||
'app:icon': 'space-icon-default'
|
'app:icon': 'space-icon-default'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fakeNodeWithoutPermissions: any = {
|
export const fakeNodeWithoutPermissions: any = {
|
||||||
aspectNames: [
|
aspectNames: ['cm:auditable', 'cm:taggable', 'cm:author', 'cm:titled', 'app:uifacets'],
|
||||||
'cm:auditable',
|
|
||||||
'cm:taggable',
|
|
||||||
'cm:author',
|
|
||||||
'cm:titled',
|
|
||||||
'app:uifacets'
|
|
||||||
],
|
|
||||||
createdAt: '2017-11-16T16:29:38.638+0000',
|
createdAt: '2017-11-16T16:29:38.638+0000',
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Sites/testsite/documentLibrary',
|
name: '/Company Home/Sites/testsite/documentLibrary',
|
||||||
@@ -548,9 +458,7 @@ export const fakeNodeWithoutPermissions: any = {
|
|||||||
properties: {
|
properties: {
|
||||||
'cm:title': 'test',
|
'cm:title': 'test',
|
||||||
'cm:author': 'yagud',
|
'cm:author': 'yagud',
|
||||||
'cm:taggable': [
|
'cm:taggable': ['e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'],
|
||||||
'e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'
|
|
||||||
],
|
|
||||||
'cm:description': 'sleepery',
|
'cm:description': 'sleepery',
|
||||||
'app:icon': 'space-icon-default'
|
'app:icon': 'space-icon-default'
|
||||||
}
|
}
|
||||||
@@ -578,11 +486,7 @@ export const fakeSiteNodeResponse: any = {
|
|||||||
modifiedAt: '2018-03-22T15:40:10.093+0000',
|
modifiedAt: '2018-03-22T15:40:10.093+0000',
|
||||||
nodeType: 'st:site',
|
nodeType: 'st:site',
|
||||||
parentId: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
parentId: '1be10a97-6eb9-4b60-b6c6-1673900e9631',
|
||||||
aspectNames: [
|
aspectNames: ['cm:tagscope', 'cm:titled', 'cm:auditable'],
|
||||||
'cm:tagscope',
|
|
||||||
'cm:titled',
|
|
||||||
'cm:auditable'
|
|
||||||
],
|
|
||||||
createdAt: '2018-03-22T15:39:50.821+0000',
|
createdAt: '2018-03-22T15:39:50.821+0000',
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
search: {
|
search: {
|
||||||
@@ -663,14 +567,8 @@ export const fakeEmptyResponse: any = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const fakeNodeLocalSiteManager = {
|
export const fakeNodeLocalSiteManager = {
|
||||||
allowableOperations: [ 'updatePermissions' ],
|
allowableOperations: ['updatePermissions'],
|
||||||
aspectNames: [
|
aspectNames: ['cm:auditable', 'cm:taggable', 'cm:author', 'cm:titled', 'app:uifacets'],
|
||||||
'cm:auditable',
|
|
||||||
'cm:taggable',
|
|
||||||
'cm:author',
|
|
||||||
'cm:titled',
|
|
||||||
'app:uifacets'
|
|
||||||
],
|
|
||||||
createdAt: '2017-11-16T16:29:38.638+0000',
|
createdAt: '2017-11-16T16:29:38.638+0000',
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Sites/testsite/documentLibrary',
|
name: '/Company Home/Sites/testsite/documentLibrary',
|
||||||
@@ -715,13 +613,7 @@ export const fakeNodeLocalSiteManager = {
|
|||||||
accessStatus: 'ALLOWED'
|
accessStatus: 'ALLOWED'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
settable: [
|
settable: ['Contributor', 'Collaborator', 'Coordinator', 'Editor', 'Consumer'],
|
||||||
'Contributor',
|
|
||||||
'Collaborator',
|
|
||||||
'Coordinator',
|
|
||||||
'Editor',
|
|
||||||
'Consumer'
|
|
||||||
],
|
|
||||||
isInheritanceEnabled: false
|
isInheritanceEnabled: false
|
||||||
},
|
},
|
||||||
modifiedByUser: {
|
modifiedByUser: {
|
||||||
@@ -734,9 +626,7 @@ export const fakeNodeLocalSiteManager = {
|
|||||||
properties: {
|
properties: {
|
||||||
'cm:title': 'test',
|
'cm:title': 'test',
|
||||||
'cm:author': 'yagud',
|
'cm:author': 'yagud',
|
||||||
'cm:taggable': [
|
'cm:taggable': ['e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'],
|
||||||
'e8c8fbba-03ba-4fa6-86b1-f7ad7c296409'
|
|
||||||
],
|
|
||||||
'cm:description': 'sleepery',
|
'cm:description': 'sleepery',
|
||||||
'app:icon': 'space-icon-default'
|
'app:icon': 'space-icon-default'
|
||||||
}
|
}
|
||||||
|
@@ -100,16 +100,11 @@ export const simpleCategories: SearchCategory[] = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const searchFilter = {
|
export const searchFilter = {
|
||||||
'app:fields': [
|
'app:fields': ['cm:name'],
|
||||||
'cm:name'
|
include: ['allowableOperations'],
|
||||||
],
|
|
||||||
include: [
|
|
||||||
'allowableOperations'
|
|
||||||
],
|
|
||||||
sorting: {
|
sorting: {
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
@@ -412,8 +407,10 @@ export const mockSearchResult = {
|
|||||||
label: 'SEARCH.FACET_QUERIES.MIMETYPE',
|
label: 'SEARCH.FACET_QUERIES.MIMETYPE',
|
||||||
filterQuery: 'content.mimetype:text/html',
|
filterQuery: 'content.mimetype:text/html',
|
||||||
metrics: [{ type: 'count', value: { count: 13 } }]
|
metrics: [{ type: 'count', value: { count: 13 } }]
|
||||||
}]
|
}
|
||||||
}, {
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
type: 'query',
|
type: 'query',
|
||||||
label: 'Size facet queries',
|
label: 'Size facet queries',
|
||||||
buckets: [
|
buckets: [
|
||||||
@@ -421,60 +418,75 @@ export const mockSearchResult = {
|
|||||||
label: 'my1',
|
label: 'my1',
|
||||||
filterQuery: 'content.size:[111111 TO MAX]',
|
filterQuery: 'content.size:[111111 TO MAX]',
|
||||||
metrics: [{ type: 'count', value: { count: 806 } }]
|
metrics: [{ type: 'count', value: { count: 806 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'my3',
|
label: 'my3',
|
||||||
filterQuery: 'content.size:[333333 TO MAX]',
|
filterQuery: 'content.size:[333333 TO MAX]',
|
||||||
metrics: [{ type: 'count', value: { count: 669 } }]
|
metrics: [{ type: 'count', value: { count: 669 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'my2',
|
label: 'my2',
|
||||||
filterQuery: 'content.size:[222222 TO MAX]',
|
filterQuery: 'content.size:[222222 TO MAX]',
|
||||||
metrics: [{ type: 'count', value: { count: 691 } }]
|
metrics: [{ type: 'count', value: { count: 691 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'my5',
|
label: 'my5',
|
||||||
filterQuery: 'content.size:[5555 TO MAX]',
|
filterQuery: 'content.size:[5555 TO MAX]',
|
||||||
metrics: [{ type: 'count', value: { count: 1866 } }]
|
metrics: [{ type: 'count', value: { count: 1866 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'my4',
|
label: 'my4',
|
||||||
filterQuery: 'content.size:[444444 TO MAX]',
|
filterQuery: 'content.size:[444444 TO MAX]',
|
||||||
metrics: [{ type: 'count', value: { count: 665 } }]
|
metrics: [{ type: 'count', value: { count: 665 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'my7',
|
label: 'my7',
|
||||||
filterQuery: 'content.size:[777777 TO MAX]',
|
filterQuery: 'content.size:[777777 TO MAX]',
|
||||||
metrics: [{ type: 'count', value: { count: 641 } }]
|
metrics: [{ type: 'count', value: { count: 641 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'SEARCH.FACET_QUERIES.SMALL',
|
label: 'SEARCH.FACET_QUERIES.SMALL',
|
||||||
filterQuery: 'content.size:[10240 TO 102400]',
|
filterQuery: 'content.size:[10240 TO 102400]',
|
||||||
metrics: [{ type: 'count', value: { count: 526 } }]
|
metrics: [{ type: 'count', value: { count: 526 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'my6',
|
label: 'my6',
|
||||||
filterQuery: 'content.size:[666666 TO MAX]',
|
filterQuery: 'content.size:[666666 TO MAX]',
|
||||||
metrics: [{ type: 'count', value: { count: 652 } }]
|
metrics: [{ type: 'count', value: { count: 652 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'SEARCH.FACET_QUERIES.XTRALARGE',
|
label: 'SEARCH.FACET_QUERIES.XTRALARGE',
|
||||||
filterQuery: 'content.size:[16777216 TO 134217728]',
|
filterQuery: 'content.size:[16777216 TO 134217728]',
|
||||||
metrics: [{ type: 'count', value: { count: 617 } }]
|
metrics: [{ type: 'count', value: { count: 617 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'my8',
|
label: 'my8',
|
||||||
filterQuery: 'content.size:[888888 TO MAX]',
|
filterQuery: 'content.size:[888888 TO MAX]',
|
||||||
metrics: [{ type: 'count', value: { count: 641 } }]
|
metrics: [{ type: 'count', value: { count: 641 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'SEARCH.FACET_QUERIES.XXTRALARGE',
|
label: 'SEARCH.FACET_QUERIES.XXTRALARGE',
|
||||||
filterQuery: 'content.size:[134217728 TO MAX]',
|
filterQuery: 'content.size:[134217728 TO MAX]',
|
||||||
metrics: [{ type: 'count', value: { count: 0 } }]
|
metrics: [{ type: 'count', value: { count: 0 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'SEARCH.FACET_QUERIES.MEDIUM',
|
label: 'SEARCH.FACET_QUERIES.MEDIUM',
|
||||||
filterQuery: 'content.size:[102400 TO 1048576]',
|
filterQuery: 'content.size:[102400 TO 1048576]',
|
||||||
metrics: [{ type: 'count', value: { count: 630 } }]
|
metrics: [{ type: 'count', value: { count: 630 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'SEARCH.FACET_QUERIES.LARGE',
|
label: 'SEARCH.FACET_QUERIES.LARGE',
|
||||||
filterQuery: 'content.size:[1048576 TO 16777216]',
|
filterQuery: 'content.size:[1048576 TO 16777216]',
|
||||||
metrics: [{ type: 'count', value: { count: 23 } }]
|
metrics: [{ type: 'count', value: { count: 23 } }]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
label: 'Extra Small',
|
label: 'Extra Small',
|
||||||
filterQuery: 'content.size:[0 TO 10240]',
|
filterQuery: 'content.size:[0 TO 10240]',
|
||||||
metrics: [{ type: 'count', value: { count: 10239 } }]
|
metrics: [{ type: 'count', value: { count: 10239 } }]
|
||||||
}]
|
}
|
||||||
}, {
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
type: 'query',
|
type: 'query',
|
||||||
label: 'SEARCH.FACET_QUERIES.MY_FACET_QUERIES',
|
label: 'SEARCH.FACET_QUERIES.MY_FACET_QUERIES',
|
||||||
buckets: [
|
buckets: [
|
||||||
@@ -482,37 +494,45 @@ export const mockSearchResult = {
|
|||||||
label: 'SEARCH.FACET_QUERIES.CREATED_THIS_YEAR',
|
label: 'SEARCH.FACET_QUERIES.CREATED_THIS_YEAR',
|
||||||
filterQuery: 'created:2019',
|
filterQuery: 'created:2019',
|
||||||
metrics: [{ type: 'count', value: { count: 0 } }]
|
metrics: [{ type: 'count', value: { count: 0 } }]
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'field',
|
type: 'field',
|
||||||
label: 'SEARCH.FACET_FIELDS.SIZE',
|
label: 'SEARCH.FACET_FIELDS.SIZE',
|
||||||
buckets: []
|
buckets: []
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
type: 'field',
|
type: 'field',
|
||||||
label: 'SEARCH.FACET_FIELDS.CREATED',
|
label: 'SEARCH.FACET_FIELDS.CREATED',
|
||||||
buckets: []
|
buckets: []
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
type: 'field',
|
type: 'field',
|
||||||
label: 'SEARCH.FACET_FIELDS.TYPE',
|
label: 'SEARCH.FACET_FIELDS.TYPE',
|
||||||
buckets: []
|
buckets: []
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
type: 'field',
|
type: 'field',
|
||||||
label: 'SEARCH.FACET_FIELDS.MODIFIER',
|
label: 'SEARCH.FACET_FIELDS.MODIFIER',
|
||||||
buckets: []
|
buckets: []
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
type: 'field',
|
type: 'field',
|
||||||
label: 'SEARCH.FACET_FIELDS.CREATOR',
|
label: 'SEARCH.FACET_FIELDS.CREATOR',
|
||||||
buckets: []
|
buckets: []
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
type: 'interval',
|
type: 'interval',
|
||||||
label: 'TheModified',
|
label: 'TheModified',
|
||||||
buckets: []
|
buckets: []
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
type: 'interval',
|
type: 'interval',
|
||||||
label: 'The Created',
|
label: 'The Created',
|
||||||
buckets: []
|
buckets: []
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -609,29 +629,23 @@ export const sizeOptions = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export const filteredResult = [
|
export const filteredResult = ['my1 (806)', 'my2 (691)', 'my3 (669)', 'my4 (665)', 'my5 (1866)'];
|
||||||
'my1 (806)',
|
|
||||||
'my2 (691)',
|
|
||||||
'my3 (669)',
|
|
||||||
'my4 (665)',
|
|
||||||
'my5 (1866)'
|
|
||||||
];
|
|
||||||
|
|
||||||
export const mockContentSizeResponseBucket = {
|
export const mockContentSizeResponseBucket = {
|
||||||
label: '5875',
|
label: '5875',
|
||||||
filterQuery: 'content.size:5875',
|
filterQuery: 'content.size:5875',
|
||||||
metrics: [
|
metrics: [
|
||||||
{
|
{
|
||||||
type: 'count',
|
type: 'count',
|
||||||
value: {
|
value: {
|
||||||
count: 364
|
count: 364
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
};
|
]
|
||||||
|
};
|
||||||
|
|
||||||
export const getMockSearchResultWithResponseBucket = () => {
|
export const getMockSearchResultWithResponseBucket = () => {
|
||||||
const cloneResult = JSON.parse(JSON.stringify( mockSearchResult));
|
const cloneResult = JSON.parse(JSON.stringify(mockSearchResult));
|
||||||
cloneResult.list.context.facets[3].buckets.push(mockContentSizeResponseBucket);
|
cloneResult.list.context.facets[3].buckets.push(mockContentSizeResponseBucket);
|
||||||
return cloneResult;
|
return cloneResult;
|
||||||
};
|
};
|
||||||
|
@@ -42,7 +42,6 @@ export class NewVersionUploaderService {
|
|||||||
* - a side by side comparison between the current target node (type, name, icon) and the new file that should update it's version
|
* - a side by side comparison between the current target node (type, name, icon) and the new file that should update it's version
|
||||||
* - the new version's minor/major changes and the optional comment of a node and the ability to upload a new file version
|
* - the new version's minor/major changes and the optional comment of a node and the ability to upload a new file version
|
||||||
* - if data.showVersionsOnly is set to true, displays the version history of a node, with the ability to restore, delete and view version of the current node
|
* - if data.showVersionsOnly is set to true, displays the version history of a node, with the ability to restore, delete and view version of the current node
|
||||||
*
|
|
||||||
* @param data data to pass to MatDialog
|
* @param data data to pass to MatDialog
|
||||||
* @param config allow to override default MatDialogConfig
|
* @param config allow to override default MatDialogConfig
|
||||||
* @param selectorAutoFocusedOnClose element's selector which should be autofocused after closing modal
|
* @param selectorAutoFocusedOnClose element's selector which should be autofocused after closing modal
|
||||||
|
@@ -46,31 +46,33 @@ export const fakeContentComments = {
|
|||||||
skipCount: 0,
|
skipCount: 0,
|
||||||
maxItems: 100
|
maxItems: 100
|
||||||
},
|
},
|
||||||
entries: [{
|
entries: [
|
||||||
entry: {
|
{
|
||||||
createdAt: '2018-03-27T10:55:45.725+0000',
|
entry: {
|
||||||
createdBy: fakeUser1,
|
createdAt: '2018-03-27T10:55:45.725+0000',
|
||||||
edited: false,
|
createdBy: fakeUser1,
|
||||||
modifiedAt: '2018-03-27T10:55:45.725+0000',
|
edited: false,
|
||||||
canEdit: true,
|
modifiedAt: '2018-03-27T10:55:45.725+0000',
|
||||||
modifiedBy: fakeUser1,
|
canEdit: true,
|
||||||
canDelete: true,
|
modifiedBy: fakeUser1,
|
||||||
id: '35a0cea7-b6d0-4abc-9030-f4e461dd1ac7',
|
canDelete: true,
|
||||||
content: 'fake-message-1'
|
id: '35a0cea7-b6d0-4abc-9030-f4e461dd1ac7',
|
||||||
|
content: 'fake-message-1'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
entry: {
|
||||||
|
createdAt: '2018-03-27T10:55:45.725+0000',
|
||||||
|
createdBy: fakeUser2,
|
||||||
|
edited: false,
|
||||||
|
modifiedAt: '2018-03-27T10:55:45.725+0000',
|
||||||
|
canEdit: true,
|
||||||
|
modifiedBy: fakeUser2,
|
||||||
|
canDelete: true,
|
||||||
|
id: '35a0cea7-b6d0-4abc-9030-f4e461dd1ac7',
|
||||||
|
content: 'fake-message-2'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, {
|
|
||||||
entry: {
|
|
||||||
createdAt: '2018-03-27T10:55:45.725+0000',
|
|
||||||
createdBy: fakeUser2,
|
|
||||||
edited: false,
|
|
||||||
modifiedAt: '2018-03-27T10:55:45.725+0000',
|
|
||||||
canEdit: true,
|
|
||||||
modifiedBy: fakeUser2,
|
|
||||||
canDelete: true,
|
|
||||||
id: '35a0cea7-b6d0-4abc-9030-f4e461dd1ac7',
|
|
||||||
content: 'fake-message-2'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -146,62 +148,62 @@ export const getDateXMinutesAgo = (minutes: number) => new Date(new Date().getTi
|
|||||||
|
|
||||||
export const commentsNodeData: CommentModel[] = [
|
export const commentsNodeData: CommentModel[] = [
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 1,
|
id: 1,
|
||||||
message: `I've done this component, is it cool?`,
|
message: `I've done this component, is it cool?`,
|
||||||
created: getDateXMinutesAgo(30),
|
created: getDateXMinutesAgo(30),
|
||||||
createdBy: new User(johnDoe),
|
createdBy: new User(johnDoe),
|
||||||
isSelected: false
|
isSelected: false
|
||||||
}),
|
}),
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 2,
|
id: 2,
|
||||||
message: 'Yeah',
|
message: 'Yeah',
|
||||||
created: getDateXMinutesAgo(15),
|
created: getDateXMinutesAgo(15),
|
||||||
createdBy: new User(janeEod),
|
createdBy: new User(janeEod),
|
||||||
isSelected: false
|
isSelected: false
|
||||||
}),
|
}),
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 3,
|
id: 3,
|
||||||
message: '+1',
|
message: '+1',
|
||||||
created: getDateXMinutesAgo(12),
|
created: getDateXMinutesAgo(12),
|
||||||
createdBy: new User(robertSmith),
|
createdBy: new User(robertSmith),
|
||||||
isSelected: false
|
isSelected: false
|
||||||
}),
|
}),
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 4,
|
id: 4,
|
||||||
message: 'ty',
|
message: 'ty',
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
createdBy: new User(johnDoe),
|
createdBy: new User(johnDoe),
|
||||||
isSelected: false
|
isSelected: false
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
export const commentsTaskData: CommentModel[] = [
|
export const commentsTaskData: CommentModel[] = [
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 1,
|
id: 1,
|
||||||
message: `I've done this task, what's next?`,
|
message: `I've done this task, what's next?`,
|
||||||
created: getDateXMinutesAgo(30),
|
created: getDateXMinutesAgo(30),
|
||||||
createdBy: new User(johnDoe),
|
createdBy: new User(johnDoe),
|
||||||
isSelected: false
|
isSelected: false
|
||||||
}),
|
}),
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 2,
|
id: 2,
|
||||||
message: `I've assigned you another one 🤠`,
|
message: `I've assigned you another one 🤠`,
|
||||||
created: getDateXMinutesAgo(15),
|
created: getDateXMinutesAgo(15),
|
||||||
createdBy: new User(janeEod),
|
createdBy: new User(janeEod),
|
||||||
isSelected: false
|
isSelected: false
|
||||||
}),
|
}),
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 3,
|
id: 3,
|
||||||
message: '+1',
|
message: '+1',
|
||||||
created: getDateXMinutesAgo(12),
|
created: getDateXMinutesAgo(12),
|
||||||
createdBy: new User(robertSmith),
|
createdBy: new User(robertSmith),
|
||||||
isSelected: false
|
isSelected: false
|
||||||
}),
|
}),
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 4,
|
id: 4,
|
||||||
message: 'Cheers',
|
message: 'Cheers',
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
createdBy: new User(johnDoe),
|
createdBy: new User(johnDoe),
|
||||||
isSelected: false
|
isSelected: false
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
@@ -37,7 +37,6 @@ export class NodeCommentsService implements CommentsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all comments that have been added to a task.
|
* Gets all comments that have been added to a task.
|
||||||
*
|
|
||||||
* @param id ID of the target task
|
* @param id ID of the target task
|
||||||
* @returns Details for each comment
|
* @returns Details for each comment
|
||||||
*/
|
*/
|
||||||
@@ -57,7 +56,6 @@ export class NodeCommentsService implements CommentsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a comment to a task.
|
* Adds a comment to a task.
|
||||||
*
|
|
||||||
* @param id ID of the target task
|
* @param id ID of the target task
|
||||||
* @param message Text for the comment
|
* @param message Text for the comment
|
||||||
* @returns Details about the comment
|
* @returns Details about the comment
|
||||||
|
@@ -33,7 +33,7 @@ import { AllowableOperationsEnum } from '../../../common/models/allowable-operat
|
|||||||
const SITE_MANAGER_ROLE = 'SiteManager';
|
const SITE_MANAGER_ROLE = 'SiteManager';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PermissionListService {
|
export class PermissionListService {
|
||||||
updated = new EventEmitter<PermissionDisplayModel>();
|
updated = new EventEmitter<PermissionDisplayModel>();
|
||||||
@@ -43,7 +43,7 @@ export class PermissionListService {
|
|||||||
error$: Subject<boolean> = new Subject();
|
error$: Subject<boolean> = new Subject();
|
||||||
nodeWithRoles$: Subject<{ node: Node; roles: RoleModel[] }> = new Subject();
|
nodeWithRoles$: Subject<{ node: Node; roles: RoleModel[] }> = new Subject();
|
||||||
data$: Observable<NodePermissionsModel> = this.nodeWithRoles$.pipe(
|
data$: Observable<NodePermissionsModel> = this.nodeWithRoles$.pipe(
|
||||||
map(({ node, roles}) => {
|
map(({ node, roles }) => {
|
||||||
const nodeLocalPermissions = this.nodePermissionService.getLocalPermissions(node);
|
const nodeLocalPermissions = this.nodePermissionService.getLocalPermissions(node);
|
||||||
const localPermissions = this.updateReadOnlyPermission(node, nodeLocalPermissions);
|
const localPermissions = this.updateReadOnlyPermission(node, nodeLocalPermissions);
|
||||||
return {
|
return {
|
||||||
@@ -68,7 +68,8 @@ export class PermissionListService {
|
|||||||
|
|
||||||
fetchPermission(nodeId: string) {
|
fetchPermission(nodeId: string) {
|
||||||
this.loading$.next(true);
|
this.loading$.next(true);
|
||||||
this.nodePermissionService.getNodeWithRoles(nodeId)
|
this.nodePermissionService
|
||||||
|
.getNodeWithRoles(nodeId)
|
||||||
.pipe(finalize(() => this.loading$.next(false)))
|
.pipe(finalize(() => this.loading$.next(false)))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
({ node, roles }) => {
|
({ node, roles }) => {
|
||||||
@@ -91,26 +92,24 @@ export class PermissionListService {
|
|||||||
|
|
||||||
const authorityId = this.getManagerAuthority(this.node);
|
const authorityId = this.getManagerAuthority(this.node);
|
||||||
if (authorityId) {
|
if (authorityId) {
|
||||||
const permissions = [
|
const permissions = [...(this.node.permissions.locallySet || []), { authorityId, name: SITE_MANAGER_ROLE, accessStatus: 'ALLOWED' }];
|
||||||
...(this.node.permissions.locallySet || []),
|
|
||||||
{ authorityId, name: SITE_MANAGER_ROLE, accessStatus: 'ALLOWED' }
|
|
||||||
];
|
|
||||||
updateLocalPermission$ = this.nodePermissionService.updatePermissions(this.node, permissions);
|
updateLocalPermission$ = this.nodePermissionService.updatePermissions(this.node, permissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLocalPermission$.pipe(switchMap(() => this.nodeService.updateNode(this.node.id, nodeBody, {include: ['permissions']})))
|
updateLocalPermission$.pipe(switchMap(() => this.nodeService.updateNode(this.node.id, nodeBody, { include: ['permissions'] }))).subscribe(
|
||||||
.subscribe(
|
(nodeUpdated: Node) => {
|
||||||
(nodeUpdated: Node) => {
|
const message = nodeUpdated.permissions.isInheritanceEnabled
|
||||||
const message = nodeUpdated.permissions.isInheritanceEnabled ? 'PERMISSION_MANAGER.MESSAGE.INHERIT-ENABLE-SUCCESS' : 'PERMISSION_MANAGER.MESSAGE.INHERIT-DISABLE-SUCCESS';
|
? 'PERMISSION_MANAGER.MESSAGE.INHERIT-ENABLE-SUCCESS'
|
||||||
this.notificationService.showInfo(message);
|
: 'PERMISSION_MANAGER.MESSAGE.INHERIT-DISABLE-SUCCESS';
|
||||||
nodeUpdated.permissions.inherited = nodeUpdated.permissions?.inherited ?? [];
|
this.notificationService.showInfo(message);
|
||||||
this.reloadNode(nodeUpdated);
|
nodeUpdated.permissions.inherited = nodeUpdated.permissions?.inherited ?? [];
|
||||||
},
|
this.reloadNode(nodeUpdated);
|
||||||
() => {
|
},
|
||||||
change.source.checked = this.node.permissions.isInheritanceEnabled;
|
() => {
|
||||||
this.notificationService.showWarning('PERMISSION_MANAGER.MESSAGE.TOGGLE-PERMISSION-FAILED');
|
change.source.checked = this.node.permissions.isInheritanceEnabled;
|
||||||
}
|
this.notificationService.showWarning('PERMISSION_MANAGER.MESSAGE.TOGGLE-PERMISSION-FAILED');
|
||||||
);
|
}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
change.source.checked = this.node.permissions.isInheritanceEnabled;
|
change.source.checked = this.node.permissions.isInheritanceEnabled;
|
||||||
this.notificationService.showError('PERMISSION_MANAGER.ERROR.NOT-ALLOWED');
|
this.notificationService.showError('PERMISSION_MANAGER.ERROR.NOT-ALLOWED');
|
||||||
@@ -121,9 +120,9 @@ export class PermissionListService {
|
|||||||
this.nodePermissionDialogService
|
this.nodePermissionDialogService
|
||||||
.openAddPermissionDialog(this.node, this.roles, 'PERMISSION_MANAGER.ADD-PERMISSION.TITLE')
|
.openAddPermissionDialog(this.node, this.roles, 'PERMISSION_MANAGER.ADD-PERMISSION.TITLE')
|
||||||
.pipe(
|
.pipe(
|
||||||
switchMap(selection => {
|
switchMap((selection) => {
|
||||||
const total = selection.length;
|
const total = selection.length;
|
||||||
const group = selection.filter(({authorityId}) => this.isGroup(authorityId)).length;
|
const group = selection.filter(({ authorityId }) => this.isGroup(authorityId)).length;
|
||||||
return forkJoin({
|
return forkJoin({
|
||||||
user: of(total - group),
|
user: of(total - group),
|
||||||
group: of(group),
|
group: of(group),
|
||||||
@@ -131,86 +130,86 @@ export class PermissionListService {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.subscribe(({ user, group, node}) => {
|
.subscribe(
|
||||||
this.notificationService.showInfo( 'PERMISSION_MANAGER.MESSAGE.PERMISSION-ADD-SUCCESS', null, { user, group });
|
({ user, group, node }) => {
|
||||||
|
this.notificationService.showInfo('PERMISSION_MANAGER.MESSAGE.PERMISSION-ADD-SUCCESS', null, { user, group });
|
||||||
this.reloadNode(node);
|
this.reloadNode(node);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.notificationService.showError( 'PERMISSION_MANAGER.MESSAGE.PERMISSION-ADD-FAIL');
|
this.notificationService.showError('PERMISSION_MANAGER.MESSAGE.PERMISSION-ADD-FAIL');
|
||||||
this.reloadNode();
|
this.reloadNode();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePermissions(permissions: PermissionElement[]) {
|
deletePermissions(permissions: PermissionElement[]) {
|
||||||
this.nodePermissionService.removePermissions(this.node, permissions)
|
this.nodePermissionService.removePermissions(this.node, permissions).subscribe(
|
||||||
.subscribe((node) => {
|
(node) => {
|
||||||
const total = permissions.length;
|
const total = permissions.length;
|
||||||
const group = permissions.filter(({authorityId}) => this.isGroup(authorityId)).length;
|
const group = permissions.filter(({ authorityId }) => this.isGroup(authorityId)).length;
|
||||||
this.notificationService.showInfo('PERMISSION_MANAGER.MESSAGE.PERMISSION-BULK-DELETE-SUCCESS', null, {user: total - group, group});
|
this.notificationService.showInfo('PERMISSION_MANAGER.MESSAGE.PERMISSION-BULK-DELETE-SUCCESS', null, { user: total - group, group });
|
||||||
this.reloadNode(node);
|
this.reloadNode(node);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.notificationService.showError('PERMISSION_MANAGER.MESSAGE.PERMISSION-DELETE-FAIL');
|
this.notificationService.showError('PERMISSION_MANAGER.MESSAGE.PERMISSION-DELETE-FAIL');
|
||||||
this.reloadNode();
|
this.reloadNode();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRole(role: string, permission: PermissionDisplayModel) {
|
updateRole(role: string, permission: PermissionDisplayModel) {
|
||||||
const updatedPermissionRole = this.buildUpdatedPermission(role, permission);
|
const updatedPermissionRole = this.buildUpdatedPermission(role, permission);
|
||||||
this.nodePermissionService.updatePermissionRole(this.node, updatedPermissionRole)
|
this.nodePermissionService.updatePermissionRole(this.node, updatedPermissionRole).subscribe(
|
||||||
.subscribe((node) => {
|
(node) => {
|
||||||
this.notificationService.showInfo('PERMISSION_MANAGER.MESSAGE.PERMISSION-UPDATE-SUCCESS');
|
this.notificationService.showInfo('PERMISSION_MANAGER.MESSAGE.PERMISSION-UPDATE-SUCCESS');
|
||||||
this.reloadNode(node);
|
this.reloadNode(node);
|
||||||
this.updated.emit(permission);
|
this.updated.emit(permission);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.notificationService.showError('PERMISSION_MANAGER.MESSAGE.PERMISSION-UPDATE-FAIL');
|
this.notificationService.showError('PERMISSION_MANAGER.MESSAGE.PERMISSION-UPDATE-FAIL');
|
||||||
this.reloadNode();
|
this.reloadNode();
|
||||||
this.errored.emit(permission);
|
this.errored.emit(permission);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bulkRoleUpdate(role: string) {
|
bulkRoleUpdate(role: string) {
|
||||||
const permissions = [...this.node.permissions.locallySet].map((permission) => this.buildUpdatedPermission(role, permission));
|
const permissions = [...this.node.permissions.locallySet].map((permission) => this.buildUpdatedPermission(role, permission));
|
||||||
this.nodePermissionService.updatePermissions(this.node, permissions)
|
this.nodePermissionService.updatePermissions(this.node, permissions).subscribe(
|
||||||
.subscribe((node) => {
|
(node) => {
|
||||||
const total = permissions.length;
|
const total = permissions.length;
|
||||||
const group = permissions.filter(({authorityId}) => this.isGroup(authorityId)).length;
|
const group = permissions.filter(({ authorityId }) => this.isGroup(authorityId)).length;
|
||||||
this.notificationService.showInfo('PERMISSION_MANAGER.MESSAGE.PERMISSION-BULK-UPDATE-SUCCESS', null, {user: total - group, group});
|
this.notificationService.showInfo('PERMISSION_MANAGER.MESSAGE.PERMISSION-BULK-UPDATE-SUCCESS', null, { user: total - group, group });
|
||||||
this.reloadNode(node);
|
this.reloadNode(node);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.notificationService.showError('PERMISSION_MANAGER.MESSAGE.PERMISSION-UPDATE-FAIL');
|
this.notificationService.showError('PERMISSION_MANAGER.MESSAGE.PERMISSION-UPDATE-FAIL');
|
||||||
this.reloadNode();
|
this.reloadNode();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePermission(permission: PermissionDisplayModel) {
|
deletePermission(permission: PermissionDisplayModel) {
|
||||||
const cloneNode = { ...this.node, permissions: { ...this.node.permissions, locallySet: [ ...this.node.permissions.locallySet ] } };
|
const cloneNode = { ...this.node, permissions: { ...this.node.permissions, locallySet: [...this.node.permissions.locallySet] } };
|
||||||
this.nodePermissionService
|
this.nodePermissionService.removePermission(cloneNode, permission).subscribe(
|
||||||
.removePermission(cloneNode, permission)
|
(node) => {
|
||||||
.subscribe((node) => {
|
this.notificationService.showInfo('PERMISSION_MANAGER.MESSAGE.PERMISSION-DELETE-SUCCESS');
|
||||||
this.notificationService.showInfo('PERMISSION_MANAGER.MESSAGE.PERMISSION-DELETE-SUCCESS');
|
if (!node.permissions.locallySet) {
|
||||||
if (!node.permissions.locallySet) {
|
node.permissions.locallySet = [];
|
||||||
node.permissions.locallySet = [];
|
|
||||||
}
|
|
||||||
this.reloadNode(node);
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
this.notificationService.showError('PERMISSION_MANAGER.MESSAGE.PERMISSION-DELETE-FAIL');
|
|
||||||
this.reloadNode();
|
|
||||||
}
|
}
|
||||||
);
|
this.reloadNode(node);
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.notificationService.showError('PERMISSION_MANAGER.MESSAGE.PERMISSION-DELETE-FAIL');
|
||||||
|
this.reloadNode();
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildUpdatedPermission(role: string, permission: PermissionElement): PermissionElement {
|
private buildUpdatedPermission(role: string, permission: PermissionElement): PermissionElement {
|
||||||
return {
|
return {
|
||||||
accessStatus: permission.accessStatus,
|
accessStatus: permission.accessStatus,
|
||||||
name: this.canUpdateThePermission(this.node, permission) ? role : permission.name,
|
name: this.canUpdateThePermission(this.node, permission) ? role : permission.name,
|
||||||
authorityId: permission.authorityId
|
authorityId: permission.authorityId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -228,7 +227,9 @@ export class PermissionListService {
|
|||||||
let authorityId: string;
|
let authorityId: string;
|
||||||
if (sitePath) {
|
if (sitePath) {
|
||||||
authorityId = `GROUP_site_${sitePath.name}_${SITE_MANAGER_ROLE}`;
|
authorityId = `GROUP_site_${sitePath.name}_${SITE_MANAGER_ROLE}`;
|
||||||
hasLocalManagerPermission = !!node.permissions.locallySet?.find((permission) => permission.authorityId === authorityId && permission.name === SITE_MANAGER_ROLE);
|
hasLocalManagerPermission = !!node.permissions.locallySet?.find(
|
||||||
|
(permission) => permission.authorityId === authorityId && permission.name === SITE_MANAGER_ROLE
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasLocalManagerPermission && authorityId) {
|
if (!hasLocalManagerPermission && authorityId) {
|
||||||
@@ -249,8 +250,8 @@ export class PermissionListService {
|
|||||||
canUpdateThePermission(node: Node, permission: PermissionElement): boolean {
|
canUpdateThePermission(node: Node, permission: PermissionElement): boolean {
|
||||||
const sitePath = node.path.elements.find((path) => path.nodeType === 'st:site');
|
const sitePath = node.path.elements.find((path) => path.nodeType === 'st:site');
|
||||||
if (!node.permissions.isInheritanceEnabled && sitePath) {
|
if (!node.permissions.isInheritanceEnabled && sitePath) {
|
||||||
const authorityId = `GROUP_site_${sitePath.name}_${SITE_MANAGER_ROLE}`;
|
const authorityId = `GROUP_site_${sitePath.name}_${SITE_MANAGER_ROLE}`;
|
||||||
return !(permission.authorityId === authorityId && permission.name === SITE_MANAGER_ROLE);
|
return !(permission.authorityId === authorityId && permission.name === SITE_MANAGER_ROLE);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -31,15 +31,10 @@ import { AllowableOperationsEnum } from '../../common/models/allowable-operation
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class NodePermissionDialogService {
|
export class NodePermissionDialogService {
|
||||||
|
constructor(private dialog: MatDialog, private nodePermissionService: NodePermissionService, private contentService: ContentService) {}
|
||||||
constructor(private dialog: MatDialog,
|
|
||||||
private nodePermissionService: NodePermissionService,
|
|
||||||
private contentService: ContentService) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a dialog to add permissions to a node.
|
* Opens a dialog to add permissions to a node.
|
||||||
*
|
|
||||||
* @param node target node
|
* @param node target node
|
||||||
* @param roles settable roles for the node
|
* @param roles settable roles for the node
|
||||||
* @param title Dialog title
|
* @param title Dialog title
|
||||||
@@ -82,18 +77,19 @@ export class NodePermissionDialogService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a dialog to update permissions for a node.
|
* Opens a dialog to update permissions for a node.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @param title Dialog title
|
* @param title Dialog title
|
||||||
* @returns Node with updated permissions
|
* @returns Node with updated permissions
|
||||||
*/
|
*/
|
||||||
updateNodePermissionByDialog(nodeId?: string, title?: string): Observable<Node> {
|
updateNodePermissionByDialog(nodeId?: string, title?: string): Observable<Node> {
|
||||||
return this.nodePermissionService.getNodeWithRoles(nodeId)
|
return this.nodePermissionService
|
||||||
|
.getNodeWithRoles(nodeId)
|
||||||
.pipe(
|
.pipe(
|
||||||
switchMap(({node, roles}) => this.openAddPermissionDialog(node, roles, title)
|
switchMap(({ node, roles }) =>
|
||||||
.pipe(
|
this.openAddPermissionDialog(node, roles, title).pipe(
|
||||||
switchMap((selection) => this.nodePermissionService.updateNodePermissions(nodeId, selection))
|
switchMap((selection) => this.nodePermissionService.updateNodePermissions(nodeId, selection))
|
||||||
))
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,6 @@ export class NodePermissionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of roles for the current node.
|
* Gets a list of roles for the current node.
|
||||||
*
|
|
||||||
* @param node The target node
|
* @param node The target node
|
||||||
* @returns Array of strings representing the roles
|
* @returns Array of strings representing the roles
|
||||||
*/
|
*/
|
||||||
@@ -66,7 +65,6 @@ export class NodePermissionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get permissions for a given node
|
* Get permissions for a given node
|
||||||
*
|
|
||||||
* @param node Node to check permissions for
|
* @param node Node to check permissions for
|
||||||
* @returns list of permission models
|
* @returns list of permission models
|
||||||
*/
|
*/
|
||||||
@@ -91,7 +89,6 @@ export class NodePermissionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the permission role for a node.
|
* Updates the permission role for a node.
|
||||||
*
|
|
||||||
* @param node Target node
|
* @param node Target node
|
||||||
* @param updatedPermissionRole Permission role to update or add
|
* @param updatedPermissionRole Permission role to update or add
|
||||||
* @returns Node with updated permission
|
* @returns Node with updated permission
|
||||||
@@ -110,7 +107,6 @@ export class NodePermissionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update permissions for a node.
|
* Update permissions for a node.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @param permissionList New permission settings
|
* @param permissionList New permission settings
|
||||||
* @returns Node with updated permissions
|
* @returns Node with updated permissions
|
||||||
@@ -121,7 +117,6 @@ export class NodePermissionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the locally set permissions for a node.
|
* Updates the locally set permissions for a node.
|
||||||
*
|
|
||||||
* @param node ID of the target node
|
* @param node ID of the target node
|
||||||
* @param permissions Permission settings
|
* @param permissions Permission settings
|
||||||
* @returns Node with updated permissions
|
* @returns Node with updated permissions
|
||||||
@@ -164,7 +159,6 @@ export class NodePermissionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a permission setting from a node.
|
* Removes a permission setting from a node.
|
||||||
*
|
|
||||||
* @param node ID of the target node
|
* @param node ID of the target node
|
||||||
* @param permissionToRemove Permission setting to remove
|
* @param permissionToRemove Permission setting to remove
|
||||||
* @returns Node with modified permissions
|
* @returns Node with modified permissions
|
||||||
@@ -197,7 +191,6 @@ export class NodePermissionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all members related to a group name.
|
* Gets all members related to a group name.
|
||||||
*
|
|
||||||
* @param groupName Name of group to look for members
|
* @param groupName Name of group to look for members
|
||||||
* @param opts Extra options supported by JS-API
|
* @param opts Extra options supported by JS-API
|
||||||
* @returns List of members
|
* @returns List of members
|
||||||
@@ -258,7 +251,6 @@ export class NodePermissionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes permissions setting from a node.
|
* Removes permissions setting from a node.
|
||||||
*
|
|
||||||
* @param node target node with permission
|
* @param node target node with permission
|
||||||
* @param permissions Permissions to remove
|
* @param permissions Permissions to remove
|
||||||
* @returns Node with modified permissions
|
* @returns Node with modified permissions
|
||||||
@@ -278,7 +270,6 @@ export class NodePermissionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* updates permissions setting from a node.
|
* updates permissions setting from a node.
|
||||||
*
|
|
||||||
* @param node target node with permission
|
* @param node target node with permission
|
||||||
* @param permissions Permissions to update
|
* @param permissions Permissions to update
|
||||||
* @returns Node with modified permissions
|
* @returns Node with modified permissions
|
||||||
@@ -291,7 +282,6 @@ export class NodePermissionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all node detail for nodeId along with settable permissions.
|
* Gets all node detail for nodeId along with settable permissions.
|
||||||
*
|
|
||||||
* @param nodeId Id of the node
|
* @param nodeId Id of the node
|
||||||
* @returns node and it's associated roles { node: Node; roles: RoleModel[] }
|
* @returns node and it's associated roles { node: Node; roles: RoleModel[] }
|
||||||
*/
|
*/
|
||||||
|
@@ -19,7 +19,6 @@ import { NodeEntry } from '@alfresco/js-api';
|
|||||||
import { NodeNameTooltipPipe } from './node-name-tooltip.pipe';
|
import { NodeNameTooltipPipe } from './node-name-tooltip.pipe';
|
||||||
|
|
||||||
describe('NodeNameTooltipPipe', () => {
|
describe('NodeNameTooltipPipe', () => {
|
||||||
|
|
||||||
const nodeName = 'node-name';
|
const nodeName = 'node-name';
|
||||||
const nodeTitle = 'node-title';
|
const nodeTitle = 'node-title';
|
||||||
const nodeDescription = 'node-description';
|
const nodeDescription = 'node-description';
|
||||||
|
@@ -33,7 +33,6 @@ export class PredictionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get predictions for a given node
|
* Get predictions for a given node
|
||||||
*
|
|
||||||
* @param nodeId The identifier of node.
|
* @param nodeId The identifier of node.
|
||||||
* @returns Observable<PredictionPaging>
|
* @returns Observable<PredictionPaging>
|
||||||
*/
|
*/
|
||||||
@@ -43,7 +42,6 @@ export class PredictionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Review a prediction
|
* Review a prediction
|
||||||
*
|
|
||||||
* @param predictionId The identifier of prediction.
|
* @param predictionId The identifier of prediction.
|
||||||
* @param reviewStatus Review status to apply.
|
* @param reviewStatus Review status to apply.
|
||||||
* @returns Observable<void>
|
* @returns Observable<void>
|
||||||
|
@@ -39,14 +39,10 @@ export class SearchAiService {
|
|||||||
|
|
||||||
toggleSearchAiInput$ = this.toggleSearchAiInput.asObservable();
|
toggleSearchAiInput$ = this.toggleSearchAiInput.asObservable();
|
||||||
|
|
||||||
constructor(
|
constructor(private apiService: AlfrescoApiService, private translateService: TranslateService) {}
|
||||||
private apiService: AlfrescoApiService,
|
|
||||||
private translateService: TranslateService
|
|
||||||
) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of the search AI input.
|
* Update the state of the search AI input.
|
||||||
*
|
|
||||||
* @param state The new state of the search AI input.
|
* @param state The new state of the search AI input.
|
||||||
*/
|
*/
|
||||||
updateSearchAiInputState(state: SearchAiInputState): void {
|
updateSearchAiInputState(state: SearchAiInputState): void {
|
||||||
@@ -55,7 +51,6 @@ export class SearchAiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask a question to the AI.
|
* Ask a question to the AI.
|
||||||
*
|
|
||||||
* @param question The question to ask.
|
* @param question The question to ask.
|
||||||
* @returns QuestionModel object containing information about questions.
|
* @returns QuestionModel object containing information about questions.
|
||||||
*/
|
*/
|
||||||
@@ -65,7 +60,6 @@ export class SearchAiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an answer to specific question.
|
* Get an answer to specific question.
|
||||||
*
|
|
||||||
* @param questionId The ID of the question to get an answer for.
|
* @param questionId The ID of the question to get an answer for.
|
||||||
* @returns AiAnswerEntry object containing the answer.
|
* @returns AiAnswerEntry object containing the answer.
|
||||||
*/
|
*/
|
||||||
@@ -75,7 +69,6 @@ export class SearchAiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the knowledge retrieval configuration.
|
* Get the knowledge retrieval configuration.
|
||||||
*
|
|
||||||
* @returns KnowledgeRetrievalConfigEntry object containing the configuration.
|
* @returns KnowledgeRetrievalConfigEntry object containing the configuration.
|
||||||
*/
|
*/
|
||||||
getConfig(): Observable<KnowledgeRetrievalConfigEntry> {
|
getConfig(): Observable<KnowledgeRetrievalConfigEntry> {
|
||||||
@@ -84,7 +77,6 @@ export class SearchAiService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if using of search is possible (if all conditions are met).
|
* Check if using of search is possible (if all conditions are met).
|
||||||
*
|
|
||||||
* @param selectedNodesState information about selected nodes.
|
* @param selectedNodesState information about selected nodes.
|
||||||
* @param maxSelectedNodes max number of selected nodes. Default 100.
|
* @param maxSelectedNodes max number of selected nodes. Default 100.
|
||||||
* @returns string with error if any condition is not met, empty string otherwise.
|
* @returns string with error if any condition is not met, empty string otherwise.
|
||||||
|
@@ -49,7 +49,6 @@ describe('SearchChipAutocompleteInputComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the input element
|
* Get the input element
|
||||||
*
|
|
||||||
* @returns native element
|
* @returns native element
|
||||||
*/
|
*/
|
||||||
function getInput(): HTMLInputElement {
|
function getInput(): HTMLInputElement {
|
||||||
@@ -58,7 +57,6 @@ describe('SearchChipAutocompleteInputComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter the new input value
|
* Enter the new input value
|
||||||
*
|
|
||||||
* @param value value to input
|
* @param value value to input
|
||||||
*/
|
*/
|
||||||
function enterNewInputValue(value: string) {
|
function enterNewInputValue(value: string) {
|
||||||
@@ -71,7 +69,6 @@ describe('SearchChipAutocompleteInputComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add new option
|
* Add new option
|
||||||
*
|
|
||||||
* @param value value to input
|
* @param value value to input
|
||||||
*/
|
*/
|
||||||
function addNewOption(value: string) {
|
function addNewOption(value: string) {
|
||||||
@@ -84,7 +81,6 @@ describe('SearchChipAutocompleteInputComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get material chip list
|
* Get material chip list
|
||||||
*
|
|
||||||
* @returns list of chips
|
* @returns list of chips
|
||||||
*/
|
*/
|
||||||
async function getChipList(): Promise<MatChipHarness[]> {
|
async function getChipList(): Promise<MatChipHarness[]> {
|
||||||
@@ -94,7 +90,6 @@ describe('SearchChipAutocompleteInputComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get chip value by specific index
|
* Get chip value by specific index
|
||||||
*
|
|
||||||
* @param index index of the chip
|
* @param index index of the chip
|
||||||
* @returns chip value
|
* @returns chip value
|
||||||
*/
|
*/
|
||||||
@@ -105,7 +100,6 @@ describe('SearchChipAutocompleteInputComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get material option elements
|
* Get material option elements
|
||||||
*
|
|
||||||
* @returns list of debug elements
|
* @returns list of debug elements
|
||||||
*/
|
*/
|
||||||
async function getOptionElements(): Promise<MatOptionHarness[]> {
|
async function getOptionElements(): Promise<MatOptionHarness[]> {
|
||||||
@@ -115,7 +109,6 @@ describe('SearchChipAutocompleteInputComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get added options for auto-complete
|
* Get added options for auto-complete
|
||||||
*
|
|
||||||
* @returns list of debug elements
|
* @returns list of debug elements
|
||||||
*/
|
*/
|
||||||
function getAddedOptionElements(): DebugElement[] {
|
function getAddedOptionElements(): DebugElement[] {
|
||||||
|
@@ -169,7 +169,6 @@ export class SearchChipAutocompleteInputComponent implements OnInit, OnDestroy,
|
|||||||
* This method checks if the provided `option` is present in the `selectedOptions` array.
|
* This method checks if the provided `option` is present in the `selectedOptions` array.
|
||||||
* If a custom comparison function (`compareOption`) is provided, it uses this function to determine equality.
|
* If a custom comparison function (`compareOption`) is provided, it uses this function to determine equality.
|
||||||
* Otherwise, it falls back to using strict equality comparison.
|
* Otherwise, it falls back to using strict equality comparison.
|
||||||
*
|
|
||||||
* @param option - The option to check for selection.
|
* @param option - The option to check for selection.
|
||||||
* @returns `true` if the option is selected, `false` otherwise.
|
* @returns `true` if the option is selected, `false` otherwise.
|
||||||
*/
|
*/
|
||||||
|
@@ -63,7 +63,6 @@ describe('SearchFilterAutocompleteChipsComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add new auto-complete input
|
* Add new auto-complete input
|
||||||
*
|
|
||||||
* @param value value to add
|
* @param value value to add
|
||||||
*/
|
*/
|
||||||
function addNewOption(value: string) {
|
function addNewOption(value: string) {
|
||||||
|
@@ -57,7 +57,6 @@ describe('SearchFacetChipTabbedComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the filter display value
|
* Get the filter display value
|
||||||
*
|
|
||||||
* @returns filter value
|
* @returns filter value
|
||||||
*/
|
*/
|
||||||
function getDisplayValue(): string {
|
function getDisplayValue(): string {
|
||||||
@@ -66,7 +65,6 @@ describe('SearchFacetChipTabbedComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Emit the event for the tabbed content
|
* Emit the event for the tabbed content
|
||||||
*
|
|
||||||
* @param eventName event name to trigger
|
* @param eventName event name to trigger
|
||||||
* @param event event to trigger
|
* @param event event to trigger
|
||||||
*/
|
*/
|
||||||
|
@@ -64,7 +64,6 @@ describe('SearchFacetTabbedContentComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the tab label content
|
* Get the tab label content
|
||||||
*
|
|
||||||
* @returns list of native elements
|
* @returns list of native elements
|
||||||
*/
|
*/
|
||||||
async function getTabs(): Promise<MatTabHarness[]> {
|
async function getTabs(): Promise<MatTabHarness[]> {
|
||||||
@@ -85,7 +84,6 @@ describe('SearchFacetTabbedContentComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add new item to the bucket
|
* Add new item to the bucket
|
||||||
*
|
|
||||||
* @param field field name
|
* @param field field name
|
||||||
* @param displayValue value to display
|
* @param displayValue value to display
|
||||||
*/
|
*/
|
||||||
|
@@ -31,7 +31,6 @@ describe('SearchInputComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the search input value
|
* Sets the search input value
|
||||||
*
|
|
||||||
* @param value the value to set
|
* @param value the value to set
|
||||||
*/
|
*/
|
||||||
async function setInputValue(value: string) {
|
async function setInputValue(value: string) {
|
||||||
|
@@ -47,7 +47,6 @@ describe('SearchLogicalFilterComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get search input elements
|
* Get search input elements
|
||||||
*
|
|
||||||
* @returns list of native elements
|
* @returns list of native elements
|
||||||
*/
|
*/
|
||||||
function getInputs(): HTMLInputElement[] {
|
function getInputs(): HTMLInputElement[] {
|
||||||
@@ -56,7 +55,6 @@ describe('SearchLogicalFilterComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get input label elements
|
* Get input label elements
|
||||||
*
|
|
||||||
* @returns list of labels
|
* @returns list of labels
|
||||||
*/
|
*/
|
||||||
function getInputsLabels(): string[] {
|
function getInputsLabels(): string[] {
|
||||||
@@ -65,7 +63,6 @@ describe('SearchLogicalFilterComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Enters a new phrase
|
* Enters a new phrase
|
||||||
*
|
|
||||||
* @param value new value
|
* @param value new value
|
||||||
* @param index value index
|
* @param index value index
|
||||||
*/
|
*/
|
||||||
|
@@ -54,7 +54,7 @@ export class SearchTextComponent implements SearchWidget, OnInit, OnDestroy {
|
|||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.context && this.settings && this.settings.pattern) {
|
if (this.context && this.settings?.pattern) {
|
||||||
const pattern = new RegExp(this.settings.pattern, 'g');
|
const pattern = new RegExp(this.settings.pattern, 'g');
|
||||||
const match = pattern.exec(this.context.queryFragments[this.id] || '');
|
const match = pattern.exec(this.context.queryFragments[this.id] || '');
|
||||||
if (this.settings.allowUpdateOnChange !== undefined && this.settings.allowUpdateOnChange !== null) {
|
if (this.settings.allowUpdateOnChange !== undefined && this.settings.allowUpdateOnChange !== null) {
|
||||||
|
@@ -18,11 +18,12 @@
|
|||||||
import { UntypedFormControl } from '@angular/forms';
|
import { UntypedFormControl } from '@angular/forms';
|
||||||
|
|
||||||
export class SearchTermValidator {
|
export class SearchTermValidator {
|
||||||
|
|
||||||
static minAlphanumericChars(minChars: number) {
|
static minAlphanumericChars(minChars: number) {
|
||||||
return (control: UntypedFormControl) => ('' + control.value).replace(/[^0-9a-zA-Z]+/g, '').length >= minChars ? null : {
|
return (control: UntypedFormControl) =>
|
||||||
hasMinAlphanumericChars: false
|
('' + control.value).replace(/[^0-9a-zA-Z]+/g, '').length >= minChars
|
||||||
};
|
? null
|
||||||
|
: {
|
||||||
|
hasMinAlphanumericChars: false
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -26,14 +26,13 @@ export class Payload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe('SearchFilterList', () => {
|
describe('SearchFilterList', () => {
|
||||||
|
const generateItems = (count: number): Payload[] =>
|
||||||
const generateItems = (count: number): Payload[] => Array(count).fill(null).map((_, id) => new Payload(id));
|
Array(count)
|
||||||
|
.fill(null)
|
||||||
|
.map((_, id) => new Payload(id));
|
||||||
|
|
||||||
it('should init with external items', () => {
|
it('should init with external items', () => {
|
||||||
const items = [
|
const items = [new Payload(1), new Payload(2)];
|
||||||
new Payload(1),
|
|
||||||
new Payload(2)
|
|
||||||
];
|
|
||||||
const list = new SearchFilterList<Payload>(items);
|
const list = new SearchFilterList<Payload>(items);
|
||||||
|
|
||||||
expect(list.length).toBe(2);
|
expect(list.length).toBe(2);
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
const DEFAULT_PAGE_SIZE = 5;
|
const DEFAULT_PAGE_SIZE = 5;
|
||||||
|
|
||||||
export class SearchFilterList<T> implements Iterable<T> {
|
export class SearchFilterList<T> implements Iterable<T> {
|
||||||
|
|
||||||
private filteredItems: T[] = [];
|
private filteredItems: T[] = [];
|
||||||
private _filterText: string = '';
|
private _filterText: string = '';
|
||||||
|
|
||||||
@@ -41,7 +40,7 @@ export class SearchFilterList<T> implements Iterable<T> {
|
|||||||
return this._filter;
|
return this._filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
set filter(value: (item: T) => boolean ) {
|
set filter(value: (item: T) => boolean) {
|
||||||
this._filter = value;
|
this._filter = value;
|
||||||
this.applyFilter();
|
this.applyFilter();
|
||||||
}
|
}
|
||||||
@@ -57,7 +56,6 @@ export class SearchFilterList<T> implements Iterable<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns visible portion of the items.
|
* Returns visible portion of the items.
|
||||||
*
|
|
||||||
* @returns list of items
|
* @returns list of items
|
||||||
*/
|
*/
|
||||||
get visibleItems(): T[] {
|
get visibleItems(): T[] {
|
||||||
@@ -66,7 +64,6 @@ export class SearchFilterList<T> implements Iterable<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get items length
|
* Get items length
|
||||||
*
|
|
||||||
* @returns entire collection length including items not displayed on the page
|
* @returns entire collection length including items not displayed on the page
|
||||||
*/
|
*/
|
||||||
get length(): number {
|
get length(): number {
|
||||||
@@ -75,7 +72,6 @@ export class SearchFilterList<T> implements Iterable<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect whether more items can be displayed.
|
* Detect whether more items can be displayed.
|
||||||
*
|
|
||||||
* @returns `true` if can show more items, otherwise `false`
|
* @returns `true` if can show more items, otherwise `false`
|
||||||
*/
|
*/
|
||||||
get canShowMoreItems(): boolean {
|
get canShowMoreItems(): boolean {
|
||||||
@@ -84,7 +80,6 @@ export class SearchFilterList<T> implements Iterable<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect whether less items can be displayed.
|
* Detect whether less items can be displayed.
|
||||||
*
|
|
||||||
* @returns `true` if can show less items, otherwise `false`
|
* @returns `true` if can show less items, otherwise `false`
|
||||||
*/
|
*/
|
||||||
get canShowLessItems(): boolean {
|
get canShowLessItems(): boolean {
|
||||||
@@ -93,7 +88,6 @@ export class SearchFilterList<T> implements Iterable<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect whether content fits single page.
|
* Detect whether content fits single page.
|
||||||
*
|
|
||||||
* @returns `true` if content fits single page, otherwise `false`.
|
* @returns `true` if content fits single page, otherwise `false`.
|
||||||
*/
|
*/
|
||||||
get fitsPage(): boolean {
|
get fitsPage(): boolean {
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Subject, Observable, from, ReplaySubject, BehaviorSubject } from 'rxjs';
|
import { Subject, Observable, from, ReplaySubject } from 'rxjs';
|
||||||
import { AppConfigService } from '@alfresco/adf-core';
|
import { AppConfigService } from '@alfresco/adf-core';
|
||||||
import {
|
import {
|
||||||
SearchRequest,
|
SearchRequest,
|
||||||
@@ -37,13 +37,8 @@ import { FacetField } from '../models/facet-field.interface';
|
|||||||
import { FacetFieldBucket } from '../models/facet-field-bucket.interface';
|
import { FacetFieldBucket } from '../models/facet-field-bucket.interface';
|
||||||
import { SearchForm } from '../models/search-form.interface';
|
import { SearchForm } from '../models/search-form.interface';
|
||||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
import { Buffer } from 'buffer';
|
|
||||||
import { inject } from '@angular/core';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
|
|
||||||
export abstract class BaseQueryBuilderService {
|
export abstract class BaseQueryBuilderService {
|
||||||
private readonly router = inject(Router);
|
|
||||||
private readonly activatedRoute = inject(ActivatedRoute);
|
|
||||||
private _searchApi: SearchApi;
|
private _searchApi: SearchApi;
|
||||||
get searchApi(): SearchApi {
|
get searchApi(): SearchApi {
|
||||||
this._searchApi = this._searchApi ?? new SearchApi(this.alfrescoApiService.getInstance());
|
this._searchApi = this._searchApi ?? new SearchApi(this.alfrescoApiService.getInstance());
|
||||||
@@ -53,9 +48,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
/* Stream that emits the search configuration whenever the user change the search forms */
|
/* Stream that emits the search configuration whenever the user change the search forms */
|
||||||
configUpdated = new Subject<SearchConfiguration>();
|
configUpdated = new Subject<SearchConfiguration>();
|
||||||
|
|
||||||
/* Stream that emits the event each time when search filter finishes loading initial value */
|
|
||||||
filterLoaded = new Subject<void>();
|
|
||||||
|
|
||||||
/* Stream that emits the query before search whenever user search */
|
/* Stream that emits the query before search whenever user search */
|
||||||
updated = new Subject<SearchRequest>();
|
updated = new Subject<SearchRequest>();
|
||||||
|
|
||||||
@@ -68,17 +60,12 @@ export abstract class BaseQueryBuilderService {
|
|||||||
/* Stream that emits search forms */
|
/* Stream that emits search forms */
|
||||||
searchForms = new ReplaySubject<SearchForm[]>(1);
|
searchForms = new ReplaySubject<SearchForm[]>(1);
|
||||||
|
|
||||||
/* Stream that emits the initial value for some or all search filters */
|
|
||||||
populateFilters = new BehaviorSubject<{ [key: string]: any }>({});
|
|
||||||
|
|
||||||
categories: SearchCategory[] = [];
|
categories: SearchCategory[] = [];
|
||||||
queryFragments: { [id: string]: string } = {};
|
queryFragments: { [id: string]: string } = {};
|
||||||
filterQueries: FilterQuery[] = [];
|
filterQueries: FilterQuery[] = [];
|
||||||
filterRawParams: { [key: string]: any } = {};
|
|
||||||
paging: { maxItems?: number; skipCount?: number } = null;
|
paging: { maxItems?: number; skipCount?: number } = null;
|
||||||
sorting: SearchSortingDefinition[] = [];
|
sorting: SearchSortingDefinition[] = [];
|
||||||
sortingOptions: SearchSortingDefinition[] = [];
|
sortingOptions: SearchSortingDefinition[] = [];
|
||||||
private encodedQuery: string;
|
|
||||||
private scope: RequestScope;
|
private scope: RequestScope;
|
||||||
private selectedConfiguration: number;
|
private selectedConfiguration: number;
|
||||||
private _userQuery = '';
|
private _userQuery = '';
|
||||||
@@ -101,7 +88,7 @@ export abstract class BaseQueryBuilderService {
|
|||||||
// TODO: to be supported in future iterations
|
// TODO: to be supported in future iterations
|
||||||
ranges: { [id: string]: SearchRange } = {};
|
ranges: { [id: string]: SearchRange } = {};
|
||||||
|
|
||||||
protected constructor(protected readonly appConfig: AppConfigService, protected readonly alfrescoApiService: AlfrescoApiService) {
|
protected constructor(protected appConfig: AppConfigService, protected alfrescoApiService: AlfrescoApiService) {
|
||||||
this.resetToDefaults();
|
this.resetToDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,14 +96,7 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
public abstract isFilterServiceActive(): boolean;
|
public abstract isFilterServiceActive(): boolean;
|
||||||
|
|
||||||
public resetToDefaults(withNavigate = false) {
|
public resetToDefaults() {
|
||||||
if (withNavigate) {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { q: null },
|
|
||||||
relativeTo: this.activatedRoute,
|
|
||||||
queryParamsHandling: 'merge'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const currentConfig = this.getDefaultConfiguration();
|
const currentConfig = this.getDefaultConfiguration();
|
||||||
this.resetSearchOptions();
|
this.resetSearchOptions();
|
||||||
this.configUpdated.next(currentConfig);
|
this.configUpdated.next(currentConfig);
|
||||||
@@ -157,9 +137,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
this.sortingOptions = [];
|
this.sortingOptions = [];
|
||||||
this.userFacetBuckets = {};
|
this.userFacetBuckets = {};
|
||||||
this.scope = null;
|
this.scope = null;
|
||||||
this.filterRawParams = {};
|
|
||||||
this._userQuery = '';
|
|
||||||
this.populateFilters.next({});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSearchFormDetails(): SearchForm[] {
|
public getSearchFormDetails(): SearchForm[] {
|
||||||
@@ -199,7 +176,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a facet bucket to a field.
|
* Adds a facet bucket to a field.
|
||||||
*
|
|
||||||
* @param field The target field
|
* @param field The target field
|
||||||
* @param bucket Bucket to add
|
* @param bucket Bucket to add
|
||||||
*/
|
*/
|
||||||
@@ -216,7 +192,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the buckets currently added to a field
|
* Gets the buckets currently added to a field
|
||||||
*
|
|
||||||
* @param field The target fields
|
* @param field The target fields
|
||||||
* @returns Bucket array
|
* @returns Bucket array
|
||||||
*/
|
*/
|
||||||
@@ -226,7 +201,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an existing bucket from a field.
|
* Removes an existing bucket from a field.
|
||||||
*
|
|
||||||
* @param field The target field
|
* @param field The target field
|
||||||
* @param bucket Bucket to remove
|
* @param bucket Bucket to remove
|
||||||
*/
|
*/
|
||||||
@@ -239,7 +213,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a filter query to the current query.
|
* Adds a filter query to the current query.
|
||||||
*
|
|
||||||
* @param query Query string to add
|
* @param query Query string to add
|
||||||
*/
|
*/
|
||||||
addFilterQuery(query: string): void {
|
addFilterQuery(query: string): void {
|
||||||
@@ -253,7 +226,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an existing filter query.
|
* Removes an existing filter query.
|
||||||
*
|
|
||||||
* @param query The query to remove
|
* @param query The query to remove
|
||||||
*/
|
*/
|
||||||
removeFilterQuery(query: string): void {
|
removeFilterQuery(query: string): void {
|
||||||
@@ -264,7 +236,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a facet query by label.
|
* Gets a facet query by label.
|
||||||
*
|
|
||||||
* @param label Label of the query
|
* @param label Label of the query
|
||||||
* @returns Facet query data
|
* @returns Facet query data
|
||||||
*/
|
*/
|
||||||
@@ -280,7 +251,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a facet field by label.
|
* Gets a facet field by label.
|
||||||
*
|
|
||||||
* @param label Label of the facet field
|
* @param label Label of the facet field
|
||||||
* @returns Facet field data
|
* @returns Facet field data
|
||||||
*/
|
*/
|
||||||
@@ -306,7 +276,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the current query and triggers the `updated` event.
|
* Builds the current query and triggers the `updated` event.
|
||||||
*
|
|
||||||
* @param queryBody query settings
|
* @param queryBody query settings
|
||||||
*/
|
*/
|
||||||
update(queryBody?: SearchRequest): void {
|
update(queryBody?: SearchRequest): void {
|
||||||
@@ -316,17 +285,12 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds and executes the current query.
|
* Builds and executes the current query.
|
||||||
*
|
|
||||||
* @param updateQueryParams whether query params should be updated with encoded query
|
|
||||||
* @param queryBody query settings
|
* @param queryBody query settings
|
||||||
*/
|
*/
|
||||||
async execute(updateQueryParams = true, queryBody?: SearchRequest) {
|
async execute(queryBody?: SearchRequest) {
|
||||||
try {
|
try {
|
||||||
const query = queryBody ? queryBody : this.buildQuery();
|
const query = queryBody ? queryBody : this.buildQuery();
|
||||||
if (query) {
|
if (query) {
|
||||||
if (updateQueryParams) {
|
|
||||||
this.updateSearchQueryParams();
|
|
||||||
}
|
|
||||||
const resultSetPaging: ResultSetPaging = await this.searchApi.search(query);
|
const resultSetPaging: ResultSetPaging = await this.searchApi.search(query);
|
||||||
this.executed.next(resultSetPaging);
|
this.executed.next(resultSetPaging);
|
||||||
}
|
}
|
||||||
@@ -356,7 +320,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the current query.
|
* Builds the current query.
|
||||||
*
|
|
||||||
* @returns The finished query
|
* @returns The finished query
|
||||||
*/
|
*/
|
||||||
buildQuery(): SearchRequest {
|
buildQuery(): SearchRequest {
|
||||||
@@ -397,7 +360,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the primary sorting definition.
|
* Gets the primary sorting definition.
|
||||||
*
|
|
||||||
* @returns The primary sorting definition
|
* @returns The primary sorting definition
|
||||||
*/
|
*/
|
||||||
getPrimarySorting(): SearchSortingDefinition {
|
getPrimarySorting(): SearchSortingDefinition {
|
||||||
@@ -409,7 +371,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all pre-configured sorting options that users can choose from.
|
* Gets all pre-configured sorting options that users can choose from.
|
||||||
*
|
|
||||||
* @returns Pre-configured sorting options
|
* @returns Pre-configured sorting options
|
||||||
*/
|
*/
|
||||||
getSortingOptions(): SearchSortingDefinition[] {
|
getSortingOptions(): SearchSortingDefinition[] {
|
||||||
@@ -418,7 +379,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the query group.
|
* Gets the query group.
|
||||||
*
|
|
||||||
* @param query Target query
|
* @param query Target query
|
||||||
* @returns Query group
|
* @returns Query group
|
||||||
*/
|
*/
|
||||||
@@ -428,7 +388,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if FacetQueries has been defined
|
* Checks if FacetQueries has been defined
|
||||||
*
|
|
||||||
* @returns True if defined, false otherwise
|
* @returns True if defined, false otherwise
|
||||||
*/
|
*/
|
||||||
get hasFacetQueries(): boolean {
|
get hasFacetQueries(): boolean {
|
||||||
@@ -437,7 +396,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if FacetIntervals has been defined
|
* Checks if FacetIntervals has been defined
|
||||||
*
|
|
||||||
* @returns True if defined, false otherwise
|
* @returns True if defined, false otherwise
|
||||||
*/
|
*/
|
||||||
get hasFacetIntervals(): boolean {
|
get hasFacetIntervals(): boolean {
|
||||||
@@ -501,9 +459,7 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
protected getFinalQuery(): string {
|
protected getFinalQuery(): string {
|
||||||
let query = '';
|
let query = '';
|
||||||
if (this.userQuery) {
|
|
||||||
this.filterRawParams['userQuery'] = this.userQuery;
|
|
||||||
}
|
|
||||||
this.categories.forEach((facet) => {
|
this.categories.forEach((facet) => {
|
||||||
const customQuery = this.queryFragments[facet.id];
|
const customQuery = this.queryFragments[facet.id];
|
||||||
if (customQuery) {
|
if (customQuery) {
|
||||||
@@ -558,7 +514,6 @@ export abstract class BaseQueryBuilderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Encloses a label name with double quotes if it contains whitespace characters.
|
* Encloses a label name with double quotes if it contains whitespace characters.
|
||||||
*
|
|
||||||
* @param configLabel Original label text
|
* @param configLabel Original label text
|
||||||
* @returns Label, possibly with quotes if it contains spaces
|
* @returns Label, possibly with quotes if it contains spaces
|
||||||
*/
|
*/
|
||||||
@@ -569,38 +524,4 @@ export abstract class BaseQueryBuilderService {
|
|||||||
}
|
}
|
||||||
return configLabel;
|
return configLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Encodes filter configuration stored in filterRawParams object.
|
|
||||||
*/
|
|
||||||
encodeQuery() {
|
|
||||||
this.encodedQuery = Buffer.from(JSON.stringify(this.filterRawParams)).toString('base64');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Encodes existing filters configuration and updates search query param value.
|
|
||||||
*/
|
|
||||||
updateSearchQueryParams() {
|
|
||||||
this.encodeQuery();
|
|
||||||
this.router.navigate([], {
|
|
||||||
relativeTo: this.activatedRoute,
|
|
||||||
queryParams: { q: this.encodedQuery },
|
|
||||||
queryParamsHandling: 'merge'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds search query with provided user query, executes query, encodes latest filter config and navigates to search.
|
|
||||||
*
|
|
||||||
* @param query user query to search for
|
|
||||||
* @param searchUrl search url to navigate to
|
|
||||||
*/
|
|
||||||
async navigateToSearch(query: string, searchUrl: string) {
|
|
||||||
this.userQuery = query;
|
|
||||||
await this.execute();
|
|
||||||
await this.router.navigate([searchUrl], {
|
|
||||||
queryParams: { q: this.encodedQuery },
|
|
||||||
queryParamsHandling: 'merge'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,6 @@ import { SearchConfigurationInterface } from '../../common/interfaces/search-con
|
|||||||
export class SearchConfigurationService implements SearchConfigurationInterface {
|
export class SearchConfigurationService implements SearchConfigurationInterface {
|
||||||
/**
|
/**
|
||||||
* Generates a request object with custom search parameters.
|
* Generates a request object with custom search parameters.
|
||||||
*
|
|
||||||
* @param searchTerm Term text to search for
|
* @param searchTerm Term text to search for
|
||||||
* @param maxResults Maximum number of search results to show in a page
|
* @param maxResults Maximum number of search results to show in a page
|
||||||
* @param skipCount The offset of the start of the page within the results list
|
* @param skipCount The offset of the start of the page within the results list
|
||||||
|
@@ -31,7 +31,6 @@ import { SearchDateRangeTabbedComponent } from '../components/search-date-range-
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class SearchFilterService {
|
export class SearchFilterService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains string-to-type mappings for registered widgets.
|
* Contains string-to-type mappings for registered widgets.
|
||||||
*/
|
*/
|
||||||
@@ -47,5 +46,4 @@ export class SearchFilterService {
|
|||||||
'autocomplete-chips': SearchFilterAutocompleteChipsComponent,
|
'autocomplete-chips': SearchFilterAutocompleteChipsComponent,
|
||||||
'date-range': SearchDateRangeTabbedComponent
|
'date-range': SearchDateRangeTabbedComponent
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -35,22 +35,14 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
const createQueryBuilder = (searchSettings): SearchHeaderQueryBuilderService => {
|
|
||||||
let builder: SearchHeaderQueryBuilderService;
|
|
||||||
TestBed.runInInjectionContext(() => {
|
|
||||||
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
|
||||||
builder = new SearchHeaderQueryBuilderService(buildConfig(searchSettings), alfrescoApiService, null);
|
|
||||||
});
|
|
||||||
return builder;
|
|
||||||
};
|
|
||||||
|
|
||||||
it('should load the configuration from app config', () => {
|
it('should load the configuration from app config', () => {
|
||||||
const config: SearchConfiguration = {
|
const config: SearchConfiguration = {
|
||||||
categories: [{ id: 'cat1', enabled: true } as any, { id: 'cat2', enabled: true } as any],
|
categories: [{ id: 'cat1', enabled: true } as any, { id: 'cat2', enabled: true } as any],
|
||||||
filterQueries: [{ query: 'query1' }, { query: 'query2' }]
|
filterQueries: [{ query: 'query1' }, { query: 'query2' }]
|
||||||
};
|
};
|
||||||
|
|
||||||
const builder = createQueryBuilder(config);
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
|
const builder = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
||||||
|
|
||||||
builder.categories = [];
|
builder.categories = [];
|
||||||
builder.filterQueries = [];
|
builder.filterQueries = [];
|
||||||
@@ -73,7 +65,8 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
filterQueries: [{ query: 'query1' }, { query: 'query2' }]
|
filterQueries: [{ query: 'query1' }, { query: 'query2' }]
|
||||||
};
|
};
|
||||||
|
|
||||||
const service = createQueryBuilder(config);
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
|
const service = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
||||||
|
|
||||||
const category = service.getCategoryForColumn('fake-key-1');
|
const category = service.getCategoryForColumn('fake-key-1');
|
||||||
expect(category).not.toBeNull();
|
expect(category).not.toBeNull();
|
||||||
@@ -82,7 +75,8 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should have empty user query by default', () => {
|
it('should have empty user query by default', () => {
|
||||||
const builder = createQueryBuilder({});
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
|
const builder = new SearchHeaderQueryBuilderService(buildConfig({}), alfrescoApiService, null);
|
||||||
expect(builder.userQuery).toBe('');
|
expect(builder.userQuery).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -94,7 +88,8 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
|
|
||||||
const expectedResult = [{ query: 'PARENT:"workspace://SpacesStore/fake-node-id"' }];
|
const expectedResult = [{ query: 'PARENT:"workspace://SpacesStore/fake-node-id"' }];
|
||||||
|
|
||||||
const searchHeaderService = createQueryBuilder(config);
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
|
const searchHeaderService = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
||||||
|
|
||||||
searchHeaderService.setCurrentRootFolderId('fake-node-id');
|
searchHeaderService.setCurrentRootFolderId('fake-node-id');
|
||||||
|
|
||||||
@@ -109,7 +104,9 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
filterQueries: expectedResult
|
filterQueries: expectedResult
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchHeaderService = createQueryBuilder(config);
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
|
const searchHeaderService = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
||||||
|
|
||||||
searchHeaderService.setCurrentRootFolderId('fake-node-id');
|
searchHeaderService.setCurrentRootFolderId('fake-node-id');
|
||||||
|
|
||||||
expect(searchHeaderService.filterQueries).toEqual(expectedResult, 'Filters are not as expected');
|
expect(searchHeaderService.filterQueries).toEqual(expectedResult, 'Filters are not as expected');
|
||||||
@@ -123,7 +120,8 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
filterQueries: [{ query: 'PARENT:"workspace://SpacesStore/fake-node-id' }]
|
filterQueries: [{ query: 'PARENT:"workspace://SpacesStore/fake-node-id' }]
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchHeaderService = createQueryBuilder(config);
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
|
const searchHeaderService = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
||||||
|
|
||||||
expect(searchHeaderService.activeFilters.length).toBe(0);
|
expect(searchHeaderService.activeFilters.length).toBe(0);
|
||||||
|
|
||||||
|
@@ -44,7 +44,6 @@ export class SearchService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of nodes that match the given search criteria.
|
* Gets a list of nodes that match the given search criteria.
|
||||||
*
|
|
||||||
* @param term Term to search for
|
* @param term Term to search for
|
||||||
* @param options Options for delivery of the search results
|
* @param options Options for delivery of the search results
|
||||||
* @returns List of nodes resulting from the search
|
* @returns List of nodes resulting from the search
|
||||||
@@ -61,7 +60,6 @@ export class SearchService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a search.
|
* Performs a search.
|
||||||
*
|
|
||||||
* @param searchTerm Term to search for
|
* @param searchTerm Term to search for
|
||||||
* @param maxResults Maximum number of items in the list of results
|
* @param maxResults Maximum number of items in the list of results
|
||||||
* @param skipCount Number of higher-ranked items to skip over in the list
|
* @param skipCount Number of higher-ranked items to skip over in the list
|
||||||
@@ -80,7 +78,6 @@ export class SearchService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a search with its parameters supplied by a request object.
|
* Performs a search with its parameters supplied by a request object.
|
||||||
*
|
|
||||||
* @param queryBody Object containing the search parameters
|
* @param queryBody Object containing the search parameters
|
||||||
* @returns List of search results
|
* @returns List of search results
|
||||||
*/
|
*/
|
||||||
|
@@ -79,7 +79,6 @@ export class SecurityControlsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get All security groups
|
* Get All security groups
|
||||||
*
|
|
||||||
* @param skipCount The number of entities that exist in the collection before those included in this list.
|
* @param skipCount The number of entities that exist in the collection before those included in this list.
|
||||||
* @param maxItems The maximum number of items to return in the list. Default is specified by UserPreferencesService.
|
* @param maxItems The maximum number of items to return in the list. Default is specified by UserPreferencesService.
|
||||||
* @param include Additional information about the security group
|
* @param include Additional information about the security group
|
||||||
@@ -113,7 +112,6 @@ export class SecurityControlsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create security group
|
* Create security group
|
||||||
*
|
|
||||||
* @param input securityGroupBody.
|
* @param input securityGroupBody.
|
||||||
* @returns Observable<SecurityGroupEntry>
|
* @returns Observable<SecurityGroupEntry>
|
||||||
*/
|
*/
|
||||||
@@ -132,7 +130,6 @@ export class SecurityControlsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create security marks
|
* Create security marks
|
||||||
*
|
|
||||||
* @param securityGroupId The key for the security group id.
|
* @param securityGroupId The key for the security group id.
|
||||||
* @param input securityMarkBody[].
|
* @param input securityMarkBody[].
|
||||||
* @returns Promise<SecurityMarkPaging | SecurityMarkEntry>
|
* @returns Promise<SecurityMarkPaging | SecurityMarkEntry>
|
||||||
@@ -156,7 +153,6 @@ export class SecurityControlsService {
|
|||||||
/**
|
/**
|
||||||
* Get security mark value
|
* Get security mark value
|
||||||
* Gets the value for a selected **securityGroupId**.
|
* Gets the value for a selected **securityGroupId**.
|
||||||
*
|
|
||||||
* @param securityGroupId The key for the security group id.
|
* @param securityGroupId The key for the security group id.
|
||||||
* @param skipCount The number of entities that exist in the collection before those included in this list.
|
* @param skipCount The number of entities that exist in the collection before those included in this list.
|
||||||
* @returns Promise<SecurityControlsMarkResponse>
|
* @returns Promise<SecurityControlsMarkResponse>
|
||||||
@@ -183,7 +179,6 @@ export class SecurityControlsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a security groups information
|
* Update a security groups information
|
||||||
*
|
|
||||||
* @param securityGroupId The Key of Security Group id for which info is required
|
* @param securityGroupId The Key of Security Group id for which info is required
|
||||||
* @param input SecurityGroupBody
|
* @param input SecurityGroupBody
|
||||||
* @param opts additional information about the security group
|
* @param opts additional information about the security group
|
||||||
@@ -215,7 +210,6 @@ export class SecurityControlsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates Security Mark value
|
* Updates Security Mark value
|
||||||
*
|
|
||||||
* @param securityGroupId The key for the security group id.
|
* @param securityGroupId The key for the security group id.
|
||||||
* @param securityMarkId The key for the security mark is in use or not.
|
* @param securityMarkId The key for the security mark is in use or not.
|
||||||
* @param input securityMarkBody.
|
* @param input securityMarkBody.
|
||||||
@@ -242,7 +236,6 @@ export class SecurityControlsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete security group
|
* Delete security group
|
||||||
*
|
|
||||||
* @param securityGroupId The key for the security group id.
|
* @param securityGroupId The key for the security group id.
|
||||||
* @returns Observable<void>
|
* @returns Observable<void>
|
||||||
*/
|
*/
|
||||||
@@ -255,7 +248,6 @@ export class SecurityControlsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete security mark
|
* Delete security mark
|
||||||
*
|
|
||||||
* @param securityGroupId The key for the security group id.
|
* @param securityGroupId The key for the security group id.
|
||||||
* @param securityMarkId The key for the security mark id.
|
* @param securityMarkId The key for the security mark id.
|
||||||
* @returns Promise<SecurityMarkEntry>
|
* @returns Promise<SecurityMarkEntry>
|
||||||
@@ -278,7 +270,6 @@ export class SecurityControlsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the authority clearances for a single user/group
|
* Get the authority clearances for a single user/group
|
||||||
*
|
|
||||||
* @param authorityName The name for the authority for which the clearance is to be fetched. Can be left blank in which case it will fetch it for all users with pagination
|
* @param authorityName The name for the authority for which the clearance is to be fetched. Can be left blank in which case it will fetch it for all users with pagination
|
||||||
* @param skipCount The number of entities that exist in the collection before those included in this list.
|
* @param skipCount The number of entities that exist in the collection before those included in this list.
|
||||||
* @param maxItems The maximum number of items to return in the list. Default is specified by UserPreferencesService.
|
* @param maxItems The maximum number of items to return in the list. Default is specified by UserPreferencesService.
|
||||||
@@ -301,7 +292,6 @@ export class SecurityControlsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the authority clearance.
|
* Updates the authority clearance.
|
||||||
*
|
|
||||||
* @param authorityName The name for the authority for which the clearance is to be updated
|
* @param authorityName The name for the authority for which the clearance is to be updated
|
||||||
* @param securityMarksList NodeSecurityMarkBody[]
|
* @param securityMarksList NodeSecurityMarkBody[]
|
||||||
* @returns Observable<SecurityMarkEntry | SecurityMarkPaging>
|
* @returns Observable<SecurityMarkEntry | SecurityMarkPaging>
|
||||||
|
@@ -44,7 +44,6 @@ export class TagService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of tags added to a node.
|
* Gets a list of tags added to a node.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @returns TagPaging object (defined in JS-API) containing the tags
|
* @returns TagPaging object (defined in JS-API) containing the tags
|
||||||
*/
|
*/
|
||||||
@@ -54,7 +53,6 @@ export class TagService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of all the tags already defined in the repository.
|
* Gets a list of all the tags already defined in the repository.
|
||||||
*
|
|
||||||
* @param opts Options supported by JS-API
|
* @param opts Options supported by JS-API
|
||||||
* @param includedCounts True if count field should be included in response object for each tag, false otherwise.
|
* @param includedCounts True if count field should be included in response object for each tag, false otherwise.
|
||||||
* @returns TagPaging object (defined in JS-API) containing the tags
|
* @returns TagPaging object (defined in JS-API) containing the tags
|
||||||
@@ -70,7 +68,6 @@ export class TagService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a tag to a node.
|
* Adds a tag to a node.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @param tagName Name of the tag to add
|
* @param tagName Name of the tag to add
|
||||||
* @returns TagEntry object (defined in JS-API) with details of the new tag
|
* @returns TagEntry object (defined in JS-API) with details of the new tag
|
||||||
@@ -84,7 +81,6 @@ export class TagService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a tag from a node.
|
* Removes a tag from a node.
|
||||||
*
|
|
||||||
* @param nodeId ID of the target node
|
* @param nodeId ID of the target node
|
||||||
* @param tag Name of the tag to remove
|
* @param tag Name of the tag to remove
|
||||||
* @returns Null object when the operation completes
|
* @returns Null object when the operation completes
|
||||||
@@ -95,7 +91,6 @@ export class TagService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates tags.
|
* Creates tags.
|
||||||
*
|
|
||||||
* @param tags list of tags to create.
|
* @param tags list of tags to create.
|
||||||
* @returns Created tags.
|
* @returns Created tags.
|
||||||
*/
|
*/
|
||||||
@@ -105,7 +100,6 @@ export class TagService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a tag
|
* Update a tag
|
||||||
*
|
|
||||||
* @param tagId The identifier of a tag.
|
* @param tagId The identifier of a tag.
|
||||||
* @param tagBody The updated tag.
|
* @param tagBody The updated tag.
|
||||||
* @returns Updated tag.
|
* @returns Updated tag.
|
||||||
@@ -116,7 +110,6 @@ export class TagService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Find tags which name contains searched name.
|
* Find tags which name contains searched name.
|
||||||
*
|
|
||||||
* @param name Value for name which should be used during searching tags.
|
* @param name Value for name which should be used during searching tags.
|
||||||
* @param sorting Object which configures sorting. OrderBy field specifies field used for sorting, direction specified ascending or descending direction.
|
* @param sorting Object which configures sorting. OrderBy field specifies field used for sorting, direction specified ascending or descending direction.
|
||||||
* Default sorting is ascending by tag field.
|
* Default sorting is ascending by tag field.
|
||||||
@@ -147,7 +140,6 @@ export class TagService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Find tag which name matches exactly to passed name.
|
* Find tag which name matches exactly to passed name.
|
||||||
*
|
|
||||||
* @param name Value for name which should be used during finding exact tag.
|
* @param name Value for name which should be used during finding exact tag.
|
||||||
* @returns Found tag which name matches exactly to passed name.
|
* @returns Found tag which name matches exactly to passed name.
|
||||||
*/
|
*/
|
||||||
@@ -159,7 +151,6 @@ export class TagService {
|
|||||||
* Deletes a tag with tagId.
|
* Deletes a tag with tagId.
|
||||||
* This will cause the tag to be removed from all nodes.
|
* This will cause the tag to be removed from all nodes.
|
||||||
* You must have admin rights to delete a tag.
|
* You must have admin rights to delete a tag.
|
||||||
*
|
|
||||||
* @param tagId of the tag to be deleted
|
* @param tagId of the tag to be deleted
|
||||||
* @returns Null object when the operation completes
|
* @returns Null object when the operation completes
|
||||||
*/
|
*/
|
||||||
@@ -169,7 +160,6 @@ export class TagService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign tags to node. If tag is new then tag is also created additionally, if tag already exists then it is just assigned.
|
* Assign tags to node. If tag is new then tag is also created additionally, if tag already exists then it is just assigned.
|
||||||
*
|
|
||||||
* @param nodeId Id of node to which tags should be assigned.
|
* @param nodeId Id of node to which tags should be assigned.
|
||||||
* @param tags List of tags to create and assign or just assign if they already exist.
|
* @param tags List of tags to create and assign or just assign if they already exist.
|
||||||
* @returns Just linked tags to node or single tag if linked only one tag.
|
* @returns Just linked tags to node or single tag if linked only one tag.
|
||||||
@@ -180,7 +170,6 @@ export class TagService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if tags plugin is enabled.
|
* Checks if tags plugin is enabled.
|
||||||
*
|
|
||||||
* @returns boolean true if tags plugin is enabled, false otherwise.
|
* @returns boolean true if tags plugin is enabled, false otherwise.
|
||||||
*/
|
*/
|
||||||
areTagsEnabled(): boolean {
|
areTagsEnabled(): boolean {
|
||||||
|
@@ -72,7 +72,6 @@ describe('TagsCreatorComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get name input element
|
* Get name input element
|
||||||
*
|
|
||||||
* @returns native element
|
* @returns native element
|
||||||
*/
|
*/
|
||||||
function getNameInput(): HTMLInputElement {
|
function getNameInput(): HTMLInputElement {
|
||||||
@@ -81,7 +80,6 @@ describe('TagsCreatorComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the create tag label
|
* Get the create tag label
|
||||||
*
|
|
||||||
* @returns native element
|
* @returns native element
|
||||||
*/
|
*/
|
||||||
function getCreateTagLabel(): HTMLSpanElement {
|
function getCreateTagLabel(): HTMLSpanElement {
|
||||||
@@ -90,7 +88,6 @@ describe('TagsCreatorComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get remove tag buttons
|
* Get remove tag buttons
|
||||||
*
|
|
||||||
* @returns list of native elements
|
* @returns list of native elements
|
||||||
*/
|
*/
|
||||||
function getRemoveTagButtons(): HTMLButtonElement[] {
|
function getRemoveTagButtons(): HTMLButtonElement[] {
|
||||||
@@ -100,7 +97,6 @@ describe('TagsCreatorComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get newly added tags
|
* Get newly added tags
|
||||||
*
|
|
||||||
* @returns list of tags
|
* @returns list of tags
|
||||||
*/
|
*/
|
||||||
async function getAddedTags(): Promise<string[]> {
|
async function getAddedTags(): Promise<string[]> {
|
||||||
@@ -114,7 +110,6 @@ describe('TagsCreatorComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds tag to the added list
|
* Adds tag to the added list
|
||||||
*
|
|
||||||
* @param tagName tag name
|
* @param tagName tag name
|
||||||
* @param addUsingEnter use Enter when adding
|
* @param addUsingEnter use Enter when adding
|
||||||
* @param typingTimeout typing timeout in milliseconds (default 300)
|
* @param typingTimeout typing timeout in milliseconds (default 300)
|
||||||
@@ -134,7 +129,6 @@ describe('TagsCreatorComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* type a new tag
|
* type a new tag
|
||||||
*
|
|
||||||
* @param tagName tag name
|
* @param tagName tag name
|
||||||
* @param timeout typing timeout in milliseconds (default 300)
|
* @param timeout typing timeout in milliseconds (default 300)
|
||||||
*/
|
*/
|
||||||
@@ -152,7 +146,6 @@ describe('TagsCreatorComponent', () => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the existing tags label
|
* Get the existing tags label
|
||||||
*
|
|
||||||
* @returns label
|
* @returns label
|
||||||
*/
|
*/
|
||||||
function getExistingTagsLabel(): string {
|
function getExistingTagsLabel(): string {
|
||||||
@@ -313,7 +306,6 @@ describe('TagsCreatorComponent', () => {
|
|||||||
describe('Errors', () => {
|
describe('Errors', () => {
|
||||||
/**
|
/**
|
||||||
* Get first error
|
* Get first error
|
||||||
*
|
|
||||||
* @returns error text
|
* @returns error text
|
||||||
*/
|
*/
|
||||||
function getFirstError(): string {
|
function getFirstError(): string {
|
||||||
@@ -455,7 +447,6 @@ describe('TagsCreatorComponent', () => {
|
|||||||
describe('Existing tags panel', () => {
|
describe('Existing tags panel', () => {
|
||||||
/**
|
/**
|
||||||
* Get the existing tags panel
|
* Get the existing tags panel
|
||||||
*
|
|
||||||
* @returns debug element
|
* @returns debug element
|
||||||
*/
|
*/
|
||||||
function getPanel(): DebugElement {
|
function getPanel(): DebugElement {
|
||||||
@@ -545,7 +536,6 @@ describe('TagsCreatorComponent', () => {
|
|||||||
describe('Existing tags', () => {
|
describe('Existing tags', () => {
|
||||||
/**
|
/**
|
||||||
* Get the existing tags
|
* Get the existing tags
|
||||||
*
|
|
||||||
* @returns list of tags
|
* @returns list of tags
|
||||||
*/
|
*/
|
||||||
function getExistingTags(): string[] {
|
function getExistingTags(): string[] {
|
||||||
@@ -739,7 +729,6 @@ describe('TagsCreatorComponent', () => {
|
|||||||
describe('Spinner', () => {
|
describe('Spinner', () => {
|
||||||
/**
|
/**
|
||||||
* Get the material progress spinner
|
* Get the material progress spinner
|
||||||
*
|
|
||||||
* @returns debug element
|
* @returns debug element
|
||||||
*/
|
*/
|
||||||
async function getSpinner(): Promise<MatProgressSpinnerHarness> {
|
async function getSpinner(): Promise<MatProgressSpinnerHarness> {
|
||||||
|
@@ -85,7 +85,6 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Default top list.
|
* Default top list.
|
||||||
*
|
|
||||||
* @param tags tags which should be displayed as default tags for top list.
|
* @param tags tags which should be displayed as default tags for top list.
|
||||||
*/
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
@@ -106,7 +105,6 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decides if input for tags creation/searching should be visible. When input is hidden then panel of existing tags is hidden as well.
|
* Decides if input for tags creation/searching should be visible. When input is hidden then panel of existing tags is hidden as well.
|
||||||
*
|
|
||||||
* @param tagNameControlVisible true if input should be visible, false otherwise.
|
* @param tagNameControlVisible true if input should be visible, false otherwise.
|
||||||
*/
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
@@ -273,7 +271,6 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* Remove tag from top list. In case that tag was part of search result then that tag is moved to bottom list
|
* Remove tag from top list. In case that tag was part of search result then that tag is moved to bottom list
|
||||||
* (list of existing tags) after removing so user can reselect it again later.
|
* (list of existing tags) after removing so user can reselect it again later.
|
||||||
*
|
|
||||||
* @param tag tag's name which should be removed from top list.
|
* @param tag tag's name which should be removed from top list.
|
||||||
*/
|
*/
|
||||||
removeTag(tag: string): void {
|
removeTag(tag: string): void {
|
||||||
@@ -287,7 +284,6 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when user selects any tag from list of existing tags. It moves tag from existing tags list to top list.
|
* Called when user selects any tag from list of existing tags. It moves tag from existing tags list to top list.
|
||||||
*
|
|
||||||
* @param selectedTag changes
|
* @param selectedTag changes
|
||||||
*/
|
*/
|
||||||
addExistingTagToTagsToAssign(selectedTag: TagEntry): void {
|
addExistingTagToTagsToAssign(selectedTag: TagEntry): void {
|
||||||
@@ -302,7 +298,6 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if component is in Create mode.
|
* Checks if component is in Create mode.
|
||||||
*
|
|
||||||
* @returns `true` if `Create` mode, `false` otherwise.
|
* @returns `true` if `Create` mode, `false` otherwise.
|
||||||
*/
|
*/
|
||||||
isOnlyCreateMode(): boolean {
|
isOnlyCreateMode(): boolean {
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
import { NodeEntry } from '@alfresco/js-api';
|
import { NodeEntry } from '@alfresco/js-api';
|
||||||
|
|
||||||
export class TreeBaseNode {
|
export class TreeBaseNode {
|
||||||
|
|
||||||
name: string;
|
name: string;
|
||||||
nodeId: string;
|
nodeId: string;
|
||||||
level: number;
|
level: number;
|
||||||
@@ -31,6 +30,5 @@ export class TreeBaseNode {
|
|||||||
this.level = level ? level : 0;
|
this.level = level ? level : 0;
|
||||||
this.expandable = expandable ? expandable : true;
|
this.expandable = expandable ? expandable : true;
|
||||||
this.node = nodeEntry ? new NodeEntry(nodeEntry) : undefined;
|
this.node = nodeEntry ? new NodeEntry(nodeEntry) : undefined;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -169,7 +169,6 @@ export class TreeComponent<T extends TreeNode> implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if node is LoadMoreNode node
|
* Checks if node is LoadMoreNode node
|
||||||
*
|
|
||||||
* @param _idx (unused)
|
* @param _idx (unused)
|
||||||
* @param node node to be checked
|
* @param node node to be checked
|
||||||
* @returns `true` if there are more items to load, otherwise `false`
|
* @returns `true` if there are more items to load, otherwise `false`
|
||||||
@@ -180,7 +179,6 @@ export class TreeComponent<T extends TreeNode> implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if tree is empty
|
* Checks if tree is empty
|
||||||
*
|
|
||||||
* @returns boolean
|
* @returns boolean
|
||||||
*/
|
*/
|
||||||
public isEmpty(): boolean {
|
public isEmpty(): boolean {
|
||||||
@@ -189,7 +187,6 @@ export class TreeComponent<T extends TreeNode> implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns action icon based on expanded/collapsed node state.
|
* Returns action icon based on expanded/collapsed node state.
|
||||||
*
|
|
||||||
* @param node node to be checked
|
* @param node node to be checked
|
||||||
* @returns collapse or expand icon
|
* @returns collapse or expand icon
|
||||||
*/
|
*/
|
||||||
@@ -199,7 +196,6 @@ export class TreeComponent<T extends TreeNode> implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes the tree, root nodes are reloaded, tree selection is cleared.
|
* Refreshes the tree, root nodes are reloaded, tree selection is cleared.
|
||||||
*
|
|
||||||
* @param skipCount Number of root nodes to skip.
|
* @param skipCount Number of root nodes to skip.
|
||||||
* @param maxItems Maximum number of nodes returned from Observable.
|
* @param maxItems Maximum number of nodes returned from Observable.
|
||||||
* @param searchTerm Specifies if categories should be filtered out by name or not. If not specified then returns categories without filtering.
|
* @param searchTerm Specifies if categories should be filtered out by name or not. If not specified then returns categories without filtering.
|
||||||
@@ -217,7 +213,6 @@ export class TreeComponent<T extends TreeNode> implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Collapses or expanding the node based on its current state
|
* Collapses or expanding the node based on its current state
|
||||||
*
|
|
||||||
* @param node node to be collapsed/expanded
|
* @param node node to be collapsed/expanded
|
||||||
*/
|
*/
|
||||||
public expandCollapseNode(node: T): void {
|
public expandCollapseNode(node: T): void {
|
||||||
@@ -242,7 +237,6 @@ export class TreeComponent<T extends TreeNode> implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads more subnode for a given parent node
|
* Loads more subnode for a given parent node
|
||||||
*
|
|
||||||
* @param node parent node
|
* @param node parent node
|
||||||
*/
|
*/
|
||||||
public loadMoreSubnodes(node: T): void {
|
public loadMoreSubnodes(node: T): void {
|
||||||
@@ -266,7 +260,6 @@ export class TreeComponent<T extends TreeNode> implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* When node is selected it selects all its descendants
|
* When node is selected it selects all its descendants
|
||||||
*
|
|
||||||
* @param node selected node
|
* @param node selected node
|
||||||
*/
|
*/
|
||||||
public onNodeSelected(node: T): void {
|
public onNodeSelected(node: T): void {
|
||||||
@@ -282,7 +275,6 @@ export class TreeComponent<T extends TreeNode> implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if all descendants of a node are selected
|
* Checks if all descendants of a node are selected
|
||||||
*
|
|
||||||
* @param node selected node
|
* @param node selected node
|
||||||
* @returns boolean
|
* @returns boolean
|
||||||
*/
|
*/
|
||||||
@@ -293,7 +285,6 @@ export class TreeComponent<T extends TreeNode> implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if some descendants of a node are selected
|
* Checks if some descendants of a node are selected
|
||||||
*
|
|
||||||
* @param node selected node
|
* @param node selected node
|
||||||
* @returns boolean
|
* @returns boolean
|
||||||
*/
|
*/
|
||||||
|
@@ -23,10 +23,10 @@ import { TreeService } from '../services/tree.service';
|
|||||||
import { treeNodesMockExpanded } from './tree-node.mock';
|
import { treeNodesMockExpanded } from './tree-node.mock';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class TreeServiceMock extends TreeService<TreeNode> {
|
export class TreeServiceMock extends TreeService<TreeNode> {
|
||||||
public getSubNodes(parentNodeId: string, skipCount?: number, maxItems?: number): Observable<TreeResponse<TreeNode>> {
|
public getSubNodes(parentNodeId: string, skipCount?: number, maxItems?: number): Observable<TreeResponse<TreeNode>> {
|
||||||
if (parentNodeId) {
|
if (parentNodeId) {
|
||||||
return of({pagination: {skipCount, maxItems}, entries: Array.from(treeNodesMockExpanded)});
|
return of({ pagination: { skipCount, maxItems }, entries: Array.from(treeNodesMockExpanded) });
|
||||||
}
|
}
|
||||||
return of();
|
return of();
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,6 @@ export abstract class TreeService<T extends TreeNode> extends DataSource<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Expands node applying subnodes to it.
|
* Expands node applying subnodes to it.
|
||||||
*
|
|
||||||
* @param nodeToExpand Node to be expanded
|
* @param nodeToExpand Node to be expanded
|
||||||
* @param subNodes List of nodes that will be added as children of expanded node
|
* @param subNodes List of nodes that will be added as children of expanded node
|
||||||
*/
|
*/
|
||||||
@@ -65,7 +64,6 @@ export abstract class TreeService<T extends TreeNode> extends DataSource<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Collapses a node removing all children from it.
|
* Collapses a node removing all children from it.
|
||||||
*
|
|
||||||
* @param nodeToCollapse Node to be collapsed
|
* @param nodeToCollapse Node to be collapsed
|
||||||
*/
|
*/
|
||||||
public collapseNode(nodeToCollapse: T): void {
|
public collapseNode(nodeToCollapse: T): void {
|
||||||
@@ -81,7 +79,6 @@ export abstract class TreeService<T extends TreeNode> extends DataSource<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Append more child nodes to already expanded parent node
|
* Append more child nodes to already expanded parent node
|
||||||
*
|
|
||||||
* @param nodeToAppend Expanded parent node
|
* @param nodeToAppend Expanded parent node
|
||||||
* @param subNodes List of nodes that will be added as children of expanded node
|
* @param subNodes List of nodes that will be added as children of expanded node
|
||||||
*/
|
*/
|
||||||
@@ -98,7 +95,6 @@ export abstract class TreeService<T extends TreeNode> extends DataSource<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes provided node from the tree
|
* Removes provided node from the tree
|
||||||
*
|
|
||||||
* @param node Node to be removed
|
* @param node Node to be removed
|
||||||
*/
|
*/
|
||||||
public removeNode(node: T): void {
|
public removeNode(node: T): void {
|
||||||
@@ -107,7 +103,6 @@ export abstract class TreeService<T extends TreeNode> extends DataSource<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets children of the node
|
* Gets children of the node
|
||||||
*
|
|
||||||
* @param parentNode Parent node
|
* @param parentNode Parent node
|
||||||
* @returns children of parent node
|
* @returns children of parent node
|
||||||
*/
|
*/
|
||||||
@@ -117,7 +112,6 @@ export abstract class TreeService<T extends TreeNode> extends DataSource<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if tree is empty
|
* Checks if tree is empty
|
||||||
*
|
|
||||||
* @returns boolean
|
* @returns boolean
|
||||||
*/
|
*/
|
||||||
public isEmpty(): boolean {
|
public isEmpty(): boolean {
|
||||||
@@ -126,7 +120,6 @@ export abstract class TreeService<T extends TreeNode> extends DataSource<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets parent node of given node. If node with parentNodeId is not found it returns undefined.
|
* Gets parent node of given node. If node with parentNodeId is not found it returns undefined.
|
||||||
*
|
|
||||||
* @param parentNodeId Id of a parent node to be found
|
* @param parentNodeId Id of a parent node to be found
|
||||||
* @returns parent node or undefined when not found
|
* @returns parent node or undefined when not found
|
||||||
*/
|
*/
|
||||||
|
@@ -88,9 +88,7 @@ export abstract class UploadBase implements OnInit, OnDestroy {
|
|||||||
protected onDestroy$ = new Subject<boolean>();
|
protected onDestroy$ = new Subject<boolean>();
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.uploadService.fileUploadError
|
this.uploadService.fileUploadError.pipe(takeUntil(this.onDestroy$)).subscribe((error) => this.error.emit(error));
|
||||||
.pipe(takeUntil(this.onDestroy$))
|
|
||||||
.subscribe(error => this.error.emit(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
@@ -100,35 +98,29 @@ export abstract class UploadBase implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload a list of file in the specified path
|
* Upload a list of file in the specified path
|
||||||
*
|
|
||||||
* @param files files to upload
|
* @param files files to upload
|
||||||
*/
|
*/
|
||||||
uploadFiles(files: File[]): void {
|
uploadFiles(files: File[]): void {
|
||||||
const filteredFiles: FileModel[] = files
|
const filteredFiles: FileModel[] = files.map<FileModel>((file: File) =>
|
||||||
.map<FileModel>((file: File) => this.createFileModel(file, this.rootFolderId, ((file as any).webkitRelativePath || '').replace(/\/[^/]*$/, '')));
|
this.createFileModel(file, this.rootFolderId, ((file as any).webkitRelativePath || '').replace(/\/[^/]*$/, ''))
|
||||||
|
);
|
||||||
|
|
||||||
this.uploadQueue(filteredFiles);
|
this.uploadQueue(filteredFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadFilesInfo(files: FileInfo[]): void {
|
uploadFilesInfo(files: FileInfo[]): void {
|
||||||
const filteredFiles: FileModel[] = files
|
const filteredFiles: FileModel[] = files.map<FileModel>((fileInfo: FileInfo) =>
|
||||||
.map<FileModel>((fileInfo: FileInfo) => this.createFileModel(fileInfo.file, this.rootFolderId, fileInfo.relativeFolder));
|
this.createFileModel(fileInfo.file, this.rootFolderId, fileInfo.relativeFolder)
|
||||||
|
);
|
||||||
|
|
||||||
this.uploadQueue(filteredFiles);
|
this.uploadQueue(filteredFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
private uploadQueue(files: FileModel[]) {
|
private uploadQueue(files: FileModel[]) {
|
||||||
const filteredFiles = files
|
const filteredFiles = files.filter(this.isFileAcceptable.bind(this)).filter(this.isFileSizeAcceptable.bind(this));
|
||||||
.filter(this.isFileAcceptable.bind(this))
|
|
||||||
.filter(this.isFileSizeAcceptable.bind(this));
|
|
||||||
|
|
||||||
this.ngZone.run(() => {
|
this.ngZone.run(() => {
|
||||||
const event = new UploadFilesEvent(
|
const event = new UploadFilesEvent([...filteredFiles], this.uploadService, this.success, this.error);
|
||||||
[...filteredFiles],
|
|
||||||
this.uploadService,
|
|
||||||
this.success,
|
|
||||||
this.error
|
|
||||||
);
|
|
||||||
this.beginUpload.emit(event);
|
this.beginUpload.emit(event);
|
||||||
|
|
||||||
if (!event.defaultPrevented) {
|
if (!event.defaultPrevented) {
|
||||||
@@ -142,7 +134,6 @@ export abstract class UploadBase implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the given file is allowed by the extension filters
|
* Checks if the given file is allowed by the extension filters
|
||||||
*
|
|
||||||
* @param file FileModel
|
* @param file FileModel
|
||||||
* @returns `true` if file is acceptable, otherwise `false`
|
* @returns `true` if file is acceptable, otherwise `false`
|
||||||
*/
|
*/
|
||||||
@@ -151,16 +142,13 @@ export abstract class UploadBase implements OnInit, OnDestroy {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const allowedExtensions = this.acceptedFilesType
|
const allowedExtensions = this.acceptedFilesType.split(',').map((ext) => ext.trim().replace(/^\./, ''));
|
||||||
.split(',')
|
|
||||||
.map((ext) => ext.trim().replace(/^\./, ''));
|
|
||||||
|
|
||||||
return allowedExtensions.indexOf(file.extension) !== -1;
|
return allowedExtensions.indexOf(file.extension) !== -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates FileModel from File
|
* Creates FileModel from File
|
||||||
*
|
|
||||||
* @param file file instance
|
* @param file file instance
|
||||||
* @param parentId parent id
|
* @param parentId parent id
|
||||||
* @param path upload path
|
* @param path upload path
|
||||||
@@ -168,14 +156,18 @@ export abstract class UploadBase implements OnInit, OnDestroy {
|
|||||||
* @returns file model
|
* @returns file model
|
||||||
*/
|
*/
|
||||||
protected createFileModel(file: File, parentId: string, path: string, id?: string): FileModel {
|
protected createFileModel(file: File, parentId: string, path: string, id?: string): FileModel {
|
||||||
return new FileModel(file, {
|
return new FileModel(
|
||||||
comment: this.comment,
|
file,
|
||||||
majorVersion: this.majorVersion,
|
{
|
||||||
newVersion: this.versioning,
|
comment: this.comment,
|
||||||
parentId,
|
majorVersion: this.majorVersion,
|
||||||
path,
|
newVersion: this.versioning,
|
||||||
nodeType: this.nodeType
|
parentId,
|
||||||
}, id);
|
path,
|
||||||
|
nodeType: this.nodeType
|
||||||
|
},
|
||||||
|
id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected isFileSizeAllowed(file: FileModel) {
|
protected isFileSizeAllowed(file: FileModel) {
|
||||||
@@ -197,7 +189,6 @@ export abstract class UploadBase implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the given file is an acceptable size
|
* Checks if the given file is an acceptable size
|
||||||
*
|
|
||||||
* @param file FileModel
|
* @param file FileModel
|
||||||
* @returns `true` if file size is acceptable, otherwise `false`
|
* @returns `true` if file size is acceptable, otherwise `false`
|
||||||
*/
|
*/
|
||||||
@@ -207,15 +198,11 @@ export abstract class UploadBase implements OnInit, OnDestroy {
|
|||||||
if (!this.isFileSizeAllowed(file)) {
|
if (!this.isFileSizeAllowed(file)) {
|
||||||
acceptableSize = false;
|
acceptableSize = false;
|
||||||
|
|
||||||
const message = this.translationService.instant(
|
const message = this.translationService.instant('FILE_UPLOAD.MESSAGES.EXCEED_MAX_FILE_SIZE', { fileName: file.name });
|
||||||
'FILE_UPLOAD.MESSAGES.EXCEED_MAX_FILE_SIZE',
|
|
||||||
{ fileName: file.name }
|
|
||||||
);
|
|
||||||
|
|
||||||
this.error.emit(message);
|
this.error.emit(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return acceptableSize;
|
return acceptableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user