mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
Adjust ADF to latest JS-API version (#8882)
* Bump js-api version * Fix imports * Fix content-services unit tests * Fix process-services unit tests * [ci:force] Trigger CI * Fix code smells * Fix orderBy param * Fix code smells * Fix failing unit tests * Bump js-api version and align with new changes * Remove dangling coma * Fix delete return type * Add correct date format in task filters e2es * Fix typing in task filter sorting * Fix activiti content api import * Add null check for has avatar * Make User class instead of type * Fix user type in comment model * Fix sonar cloud issue * Type fixes * Update js-api version
This commit is contained in:
parent
876ca7a0a7
commit
76e2870c66
@ -31,7 +31,7 @@ Deletes multiple files and folders.
|
|||||||
| Name | Type | Default value | Description |
|
| Name | Type | Default value | Description |
|
||||||
| ---- | ---- | ------------- | ----------- |
|
| ---- | ---- | ------------- | ----------- |
|
||||||
| permanent | `boolean` | false | If true then the nodes are deleted immediately rather than being put in the trash |
|
| permanent | `boolean` | false | If true then the nodes are deleted immediately rather than being put in the trash |
|
||||||
| selection | [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`[] \| DeletedNodeEntity[]` | | Array of nodes to delete. |
|
| selection | [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`[] \| DeletedNodeEntry[]` | | Array of nodes to delete. |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ Deletes multiple files and folders.
|
|||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
Note that if a target item is already in the trashcan (and is therefore a `DeletedNodeEntity`) then
|
Note that if a target item is already in the trashcan (and is therefore a `DeletedNodeEntry`) then
|
||||||
this action will delete the file permanently.
|
this action will delete the file permanently.
|
||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
@ -38,7 +38,7 @@ Restores deleted nodes to their original location.
|
|||||||
this.documentList.reload();
|
this.documentList.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateLocation(path: PathInfoEntity) {
|
navigateLocation(path: PathInfo) {
|
||||||
const parent = path.elements[path.elements.length - 1];
|
const parent = path.elements[path.elements.length - 1];
|
||||||
this.router.navigate(['files/', parent.id]);
|
this.router.navigate(['files/', parent.id]);
|
||||||
}
|
}
|
||||||
|
@ -108,14 +108,14 @@ describe('Start Task - Custom App', () => {
|
|||||||
for (let i = 0; i < 3; i++) {
|
for (let i = 0; i < 3; i++) {
|
||||||
completedTasks[i] = await tasksApi.createNewTask(new TaskRepresentation({
|
completedTasks[i] = await tasksApi.createNewTask(new TaskRepresentation({
|
||||||
name: completedTasksName[i],
|
name: completedTasksName[i],
|
||||||
dueDate: DateUtil.formatDate('YYYY-MM-DDTHH:mm:ss.SSSZ', new Date(), i + 2)
|
dueDate: new Date(DateUtil.formatDate('YYYY-MM-DDTHH:mm:ss.SSSZ', new Date(), i + 2))
|
||||||
}));
|
}));
|
||||||
await taskActionsApi.completeTask(completedTasks[i].id);
|
await taskActionsApi.completeTask(completedTasks[i].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
taskWithDueDate = await tasksApi.createNewTask(new TaskRepresentation({
|
taskWithDueDate = await tasksApi.createNewTask(new TaskRepresentation({
|
||||||
name: paginationTasksName[0],
|
name: paginationTasksName[0],
|
||||||
dueDate: currentDateStandardFormat
|
dueDate: new Date(currentDateStandardFormat)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
await loginPage.login(processUserModel.username, processUserModel.password);
|
await loginPage.login(processUserModel.username, processUserModel.password);
|
||||||
|
@ -30,8 +30,7 @@ import * as fs from 'fs';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { FileModel } from '../../models/ACS/file.model';
|
import { FileModel } from '../../models/ACS/file.model';
|
||||||
import CONSTANTS = require('../../util/constants');
|
import CONSTANTS = require('../../util/constants');
|
||||||
import { Activiti, RelatedContentRepresentation } from '@alfresco/js-api';
|
import { ActivitiContentApi, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||||
import ContentApi = Activiti.ContentApi;
|
|
||||||
|
|
||||||
describe('Attachment list action menu for tasks', () => {
|
describe('Attachment list action menu for tasks', () => {
|
||||||
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
|
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
|
||||||
@ -46,8 +45,7 @@ describe('Attachment list action menu for tasks', () => {
|
|||||||
const usersActions = new UsersActions(apiService);
|
const usersActions = new UsersActions(apiService);
|
||||||
const modelsActions = new ModelsActions(apiService);
|
const modelsActions = new ModelsActions(apiService);
|
||||||
const taskUtil = new TaskUtil(apiService);
|
const taskUtil = new TaskUtil(apiService);
|
||||||
const contentApi = new ContentApi();
|
const contentApi = new ActivitiContentApi(apiService.getInstance());
|
||||||
contentApi.init(apiService.getInstance());
|
|
||||||
|
|
||||||
const pngFile = new FileModel({
|
const pngFile = new FileModel({
|
||||||
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location,
|
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location,
|
||||||
|
@ -91,7 +91,7 @@ describe('Task Filters Sorting', () => {
|
|||||||
appId,
|
appId,
|
||||||
name: 'Newest first',
|
name: 'Newest first',
|
||||||
icon: 'glyphicon-filter',
|
icon: 'glyphicon-filter',
|
||||||
filter: { sort: 'created-desc', state: 'completed', assignment: 'involved' }
|
filter: { sort: 'created-desc', state: 'completed' }
|
||||||
});
|
});
|
||||||
await userFiltersUtil.createUserTaskFilter(newFilter);
|
await userFiltersUtil.createUserTaskFilter(newFilter);
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ describe('Task Filters Sorting', () => {
|
|||||||
appId,
|
appId,
|
||||||
name: 'Newest last',
|
name: 'Newest last',
|
||||||
icon: 'glyphicon-filter',
|
icon: 'glyphicon-filter',
|
||||||
filter: { sort: 'created-asc', state: 'completed', assignment: 'involved' }
|
filter: { sort: 'created-asc', state: 'completed' }
|
||||||
});
|
});
|
||||||
await userFiltersUtil.createUserTaskFilter(newFilter);
|
await userFiltersUtil.createUserTaskFilter(newFilter);
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ describe('Task Filters Sorting', () => {
|
|||||||
appId,
|
appId,
|
||||||
name: 'Due first',
|
name: 'Due first',
|
||||||
icon: 'glyphicon-filter',
|
icon: 'glyphicon-filter',
|
||||||
filter: { sort: 'due-desc', state: 'completed', assignment: 'involved' }
|
filter: { sort: 'due-desc', state: 'completed' }
|
||||||
});
|
});
|
||||||
await userFiltersUtil.createUserTaskFilter(newFilter);
|
await userFiltersUtil.createUserTaskFilter(newFilter);
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ describe('Task Filters Sorting', () => {
|
|||||||
appId,
|
appId,
|
||||||
name: 'Due last',
|
name: 'Due last',
|
||||||
icon: 'glyphicon-filter',
|
icon: 'glyphicon-filter',
|
||||||
filter: { sort: 'due-asc', state: 'completed', assignment: 'involved' }
|
filter: { sort: 'due-asc', state: 'completed' }
|
||||||
});
|
});
|
||||||
await userFiltersUtil.createUserTaskFilter(newFilter);
|
await userFiltersUtil.createUserTaskFilter(newFilter);
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ describe('Task Filters Sorting', () => {
|
|||||||
appId,
|
appId,
|
||||||
name: 'Newest first Open',
|
name: 'Newest first Open',
|
||||||
icon: 'glyphicon-filter',
|
icon: 'glyphicon-filter',
|
||||||
filter: { sort: 'created-desc', state: 'open', assignment: 'involved' }
|
filter: { sort: 'created-desc', state: 'open' }
|
||||||
});
|
});
|
||||||
await userFiltersUtil.createUserTaskFilter(newFilter);
|
await userFiltersUtil.createUserTaskFilter(newFilter);
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ describe('Task Filters Sorting', () => {
|
|||||||
appId,
|
appId,
|
||||||
name: 'Newest last Open',
|
name: 'Newest last Open',
|
||||||
icon: 'glyphicon-filter',
|
icon: 'glyphicon-filter',
|
||||||
filter: { sort: 'created-asc', state: 'open', assignment: 'involved' }
|
filter: { sort: 'created-asc', state: 'open' }
|
||||||
});
|
});
|
||||||
await userFiltersUtil.createUserTaskFilter(newFilter);
|
await userFiltersUtil.createUserTaskFilter(newFilter);
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ describe('Task Filters Sorting', () => {
|
|||||||
appId,
|
appId,
|
||||||
name: 'Due first Open',
|
name: 'Due first Open',
|
||||||
icon: 'glyphicon-filter',
|
icon: 'glyphicon-filter',
|
||||||
filter: { sort: 'due-desc', state: 'open', assignment: 'involved' }
|
filter: { sort: 'due-desc', state: 'open' }
|
||||||
});
|
});
|
||||||
await userFiltersUtil.createUserTaskFilter(newFilter);
|
await userFiltersUtil.createUserTaskFilter(newFilter);
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ describe('Task Filters Sorting', () => {
|
|||||||
appId,
|
appId,
|
||||||
name: 'Due last Open',
|
name: 'Due last Open',
|
||||||
icon: 'glyphicon-filter',
|
icon: 'glyphicon-filter',
|
||||||
filter: { sort: 'due-asc', state: 'open', assignment: 'involved' }
|
filter: { sort: 'due-asc', state: 'open' }
|
||||||
});
|
});
|
||||||
await userFiltersUtil.createUserTaskFilter(newFilter);
|
await userFiltersUtil.createUserTaskFilter(newFilter);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
"dist": "rm -rf ../../dist/libs/cli && npm run build && cp -R ./bin ../../dist/libs/cli && cp -R ./resources ../../dist/libs/cli && cp -R ./templates ../../dist/libs/cli && cp ./package.json ../../dist/libs/cli"
|
"dist": "rm -rf ../../dist/libs/cli && npm run build && cp -R ./bin ../../dist/libs/cli && cp -R ./resources ../../dist/libs/cli && cp -R ./templates ../../dist/libs/cli && cp ./package.json ../../dist/libs/cli"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alfresco/js-api": ">=6.3.0-1108",
|
"@alfresco/js-api": ">=6.3.0-1271",
|
||||||
"commander": "^6.2.1",
|
"commander": "^6.2.1",
|
||||||
"ejs": "^3.1.9",
|
"ejs": "^3.1.9",
|
||||||
"license-checker": "^25.0.1",
|
"license-checker": "^25.0.1",
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"@angular/platform-browser": ">=14.1.3",
|
"@angular/platform-browser": ">=14.1.3",
|
||||||
"@angular/platform-browser-dynamic": ">=14.1.3",
|
"@angular/platform-browser-dynamic": ">=14.1.3",
|
||||||
"@angular/router": ">=14.1.3",
|
"@angular/router": ">=14.1.3",
|
||||||
"@alfresco/js-api": ">=6.3.0-1108",
|
"@alfresco/js-api": ">=6.3.0-1271",
|
||||||
"@ngx-translate/core": ">=14.0.0",
|
"@ngx-translate/core": ">=14.0.0",
|
||||||
"moment": ">=2.22.2",
|
"moment": ">=2.22.2",
|
||||||
"@alfresco/adf-core": ">=6.2.0"
|
"@alfresco/adf-core": ">=6.2.0"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { PersonEntry, Person, PersonPaging } from '@alfresco/js-api';
|
import { PersonEntry, Person, PersonPaging } from '@alfresco/js-api';
|
||||||
|
|
||||||
export const fakeEcmUser = {
|
export const fakeEcmUser: Person = {
|
||||||
id: 'fake-id',
|
id: 'fake-id',
|
||||||
firstName: 'fake-ecm-first-name',
|
firstName: 'fake-ecm-first-name',
|
||||||
lastName: 'fake-ecm-last-name',
|
lastName: 'fake-ecm-last-name',
|
||||||
@ -32,7 +32,7 @@ export const fakeEcmUser = {
|
|||||||
location: 'fake location',
|
location: 'fake location',
|
||||||
mobile: '000000000',
|
mobile: '000000000',
|
||||||
telephone: '11111111',
|
telephone: '11111111',
|
||||||
statusUpdatedAt: 'fake-date',
|
statusUpdatedAt: new Date(),
|
||||||
userStatus: 'active',
|
userStatus: 'active',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
emailNotificationsEnabled: true
|
emailNotificationsEnabled: true
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { ContentService } from './content.service';
|
import { ContentService } from './content.service';
|
||||||
import { AppConfigService, AuthenticationService, StorageService, CoreTestingModule } from '@alfresco/adf-core';
|
import { AppConfigService, AuthenticationService, StorageService, CoreTestingModule } from '@alfresco/adf-core';
|
||||||
import { Node } from '@alfresco/js-api';
|
import { Node, PermissionsInfo } from '@alfresco/js-api';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
@ -140,12 +140,12 @@ describe('ContentService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should havePermission return true if the permissions is empty and the permission to check is Consumer', () => {
|
it('should havePermission return true if the permissions is empty and the permission to check is Consumer', () => {
|
||||||
const permissionNode = new Node({ permissions: [] });
|
const permissionNode = new Node({ permissions: new PermissionsInfo() });
|
||||||
expect(contentService.hasPermissions(permissionNode, 'Consumer', 'user1')).toBeTruthy();
|
expect(contentService.hasPermissions(permissionNode, 'Consumer', 'user1')).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should havePermission return false if the permissions is empty and the permission to check is not Consumer', () => {
|
it('should havePermission return false if the permissions is empty and the permission to check is not Consumer', () => {
|
||||||
const permissionNode = new Node({ permissions: [] });
|
const permissionNode = new Node({ permissions: new PermissionsInfo() });
|
||||||
expect(contentService.hasPermissions(permissionNode, '!Consumer', 'user1')).toBeFalsy();
|
expect(contentService.hasPermissions(permissionNode, '!Consumer', 'user1')).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ describe('UploadService', () => {
|
|||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
{ newVersion: true },
|
{ newVersion: true, name: 'fake-name', nodeType: undefined },
|
||||||
{
|
{
|
||||||
renditions: 'doclib',
|
renditions: 'doclib',
|
||||||
include: ['allowableOperations'],
|
include: ['allowableOperations'],
|
||||||
@ -376,7 +376,7 @@ describe('UploadService', () => {
|
|||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
{ newVersion: false },
|
{ newVersion: false, name: 'file-name', nodeType: undefined },
|
||||||
{
|
{
|
||||||
include: [ 'allowableOperations' ],
|
include: [ 'allowableOperations' ],
|
||||||
renditions: 'doclib',
|
renditions: 'doclib',
|
||||||
@ -402,7 +402,7 @@ describe('UploadService', () => {
|
|||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
{ newVersion: false },
|
{ newVersion: false, name: 'file-name', nodeType: undefined },
|
||||||
{
|
{
|
||||||
include: [ 'allowableOperations' ],
|
include: [ 'allowableOperations' ],
|
||||||
renditions: 'doclib',
|
renditions: 'doclib',
|
||||||
@ -434,6 +434,8 @@ describe('UploadService', () => {
|
|||||||
'123',
|
'123',
|
||||||
{
|
{
|
||||||
newVersion: false,
|
newVersion: false,
|
||||||
|
name: 'fake-name',
|
||||||
|
nodeType: undefined,
|
||||||
parentId: '123',
|
parentId: '123',
|
||||||
path: 'fake-dir',
|
path: 'fake-dir',
|
||||||
secondaryChildren: [ { assocType: 'assoc-1', childId: 'child-id' }],
|
secondaryChildren: [ { assocType: 'assoc-1', childId: 'child-id' }],
|
||||||
@ -547,7 +549,7 @@ describe('UploadService', () => {
|
|||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
{ newVersion: true },
|
{ newVersion: true, name: 'fake-name', nodeType: undefined },
|
||||||
{
|
{
|
||||||
include: ['allowableOperations'],
|
include: ['allowableOperations'],
|
||||||
overwrite: true,
|
overwrite: true,
|
||||||
|
@ -28,7 +28,7 @@ import { FileModel, FileUploadProgress, FileUploadStatus } from '../models/file.
|
|||||||
import { AppConfigService, AlfrescoApiService } from '@alfresco/adf-core';
|
import { AppConfigService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
|
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
|
||||||
import { NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api';
|
import { NodeBodyCreate, NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api';
|
||||||
|
|
||||||
const MIN_CANCELLABLE_FILE_SIZE = 1000000;
|
const MIN_CANCELLABLE_FILE_SIZE = 1000000;
|
||||||
const MAX_CANCELLABLE_FILE_PERCENTAGE = 50;
|
const MAX_CANCELLABLE_FILE_PERCENTAGE = 50;
|
||||||
@ -237,7 +237,7 @@ export class UploadService {
|
|||||||
if (file.id) {
|
if (file.id) {
|
||||||
return this.nodesApi.updateNodeContent(file.id, file.file as any, opts);
|
return this.nodesApi.updateNodeContent(file.id, file.file as any, opts);
|
||||||
} else {
|
} else {
|
||||||
const nodeBody = {...file.options};
|
const nodeBody: NodeBodyCreate = { ...file.options, name: file.name, nodeType: file.options.nodeType };
|
||||||
delete nodeBody['versioningEnabled'];
|
delete nodeBody['versioningEnabled'];
|
||||||
|
|
||||||
return this.uploadApi.uploadFile(
|
return this.uploadApi.uploadFile(
|
||||||
|
@ -50,11 +50,11 @@ const fakeSiteList: SitePaging = new SitePaging({
|
|||||||
},
|
},
|
||||||
entries: [
|
entries: [
|
||||||
{
|
{
|
||||||
entry: {
|
entry: new Site({
|
||||||
id: 'FAKE',
|
id: 'FAKE',
|
||||||
guid: 'FAKE-GUID',
|
guid: 'FAKE-GUID',
|
||||||
title: 'FAKE-SITE-TITLE'
|
title: 'FAKE-SITE-TITLE'
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, fakeAsync, flush, TestBed, tick } from '@angular/core/testing';
|
import { ComponentFixture, fakeAsync, flush, TestBed, tick } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Node, NodeEntry, NodePaging, RequestScope, ResultSetPaging, SiteEntry, SitePaging } from '@alfresco/js-api';
|
import { Node, NodeEntry, NodePaging, RequestScope, ResultSetPaging, SiteEntry, SitePaging, SitePagingList } from '@alfresco/js-api';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
|
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
|
||||||
import { ContentTestingModule } from '../testing/content.testing.module';
|
import { ContentTestingModule } from '../testing/content.testing.module';
|
||||||
@ -134,13 +134,13 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
|||||||
list: {
|
list: {
|
||||||
pagination: {},
|
pagination: {},
|
||||||
entries: [],
|
entries: [],
|
||||||
source: {}
|
source: new Node()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
|
||||||
|
|
||||||
customResourcesService = TestBed.inject(CustomResourcesService);
|
customResourcesService = TestBed.inject(CustomResourcesService);
|
||||||
getCorrespondingNodeIdsSpy = spyOn(customResourcesService, 'getCorrespondingNodeIds').and.callFake((id) => {
|
getCorrespondingNodeIdsSpy = spyOn(customResourcesService, 'getCorrespondingNodeIds').and.callFake((id) => {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Node, NodeEntry, NodePaging, ResultSetPaging, SiteEntry, SitePaging, UserInfo } from '@alfresco/js-api';
|
import { Node, NodeEntry, NodePaging, PathElement, ResultSetPaging, Site, SiteEntry, SitePaging, SitePagingList, UserInfo } from '@alfresco/js-api';
|
||||||
import { AppConfigService, DataRow, ThumbnailService, DataColumn } from '@alfresco/adf-core';
|
import { AppConfigService, DataRow, ThumbnailService, DataColumn } from '@alfresco/adf-core';
|
||||||
import { ContentService } from '../common/services/content.service';
|
import { ContentService } from '../common/services/content.service';
|
||||||
import { UploadService } from '../common/services/upload.service';
|
import { UploadService } from '../common/services/upload.service';
|
||||||
@ -123,7 +123,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
|||||||
|
|
||||||
describe('Site selection', () => {
|
describe('Site selection', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
|
||||||
component.currentFolderId = 'fake-starting-folder';
|
component.currentFolderId = 'fake-starting-folder';
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should trigger siteChange event when a site is selected in sites-dropdown', async () => {
|
it('should trigger siteChange event when a site is selected in sites-dropdown', async () => {
|
||||||
const fakeSiteEntry = new SiteEntry({ entry: { title: 'fake-new-site', guid: 'fake-new-site' } });
|
const fakeSiteEntry = new SiteEntry({ entry: new Site({ title: 'fake-new-site', guid: 'fake-new-site' }) });
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
@ -162,9 +162,9 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
|||||||
spyOn(sitesService, 'getSites').and.returnValue(
|
spyOn(sitesService, 'getSites').and.returnValue(
|
||||||
of(
|
of(
|
||||||
new SitePaging({
|
new SitePaging({
|
||||||
list: {
|
list: new SitePagingList({
|
||||||
entries: [{ entry: { guid: 'namek', id: 'namek' } }, { entry: { guid: 'blog', id: 'blog' } }]
|
entries: [{ entry: new Site({ guid: 'namek', id: 'namek' }) }, { entry: new Site({ guid: 'blog', id: 'blog' }) }]
|
||||||
}
|
})
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -262,7 +262,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
|||||||
|
|
||||||
spyOn(documentListService, 'getFolderNode').and.returnValue(of(new NodeEntry()));
|
spyOn(documentListService, 'getFolderNode').and.returnValue(of(new NodeEntry()));
|
||||||
spyOn(documentListService, 'getFolder').and.returnValue(throwError('No results for test'));
|
spyOn(documentListService, 'getFolder').and.returnValue(throwError('No results for test'));
|
||||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
|
||||||
|
|
||||||
component.currentFolderId = 'cat-girl-nuku-nuku';
|
component.currentFolderId = 'cat-girl-nuku-nuku';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -303,7 +303,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
|||||||
searchQueryBuilderService.update();
|
searchQueryBuilderService.update();
|
||||||
triggerSearchResults(fakeResultSetPaging);
|
triggerSearchResults(fakeResultSetPaging);
|
||||||
|
|
||||||
const chosenNode = new Node({ path: { elements: ['one'] } });
|
const chosenNode = new Node({ path: { elements: [new PathElement({ name: 'one' })] } });
|
||||||
component.onCurrentSelection([{ entry: chosenNode }]);
|
component.onCurrentSelection([{ entry: chosenNode }]);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
|||||||
searchQueryBuilderService.update();
|
searchQueryBuilderService.update();
|
||||||
triggerSearchResults(fakeResultSetPaging);
|
triggerSearchResults(fakeResultSetPaging);
|
||||||
|
|
||||||
const chosenNode = new Node({ path: { elements: ['fake-path'] }, isFile: false, isFolder: true });
|
const chosenNode = new Node({ path: { elements: [new PathElement({ name: 'fake-path' })] }, isFile: false, isFolder: true });
|
||||||
component.onCurrentSelection([{ entry: chosenNode }]);
|
component.onCurrentSelection([{ entry: chosenNode }]);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
|||||||
const rows = [{}, {}] as DataRow[];
|
const rows = [{}, {}] as DataRow[];
|
||||||
component.documentList.data = new ShareDataTableAdapter(thumbnailService, contentService, schema);
|
component.documentList.data = new ShareDataTableAdapter(thumbnailService, contentService, schema);
|
||||||
spyOn(component.documentList.data, 'getRows').and.returnValue(rows);
|
spyOn(component.documentList.data, 'getRows').and.returnValue(rows);
|
||||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should the selection become the currently navigated folder when the folder loads (Acts as destination for cases like copy action)', () => {
|
it('should the selection become the currently navigated folder when the folder loads (Acts as destination for cases like copy action)', () => {
|
||||||
@ -655,7 +655,10 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
|||||||
|
|
||||||
it('should return only the last uploaded node to become preselected when the selection mode is single', () => {
|
it('should return only the last uploaded node to become preselected when the selection mode is single', () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const fakeNodes = [new NodeEntry({ id: 'fakeNode1' }), new NodeEntry({ id: 'fakeNode2' })];
|
const fakeNodes = [
|
||||||
|
new NodeEntry({ entry: new Node({ id: 'fakeNode1' }) }),
|
||||||
|
new NodeEntry({ entry: new Node({ id: 'fakeNode2' }) })
|
||||||
|
];
|
||||||
component.currentUploadBatch = fakeNodes;
|
component.currentUploadBatch = fakeNodes;
|
||||||
component.selectionMode = 'single';
|
component.selectionMode = 'single';
|
||||||
|
|
||||||
@ -664,7 +667,10 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
|||||||
|
|
||||||
it('should return all the uploaded nodes to become preselected when the selection mode is multiple', () => {
|
it('should return all the uploaded nodes to become preselected when the selection mode is multiple', () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const fakeNodes = [new NodeEntry({ id: 'fakeNode1' }), new NodeEntry({ id: 'fakeNode2' })];
|
const fakeNodes = [
|
||||||
|
new NodeEntry({ entry: new Node({ id: 'fakeNode1' }) }),
|
||||||
|
new NodeEntry({ entry: new Node({ id: 'fakeNode2' }) })
|
||||||
|
];
|
||||||
component.currentUploadBatch = fakeNodes;
|
component.currentUploadBatch = fakeNodes;
|
||||||
component.selectionMode = 'multiple';
|
component.selectionMode = 'multiple';
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/materia
|
|||||||
import { CUSTOM_ELEMENTS_SCHEMA, EventEmitter } from '@angular/core';
|
import { CUSTOM_ELEMENTS_SCHEMA, EventEmitter } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { ContentNodeSelectorComponent } from './content-node-selector.component';
|
import { ContentNodeSelectorComponent } from './content-node-selector.component';
|
||||||
import { Node, NodeEntry, SitePaging } from '@alfresco/js-api';
|
import { Node, NodeEntry, SitePaging, SitePagingList } from '@alfresco/js-api';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { FileModel } from '../common/models/file.model';
|
import { FileModel } from '../common/models/file.model';
|
||||||
import { FileUploadEvent } from '../common/events/file.event';
|
import { FileUploadEvent } from '../common/events/file.event';
|
||||||
@ -88,7 +88,7 @@ describe('ContentNodeSelectorComponent', () => {
|
|||||||
|
|
||||||
spyOn(documentListService, 'getFolder');
|
spyOn(documentListService, 'getFolder');
|
||||||
spyOn(documentListService, 'getFolderNode');
|
spyOn(documentListService, 'getFolderNode');
|
||||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
|
||||||
|
|
||||||
fixture = TestBed.createComponent(ContentNodeSelectorComponent);
|
fixture = TestBed.createComponent(ContentNodeSelectorComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
@ -97,15 +97,12 @@ describe('ContentNodeSelectorComponent', () => {
|
|||||||
spyOn(contentService, 'hasAllowableOperations').and.returnValue(true);
|
spyOn(contentService, 'hasAllowableOperations').and.returnValue(true);
|
||||||
|
|
||||||
const fakeFolderNodeWithPermission = new NodeEntry({
|
const fakeFolderNodeWithPermission = new NodeEntry({
|
||||||
entry: {
|
entry: new Node({
|
||||||
allowableOperations: [
|
allowableOperations: ['create', 'update'],
|
||||||
'create',
|
|
||||||
'update'
|
|
||||||
],
|
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
name: 'Folder Fake Name',
|
name: 'Folder Fake Name',
|
||||||
nodeType: 'cm:folder'
|
nodeType: 'cm:folder'
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const nodesApiService = TestBed.inject(NodesApiService);
|
const nodesApiService = TestBed.inject(NodesApiService);
|
||||||
|
@ -113,7 +113,7 @@ describe('LibraryMembershipDirective', () => {
|
|||||||
mockSupportedVersion = false;
|
mockSupportedVersion = false;
|
||||||
getMembershipSpy = spyOn(directive['sitesApi'], 'getSiteMembershipRequestForPerson').and.returnValue(Promise.resolve({ entry: requestedMembershipResponse }));
|
getMembershipSpy = spyOn(directive['sitesApi'], 'getSiteMembershipRequestForPerson').and.returnValue(Promise.resolve({ entry: requestedMembershipResponse }));
|
||||||
addMembershipSpy = spyOn(directive['sitesApi'], 'createSiteMembershipRequestForPerson').and.returnValue(Promise.resolve({ entry: requestedMembershipResponse }));
|
addMembershipSpy = spyOn(directive['sitesApi'], 'createSiteMembershipRequestForPerson').and.returnValue(Promise.resolve({ entry: requestedMembershipResponse }));
|
||||||
deleteMembershipSpy = spyOn(directive['sitesApi'], 'deleteSiteMembershipRequestForPerson').and.returnValue(Promise.resolve({}));
|
deleteMembershipSpy = spyOn(directive['sitesApi'], 'deleteSiteMembershipRequestForPerson').and.returnValue(Promise.resolve());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should do nothing if there is no selected library ', fakeAsync(() => {
|
it('should do nothing if there is no selected library ', fakeAsync(() => {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
import { Directive, EventEmitter, HostListener, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
SiteEntry,
|
SiteEntry,
|
||||||
SiteMembershipRequestBody,
|
SiteMembershipRequestBodyCreate,
|
||||||
SiteMemberEntry,
|
SiteMemberEntry,
|
||||||
SiteMembershipRequestEntry,
|
SiteMembershipRequestEntry,
|
||||||
SitesApi
|
SitesApi
|
||||||
@ -208,7 +208,7 @@ export class LibraryMembershipDirective implements OnChanges {
|
|||||||
private joinLibraryRequest(): Observable<SiteMembershipRequestEntry> {
|
private joinLibraryRequest(): Observable<SiteMembershipRequestEntry> {
|
||||||
const memberBody = {
|
const memberBody = {
|
||||||
id: this.targetSite.id
|
id: this.targetSite.id
|
||||||
} as SiteMembershipRequestBody;
|
} as SiteMembershipRequestBodyCreate;
|
||||||
|
|
||||||
if (this.versionCompatibilityService.isVersionSupported('7.0.0')) {
|
if (this.versionCompatibilityService.isVersionSupported('7.0.0')) {
|
||||||
memberBody.client = 'workspace';
|
memberBody.client = 'workspace';
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
/* eslint-disable @angular-eslint/no-input-rename */
|
/* eslint-disable @angular-eslint/no-input-rename */
|
||||||
|
|
||||||
import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core';
|
import { Directive, ElementRef, EventEmitter, HostListener, Input, OnChanges, Output } from '@angular/core';
|
||||||
import { NodeEntry, Node, DeletedNodeEntity, DeletedNode, TrashcanApi, NodesApi } from '@alfresco/js-api';
|
import { NodeEntry, Node, DeletedNodeEntry, DeletedNode, TrashcanApi, NodesApi } from '@alfresco/js-api';
|
||||||
import { Observable, forkJoin, from, of } from 'rxjs';
|
import { Observable, forkJoin, from, of } from 'rxjs';
|
||||||
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
|
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
|
||||||
import { map, catchError, retry } from 'rxjs/operators';
|
import { map, catchError, retry } from 'rxjs/operators';
|
||||||
@ -51,7 +51,7 @@ interface ProcessStatus {
|
|||||||
export class NodeDeleteDirective implements OnChanges {
|
export class NodeDeleteDirective implements OnChanges {
|
||||||
/** Array of nodes to delete. */
|
/** Array of nodes to delete. */
|
||||||
@Input('adf-delete')
|
@Input('adf-delete')
|
||||||
selection: NodeEntry[] | DeletedNodeEntity[];
|
selection: NodeEntry[] | DeletedNodeEntry[];
|
||||||
|
|
||||||
/** If true then the nodes are deleted immediately rather than being put in the trash */
|
/** If true then the nodes are deleted immediately rather than being put in the trash */
|
||||||
@Input()
|
@Input()
|
||||||
@ -97,7 +97,7 @@ export class NodeDeleteDirective implements OnChanges {
|
|||||||
this.elementRef.nativeElement.disabled = disable;
|
this.elementRef.nativeElement.disabled = disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private process(selection: NodeEntry[] | DeletedNodeEntity[]) {
|
private process(selection: NodeEntry[] | DeletedNodeEntry[]) {
|
||||||
if (selection && selection.length) {
|
if (selection && selection.length) {
|
||||||
|
|
||||||
const batch = this.getDeleteNodesBatch(selection);
|
const batch = this.getDeleteNodesBatch(selection);
|
||||||
@ -118,7 +118,7 @@ export class NodeDeleteDirective implements OnChanges {
|
|||||||
return selection.map((node) => this.deleteNode(node));
|
return selection.map((node) => this.deleteNode(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
private deleteNode(node: NodeEntry | DeletedNodeEntity): Observable<ProcessedNodeData> {
|
private deleteNode(node: NodeEntry | DeletedNodeEntry): Observable<ProcessedNodeData> {
|
||||||
const id = (node.entry as any).nodeId || node.entry.id;
|
const id = (node.entry as any).nodeId || node.entry.id;
|
||||||
|
|
||||||
let promise: Promise<any>;
|
let promise: Promise<any>;
|
||||||
|
@ -51,7 +51,7 @@ import { DocumentListService } from './../services/document-list.service';
|
|||||||
import { CustomResourcesService } from './../services/custom-resources.service';
|
import { CustomResourcesService } from './../services/custom-resources.service';
|
||||||
import { DocumentListComponent } from './document-list.component';
|
import { DocumentListComponent } from './document-list.component';
|
||||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||||
import { FavoritePaging, NodeEntry, NodePaging, Node } from '@alfresco/js-api';
|
import { FavoritePaging, NodeEntry, NodePaging, Node, FavoritePagingList } from '@alfresco/js-api';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { DocumentListModule } from '../document-list.module';
|
import { DocumentListModule } from '../document-list.module';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
@ -106,15 +106,15 @@ describe('DocumentList', () => {
|
|||||||
appConfigService = TestBed.inject(AppConfigService);
|
appConfigService = TestBed.inject(AppConfigService);
|
||||||
|
|
||||||
spyFolder = spyOn(documentListService, 'getFolder').and.returnValue(of({ list: {} }));
|
spyFolder = spyOn(documentListService, 'getFolder').and.returnValue(of({ list: {} }));
|
||||||
spyFolderNode = spyOn(documentListService, 'getFolderNode').and.returnValue(of(new NodeEntry({ entry: {} })));
|
spyFolderNode = spyOn(documentListService, 'getFolderNode').and.returnValue(of(new NodeEntry({ entry: new Node() })));
|
||||||
spyOn(documentList['nodesApi'], 'getNode').and.returnValue(Promise.resolve(new NodeEntry({ entry: {} })));
|
spyOn(documentList['nodesApi'], 'getNode').and.returnValue(Promise.resolve(new NodeEntry({ entry: new Node() })));
|
||||||
|
|
||||||
documentList.ngOnInit();
|
documentList.ngOnInit();
|
||||||
documentList.currentFolderId = 'no-node';
|
documentList.currentFolderId = 'no-node';
|
||||||
|
|
||||||
spyGetSites = spyOn(customResourcesService.sitesApi, 'listSites').and.returnValue(Promise.resolve(fakeGetSitesAnswer));
|
spyGetSites = spyOn(customResourcesService.sitesApi, 'listSites').and.returnValue(Promise.resolve(fakeGetSitesAnswer));
|
||||||
spyFavorite = spyOn(customResourcesService.favoritesApi, 'listFavorites').and.returnValue(
|
spyFavorite = spyOn(customResourcesService.favoritesApi, 'listFavorites').and.returnValue(
|
||||||
Promise.resolve(new FavoritePaging({ list: { entries: [] } }))
|
Promise.resolve(new FavoritePaging({ list: new FavoritePagingList({ entries: [] }) }))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1208,7 +1208,7 @@ describe('DocumentList', () => {
|
|||||||
expect(folderNode.value.id).toBe('fake-node');
|
expect(folderNode.value.id).toBe('fake-node');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
documentList.onNodeDblClick(new NodeEntry({ entry: { id: 'fake-node', isFolder: true } }));
|
documentList.onNodeDblClick(new NodeEntry({ entry: new Node({ id: 'fake-node', isFolder: true }) }));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set no permission when getFolderNode fails with 403', (done) => {
|
it('should set no permission when getFolderNode fails with 403', (done) => {
|
||||||
|
@ -19,7 +19,7 @@ import { CustomResourcesService } from './custom-resources.service';
|
|||||||
import { PaginationModel } from '@alfresco/adf-core';
|
import { PaginationModel } from '@alfresco/adf-core';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||||
import { FavoritePaging } from '@alfresco/js-api';
|
import { Favorite, FavoritePaging, FavoritePagingList } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('CustomResourcesService', () => {
|
describe('CustomResourcesService', () => {
|
||||||
let customResourcesService: CustomResourcesService;
|
let customResourcesService: CustomResourcesService;
|
||||||
@ -34,22 +34,26 @@ describe('CustomResourcesService', () => {
|
|||||||
|
|
||||||
describe('loadFavorites', () => {
|
describe('loadFavorites', () => {
|
||||||
it('should return a list of items with default properties when target properties does not exist', (done) => {
|
it('should return a list of items with default properties when target properties does not exist', (done) => {
|
||||||
spyOn(customResourcesService.favoritesApi, 'listFavorites').and.returnValue(Promise.resolve(new FavoritePaging({
|
spyOn(customResourcesService.favoritesApi, 'listFavorites').and.returnValue(
|
||||||
list: {
|
Promise.resolve(
|
||||||
|
new FavoritePaging({
|
||||||
|
list: new FavoritePagingList({
|
||||||
entries: [
|
entries: [
|
||||||
{
|
{
|
||||||
entry: {
|
entry: new Favorite({
|
||||||
target: {
|
target: {
|
||||||
file: {
|
file: {
|
||||||
title: 'some-title',
|
title: 'some-title',
|
||||||
description: 'some-description'
|
description: 'some-description'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
})
|
||||||
})));
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
const pagination: PaginationModel = {
|
const pagination: PaginationModel = {
|
||||||
maxItems: 100,
|
maxItems: 100,
|
||||||
skipCount: 0
|
skipCount: 0
|
||||||
@ -73,11 +77,13 @@ describe('CustomResourcesService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a list of items with merged properties when target properties exist', (done) => {
|
it('should return a list of items with merged properties when target properties exist', (done) => {
|
||||||
spyOn(customResourcesService.favoritesApi, 'listFavorites').and.returnValue(Promise.resolve(new FavoritePaging({
|
spyOn(customResourcesService.favoritesApi, 'listFavorites').and.returnValue(
|
||||||
list: {
|
Promise.resolve(
|
||||||
|
new FavoritePaging({
|
||||||
|
list: new FavoritePagingList({
|
||||||
entries: [
|
entries: [
|
||||||
{
|
{
|
||||||
entry: {
|
entry: new Favorite({
|
||||||
properties: {
|
properties: {
|
||||||
'cm:property': 'some-property'
|
'cm:property': 'some-property'
|
||||||
},
|
},
|
||||||
@ -87,11 +93,13 @@ describe('CustomResourcesService', () => {
|
|||||||
description: 'some-description'
|
description: 'some-description'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
})
|
||||||
})));
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
const pagination: PaginationModel = {
|
const pagination: PaginationModel = {
|
||||||
maxItems: 100,
|
maxItems: 100,
|
||||||
skipCount: 0
|
skipCount: 0
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { PathInfoEntity } from '@alfresco/js-api';
|
import { PathInfo } from '@alfresco/js-api';
|
||||||
|
|
||||||
export class RestoreMessageModel {
|
export class RestoreMessageModel {
|
||||||
message: string;
|
message: string;
|
||||||
path: PathInfoEntity;
|
path: PathInfo;
|
||||||
action: string;
|
action: string;
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,10 @@ import { Node, NodePaging, NodeEntry } from '@alfresco/js-api';
|
|||||||
export const fakeNodeWithCreatePermission = new Node({
|
export const fakeNodeWithCreatePermission = new Node({
|
||||||
isFile: false,
|
isFile: false,
|
||||||
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
modifiedAt: '2017-06-08T13:53:46.495Z',
|
modifiedAt: new Date('2017-06-08T13:53:46.495Z'),
|
||||||
nodeType: 'cm:folder',
|
nodeType: 'cm:folder',
|
||||||
parentId: '55052317-7e59-4058-8e07-769f41e615e1',
|
parentId: '55052317-7e59-4058-8e07-769f41e615e1',
|
||||||
createdAt: '2017-05-22T11:36:11.270Z',
|
createdAt: new Date('2017-05-22T11:36:11.270Z'),
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/User Homes',
|
name: '/Company Home/User Homes',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
@ -43,11 +43,11 @@ export const fakeNodeWithCreatePermission = new Node({
|
|||||||
export const fakeNodeWithNoPermission = new Node({
|
export const fakeNodeWithNoPermission = new Node({
|
||||||
isFile: false,
|
isFile: false,
|
||||||
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
modifiedAt: '2017-06-08T13:53:46.495Z',
|
modifiedAt: new Date('2017-06-08T13:53:46.495Z'),
|
||||||
nodeType: 'cm:folder',
|
nodeType: 'cm:folder',
|
||||||
parentId: '55052317-7e59-4058-8e07-769f41e615e1',
|
parentId: '55052317-7e59-4058-8e07-769f41e615e1',
|
||||||
aspectNames: ['cm:ownable', 'cm:auditable'],
|
aspectNames: ['cm:ownable', 'cm:auditable'],
|
||||||
createdAt: '2017-05-22T11:36:11.270Z',
|
createdAt: new Date('2017-05-22T11:36:11.270Z'),
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/User Homes',
|
name: '/Company Home/User Homes',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
@ -219,7 +219,7 @@ export const fakeNodePaging: NodePaging = {
|
|||||||
export const mockNode1 = new Node({
|
export const mockNode1 = new Node({
|
||||||
isFile: true,
|
isFile: true,
|
||||||
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
modifiedAt: '2017-05-24T15:08:55.640Z',
|
modifiedAt: new Date('2017-05-24T15:08:55.640Z'),
|
||||||
nodeType: 'cm:content',
|
nodeType: 'cm:content',
|
||||||
content: {
|
content: {
|
||||||
mimeType: 'application/rtf',
|
mimeType: 'application/rtf',
|
||||||
@ -228,7 +228,7 @@ export const mockNode1 = new Node({
|
|||||||
encoding: 'UTF-8'
|
encoding: 'UTF-8'
|
||||||
},
|
},
|
||||||
parentId: 'd124de26-6ba0-4f40-8d98-4907da2d337a',
|
parentId: 'd124de26-6ba0-4f40-8d98-4907da2d337a',
|
||||||
createdAt: '2017-05-24T15:08:55.640Z',
|
createdAt: new Date('2017-05-24T15:08:55.640Z'),
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Guest Home',
|
name: '/Company Home/Guest Home',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
@ -248,7 +248,7 @@ export const mockNode1 = new Node({
|
|||||||
export const mockNode2 = new Node({
|
export const mockNode2 = new Node({
|
||||||
isFile: true,
|
isFile: true,
|
||||||
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
modifiedAt: '2017-05-24T15:08:55.640Z',
|
modifiedAt: new Date('2017-05-24T15:08:55.640Z'),
|
||||||
nodeType: 'cm:content',
|
nodeType: 'cm:content',
|
||||||
content: {
|
content: {
|
||||||
mimeType: 'application/rtf',
|
mimeType: 'application/rtf',
|
||||||
@ -257,7 +257,7 @@ export const mockNode2 = new Node({
|
|||||||
encoding: 'UTF-8'
|
encoding: 'UTF-8'
|
||||||
},
|
},
|
||||||
parentId: 'd124de26-6ba0-4f40-8d98-4907da2d337a',
|
parentId: 'd124de26-6ba0-4f40-8d98-4907da2d337a',
|
||||||
createdAt: '2017-05-24T15:08:55.640Z',
|
createdAt: new Date('2017-05-24T15:08:55.640Z'),
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Guest Home',
|
name: '/Company Home/Guest Home',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
@ -277,7 +277,7 @@ export const mockNode2 = new Node({
|
|||||||
export const mockNode3 = new Node({
|
export const mockNode3 = new Node({
|
||||||
isFile: true,
|
isFile: true,
|
||||||
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
createdByUser: { id: 'admin', displayName: 'Administrator' },
|
||||||
modifiedAt: '2017-05-24T15:08:55.640Z',
|
modifiedAt: new Date('2017-05-24T15:08:55.640Z'),
|
||||||
nodeType: 'cm:content',
|
nodeType: 'cm:content',
|
||||||
content: {
|
content: {
|
||||||
mimeType: 'application/rtf',
|
mimeType: 'application/rtf',
|
||||||
@ -286,7 +286,7 @@ export const mockNode3 = new Node({
|
|||||||
encoding: 'UTF-8'
|
encoding: 'UTF-8'
|
||||||
},
|
},
|
||||||
parentId: 'd124de26-6ba0-4f40-8d98-4907da2d337a',
|
parentId: 'd124de26-6ba0-4f40-8d98-4907da2d337a',
|
||||||
createdAt: '2017-05-24T15:08:55.640Z',
|
createdAt: new Date('2017-05-24T15:08:55.640Z'),
|
||||||
path: {
|
path: {
|
||||||
name: '/Company Home/Guest Home',
|
name: '/Company Home/Guest Home',
|
||||||
isComplete: true,
|
isComplete: true,
|
||||||
|
@ -17,41 +17,41 @@
|
|||||||
|
|
||||||
import { Component, ViewChild } from '@angular/core';
|
import { Component, ViewChild } from '@angular/core';
|
||||||
import { SearchComponent } from '../search/components/search.component';
|
import { SearchComponent } from '../search/components/search.component';
|
||||||
import { SearchRequest, ResultSetPaging } from '@alfresco/js-api';
|
import { SearchRequest, ResultSetPaging, ResultSetRowEntry, ContentInfo, UserInfo, ResultNode } from '@alfresco/js-api';
|
||||||
|
|
||||||
const entryItem = {
|
const entryItem = new ResultSetRowEntry({
|
||||||
entry: {
|
entry: new ResultNode({
|
||||||
id: '123',
|
id: '123',
|
||||||
name: 'MyDoc',
|
name: 'MyDoc',
|
||||||
isFile: true,
|
isFile: true,
|
||||||
content: {
|
content: new ContentInfo({
|
||||||
mimeType: 'text/plain'
|
mimeType: 'text/plain'
|
||||||
},
|
}),
|
||||||
createdByUser: {
|
createdByUser: new UserInfo({
|
||||||
displayName: 'John Doe'
|
displayName: 'John Doe'
|
||||||
},
|
}),
|
||||||
modifiedByUser: {
|
modifiedByUser: new UserInfo({
|
||||||
displayName: 'John Doe'
|
displayName: 'John Doe'
|
||||||
}
|
})
|
||||||
}
|
})
|
||||||
};
|
});
|
||||||
|
|
||||||
const entryDifferentItem = {
|
const entryDifferentItem = new ResultSetRowEntry({
|
||||||
entry: {
|
entry: new ResultNode({
|
||||||
id: '999',
|
id: '999',
|
||||||
name: 'TEST_DOC',
|
name: 'TEST_DOC',
|
||||||
isFile: true,
|
isFile: true,
|
||||||
content: {
|
content: new ContentInfo({
|
||||||
mimeType: 'text/plain'
|
mimeType: 'text/plain'
|
||||||
},
|
}),
|
||||||
createdByUser: {
|
createdByUser: new UserInfo({
|
||||||
displayName: 'John TEST'
|
displayName: 'John TEST'
|
||||||
},
|
}),
|
||||||
modifiedByUser: {
|
modifiedByUser: new UserInfo({
|
||||||
displayName: 'John TEST'
|
displayName: 'John TEST'
|
||||||
}
|
})
|
||||||
}
|
})
|
||||||
};
|
});
|
||||||
|
|
||||||
export const result = new ResultSetPaging({
|
export const result = new ResultSetPaging({
|
||||||
list: {
|
list: {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { SitePaging } from '@alfresco/js-api';
|
import { SitePaging, SitePagingList } from '@alfresco/js-api';
|
||||||
|
|
||||||
/* We are using functions instead of constants here to pass a new instance of the object each time */
|
/* We are using functions instead of constants here to pass a new instance of the object each time */
|
||||||
export const getFakeSitePaging = (): SitePaging => ({
|
export const getFakeSitePaging = (): SitePaging => ({
|
||||||
@ -162,9 +162,11 @@ export const getFakeSitePagingLastPage = (): SitePaging => ({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const getFakeSitePagingWithMembers = () => new SitePaging({
|
export const getFakeSitePagingWithMembers = () =>
|
||||||
list: {
|
new SitePaging({
|
||||||
entries: [{
|
list: new SitePagingList({
|
||||||
|
entries: [
|
||||||
|
{
|
||||||
entry: {
|
entry: {
|
||||||
visibility: 'MODERATED',
|
visibility: 'MODERATED',
|
||||||
guid: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
guid: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
||||||
@ -204,7 +206,7 @@ export const getFakeSitePagingWithMembers = () => new SitePaging({
|
|||||||
lastName: 'Beecher',
|
lastName: 'Beecher',
|
||||||
userStatus: 'Helping to design the look and feel of the new web site',
|
userStatus: 'Helping to design the look and feel of the new web site',
|
||||||
jobTitle: 'Graphic Designer',
|
jobTitle: 'Graphic Designer',
|
||||||
statusUpdatedAt: '2011-02-15T20:20:13.432+0000',
|
statusUpdatedAt: new Date('2011-02-15T20:20:13.432+0000'),
|
||||||
mobile: '0112211001100',
|
mobile: '0112211001100',
|
||||||
emailNotificationsEnabled: true,
|
emailNotificationsEnabled: true,
|
||||||
description: 'Alice is a demo user for the sample Alfresco Team site.',
|
description: 'Alice is a demo user for the sample Alfresco Team site.',
|
||||||
@ -231,7 +233,8 @@ export const getFakeSitePagingWithMembers = () => new SitePaging({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
entry: {
|
entry: {
|
||||||
visibility: 'PUBLIC',
|
visibility: 'PUBLIC',
|
||||||
guid: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
guid: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
||||||
@ -240,7 +243,8 @@ export const getFakeSitePagingWithMembers = () => new SitePaging({
|
|||||||
preset: 'site-dashboard',
|
preset: 'site-dashboard',
|
||||||
title: 'FAKE-SITE-PUBLIC'
|
title: 'FAKE-SITE-PUBLIC'
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
entry: {
|
entry: {
|
||||||
visibility: 'PRIVATE',
|
visibility: 'PRIVATE',
|
||||||
guid: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
guid: 'b4cff62a-664d-4d45-9302-98723eac1319',
|
||||||
@ -279,5 +283,5 @@ export const getFakeSitePagingWithMembers = () => new SitePaging({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
|
@ -15,31 +15,27 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CommentModel } from '@alfresco/adf-core';
|
import { CommentModel, User } from '@alfresco/adf-core';
|
||||||
import { EcmCompanyModel } from '../../common/models/ecm-company.model';
|
import { EcmCompanyModel } from '../../common/models/ecm-company.model';
|
||||||
import { EcmUserModel } from '../../common/models/ecm-user.model';
|
import { EcmUserModel } from '../../common/models/ecm-user.model';
|
||||||
|
|
||||||
export const fakeUser1 = {
|
export const fakeUser1 = new User({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
firstName: 'firstName',
|
firstName: 'firstName',
|
||||||
lastName: 'lastName',
|
lastName: 'lastName',
|
||||||
email: 'fake-email@dom.com',
|
email: 'fake-email@dom.com',
|
||||||
emailNotificationsEnabled: true,
|
|
||||||
company: {},
|
|
||||||
id: 'fake-email@dom.com',
|
id: 'fake-email@dom.com',
|
||||||
avatarId: '123-123-123'
|
avatarId: '123-123-123'
|
||||||
};
|
});
|
||||||
|
|
||||||
export const fakeUser2 = {
|
export const fakeUser2 = new User({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
firstName: 'some',
|
firstName: 'some',
|
||||||
lastName: 'one',
|
lastName: 'one',
|
||||||
email: 'some-one@somegroup.com',
|
email: 'some-one@somegroup.com',
|
||||||
emailNotificationsEnabled: true,
|
|
||||||
company: {},
|
|
||||||
id: 'fake-email@dom.com',
|
id: 'fake-email@dom.com',
|
||||||
avatarId: '001-001-001'
|
avatarId: '001-001-001'
|
||||||
};
|
});
|
||||||
|
|
||||||
export const fakeContentComments = {
|
export const fakeContentComments = {
|
||||||
list: {
|
list: {
|
||||||
@ -153,28 +149,28 @@ export const commentsNodeData: 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: 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: 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: 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: johnDoe,
|
createdBy: new User(johnDoe),
|
||||||
isSelected: false
|
isSelected: false
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
@ -184,28 +180,28 @@ export const commentsTaskData: 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: 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: 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: 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: johnDoe,
|
createdBy: new User(johnDoe),
|
||||||
isSelected: false
|
isSelected: false
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
@ -19,7 +19,8 @@ import {
|
|||||||
AlfrescoApiService,
|
AlfrescoApiService,
|
||||||
LogService,
|
LogService,
|
||||||
CommentModel,
|
CommentModel,
|
||||||
CommentsService
|
CommentsService,
|
||||||
|
User
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { CommentEntry, CommentsApi, Comment } from '@alfresco/js-api';
|
import { CommentEntry, CommentsApi, Comment } from '@alfresco/js-api';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
@ -98,7 +99,7 @@ export class NodeCommentsService implements CommentsService {
|
|||||||
id: comment.id,
|
id: comment.id,
|
||||||
message: comment.content,
|
message: comment.content,
|
||||||
created: comment.createdAt,
|
created: comment.createdAt,
|
||||||
createdBy: comment.createdBy
|
createdBy: new User(comment.createdBy)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { SearchConfigurationService } from '../../../search/services/search-configuration.service';
|
import { SearchConfigurationService } from '../../../search/services/search-configuration.service';
|
||||||
import { SearchService } from '../../../search/services/search.service';
|
import { SearchService } from '../../../search/services/search.service';
|
||||||
import { NodeEntry } from '@alfresco/js-api';
|
import { Node, NodeEntry } from '@alfresco/js-api';
|
||||||
import { Component, EventEmitter, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
import { Component, EventEmitter, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
import { UntypedFormControl } from '@angular/forms';
|
import { UntypedFormControl } from '@angular/forms';
|
||||||
import { debounceTime } from 'rxjs/operators';
|
import { debounceTime } from 'rxjs/operators';
|
||||||
@ -30,13 +30,9 @@ import { MatSelectionList } from '@angular/material/list';
|
|||||||
templateUrl: './add-permission-panel.component.html',
|
templateUrl: './add-permission-panel.component.html',
|
||||||
styleUrls: ['./add-permission-panel.component.scss'],
|
styleUrls: ['./add-permission-panel.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
providers: [
|
providers: [{ provide: SearchConfigurationService, useClass: SearchPermissionConfigurationService }, SearchService]
|
||||||
{ provide: SearchConfigurationService, useClass: SearchPermissionConfigurationService },
|
|
||||||
SearchService
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
export class AddPermissionPanelComponent {
|
export class AddPermissionPanelComponent {
|
||||||
|
|
||||||
@ViewChild('search', { static: true })
|
@ViewChild('search', { static: true })
|
||||||
search: SearchComponent;
|
search: SearchComponent;
|
||||||
|
|
||||||
@ -54,15 +50,13 @@ export class AddPermissionPanelComponent {
|
|||||||
selectedItems: NodeEntry[] = [];
|
selectedItems: NodeEntry[] = [];
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
EVERYONE: NodeEntry = new NodeEntry({ entry: { nodeType: 'cm:authorityContainer', properties: {'cm:authorityName': 'GROUP_EVERYONE'}}});
|
EVERYONE: NodeEntry = new NodeEntry({
|
||||||
|
entry: new Node({ nodeType: 'cm:authorityContainer', properties: { 'cm:authorityName': 'GROUP_EVERYONE' } })
|
||||||
|
});
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.searchInput.valueChanges
|
this.searchInput.valueChanges.pipe(debounceTime(this.debounceSearch)).subscribe((searchValue) => {
|
||||||
.pipe(
|
const selectionOptions = this.matSelectionList.selectedOptions.selected.map((option) => option.value);
|
||||||
debounceTime(this.debounceSearch)
|
|
||||||
)
|
|
||||||
.subscribe((searchValue) => {
|
|
||||||
const selectionOptions = this.matSelectionList.selectedOptions.selected.map(option => option.value);
|
|
||||||
this.selectedItems.push(...selectionOptions);
|
this.selectedItems.push(...selectionOptions);
|
||||||
this.matSelectionList.deselectAll();
|
this.matSelectionList.deselectAll();
|
||||||
this.searchedWord = searchValue;
|
this.searchedWord = searchValue;
|
||||||
@ -73,10 +67,9 @@ export class AddPermissionPanelComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSelectionChange() {
|
onSelectionChange() {
|
||||||
const currentSelection = this.matSelectionList.selectedOptions.selected.map(option => option.value);
|
const currentSelection = this.matSelectionList.selectedOptions.selected.map((option) => option.value);
|
||||||
const uniqueSelection = [ ...currentSelection, ...this.selectedItems ]
|
const uniqueSelection = [...currentSelection, ...this.selectedItems].reduce((uniquesElements, currentElement) => {
|
||||||
.reduce((uniquesElements, currentElement) => {
|
const isExist = uniquesElements.find((uniqueElement) => uniqueElement.entry.id === currentElement.entry.id);
|
||||||
const isExist = uniquesElements.find(uniqueElement => uniqueElement.entry.id === currentElement.entry.id);
|
|
||||||
if (!isExist) {
|
if (!isExist) {
|
||||||
uniquesElements.push(currentElement);
|
uniquesElements.push(currentElement);
|
||||||
}
|
}
|
||||||
@ -90,5 +83,4 @@ export class AddPermissionPanelComponent {
|
|||||||
this.selectedItems.splice(0, this.selectedItems.length);
|
this.selectedItems.splice(0, this.selectedItems.length);
|
||||||
this.search.resetResults();
|
this.search.resetResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { User } from '@alfresco/adf-core';
|
import { User } from '@alfresco/adf-core';
|
||||||
import { NodeEntry } from '@alfresco/js-api';
|
import { Group, NodeEntry } from '@alfresco/js-api';
|
||||||
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
import { NodePermissionService } from '../../services/node-permission.service';
|
import { NodePermissionService } from '../../services/node-permission.service';
|
||||||
@ -48,7 +48,7 @@ export class UserIconColumnComponent implements OnInit {
|
|||||||
@Input()
|
@Input()
|
||||||
selected: boolean = false;
|
selected: boolean = false;
|
||||||
|
|
||||||
displayText$ = new BehaviorSubject<User>(null);
|
displayText$ = new BehaviorSubject<User | Group>(null);
|
||||||
group = false;
|
group = false;
|
||||||
|
|
||||||
get isSelected(): boolean {
|
get isSelected(): boolean {
|
||||||
@ -61,13 +61,15 @@ export class UserIconColumnComponent implements OnInit {
|
|||||||
if (this.context) {
|
if (this.context) {
|
||||||
const { person, group, authorityId } = this.context.row.obj?.entry ?? this.context.row.obj;
|
const { person, group, authorityId } = this.context.row.obj?.entry ?? this.context.row.obj;
|
||||||
this.group = this.isGroup(group, authorityId);
|
this.group = this.isGroup(group, authorityId);
|
||||||
this.displayText$.next(person || group || { displayName: authorityId });
|
const user = person ? new User(person) : undefined;
|
||||||
|
this.displayText$.next(user || group || { displayName: authorityId });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.node) {
|
if (this.node) {
|
||||||
const { person, group } = this.nodePermissionService.transformNodeToUserPerson(this.node.entry);
|
const { person, group } = this.nodePermissionService.transformNodeToUserPerson(this.node.entry);
|
||||||
this.group = this.isGroup(group, null);
|
this.group = this.isGroup(group, null);
|
||||||
this.displayText$.next(person || group);
|
const user = person ? new User(person) : undefined;
|
||||||
|
this.displayText$.next(user || group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { ContentInfo, Node, NodePagingList, UserInfo } from '@alfresco/js-api';
|
||||||
|
|
||||||
export const fakeSearch = {
|
export const fakeSearch = {
|
||||||
list: {
|
list: new NodePagingList({
|
||||||
pagination: {
|
pagination: {
|
||||||
count: 1,
|
count: 1,
|
||||||
hasMoreItems: false,
|
hasMoreItems: false,
|
||||||
@ -26,22 +28,20 @@ export const fakeSearch = {
|
|||||||
},
|
},
|
||||||
entries: [
|
entries: [
|
||||||
{
|
{
|
||||||
entry: {
|
entry: new Node({
|
||||||
id: '123',
|
id: '123',
|
||||||
name: 'MyDoc',
|
name: 'MyDoc',
|
||||||
content: {
|
content: new ContentInfo({ mimeType: 'text/plain' }),
|
||||||
mimetype: 'text/plain'
|
createdByUser: new UserInfo({
|
||||||
},
|
|
||||||
createdByUser: {
|
|
||||||
displayName: 'John Doe'
|
displayName: 'John Doe'
|
||||||
},
|
}),
|
||||||
modifiedByUser: {
|
modifiedByUser: new UserInfo({
|
||||||
displayName: 'John Doe'
|
displayName: 'John Doe'
|
||||||
}
|
})
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mockError = {
|
export const mockError = {
|
||||||
@ -55,7 +55,5 @@ export const mockError = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const searchMockApi: any = {
|
export const searchMockApi: any = {
|
||||||
|
|
||||||
findNodes: () => Promise.resolve(fakeSearch)
|
findNodes: () => Promise.resolve(fakeSearch)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -124,13 +124,13 @@ export interface SearchOptions {
|
|||||||
include?: string[];
|
include?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String to control the order of the entities returned in a list. You can use this
|
* String array to control the order of the entities returned in a list. You can use this
|
||||||
* parameter to sort the list by one or more fields. Each field has a default sort order,
|
* parameter to sort the list by one or more fields. Each field has a default sort order,
|
||||||
* which is normally ascending order (but see the JS-API docs to check if any fields used
|
* which is normally ascending order (but see the JS-API docs to check if any fields used
|
||||||
* in a method have a descending default search order). To sort the entities in a specific
|
* in a method have a descending default search order). To sort the entities in a specific
|
||||||
* order, you can use the "ASC" and "DESC" keywords for any field.
|
* order, you can use the "ASC" and "DESC" keywords for any field.
|
||||||
*/
|
*/
|
||||||
orderBy?: string;
|
orderBy?: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of field names. You can use this parameter to restrict the fields returned within
|
* List of field names. You can use this parameter to restrict the fields returned within
|
||||||
|
@ -19,20 +19,9 @@ import { TestBed } from '@angular/core/testing';
|
|||||||
import { CoreTestingModule } from '@alfresco/adf-core';
|
import { CoreTestingModule } from '@alfresco/adf-core';
|
||||||
import { SecurityControlsService } from './security-controls-groups-marks-security.service';
|
import { SecurityControlsService } from './security-controls-groups-marks-security.service';
|
||||||
import { fakeAuthorityClearanceApiResponse } from './mock/security-authorities.mock';
|
import { fakeAuthorityClearanceApiResponse } from './mock/security-authorities.mock';
|
||||||
import {
|
import { fakeGroupsApiResponse, createNewSecurityGroupMock } from './mock/security-groups.mock';
|
||||||
fakeGroupsApiResponse,
|
import { fakeMarksApiResponse, createNewSecurityMarkMock } from './mock/security-marks.mock';
|
||||||
createNewSecurityGroupMock
|
import { SecurityGroup, SecurityGroupBody, SecurityGroupEntry, SecurityMarkBody, SecurityMarkEntry } from '@alfresco/js-api';
|
||||||
} from './mock/security-groups.mock';
|
|
||||||
import {
|
|
||||||
fakeMarksApiResponse,
|
|
||||||
createNewSecurityMarkMock
|
|
||||||
} from './mock/security-marks.mock';
|
|
||||||
import {
|
|
||||||
SecurityGroupBody,
|
|
||||||
SecurityGroupEntry,
|
|
||||||
SecurityMarkBody,
|
|
||||||
SecurityMarkEntry
|
|
||||||
} from '@alfresco/js-api';
|
|
||||||
|
|
||||||
describe('SecurityControlsService', () => {
|
describe('SecurityControlsService', () => {
|
||||||
let service: SecurityControlsService;
|
let service: SecurityControlsService;
|
||||||
@ -55,10 +44,7 @@ describe('SecurityControlsService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to get the list of Security groups', async () => {
|
it('should be able to get the list of Security groups', async () => {
|
||||||
const getGroupSpy = spyOn(
|
const getGroupSpy = spyOn(service.groupsApi, 'getSecurityGroups').and.returnValue(Promise.resolve(fakeGroupsApiResponse));
|
||||||
service.groupsApi,
|
|
||||||
'getSecurityGroups'
|
|
||||||
).and.returnValue(Promise.resolve(fakeGroupsApiResponse));
|
|
||||||
const groupPromise = service.getSecurityGroup(0, 5, 'inUse');
|
const groupPromise = service.getSecurityGroup(0, 5, 'inUse');
|
||||||
const group = await groupPromise;
|
const group = await groupPromise;
|
||||||
expect(getGroupSpy).toHaveBeenCalledWith({
|
expect(getGroupSpy).toHaveBeenCalledWith({
|
||||||
@ -73,21 +59,15 @@ describe('SecurityControlsService', () => {
|
|||||||
expect(group.entries[0].groupName).toBe('Classification');
|
expect(group.entries[0].groupName).toBe('Classification');
|
||||||
expect(group.entries[0].groupType).toBe('HIERARCHICAL');
|
expect(group.entries[0].groupType).toBe('HIERARCHICAL');
|
||||||
|
|
||||||
expect(group.entries[1].id).toBe(
|
expect(group.entries[1].id).toBe('d2b11d9f-2707-439f-a7c6-e7872f395553');
|
||||||
'd2b11d9f-2707-439f-a7c6-e7872f395553'
|
|
||||||
);
|
|
||||||
expect(group.entries[1].groupName).toBe('SG1');
|
expect(group.entries[1].groupName).toBe('SG1');
|
||||||
expect(group.entries[1].groupType).toBe('USER_REQUIRES_ALL');
|
expect(group.entries[1].groupType).toBe('USER_REQUIRES_ALL');
|
||||||
|
|
||||||
expect(group.entries[2].id).toBe(
|
expect(group.entries[2].id).toBe('1b77a32d-6b8b-4a37-b195-7f2ff2fe4ed3');
|
||||||
'1b77a32d-6b8b-4a37-b195-7f2ff2fe4ed3'
|
|
||||||
);
|
|
||||||
expect(group.entries[2].groupName).toBe('SG2');
|
expect(group.entries[2].groupName).toBe('SG2');
|
||||||
expect(group.entries[2].groupType).toBe('USER_REQUIRES_ALL');
|
expect(group.entries[2].groupType).toBe('USER_REQUIRES_ALL');
|
||||||
|
|
||||||
expect(group.entries[3].id).toBe(
|
expect(group.entries[3].id).toBe('709791f8-22dc-428a-82dd-daf3e1aa8a60');
|
||||||
'709791f8-22dc-428a-82dd-daf3e1aa8a60'
|
|
||||||
);
|
|
||||||
expect(group.entries[3].groupName).toBe('SG3');
|
expect(group.entries[3].groupName).toBe('SG3');
|
||||||
expect(group.entries[3].groupType).toBe('USER_REQUIRES_ALL');
|
expect(group.entries[3].groupType).toBe('USER_REQUIRES_ALL');
|
||||||
});
|
});
|
||||||
@ -96,48 +76,34 @@ describe('SecurityControlsService', () => {
|
|||||||
spyOn(service.groupsApi, 'createSecurityGroup').and.returnValue(
|
spyOn(service.groupsApi, 'createSecurityGroup').and.returnValue(
|
||||||
Promise.resolve(
|
Promise.resolve(
|
||||||
new SecurityGroupEntry({
|
new SecurityGroupEntry({
|
||||||
entry: {
|
entry: new SecurityGroup({
|
||||||
groupName: 'TestGroup',
|
groupName: 'TestGroup',
|
||||||
groupType: 'HIERARCHICAL',
|
groupType: 'HIERARCHICAL',
|
||||||
id: 'eddf6269-ceba-42c6-b979-9ac445d29a94'
|
id: 'eddf6269-ceba-42c6-b979-9ac445d29a94'
|
||||||
}
|
})
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const response = await service
|
const response = await service.createSecurityGroup(createNewSecurityGroupMock).toPromise();
|
||||||
.createSecurityGroup(createNewSecurityGroupMock)
|
|
||||||
.toPromise();
|
|
||||||
|
|
||||||
securityGroupId = response.entry.id;
|
securityGroupId = response.entry.id;
|
||||||
expect(response.entry.groupName).toEqual('TestGroup');
|
expect(response.entry.groupName).toEqual('TestGroup');
|
||||||
expect(response.entry.groupType).toEqual('HIERARCHICAL');
|
expect(response.entry.groupType).toEqual('HIERARCHICAL');
|
||||||
expect(response.entry.id).toEqual(
|
expect(response.entry.id).toEqual('eddf6269-ceba-42c6-b979-9ac445d29a94');
|
||||||
'eddf6269-ceba-42c6-b979-9ac445d29a94'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to get the list of Security Marks', async () => {
|
it('should be able to get the list of Security Marks', async () => {
|
||||||
const getMarkSpy = spyOn(
|
const getMarkSpy = spyOn(service.marksApi, 'getSecurityMarks').and.returnValue(Promise.resolve(fakeMarksApiResponse));
|
||||||
service.marksApi,
|
const markPromise = service.getSecurityMark(securityGroupId, 0);
|
||||||
'getSecurityMarks'
|
|
||||||
).and.returnValue(Promise.resolve(fakeMarksApiResponse));
|
|
||||||
const markPromise = service.getSecurityMark(
|
|
||||||
securityGroupId,
|
|
||||||
0,
|
|
||||||
'inUse'
|
|
||||||
);
|
|
||||||
const mark = await markPromise;
|
const mark = await markPromise;
|
||||||
|
|
||||||
expect(getMarkSpy).toHaveBeenCalledWith(securityGroupId, {
|
expect(getMarkSpy).toHaveBeenCalledWith(securityGroupId, {
|
||||||
skipCount: 0,
|
skipCount: 0
|
||||||
include: 'inUse'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(mark.pagination.skipCount).toBe(0);
|
expect(mark.pagination.skipCount).toBe(0);
|
||||||
expect(mark.pagination.maxItems).toBe(10);
|
expect(mark.pagination.maxItems).toBe(10);
|
||||||
expect(mark.entries[0].groupId).toBe(
|
expect(mark.entries[0].groupId).toBe('eddf6269-ceba-42c6-b979-9ac445d29a94');
|
||||||
'eddf6269-ceba-42c6-b979-9ac445d29a94'
|
|
||||||
);
|
|
||||||
expect(mark.entries[0].name).toBe('securityMark1');
|
expect(mark.entries[0].name).toBe('securityMark1');
|
||||||
expect(mark.entries[0].id).toBe('ffBOeOJJ');
|
expect(mark.entries[0].id).toBe('ffBOeOJJ');
|
||||||
});
|
});
|
||||||
@ -176,12 +142,7 @@ describe('SecurityControlsService', () => {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const response = await service
|
const response = await service.updateSecurityMark(securityGroupId, securityMarkId, securityMarkBody);
|
||||||
.updateSecurityMark(
|
|
||||||
securityGroupId,
|
|
||||||
securityMarkId,
|
|
||||||
securityMarkBody
|
|
||||||
);
|
|
||||||
|
|
||||||
securityGroupId = response.entry.groupId;
|
securityGroupId = response.entry.groupId;
|
||||||
securityMarkId = response.entry.id;
|
securityMarkId = response.entry.id;
|
||||||
@ -194,11 +155,11 @@ describe('SecurityControlsService', () => {
|
|||||||
spyOn(service.groupsApi, 'updateSecurityGroup').and.returnValue(
|
spyOn(service.groupsApi, 'updateSecurityGroup').and.returnValue(
|
||||||
Promise.resolve(
|
Promise.resolve(
|
||||||
new SecurityGroupEntry({
|
new SecurityGroupEntry({
|
||||||
entry: {
|
entry: new SecurityGroup({
|
||||||
groupName: 'TestGroup',
|
groupName: 'TestGroup',
|
||||||
groupType: 'HIERARCHICAL',
|
groupType: 'HIERARCHICAL',
|
||||||
id: 'eddf6269-ceba-42c6-b979-9ac445d29a94'
|
id: 'eddf6269-ceba-42c6-b979-9ac445d29a94'
|
||||||
}
|
})
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -230,31 +191,15 @@ describe('SecurityControlsService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should delete a security group', async () => {
|
it('should delete a security group', async () => {
|
||||||
spyOn(service.groupsApi, 'deleteSecurityGroup').and.returnValue(
|
spyOn(service.groupsApi, 'deleteSecurityGroup').and.returnValue(Promise.resolve());
|
||||||
Promise.resolve(
|
await service.deleteSecurityGroup(securityGroupId).toPromise();
|
||||||
new SecurityGroupEntry({
|
expect(service.groupsApi.deleteSecurityGroup).toHaveBeenCalled();
|
||||||
entry: {
|
|
||||||
groupName: 'TestGroup',
|
|
||||||
groupType: 'HIERARCHICAL',
|
|
||||||
id: 'eddf6269-ceba-42c6-b979-9ac445d29a94'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const response = await service
|
|
||||||
.deleteSecurityGroup(securityGroupId)
|
|
||||||
.toPromise();
|
|
||||||
|
|
||||||
expect(response.entry.groupName).toEqual('TestGroup');
|
|
||||||
expect(response.entry.groupType).toEqual('HIERARCHICAL');
|
|
||||||
expect(response.entry.id).toEqual('eddf6269-ceba-42c6-b979-9ac445d29a94');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to get clearances for authority', async () => {
|
it('should be able to get clearances for authority', async () => {
|
||||||
const getClearancesForAuthoritySpy = spyOn(
|
const getClearancesForAuthoritySpy = spyOn(service.authorityClearanceApi, 'getAuthorityClearanceForAuthority').and.returnValue(
|
||||||
service.authorityClearanceApi,
|
Promise.resolve(fakeAuthorityClearanceApiResponse)
|
||||||
'getAuthorityClearanceForAuthority'
|
);
|
||||||
).and.returnValue(Promise.resolve(fakeAuthorityClearanceApiResponse));
|
|
||||||
const clearancePromise = service.getClearancesForAuthority('test-id', 0, 10);
|
const clearancePromise = service.getClearancesForAuthority('test-id', 0, 10);
|
||||||
const clearance = await clearancePromise.toPromise();
|
const clearance = await clearancePromise.toPromise();
|
||||||
|
|
||||||
@ -283,11 +228,15 @@ describe('SecurityControlsService', () => {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const response = await service.updateClearancesForAuthority('test-id', [{
|
const response = await service
|
||||||
|
.updateClearancesForAuthority('test-id', [
|
||||||
|
{
|
||||||
groupId: 'test-group-id',
|
groupId: 'test-group-id',
|
||||||
op: 'test-op',
|
op: 'test-op',
|
||||||
id: 'test-id'
|
id: 'test-id'
|
||||||
}]).toPromise();
|
}
|
||||||
|
])
|
||||||
|
.toPromise();
|
||||||
|
|
||||||
if (response instanceof SecurityMarkEntry) {
|
if (response instanceof SecurityMarkEntry) {
|
||||||
expect(response.entry.id).toEqual('test-id');
|
expect(response.entry.id).toEqual('test-id');
|
||||||
@ -296,8 +245,8 @@ describe('SecurityControlsService', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reload security groups', doneCallback => {
|
it('should reload security groups', (doneCallback) => {
|
||||||
service.reloadSecurityControls$.subscribe(res => {
|
service.reloadSecurityControls$.subscribe((res) => {
|
||||||
expect(res).toBeUndefined();
|
expect(res).toBeUndefined();
|
||||||
doneCallback();
|
doneCallback();
|
||||||
});
|
});
|
||||||
|
@ -30,7 +30,8 @@ import {
|
|||||||
SecurityGroupPaging,
|
SecurityGroupPaging,
|
||||||
AuthorityClearanceApi,
|
AuthorityClearanceApi,
|
||||||
AuthorityClearanceGroupPaging,
|
AuthorityClearanceGroupPaging,
|
||||||
NodeSecurityMarkBody
|
NodeSecurityMarkBody,
|
||||||
|
GsGroupInclude
|
||||||
} from '@alfresco/js-api';
|
} from '@alfresco/js-api';
|
||||||
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
|
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { finalize } from 'rxjs/operators';
|
import { finalize } from 'rxjs/operators';
|
||||||
@ -125,8 +126,8 @@ export class SecurityControlsService {
|
|||||||
const payload: SecurityGroupBody = {
|
const payload: SecurityGroupBody = {
|
||||||
...input
|
...input
|
||||||
};
|
};
|
||||||
const opts = {
|
const opts: GsGroupInclude = {
|
||||||
DEFAULT_INCLUDE
|
include: DEFAULT_INCLUDE
|
||||||
};
|
};
|
||||||
const promise = this.groupsApi.createSecurityGroup(payload, opts);
|
const promise = this.groupsApi.createSecurityGroup(payload, opts);
|
||||||
|
|
||||||
@ -169,19 +170,16 @@ export class SecurityControlsService {
|
|||||||
*
|
*
|
||||||
* @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.
|
||||||
* @param include The key for the security mark is in use or not
|
|
||||||
* @return Promise<SecurityControlsMarkResponse>
|
* @return Promise<SecurityControlsMarkResponse>
|
||||||
*/
|
*/
|
||||||
getSecurityMark(
|
getSecurityMark(
|
||||||
securityGroupId: string,
|
securityGroupId: string,
|
||||||
skipCount = DEFAULT_SKIP_COUNT,
|
skipCount = DEFAULT_SKIP_COUNT
|
||||||
include = DEFAULT_INCLUDE
|
|
||||||
): Promise<SecurityControlsMarkResponse> {
|
): Promise<SecurityControlsMarkResponse> {
|
||||||
let securityControlsMarkResponse: SecurityControlsMarkResponse;
|
let securityControlsMarkResponse: SecurityControlsMarkResponse;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.marksApi
|
this.marksApi
|
||||||
.getSecurityMarks(securityGroupId, {
|
.getSecurityMarks(securityGroupId, {
|
||||||
include,
|
|
||||||
skipCount
|
skipCount
|
||||||
})
|
})
|
||||||
.then((response: SecurityMarkPaging) => {
|
.then((response: SecurityMarkPaging) => {
|
||||||
@ -276,11 +274,11 @@ 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.
|
||||||
* @return Observable<SecurityGroupEntry>
|
* @return Observable<void>
|
||||||
*/
|
*/
|
||||||
deleteSecurityGroup(
|
deleteSecurityGroup(
|
||||||
securityGroupId: string
|
securityGroupId: string
|
||||||
): Observable<SecurityGroupEntry> {
|
): Observable<void> {
|
||||||
this.loadingSource.next(true);
|
this.loadingSource.next(true);
|
||||||
const promise = this.groupsApi.deleteSecurityGroup(securityGroupId);
|
const promise = this.groupsApi.deleteSecurityGroup(securityGroupId);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||||
import { LogService, InfiniteSelectScrollDirective, AuthenticationService } from '@alfresco/adf-core';
|
import { LogService, InfiniteSelectScrollDirective, AuthenticationService } from '@alfresco/adf-core';
|
||||||
import { SitePaging, SiteEntry } from '@alfresco/js-api';
|
import { SitePaging, SiteEntry, Site } from '@alfresco/js-api';
|
||||||
import { MatSelectChange } from '@angular/material/select';
|
import { MatSelectChange } from '@angular/material/select';
|
||||||
import {LiveAnnouncer} from '@angular/cdk/a11y';
|
import {LiveAnnouncer} from '@angular/cdk/a11y';
|
||||||
import {TranslateService} from '@ngx-translate/core';
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
@ -128,11 +128,7 @@ export class DropdownSitesComponent implements OnInit {
|
|||||||
|
|
||||||
if (!this.hideMyFiles) {
|
if (!this.hideMyFiles) {
|
||||||
const siteEntry = new SiteEntry({
|
const siteEntry = new SiteEntry({
|
||||||
entry: {
|
entry: new Site({ id: this.MY_FILES_VALUE, guid: this.MY_FILES_VALUE, title: 'DROPDOWN.MY_FILES_OPTION' })
|
||||||
id: this.MY_FILES_VALUE,
|
|
||||||
guid: this.MY_FILES_VALUE,
|
|
||||||
title: 'DROPDOWN.MY_FILES_OPTION'
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.siteList.list.entries.unshift(siteEntry);
|
this.siteList.list.entries.unshift(siteEntry);
|
||||||
@ -180,7 +176,7 @@ export class DropdownSitesComponent implements OnInit {
|
|||||||
return sites;
|
return sites;
|
||||||
}
|
}
|
||||||
|
|
||||||
private isCurrentUserMember(site, loggedUserName): boolean {
|
private isCurrentUserMember(site: SiteEntry, loggedUserName: string): boolean {
|
||||||
return site.entry.visibility === 'PUBLIC' ||
|
return site.entry.visibility === 'PUBLIC' ||
|
||||||
!!site.relations.members.list.entries.find((member) => member.entry.id.toLowerCase() === loggedUserName.toLowerCase());
|
!!site.relations.members.list.entries.find((member) => member.entry.id.toLowerCase() === loggedUserName.toLowerCase());
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ import { throwError } from 'rxjs';
|
|||||||
import { Pagination, Tag, TagBody, TagEntry, TagPaging, TagPagingList } from '@alfresco/js-api';
|
import { Pagination, Tag, TagBody, TagEntry, TagPaging, TagPagingList } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('TagService', () => {
|
describe('TagService', () => {
|
||||||
|
|
||||||
let service: TagService;
|
let service: TagService;
|
||||||
let logService: LogService;
|
let logService: LogService;
|
||||||
let userPreferencesService: UserPreferencesService;
|
let userPreferencesService: UserPreferencesService;
|
||||||
@ -43,37 +42,32 @@ describe('TagService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [TranslateModule.forRoot(), ContentTestingModule]
|
||||||
TranslateModule.forRoot(),
|
|
||||||
ContentTestingModule
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
service = TestBed.inject(TagService);
|
service = TestBed.inject(TagService);
|
||||||
logService = TestBed.inject(LogService);
|
logService = TestBed.inject(LogService);
|
||||||
userPreferencesService = TestBed.inject(UserPreferencesService);
|
userPreferencesService = TestBed.inject(UserPreferencesService);
|
||||||
|
|
||||||
spyOn(service.tagsApi, 'deleteTagFromNode').and.returnValue(
|
spyOn(service.tagsApi, 'deleteTagFromNode').and.returnValue(Promise.resolve());
|
||||||
Promise.resolve({})
|
spyOn(service.tagsApi, 'createTagForNode').and.returnValue(Promise.resolve(new TagEntry({})));
|
||||||
);
|
|
||||||
spyOn(service.tagsApi, 'createTagForNode').and.returnValue(
|
|
||||||
Promise.resolve(new TagEntry({}))
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Content tests', () => {
|
describe('Content tests', () => {
|
||||||
|
|
||||||
it('should catch errors on getTagsByNodeId call', async () => {
|
it('should catch errors on getTagsByNodeId call', async () => {
|
||||||
spyOn(service, 'getTagsByNodeId').and.returnValue(throwError({ error: 'error' }));
|
spyOn(service, 'getTagsByNodeId').and.returnValue(throwError({ error: 'error' }));
|
||||||
await service.getTagsByNodeId('fake-node-id').subscribe(() => {
|
await service.getTagsByNodeId('fake-node-id').subscribe(
|
||||||
|
() => {
|
||||||
throwError('This call should fail');
|
throwError('This call should fail');
|
||||||
}, (error) => {
|
},
|
||||||
|
(error) => {
|
||||||
expect(error.error).toBe('error');
|
expect(error.error).toBe('error');
|
||||||
});
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should trigger a refresh event on removeTag() call', async () => {
|
it('should trigger a refresh event on removeTag() call', async () => {
|
||||||
await service.refresh.subscribe((res) => {
|
await service.refresh.subscribe(() => {
|
||||||
expect(res).toBeDefined();
|
expect(service.tagsApi.deleteTagFromNode).toHaveBeenCalledWith('fake-node-id', 'fake-tag');
|
||||||
});
|
});
|
||||||
|
|
||||||
service.removeTag('fake-node-id', 'fake-tag');
|
service.removeTag('fake-node-id', 'fake-tag');
|
||||||
@ -108,12 +102,14 @@ describe('TagService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should emit refresh when tags creation is success', fakeAsync(() => {
|
it('should emit refresh when tags creation is success', fakeAsync(() => {
|
||||||
const tags: TagEntry[] = [{
|
const tags: TagEntry[] = [
|
||||||
|
{
|
||||||
entry: {
|
entry: {
|
||||||
id: 'Some id 1',
|
id: 'Some id 1',
|
||||||
tag: 'Some tag 1'
|
tag: 'Some tag 1'
|
||||||
}
|
}
|
||||||
}];
|
}
|
||||||
|
];
|
||||||
spyOn(service.refresh, 'emit');
|
spyOn(service.refresh, 'emit');
|
||||||
spyOn(service.tagsApi, 'createTags').and.returnValue(Promise.resolve(tags));
|
spyOn(service.tagsApi, 'createTags').and.returnValue(Promise.resolve(tags));
|
||||||
service.createTags([]);
|
service.createTags([]);
|
||||||
@ -142,9 +138,12 @@ describe('TagService', () => {
|
|||||||
spyOn(service.tagsApi, 'listTags').and.returnValue(Promise.resolve(result));
|
spyOn(service.tagsApi, 'listTags').and.returnValue(Promise.resolve(result));
|
||||||
const skipCount = 10;
|
const skipCount = 10;
|
||||||
|
|
||||||
service.getAllTheTags({
|
service.getAllTheTags(
|
||||||
|
{
|
||||||
skipCount
|
skipCount
|
||||||
}, true);
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
expect(service.tagsApi.listTags).toHaveBeenCalledWith({
|
expect(service.tagsApi.listTags).toHaveBeenCalledWith({
|
||||||
include: ['count'],
|
include: ['count'],
|
||||||
skipCount
|
skipCount
|
||||||
@ -155,9 +154,12 @@ describe('TagService', () => {
|
|||||||
spyOn(service.tagsApi, 'listTags').and.returnValue(Promise.resolve(result));
|
spyOn(service.tagsApi, 'listTags').and.returnValue(Promise.resolve(result));
|
||||||
const skipCount = 10;
|
const skipCount = 10;
|
||||||
|
|
||||||
service.getAllTheTags({
|
service.getAllTheTags(
|
||||||
|
{
|
||||||
skipCount
|
skipCount
|
||||||
}, false);
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
expect(service.tagsApi.listTags).toHaveBeenCalledWith({
|
expect(service.tagsApi.listTags).toHaveBeenCalledWith({
|
||||||
include: undefined,
|
include: undefined,
|
||||||
skipCount
|
skipCount
|
||||||
@ -361,7 +363,9 @@ describe('TagService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should call assignTagsToNode on TagsApi with correct parameters', () => {
|
it('should call assignTagsToNode on TagsApi with correct parameters', () => {
|
||||||
spyOn(service.tagsApi, 'assignTagsToNode').and.returnValue(Promise.resolve(singleResult));
|
spyOn(service.tagsApi, 'assignTagsToNode').and.returnValue(
|
||||||
|
Promise.resolve(new TagPaging({ list: new TagPagingList({ entries: [singleResult] }) }))
|
||||||
|
);
|
||||||
|
|
||||||
service.assignTagsToNode(nodeId, tags);
|
service.assignTagsToNode(nodeId, tags);
|
||||||
expect(service.tagsApi.assignTagsToNode).toHaveBeenCalledWith(nodeId, tags);
|
expect(service.tagsApi.assignTagsToNode).toHaveBeenCalledWith(nodeId, tags);
|
||||||
@ -381,10 +385,12 @@ describe('TagService', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should return observable which emits single tag', fakeAsync(() => {
|
it('should return observable which emits single tag', fakeAsync(() => {
|
||||||
spyOn(service.tagsApi, 'assignTagsToNode').and.returnValue(Promise.resolve(singleResult));
|
spyOn(service.tagsApi, 'assignTagsToNode').and.returnValue(
|
||||||
|
Promise.resolve(new TagPaging({ list: new TagPagingList({ entries: [singleResult] }) }))
|
||||||
|
);
|
||||||
|
|
||||||
service.assignTagsToNode(nodeId, tags).subscribe((tagsResult) => {
|
service.assignTagsToNode(nodeId, tags).subscribe((tagsResult) => {
|
||||||
expect(tagsResult).toEqual(singleResult);
|
expect(tagsResult).toEqual(new TagPaging({ list: new TagPagingList({ entries: [singleResult] }) }));
|
||||||
});
|
});
|
||||||
tick();
|
tick();
|
||||||
}));
|
}));
|
||||||
|
@ -99,8 +99,8 @@ export class TagService {
|
|||||||
removeTag(nodeId: string, tag: string): Observable<void> {
|
removeTag(nodeId: string, tag: string): Observable<void> {
|
||||||
const observableRemove = from(this.tagsApi.deleteTagFromNode(nodeId, tag));
|
const observableRemove = from(this.tagsApi.deleteTagFromNode(nodeId, tag));
|
||||||
|
|
||||||
observableRemove.subscribe((data) => {
|
observableRemove.subscribe(() => {
|
||||||
this.refresh.emit(data);
|
this.refresh.emit();
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
this.handleError(err);
|
this.handleError(err);
|
||||||
});
|
});
|
||||||
|
@ -22,28 +22,39 @@ import { ContentTestingModule } from '../../testing/content.testing.module';
|
|||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { TreeBaseNode } from '../models/tree-view.model';
|
import { TreeBaseNode } from '../models/tree-view.model';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { NodePaging } from '@alfresco/js-api';
|
import { Node, NodePaging } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('TreeViewService', () => {
|
describe('TreeViewService', () => {
|
||||||
|
|
||||||
let service: TreeViewService;
|
let service: TreeViewService;
|
||||||
let nodeService: NodesApiService;
|
let nodeService: NodesApiService;
|
||||||
|
|
||||||
const fakeNodeList = new NodePaging({ list: { entries: [
|
const fakeNodeList = new NodePaging({
|
||||||
{ entry: { id: 'fake-node-id', name: 'fake-node-name', isFolder: true } }
|
list: {
|
||||||
] } });
|
entries: [
|
||||||
|
{
|
||||||
|
entry: new Node({
|
||||||
|
id: 'fake-node-id',
|
||||||
|
name: 'fake-node-name',
|
||||||
|
isFolder: true,
|
||||||
|
isFile: false,
|
||||||
|
nodeType: 'cm:folder',
|
||||||
|
createdByUser: null,
|
||||||
|
modifiedByUser: null,
|
||||||
|
createdAt: new Date(),
|
||||||
|
modifiedAt: new Date()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const fakeMixedNodeList = new NodePaging({ list: { entries: [
|
const fakeMixedNodeList = new NodePaging({
|
||||||
{ entry: { id: 'fake-node-id', name: 'fake-node-name', isFolder: true } },
|
list: { entries: [fakeNodeList.list.entries[0], { entry: new Node({ id: 'fake-file-id', name: 'fake-file-name', isFolder: false }) }] }
|
||||||
{ entry: { id: 'fake-file-id', name: 'fake-file-name', isFolder: false } }
|
});
|
||||||
] } });
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [TranslateModule.forRoot(), ContentTestingModule]
|
||||||
TranslateModule.forRoot(),
|
|
||||||
ContentTestingModule
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
service = TestBed.inject(TreeViewService);
|
service = TestBed.inject(TreeViewService);
|
||||||
nodeService = TestBed.inject(NodesApiService);
|
nodeService = TestBed.inject(NodesApiService);
|
||||||
|
@ -19,7 +19,7 @@ import { SimpleChange } from '@angular/core';
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { of, throwError } from 'rxjs';
|
import { of, throwError } from 'rxjs';
|
||||||
import { UploadButtonComponent } from './upload-button.component';
|
import { UploadButtonComponent } from './upload-button.component';
|
||||||
import { NodeEntry } from '@alfresco/js-api';
|
import { Node, NodeEntry } from '@alfresco/js-api';
|
||||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { mockUploadErrorPromise } from '../../mock/upload.service.mock';
|
import { mockUploadErrorPromise } from '../../mock/upload.service.mock';
|
||||||
@ -28,7 +28,6 @@ import { NodesApiService } from '../../common/services/nodes-api.service';
|
|||||||
import { FileUploadErrorEvent } from '../../common/events/file.event';
|
import { FileUploadErrorEvent } from '../../common/events/file.event';
|
||||||
|
|
||||||
describe('UploadButtonComponent', () => {
|
describe('UploadButtonComponent', () => {
|
||||||
|
|
||||||
const file = { name: 'fake-name-1', size: 10, webkitRelativePath: 'fake-folder1/fake-name-1.json' };
|
const file = { name: 'fake-name-1', size: 10, webkitRelativePath: 'fake-folder1/fake-name-1.json' };
|
||||||
const fakeEvent = {
|
const fakeEvent = {
|
||||||
currentTarget: {
|
currentTarget: {
|
||||||
@ -38,15 +37,7 @@ describe('UploadButtonComponent', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fakeFolderNodeWithPermission = new NodeEntry({
|
const fakeFolderNodeWithPermission = new NodeEntry({
|
||||||
entry: {
|
entry: new Node({ name: 'Folder Fake Name', nodeType: 'cm:folder', isFolder: true, allowableOperations: ['create', 'update'] })
|
||||||
allowableOperations: [
|
|
||||||
'create',
|
|
||||||
'update'
|
|
||||||
],
|
|
||||||
isFolder: true,
|
|
||||||
name: 'Folder Fake Name',
|
|
||||||
nodeType: 'cm:folder'
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let component: UploadButtonComponent;
|
let component: UploadButtonComponent;
|
||||||
@ -56,10 +47,7 @@ describe('UploadButtonComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [TranslateModule.forRoot(), ContentTestingModule]
|
||||||
TranslateModule.forRoot(),
|
|
||||||
ContentTestingModule
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
fixture = TestBed.createComponent(UploadButtonComponent);
|
fixture = TestBed.createComponent(UploadButtonComponent);
|
||||||
uploadService = TestBed.inject(UploadService);
|
uploadService = TestBed.inject(UploadService);
|
||||||
@ -214,11 +202,7 @@ describe('UploadButtonComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('fileSize', () => {
|
describe('fileSize', () => {
|
||||||
|
const files: File[] = [{ name: 'bigFile.png', size: 1000 } as File, { name: 'smallFile.png', size: 10 } as File];
|
||||||
const files: File[] = [
|
|
||||||
{ name: 'bigFile.png', size: 1000 } as File,
|
|
||||||
{ name: 'smallFile.png', size: 10 } as File
|
|
||||||
];
|
|
||||||
|
|
||||||
let addToQueueSpy;
|
let addToQueueSpy;
|
||||||
|
|
||||||
@ -245,9 +229,7 @@ describe('UploadButtonComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should allow file of 0 size when the max file size is set to 0', () => {
|
it('should allow file of 0 size when the max file size is set to 0', () => {
|
||||||
const zeroFiles: File[] = [
|
const zeroFiles: File[] = [{ name: 'zeroFile.png', size: 0 } as File];
|
||||||
{ name: 'zeroFile.png', size: 0 } as File
|
|
||||||
];
|
|
||||||
component.maxFilesSize = 0;
|
component.maxFilesSize = 0;
|
||||||
|
|
||||||
component.uploadFiles(zeroFiles);
|
component.uploadFiles(zeroFiles);
|
||||||
@ -284,12 +266,7 @@ describe('UploadButtonComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('uploadFiles', () => {
|
describe('uploadFiles', () => {
|
||||||
|
const files: File[] = [{ name: 'phobos.jpg' } as File, { name: 'deimos.png' } as File, { name: 'ganymede.bmp' } as File];
|
||||||
const files: File[] = [
|
|
||||||
{ name: 'phobos.jpg' } as File,
|
|
||||||
{ name: 'deimos.png' } as File,
|
|
||||||
{ name: 'ganymede.bmp' } as File
|
|
||||||
];
|
|
||||||
|
|
||||||
let addToQueueSpy;
|
let addToQueueSpy;
|
||||||
|
|
||||||
@ -344,8 +321,7 @@ describe('UploadButtonComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOn(uploadService, 'uploadFilesInTheQueue').and.stub();
|
spyOn(uploadService, 'uploadFilesInTheQueue').and.stub();
|
||||||
fakeNodeWithNoPermission = {
|
fakeNodeWithNoPermission = {};
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not call uploadFiles for node without permission', () => {
|
it('should not call uploadFiles for node without permission', () => {
|
||||||
|
@ -21,7 +21,7 @@ import { By } from '@angular/platform-browser';
|
|||||||
import { VersionListComponent } from './version-list.component';
|
import { VersionListComponent } from './version-list.component';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { Node, VersionPaging, VersionEntry, NodeEntry } from '@alfresco/js-api';
|
import { Node, VersionPaging, NodeEntry, VersionEntry, Version } from '@alfresco/js-api';
|
||||||
import { ContentTestingModule } from '../testing/content.testing.module';
|
import { ContentTestingModule } from '../testing/content.testing.module';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { ContentVersionService } from './content-version.service';
|
import { ContentVersionService } from './content-version.service';
|
||||||
@ -36,8 +36,8 @@ describe('VersionListComponent', () => {
|
|||||||
const versionId = '1.0';
|
const versionId = '1.0';
|
||||||
|
|
||||||
const versionTest = [
|
const versionTest = [
|
||||||
{ entry: { name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' } } as VersionEntry,
|
new VersionEntry({ entry: new Version({ name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' }) }),
|
||||||
{ entry: { name: 'test-file-name-two', id: '1.0', versionComment: 'test-version-comment' } } as VersionEntry
|
new VersionEntry({ entry: new Version({ name: 'test-file-name-two', id: '1.0', versionComment: 'test-version-comment' }) })
|
||||||
];
|
];
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -47,10 +47,7 @@ describe('VersionListComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [TranslateModule.forRoot(), ContentTestingModule],
|
||||||
TranslateModule.forRoot(),
|
|
||||||
ContentTestingModule
|
|
||||||
],
|
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||||
});
|
});
|
||||||
fixture = TestBed.createComponent(VersionListComponent);
|
fixture = TestBed.createComponent(VersionListComponent);
|
||||||
@ -61,7 +58,7 @@ describe('VersionListComponent', () => {
|
|||||||
component.node = { id: nodeId, allowableOperations: ['update'] } as Node;
|
component.node = { id: nodeId, allowableOperations: ['update'] } as Node;
|
||||||
|
|
||||||
spyOn(component, 'downloadContent').and.stub();
|
spyOn(component, 'downloadContent').and.stub();
|
||||||
spyOn(component.nodesApi, 'getNode').and.returnValue(Promise.resolve(new NodeEntry({ entry: { id: 'nodeInfoId' } })));
|
spyOn(component.nodesApi, 'getNode').and.returnValue(Promise.resolve(new NodeEntry({ entry: new Node({ id: 'nodeInfoId' }) })));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should raise confirmation dialog on delete', () => {
|
it('should raise confirmation dialog on delete', () => {
|
||||||
@ -84,7 +81,7 @@ describe('VersionListComponent', () => {
|
|||||||
afterClosed: () => of(true)
|
afterClosed: () => of(true)
|
||||||
} as any);
|
} as any);
|
||||||
|
|
||||||
spyOn(component.versionsApi, 'deleteVersion').and.returnValue(Promise.resolve(true));
|
spyOn(component.versionsApi, 'deleteVersion').and.returnValue(Promise.resolve());
|
||||||
|
|
||||||
component.deleteVersion(versionId);
|
component.deleteVersion(versionId);
|
||||||
|
|
||||||
@ -99,7 +96,7 @@ describe('VersionListComponent', () => {
|
|||||||
afterClosed: () => of(false)
|
afterClosed: () => of(false)
|
||||||
} as any);
|
} as any);
|
||||||
|
|
||||||
spyOn(component.versionsApi, 'deleteVersion').and.returnValue(Promise.resolve(true));
|
spyOn(component.versionsApi, 'deleteVersion').and.returnValue(Promise.resolve());
|
||||||
|
|
||||||
component.deleteVersion(versionId);
|
component.deleteVersion(versionId);
|
||||||
|
|
||||||
@ -118,10 +115,8 @@ describe('VersionListComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Version history fetching', () => {
|
describe('Version history fetching', () => {
|
||||||
|
|
||||||
it('should use loading bar', () => {
|
it('should use loading bar', () => {
|
||||||
spyOn(component.versionsApi, 'listVersionHistory').and
|
spyOn(component.versionsApi, 'listVersionHistory').and.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
||||||
.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
|
||||||
|
|
||||||
let loadingProgressBar = fixture.debugElement.query(By.css('[data-automation-id="version-history-loading-bar"]'));
|
let loadingProgressBar = fixture.debugElement.query(By.css('[data-automation-id="version-history-loading-bar"]'));
|
||||||
expect(loadingProgressBar).toBeNull();
|
expect(loadingProgressBar).toBeNull();
|
||||||
@ -134,8 +129,7 @@ describe('VersionListComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should load the versions for a given id', () => {
|
it('should load the versions for a given id', () => {
|
||||||
spyOn(component.versionsApi, 'listVersionHistory').and
|
spyOn(component.versionsApi, 'listVersionHistory').and.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
||||||
.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
|
||||||
|
|
||||||
component.ngOnChanges();
|
component.ngOnChanges();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -145,15 +139,15 @@ describe('VersionListComponent', () => {
|
|||||||
|
|
||||||
it('should show the versions after loading', (done) => {
|
it('should show the versions after loading', (done) => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
spyOn(component.versionsApi, 'listVersionHistory').and.callFake(() => Promise.resolve(new VersionPaging({
|
spyOn(component.versionsApi, 'listVersionHistory').and.callFake(() =>
|
||||||
|
Promise.resolve(
|
||||||
|
new VersionPaging({
|
||||||
list: {
|
list: {
|
||||||
entries: [
|
entries: [versionTest[0]]
|
||||||
{
|
|
||||||
entry: { name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' }
|
|
||||||
}
|
}
|
||||||
]
|
})
|
||||||
}
|
)
|
||||||
})));
|
);
|
||||||
|
|
||||||
component.ngOnChanges();
|
component.ngOnChanges();
|
||||||
|
|
||||||
@ -171,18 +165,15 @@ describe('VersionListComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should NOT show the versions comments if input property is set not to show them', (done) => {
|
it('should NOT show the versions comments if input property is set not to show them', (done) => {
|
||||||
spyOn(component.versionsApi, 'listVersionHistory').and
|
spyOn(component.versionsApi, 'listVersionHistory').and.callFake(() =>
|
||||||
.callFake(() => Promise.resolve(
|
Promise.resolve(
|
||||||
new VersionPaging({
|
new VersionPaging({
|
||||||
list: {
|
list: {
|
||||||
entries: [
|
entries: [versionTest[0]]
|
||||||
{
|
|
||||||
entry: { name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
));
|
)
|
||||||
|
);
|
||||||
|
|
||||||
component.showComments = false;
|
component.showComments = false;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -199,14 +190,9 @@ describe('VersionListComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to download a version', () => {
|
it('should be able to download a version', () => {
|
||||||
const versionEntry = {
|
spyOn(component.versionsApi, 'listVersionHistory').and.returnValue(
|
||||||
entry: {
|
Promise.resolve(new VersionPaging({ list: { entries: [versionTest[0]] } }))
|
||||||
name: 'test-file-name',
|
);
|
||||||
id: '1.0',
|
|
||||||
versionComment: 'test-version-comment'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
spyOn(component.versionsApi, 'listVersionHistory').and.returnValue(Promise.resolve(new VersionPaging({ list: { entries: [versionEntry] } })));
|
|
||||||
spyOn(contentVersionService.contentApi, 'getContentUrl').and.returnValue('the/download/url');
|
spyOn(contentVersionService.contentApi, 'getContentUrl').and.returnValue('the/download/url');
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -223,15 +209,9 @@ describe('VersionListComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should NOT be able to download a version if configured so', () => {
|
it('should NOT be able to download a version if configured so', () => {
|
||||||
const versionEntry = {
|
spyOn(component.versionsApi, 'listVersionHistory').and.callFake(() =>
|
||||||
entry: {
|
Promise.resolve(new VersionPaging({ list: { entries: [versionTest[0]] } }))
|
||||||
name: 'test-file-name',
|
);
|
||||||
id: '1.0',
|
|
||||||
versionComment: 'test-version-comment'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
spyOn(component.versionsApi, 'listVersionHistory').and
|
|
||||||
.callFake(() => Promise.resolve(new VersionPaging({ list: { entries: [versionEntry] } })));
|
|
||||||
const spyOnDownload = spyOn(component.contentApi, 'getContentUrl').and.stub();
|
const spyOnDownload = spyOn(component.contentApi, 'getContentUrl').and.stub();
|
||||||
|
|
||||||
component.allowDownload = false;
|
component.allowDownload = false;
|
||||||
@ -243,7 +223,6 @@ describe('VersionListComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Version restoring', () => {
|
describe('Version restoring', () => {
|
||||||
|
|
||||||
it('should restore version only when restore allowed', () => {
|
it('should restore version only when restore allowed', () => {
|
||||||
component.node.allowableOperations = [];
|
component.node.allowableOperations = [];
|
||||||
spyOn(component.versionsApi, 'revertVersion').and.stub();
|
spyOn(component.versionsApi, 'revertVersion').and.stub();
|
||||||
@ -255,9 +234,7 @@ describe('VersionListComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
component.versions = versionTest;
|
component.versions = versionTest;
|
||||||
|
|
||||||
const spyOnRevertVersion = spyOn(component.versionsApi, 'revertVersion').and
|
const spyOnRevertVersion = spyOn(component.versionsApi, 'revertVersion').and.callFake(() => Promise.resolve(versionTest[0]));
|
||||||
.callFake(() => Promise.resolve(new VersionEntry(
|
|
||||||
{ entry: { name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' } })));
|
|
||||||
|
|
||||||
component.restore(versionId);
|
component.restore(versionId);
|
||||||
|
|
||||||
@ -267,12 +244,9 @@ describe('VersionListComponent', () => {
|
|||||||
it('should get node info after restoring the node', fakeAsync(() => {
|
it('should get node info after restoring the node', fakeAsync(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
component.versions = versionTest;
|
component.versions = versionTest;
|
||||||
spyOn(component.versionsApi, 'listVersionHistory')
|
spyOn(component.versionsApi, 'listVersionHistory').and.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
||||||
.and.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
|
||||||
|
|
||||||
spyOn(component.versionsApi, 'revertVersion')
|
spyOn(component.versionsApi, 'revertVersion').and.callFake(() => Promise.resolve(versionTest[0]));
|
||||||
.and.callFake(() => Promise.resolve(new VersionEntry(
|
|
||||||
{ entry: { name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' } })));
|
|
||||||
|
|
||||||
component.restore(versionId);
|
component.restore(versionId);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -284,12 +258,9 @@ describe('VersionListComponent', () => {
|
|||||||
it('should emit with node info data', fakeAsync(() => {
|
it('should emit with node info data', fakeAsync(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
component.versions = versionTest;
|
component.versions = versionTest;
|
||||||
spyOn(component.versionsApi, 'listVersionHistory')
|
spyOn(component.versionsApi, 'listVersionHistory').and.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
||||||
.and.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
|
||||||
|
|
||||||
spyOn(component.versionsApi, 'revertVersion')
|
spyOn(component.versionsApi, 'revertVersion').and.callFake(() => Promise.resolve(versionTest[0]));
|
||||||
.and.callFake(() => Promise.resolve(new VersionEntry(
|
|
||||||
{ entry: { name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' } })));
|
|
||||||
|
|
||||||
spyOn(component.restored, 'emit');
|
spyOn(component.restored, 'emit');
|
||||||
|
|
||||||
@ -304,8 +275,9 @@ describe('VersionListComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
component.versions = versionTest;
|
component.versions = versionTest;
|
||||||
|
|
||||||
const spyOnListVersionHistory = spyOn(component.versionsApi, 'listVersionHistory').and
|
const spyOnListVersionHistory = spyOn(component.versionsApi, 'listVersionHistory').and.callFake(() =>
|
||||||
.callFake(() => Promise.resolve({ list: { entries: versionTest } }));
|
Promise.resolve({ list: { entries: versionTest } })
|
||||||
|
);
|
||||||
spyOn(component.versionsApi, 'revertVersion').and.callFake(() => Promise.resolve(null));
|
spyOn(component.versionsApi, 'revertVersion').and.callFake(() => Promise.resolve(null));
|
||||||
|
|
||||||
component.restore(versionId);
|
component.restore(versionId);
|
||||||
@ -329,18 +301,16 @@ describe('VersionListComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
spyOn(component.versionsApi, 'listVersionHistory').and.callFake(() => Promise.resolve(new VersionPaging({
|
versionTest[1].entry.id = '1.1';
|
||||||
|
spyOn(component.versionsApi, 'listVersionHistory').and.callFake(() =>
|
||||||
|
Promise.resolve(
|
||||||
|
new VersionPaging({
|
||||||
list: {
|
list: {
|
||||||
entries: [
|
entries: versionTest
|
||||||
{
|
|
||||||
entry: { name: 'test-file-two', id: '1.1', versionComment: 'test-version-comment' }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
entry: { name: 'test-file-name', id: '1.0', versionComment: 'test-version-comment' }
|
|
||||||
}
|
}
|
||||||
]
|
})
|
||||||
}
|
)
|
||||||
})));
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('showActions', () => {
|
describe('showActions', () => {
|
||||||
@ -373,7 +343,6 @@ describe('VersionListComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('disabled', () => {
|
describe('disabled', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
component.node = { id: nodeId } as Node;
|
component.node = { id: nodeId } as Node;
|
||||||
component.ngOnChanges();
|
component.ngOnChanges();
|
||||||
@ -406,7 +375,6 @@ describe('VersionListComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('enabled', () => {
|
describe('enabled', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
component.node = { id: nodeId, allowableOperations: ['update', 'delete'] } as Node;
|
component.node = { id: nodeId, allowableOperations: ['update', 'delete'] } as Node;
|
||||||
component.ngOnChanges();
|
component.ngOnChanges();
|
||||||
@ -425,7 +393,7 @@ describe('VersionListComponent', () => {
|
|||||||
|
|
||||||
it('should enable restore action if is allowed', (done) => {
|
it('should enable restore action if is allowed', (done) => {
|
||||||
fixture.whenStable().then(() => {
|
fixture.whenStable().then(() => {
|
||||||
expect(getRestoreButton().disabled).toBeFalse();
|
expect(getRestoreButton('1.1').disabled).toBeFalse();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Node, VersionPaging } from '@alfresco/js-api';
|
import { Node, Version, VersionEntry, VersionPaging } from '@alfresco/js-api';
|
||||||
import { VersionManagerComponent } from './version-manager.component';
|
import { VersionManagerComponent } from './version-manager.component';
|
||||||
import { ContentTestingModule } from '../testing/content.testing.module';
|
import { ContentTestingModule } from '../testing/content.testing.module';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
@ -36,20 +36,11 @@ describe('VersionManagerComponent', () => {
|
|||||||
name: 'TEST-NODE',
|
name: 'TEST-NODE',
|
||||||
isFile: true
|
isFile: true
|
||||||
});
|
});
|
||||||
const versionEntry = {
|
const versionEntry = new VersionEntry({ entry: new Version({ id: '1.0', name: node.name, versionComment: expectedComment }) });
|
||||||
entry: {
|
|
||||||
id: '1.0',
|
|
||||||
name: node.name,
|
|
||||||
versionComment: expectedComment
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [TranslateModule.forRoot(), ContentTestingModule],
|
||||||
TranslateModule.forRoot(),
|
|
||||||
ContentTestingModule
|
|
||||||
],
|
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||||
});
|
});
|
||||||
fixture = TestBed.createComponent(VersionManagerComponent);
|
fixture = TestBed.createComponent(VersionManagerComponent);
|
||||||
@ -57,8 +48,9 @@ describe('VersionManagerComponent', () => {
|
|||||||
component.node = node;
|
component.node = node;
|
||||||
|
|
||||||
nodesApiService = TestBed.inject(NodesApiService);
|
nodesApiService = TestBed.inject(NodesApiService);
|
||||||
spyOnListVersionHistory = spyOn(component.versionListComponent['versionsApi'], 'listVersionHistory').and
|
spyOnListVersionHistory = spyOn(component.versionListComponent['versionsApi'], 'listVersionHistory').and.callFake(() =>
|
||||||
.callFake(() => Promise.resolve(new VersionPaging({ list: { entries: [ versionEntry ] }})));
|
Promise.resolve(new VersionPaging({ list: { entries: [versionEntry] } }))
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should load the versions for a given node', () => {
|
it('should load the versions for a given node', () => {
|
||||||
@ -110,7 +102,6 @@ describe('VersionManagerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Animation', () => {
|
describe('Animation', () => {
|
||||||
|
|
||||||
it('should upload button be hide by default', () => {
|
it('should upload button be hide by default', () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|||||||
import { AppExtensionService, ViewerExtensionRef } from '@alfresco/adf-extensions';
|
import { AppExtensionService, ViewerExtensionRef } from '@alfresco/adf-extensions';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { NodeEntry, VersionEntry } from '@alfresco/js-api';
|
import { ContentInfo, Node, NodeEntry, VersionEntry } from '@alfresco/js-api';
|
||||||
import { AlfrescoViewerComponent, NodeActionsService, RenditionService } from '@alfresco/adf-content-services';
|
import { AlfrescoViewerComponent, NodeActionsService, RenditionService } from '@alfresco/adf-content-services';
|
||||||
import { CoreTestingModule, EventMock, ViewUtilService, ViewerComponent } from '@alfresco/adf-core';
|
import { CoreTestingModule, EventMock, ViewUtilService, ViewerComponent } from '@alfresco/adf-core';
|
||||||
import { NodesApiService } from '../../common/services/nodes-api.service';
|
import { NodesApiService } from '../../common/services/nodes-api.service';
|
||||||
@ -45,8 +45,7 @@ import { By } from '@angular/platform-browser';
|
|||||||
</adf-alfresco-viewer>
|
</adf-alfresco-viewer>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
class ViewerWithCustomToolbarComponent {
|
class ViewerWithCustomToolbarComponent {}
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-viewer-container-toolbar-actions',
|
selector: 'adf-viewer-container-toolbar-actions',
|
||||||
@ -60,8 +59,7 @@ class ViewerWithCustomToolbarComponent {
|
|||||||
</adf-alfresco-viewer>
|
</adf-alfresco-viewer>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
class ViewerWithCustomToolbarActionsComponent {
|
class ViewerWithCustomToolbarActionsComponent {}
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-viewer-container-sidebar',
|
selector: 'adf-viewer-container-sidebar',
|
||||||
@ -73,15 +71,13 @@ class ViewerWithCustomToolbarActionsComponent {
|
|||||||
</adf-alfresco-viewer>
|
</adf-alfresco-viewer>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
class ViewerWithCustomSidebarComponent {
|
class ViewerWithCustomSidebarComponent {}
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-dialog-dummy',
|
selector: 'adf-dialog-dummy',
|
||||||
template: ``
|
template: ``
|
||||||
})
|
})
|
||||||
class DummyDialogComponent {
|
class DummyDialogComponent {}
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-viewer-container-open-with',
|
selector: 'adf-viewer-container-open-with',
|
||||||
@ -104,8 +100,7 @@ class DummyDialogComponent {
|
|||||||
</adf-alfresco-viewer>
|
</adf-alfresco-viewer>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
class ViewerWithCustomOpenWithComponent {
|
class ViewerWithCustomOpenWithComponent {}
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-viewer-container-more-actions',
|
selector: 'adf-viewer-container-more-actions',
|
||||||
@ -128,12 +123,9 @@ class ViewerWithCustomOpenWithComponent {
|
|||||||
</adf-alfresco-viewer>
|
</adf-alfresco-viewer>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
class ViewerWithCustomMoreActionsComponent {
|
class ViewerWithCustomMoreActionsComponent {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
describe('AlfrescoViewerComponent', () => {
|
describe('AlfrescoViewerComponent', () => {
|
||||||
|
|
||||||
let component: AlfrescoViewerComponent;
|
let component: AlfrescoViewerComponent;
|
||||||
let fixture: ComponentFixture<AlfrescoViewerComponent>;
|
let fixture: ComponentFixture<AlfrescoViewerComponent>;
|
||||||
let element: HTMLElement;
|
let element: HTMLElement;
|
||||||
@ -148,13 +140,7 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [NoopAnimationsModule, TranslateModule.forRoot(), CoreTestingModule, MatButtonModule, MatIconModule],
|
||||||
NoopAnimationsModule,
|
|
||||||
TranslateModule.forRoot(),
|
|
||||||
CoreTestingModule,
|
|
||||||
MatButtonModule,
|
|
||||||
MatIconModule
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
ViewerWithCustomToolbarComponent,
|
ViewerWithCustomToolbarComponent,
|
||||||
ViewerWithCustomSidebarComponent,
|
ViewerWithCustomSidebarComponent,
|
||||||
@ -164,7 +150,8 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: RenditionService, useValue: {
|
provide: RenditionService,
|
||||||
|
useValue: {
|
||||||
getNodeRendition: () => throwError('thrown'),
|
getNodeRendition: () => throwError('thrown'),
|
||||||
generateMediaTracksRendition: () => {}
|
generateMediaTracksRendition: () => {}
|
||||||
}
|
}
|
||||||
@ -191,10 +178,7 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
fixture.destroy();
|
fixture.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('Extension Type Test', () => {
|
describe('Extension Type Test', () => {
|
||||||
|
|
||||||
|
|
||||||
it('should use external viewer to display node by id', fakeAsync(() => {
|
it('should use external viewer to display node by id', fakeAsync(() => {
|
||||||
const extension: ViewerExtensionRef = {
|
const extension: ViewerExtensionRef = {
|
||||||
component: 'custom.component',
|
component: 'custom.component',
|
||||||
@ -210,7 +194,7 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
element = fixture.nativeElement;
|
element = fixture.nativeElement;
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
|
||||||
spyOn(component.nodesApi, 'getNode').and.callFake(() => Promise.resolve(new NodeEntry({entry: {}})));
|
spyOn(component.nodesApi, 'getNode').and.callFake(() => Promise.resolve(new NodeEntry({ entry: new Node() })));
|
||||||
|
|
||||||
component.nodeId = '37f7f34d-4e64-4db6-bb3f-5c89f7844251';
|
component.nodeId = '37f7f34d-4e64-4db6-bb3f-5c89f7844251';
|
||||||
component.ngOnChanges();
|
component.ngOnChanges();
|
||||||
@ -223,20 +207,17 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
expect(renditionService.generateMediaTracksRendition).not.toHaveBeenCalled();
|
expect(renditionService.generateMediaTracksRendition).not.toHaveBeenCalled();
|
||||||
expect(element.querySelector('[data-automation-id="custom.component"]')).not.toBeNull();
|
expect(element.querySelector('[data-automation-id="custom.component"]')).not.toBeNull();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('MimeType handling', () => {
|
describe('MimeType handling', () => {
|
||||||
|
|
||||||
it('should node without content show unkonwn', (done) => {
|
it('should node without content show unkonwn', (done) => {
|
||||||
const displayName = 'the-name';
|
const displayName = 'the-name';
|
||||||
const contentUrl = '/content/url/path';
|
const contentUrl = '/content/url/path';
|
||||||
|
|
||||||
component.nodeId = '12';
|
component.nodeId = '12';
|
||||||
spyOn(component['nodesApi'], 'getNode').and.returnValue(Promise.resolve(new NodeEntry({
|
spyOn(component['nodesApi'], 'getNode').and.returnValue(
|
||||||
entry: {content: {name: displayName, id: '12'}}
|
Promise.resolve(new NodeEntry({ entry: new Node({ name: displayName, id: '12', content: new ContentInfo() }) }))
|
||||||
})));
|
);
|
||||||
|
|
||||||
spyOn(component['contentApi'], 'getContentUrl').and.returnValue(contentUrl);
|
spyOn(component['contentApi'], 'getContentUrl').and.returnValue(contentUrl);
|
||||||
|
|
||||||
@ -251,8 +232,8 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
|
|
||||||
it('should change display name every time node changes', fakeAsync(() => {
|
it('should change display name every time node changes', fakeAsync(() => {
|
||||||
spyOn(component['nodesApi'], 'getNode').and.returnValues(
|
spyOn(component['nodesApi'], 'getNode').and.returnValues(
|
||||||
Promise.resolve(new NodeEntry({entry: {name: 'file1', content: {}}})),
|
Promise.resolve(new NodeEntry({ entry: new Node({ name: 'file1', content: new ContentInfo() }) })),
|
||||||
Promise.resolve(new NodeEntry({entry: {name: 'file2', content: {}}}))
|
Promise.resolve(new NodeEntry({ entry: new Node({ name: 'file2', content: new ContentInfo() }) }))
|
||||||
);
|
);
|
||||||
|
|
||||||
component.showViewer = true;
|
component.showViewer = true;
|
||||||
@ -272,13 +253,15 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
|
|
||||||
it('should append version of the file to the file content URL', fakeAsync(() => {
|
it('should append version of the file to the file content URL', fakeAsync(() => {
|
||||||
spyOn(component['nodesApi'], 'getNode').and.returnValue(
|
spyOn(component['nodesApi'], 'getNode').and.returnValue(
|
||||||
Promise.resolve(new NodeEntry({
|
Promise.resolve(
|
||||||
entry: {
|
new NodeEntry({
|
||||||
|
entry: new Node({
|
||||||
name: 'file1.pdf',
|
name: 'file1.pdf',
|
||||||
content: {},
|
content: new ContentInfo(),
|
||||||
properties: { 'cm:versionLabel': '10' }
|
properties: { 'cm:versionLabel': '10' }
|
||||||
}
|
})
|
||||||
}))
|
})
|
||||||
|
)
|
||||||
);
|
);
|
||||||
spyOn(component['versionsApi'], 'getVersion').and.returnValue(Promise.resolve(undefined));
|
spyOn(component['versionsApi'], 'getVersion').and.returnValue(Promise.resolve(undefined));
|
||||||
|
|
||||||
@ -293,14 +276,14 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
expect(component.urlFileContent).toContain('/public/alfresco/versions/1/nodes/id1/content?attachment=false&10');
|
expect(component.urlFileContent).toContain('/public/alfresco/versions/1/nodes/id1/content?attachment=false&10');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should change display name every time node\`s version changes', fakeAsync(() => {
|
it('should change display name every time node`s version changes', fakeAsync(() => {
|
||||||
spyOn(component['nodesApi'], 'getNode').and.returnValue(
|
spyOn(component['nodesApi'], 'getNode').and.returnValue(
|
||||||
Promise.resolve(new NodeEntry({entry: {name: 'node1', content: {}}}))
|
Promise.resolve(new NodeEntry({ entry: new Node({ name: 'node1', content: new ContentInfo() }) }))
|
||||||
);
|
);
|
||||||
|
|
||||||
spyOn(component['versionsApi'], 'getVersion').and.returnValues(
|
spyOn(component['versionsApi'], 'getVersion').and.returnValues(
|
||||||
Promise.resolve(new VersionEntry({entry: {name: 'file1', content: {}}})),
|
Promise.resolve(new VersionEntry({ entry: new Node({ name: 'file1', content: new ContentInfo() }) })),
|
||||||
Promise.resolve(new VersionEntry({entry: {name: 'file2', content: {}}}))
|
Promise.resolve(new VersionEntry({ entry: new Node({ name: 'file2', content: new ContentInfo() }) }))
|
||||||
);
|
);
|
||||||
|
|
||||||
component.nodeId = 'id1';
|
component.nodeId = 'id1';
|
||||||
@ -321,7 +304,7 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
|
|
||||||
it('should update node only if node name changed', fakeAsync(() => {
|
it('should update node only if node name changed', fakeAsync(() => {
|
||||||
spyOn(component['nodesApi'], 'getNode').and.returnValues(
|
spyOn(component['nodesApi'], 'getNode').and.returnValues(
|
||||||
Promise.resolve(new NodeEntry({entry: {name: 'file1', content: {}}}))
|
Promise.resolve(new NodeEntry({ entry: new Node({ name: 'file1', content: new ContentInfo() }) }))
|
||||||
);
|
);
|
||||||
|
|
||||||
component.showViewer = true;
|
component.showViewer = true;
|
||||||
@ -357,7 +340,6 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Viewer Example Component Rendering', () => {
|
describe('Viewer Example Component Rendering', () => {
|
||||||
|
|
||||||
it('should use custom toolbar', (done) => {
|
it('should use custom toolbar', (done) => {
|
||||||
const customFixture = TestBed.createComponent(ViewerWithCustomToolbarComponent);
|
const customFixture = TestBed.createComponent(ViewerWithCustomToolbarComponent);
|
||||||
const customElement: HTMLElement = customFixture.nativeElement;
|
const customElement: HTMLElement = customFixture.nativeElement;
|
||||||
@ -414,7 +396,6 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
expect(customElement.querySelector('.adf-viewer-container-more-actions')).toBeDefined();
|
expect(customElement.querySelector('.adf-viewer-container-more-actions')).toBeDefined();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should stop propagation on sidebar keydown event [keydown]', fakeAsync(() => {
|
it('should stop propagation on sidebar keydown event [keydown]', fakeAsync(() => {
|
||||||
@ -447,10 +428,8 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('error handling', () => {
|
describe('error handling', () => {
|
||||||
|
|
||||||
it('should show unknown view when node file not found', (done) => {
|
it('should show unknown view when node file not found', (done) => {
|
||||||
spyOn(component['nodesApi'], 'getNode')
|
spyOn(component['nodesApi'], 'getNode').and.returnValue(Promise.reject(new Error('error')));
|
||||||
.and.returnValue(Promise.reject({}));
|
|
||||||
|
|
||||||
component.nodeId = 'the-node-id-of-the-file-to-preview';
|
component.nodeId = 'the-node-id-of-the-file-to-preview';
|
||||||
component.mimeType = null;
|
component.mimeType = null;
|
||||||
@ -464,8 +443,7 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should show unknown view when sharedLink file not found', (done) => {
|
it('should show unknown view when sharedLink file not found', (done) => {
|
||||||
spyOn(component['sharedLinksApi'], 'getSharedLink')
|
spyOn(component['sharedLinksApi'], 'getSharedLink').and.returnValue(Promise.reject(new Error('error')));
|
||||||
.and.returnValue(Promise.reject({}));
|
|
||||||
|
|
||||||
component.sharedLinkId = 'the-Shared-Link-id';
|
component.sharedLinkId = 'the-Shared-Link-id';
|
||||||
component.mimeType = null;
|
component.mimeType = null;
|
||||||
@ -477,12 +455,10 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
expect(element.querySelector('adf-viewer-unknown-format')).not.toBeNull();
|
expect(element.querySelector('adf-viewer-unknown-format')).not.toBeNull();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should raise an event when the shared link is invalid', fakeAsync(() => {
|
it('should raise an event when the shared link is invalid', fakeAsync(() => {
|
||||||
spyOn(component['sharedLinksApi'], 'getSharedLink')
|
spyOn(component['sharedLinksApi'], 'getSharedLink').and.returnValue(Promise.reject(new Error('error')));
|
||||||
.and.returnValue(Promise.reject({}));
|
|
||||||
|
|
||||||
component.sharedLinkId = 'the-Shared-Link-id';
|
component.sharedLinkId = 'the-Shared-Link-id';
|
||||||
component.mimeType = null;
|
component.mimeType = null;
|
||||||
@ -498,7 +474,6 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Toolbar', () => {
|
describe('Toolbar', () => {
|
||||||
|
|
||||||
it('should show only next file button', async () => {
|
it('should show only next file button', async () => {
|
||||||
component.allowNavigate = true;
|
component.allowNavigate = true;
|
||||||
component.canNavigateBefore = false;
|
component.canNavigateBefore = false;
|
||||||
@ -658,7 +633,7 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
component.nodeId = '12';
|
component.nodeId = '12';
|
||||||
const displayName = 'the-name';
|
const displayName = 'the-name';
|
||||||
const nodeDetails = {
|
const nodeDetails = {
|
||||||
entry: {name: displayName, id: '12', content: {mimeType: 'txt'}}
|
entry: new Node({ name: displayName, id: '12', content: new ContentInfo({ mimeType: 'txt' }) })
|
||||||
};
|
};
|
||||||
|
|
||||||
const contentUrl = '/content/url/path';
|
const contentUrl = '/content/url/path';
|
||||||
@ -687,8 +662,7 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not render close viewer button if it is a shared link', (done) => {
|
it('should not render close viewer button if it is a shared link', (done) => {
|
||||||
spyOn(component['sharedLinksApi'], 'getSharedLink')
|
spyOn(component['sharedLinksApi'], 'getSharedLink').and.returnValue(Promise.reject(new Error('error')));
|
||||||
.and.returnValue(Promise.reject({}));
|
|
||||||
|
|
||||||
component.sharedLinkId = 'the-Shared-Link-id';
|
component.sharedLinkId = 'the-Shared-Link-id';
|
||||||
component.mimeType = null;
|
component.mimeType = null;
|
||||||
@ -700,11 +674,9 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Base component', () => {
|
describe('Base component', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
component.mimeType = 'application/pdf';
|
component.mimeType = 'application/pdf';
|
||||||
component.nodeId = 'id1';
|
component.nodeId = 'id1';
|
||||||
@ -713,7 +685,6 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('SideBar Test', () => {
|
describe('SideBar Test', () => {
|
||||||
|
|
||||||
it('should NOT display sidebar if is not allowed', (done) => {
|
it('should NOT display sidebar if is not allowed', (done) => {
|
||||||
component.showRightSidebar = true;
|
component.showRightSidebar = true;
|
||||||
component.allowRightSidebar = false;
|
component.allowRightSidebar = false;
|
||||||
@ -748,7 +719,6 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
expect(sidebar).toBeNull();
|
expect(sidebar).toBeNull();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should display sidebar on the left side', (done) => {
|
it('should display sidebar on the left side', (done) => {
|
||||||
@ -765,9 +735,7 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('View', () => {
|
describe('View', () => {
|
||||||
|
|
||||||
describe('Overlay mode true', () => {
|
describe('Overlay mode true', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
component.overlayMode = true;
|
component.overlayMode = true;
|
||||||
component.fileName = 'fake-test-file.pdf';
|
component.fileName = 'fake-test-file.pdf';
|
||||||
@ -843,7 +811,6 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Overlay mode false', () => {
|
describe('Overlay mode false', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
component.overlayMode = false;
|
component.overlayMode = false;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@ -863,7 +830,6 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Attribute', () => {
|
describe('Attribute', () => {
|
||||||
|
|
||||||
it('should FileNodeId present not thrown any error ', () => {
|
it('should FileNodeId present not thrown any error ', () => {
|
||||||
component.showViewer = true;
|
component.showViewer = true;
|
||||||
component.nodeId = 'file-node-id';
|
component.nodeId = 'file-node-id';
|
||||||
@ -873,7 +839,6 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should showViewer default value be true', () => {
|
it('should showViewer default value be true', () => {
|
||||||
expect(component.showViewer).toBe(true);
|
expect(component.showViewer).toBe(true);
|
||||||
});
|
});
|
||||||
@ -887,22 +852,18 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Events', () => {
|
describe('Events', () => {
|
||||||
|
|
||||||
it('should update version when emitted by image-viewer and user has update permissions', () => {
|
it('should update version when emitted by image-viewer and user has update permissions', () => {
|
||||||
spyOn(uploadService, 'uploadFilesInTheQueue').and.callFake(() => {
|
spyOn(uploadService, 'uploadFilesInTheQueue').and.callFake(() => {});
|
||||||
});
|
|
||||||
spyOn(uploadService, 'addToQueue');
|
spyOn(uploadService, 'addToQueue');
|
||||||
component.readOnly = false;
|
component.readOnly = false;
|
||||||
component.nodeEntry = new NodeEntry({
|
component.nodeEntry = new NodeEntry({
|
||||||
entry: {
|
entry: new Node({ name: 'fakeImage.png', id: '12', content: new ContentInfo({ mimeType: 'img/png' }) })
|
||||||
name: 'fakeImage.png',
|
|
||||||
id: '12',
|
|
||||||
content: {mimeType: 'img/png'}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
const data = atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==');
|
const data = atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==');
|
||||||
const fakeBlob = new Blob([data], { type: 'image/png' });
|
const fakeBlob = new Blob([data], { type: 'image/png' });
|
||||||
const newImageFile: File = new File([fakeBlob], component?.nodeEntry?.entry?.name, {type: component?.nodeEntry?.entry?.content?.mimeType});
|
const newImageFile: File = new File([fakeBlob], component?.nodeEntry?.entry?.name, {
|
||||||
|
type: component?.nodeEntry?.entry?.content?.mimeType
|
||||||
|
});
|
||||||
const newFile = new FileModel(
|
const newFile = new FileModel(
|
||||||
newImageFile,
|
newImageFile,
|
||||||
{
|
{
|
||||||
@ -921,15 +882,10 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not update version when emitted by image-viewer and user doesn`t have update permissions', () => {
|
it('should not update version when emitted by image-viewer and user doesn`t have update permissions', () => {
|
||||||
spyOn(uploadService, 'uploadFilesInTheQueue').and.callFake(() => {
|
spyOn(uploadService, 'uploadFilesInTheQueue').and.callFake(() => {});
|
||||||
});
|
|
||||||
component.readOnly = true;
|
component.readOnly = true;
|
||||||
component.nodeEntry = new NodeEntry({
|
component.nodeEntry = new NodeEntry({
|
||||||
entry: {
|
entry: new Node({ name: 'fakeImage.png', id: '12', content: new ContentInfo({ mimeType: 'img/png' }) })
|
||||||
name: 'fakeImage.png',
|
|
||||||
id: '12',
|
|
||||||
content: {mimeType: 'img/png'}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
const data = atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==');
|
const data = atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==');
|
||||||
const fakeBlob = new Blob([data], { type: 'image/png' });
|
const fakeBlob = new Blob([data], { type: 'image/png' });
|
||||||
@ -939,6 +895,5 @@ describe('AlfrescoViewerComponent', () => {
|
|||||||
expect(uploadService.uploadFilesInTheQueue).not.toHaveBeenCalled();
|
expect(uploadService.uploadFilesInTheQueue).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"@angular/router": ">=14.1.3",
|
"@angular/router": ">=14.1.3",
|
||||||
"@mat-datetimepicker/core": "^10.1.1",
|
"@mat-datetimepicker/core": "^10.1.1",
|
||||||
"@mat-datetimepicker/moment": "^10.1.1",
|
"@mat-datetimepicker/moment": "^10.1.1",
|
||||||
"@alfresco/js-api": ">=6.3.0-1108",
|
"@alfresco/js-api": ">=6.3.0-1271",
|
||||||
"@alfresco/adf-extensions": ">=6.2.0",
|
"@alfresco/adf-extensions": ">=6.2.0",
|
||||||
"@ngx-translate/core": ">=14.0.0",
|
"@ngx-translate/core": ">=14.0.0",
|
||||||
"minimatch-browser": ">=1.0.0",
|
"minimatch-browser": ">=1.0.0",
|
||||||
|
@ -15,14 +15,15 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { User } from '../../../../..';
|
||||||
import { CommentModel } from '../../../models/comment.model';
|
import { CommentModel } from '../../../models/comment.model';
|
||||||
|
|
||||||
export const testUser = {
|
export const testUser = new User({
|
||||||
id: '1',
|
id: '1',
|
||||||
firstName: 'Test',
|
firstName: 'Test',
|
||||||
lastName: 'User',
|
lastName: 'User',
|
||||||
email: 'tu@domain.com'
|
email: 'tu@domain.com'
|
||||||
};
|
});
|
||||||
|
|
||||||
export const mockCommentOne = new CommentModel({
|
export const mockCommentOne = new CommentModel({
|
||||||
id: 1,
|
id: 1,
|
||||||
@ -42,29 +43,25 @@ export const commentUserPictureDefined = new CommentModel({
|
|||||||
id: 2,
|
id: 2,
|
||||||
message: '2nd Test Comment',
|
message: '2nd Test Comment',
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
createdBy: {
|
createdBy: new User({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
firstName: 'some',
|
firstName: 'some',
|
||||||
lastName: 'one',
|
lastName: 'one',
|
||||||
email: 'some-one@somegroup.com',
|
email: 'some-one@somegroup.com',
|
||||||
emailNotificationsEnabled: true,
|
|
||||||
company: {},
|
|
||||||
id: 'fake-email@dom.com',
|
id: 'fake-email@dom.com',
|
||||||
avatarId: '001-001-001'
|
avatarId: '001-001-001'
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
export const commentUserNoPictureDefined = new CommentModel({
|
export const commentUserNoPictureDefined = new CommentModel({
|
||||||
id: 2,
|
id: 2,
|
||||||
message: '2nd Test Comment',
|
message: '2nd Test Comment',
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
createdBy: {
|
createdBy: new User({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
firstName: 'some',
|
firstName: 'some',
|
||||||
lastName: 'one',
|
lastName: 'one',
|
||||||
email: 'some-one@somegroup.com',
|
email: 'some-one@somegroup.com',
|
||||||
emailNotificationsEnabled: true,
|
|
||||||
company: {},
|
|
||||||
id: 'fake-email@dom.com'
|
id: 'fake-email@dom.com'
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
|
@ -31,87 +31,35 @@ export class CommentsServiceMock implements Partial<CommentsService> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const commentUser = new User({
|
||||||
|
enabled: true,
|
||||||
|
firstName: 'hruser',
|
||||||
|
displayName: 'hruser',
|
||||||
|
id: 'hruser',
|
||||||
|
email: 'test'
|
||||||
|
});
|
||||||
|
|
||||||
export const commentsResponseMock = {
|
export const commentsResponseMock = {
|
||||||
getComments: () => of([
|
getComments: () => of([
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 1,
|
id: 1,
|
||||||
message: 'Test Comment',
|
message: 'Test Comment',
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
createdBy: {
|
createdBy: commentUser,
|
||||||
enabled: true,
|
|
||||||
firstName: 'hruser',
|
|
||||||
displayName: 'hruser',
|
|
||||||
quota: -1,
|
|
||||||
quotaUsed: 12,
|
|
||||||
emailNotificationsEnabled: true,
|
|
||||||
company: {
|
|
||||||
organization: 'test',
|
|
||||||
address1: 'test',
|
|
||||||
address2: 'test',
|
|
||||||
address3: 'test',
|
|
||||||
postcode: 'test',
|
|
||||||
telephone: 'test',
|
|
||||||
fax: 'test',
|
|
||||||
email: 'test'
|
|
||||||
},
|
|
||||||
id: 'hruser',
|
|
||||||
email: 'test',
|
|
||||||
isAdmin: () => false
|
|
||||||
} as User,
|
|
||||||
isSelected: false
|
isSelected: false
|
||||||
}),
|
}),
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 2,
|
id: 2,
|
||||||
message: 'Test Comment',
|
message: 'Test Comment',
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
createdBy: {
|
createdBy: commentUser,
|
||||||
enabled: true,
|
|
||||||
firstName: 'hruser',
|
|
||||||
displayName: 'hruser',
|
|
||||||
quota: -1,
|
|
||||||
quotaUsed: 12,
|
|
||||||
emailNotificationsEnabled: true,
|
|
||||||
company: {
|
|
||||||
organization: 'test',
|
|
||||||
address1: 'test',
|
|
||||||
address2: 'test',
|
|
||||||
address3: 'test',
|
|
||||||
postcode: 'test',
|
|
||||||
telephone: 'test',
|
|
||||||
fax: 'test',
|
|
||||||
email: 'test'
|
|
||||||
},
|
|
||||||
id: 'hruser',
|
|
||||||
email: 'test',
|
|
||||||
isAdmin: () => false
|
|
||||||
} as User,
|
|
||||||
isSelected: false
|
isSelected: false
|
||||||
}),
|
}),
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 3,
|
id: 3,
|
||||||
message: 'Test Comment',
|
message: 'Test Comment',
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
createdBy: {
|
createdBy: commentUser,
|
||||||
enabled: true,
|
|
||||||
firstName: 'hruser',
|
|
||||||
displayName: 'hruser',
|
|
||||||
quota: -1,
|
|
||||||
quotaUsed: 12,
|
|
||||||
emailNotificationsEnabled: true,
|
|
||||||
company: {
|
|
||||||
organization: 'test',
|
|
||||||
address1: 'test',
|
|
||||||
address2: 'test',
|
|
||||||
address3: 'test',
|
|
||||||
postcode: 'test',
|
|
||||||
telephone: 'test',
|
|
||||||
fax: 'test',
|
|
||||||
email: 'test'
|
|
||||||
},
|
|
||||||
id: 'hruser',
|
|
||||||
email: 'test',
|
|
||||||
isAdmin: () => false
|
|
||||||
} as User,
|
|
||||||
isSelected: false
|
isSelected: false
|
||||||
})
|
})
|
||||||
]),
|
]),
|
||||||
@ -120,27 +68,7 @@ export const commentsResponseMock = {
|
|||||||
id: 1,
|
id: 1,
|
||||||
message,
|
message,
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
createdBy: {
|
createdBy: commentUser,
|
||||||
enabled: true,
|
|
||||||
firstName: 'hruser',
|
|
||||||
displayName: 'hruser',
|
|
||||||
quota: -1,
|
|
||||||
quotaUsed: 12,
|
|
||||||
emailNotificationsEnabled: true,
|
|
||||||
company: {
|
|
||||||
organization: 'test',
|
|
||||||
address1: 'test',
|
|
||||||
address2: 'test',
|
|
||||||
address3: 'test',
|
|
||||||
postcode: 'test',
|
|
||||||
telephone: 'test',
|
|
||||||
fax: 'test',
|
|
||||||
email: 'test'
|
|
||||||
},
|
|
||||||
id: 'hruser',
|
|
||||||
email: 'test',
|
|
||||||
isAdmin: () => false
|
|
||||||
} as User,
|
|
||||||
isSelected: false
|
isSelected: false
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -15,11 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CommentModel } from '../../models';
|
import { CommentModel, User } from '../../models';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { CommentsService } from '../interfaces/comments-service.interface';
|
import { CommentsService } from '../interfaces/comments-service.interface';
|
||||||
import { testUser } from './comments.stories.mock';
|
import { testUser } from './comments.stories.mock';
|
||||||
import { UserLike } from '../../pipes/user-like.interface';
|
|
||||||
|
|
||||||
export class CommentsServiceStoriesMock implements Partial<CommentsService> {
|
export class CommentsServiceStoriesMock implements Partial<CommentsService> {
|
||||||
|
|
||||||
@ -33,87 +32,35 @@ export class CommentsServiceStoriesMock implements Partial<CommentsService> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const commentUser = new User({
|
||||||
|
enabled: true,
|
||||||
|
firstName: 'hruser',
|
||||||
|
displayName: 'hruser',
|
||||||
|
id: 'hruser',
|
||||||
|
email: 'test'
|
||||||
|
});
|
||||||
|
|
||||||
export const commentsResponseMock = {
|
export const commentsResponseMock = {
|
||||||
getComments: () => of([
|
getComments: () => of([
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 1,
|
id: 1,
|
||||||
message: 'Test Comment',
|
message: 'Test Comment',
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
createdBy: {
|
createdBy: commentUser,
|
||||||
enabled: true,
|
|
||||||
firstName: 'hruser',
|
|
||||||
displayName: 'hruser',
|
|
||||||
quota: -1,
|
|
||||||
quotaUsed: 12,
|
|
||||||
emailNotificationsEnabled: true,
|
|
||||||
company: {
|
|
||||||
organization: 'test',
|
|
||||||
address1: 'test',
|
|
||||||
address2: 'test',
|
|
||||||
address3: 'test',
|
|
||||||
postcode: 'test',
|
|
||||||
telephone: 'test',
|
|
||||||
fax: 'test',
|
|
||||||
email: 'test'
|
|
||||||
},
|
|
||||||
id: 'hruser',
|
|
||||||
email: 'test',
|
|
||||||
isAdmin: () => false
|
|
||||||
} as UserLike,
|
|
||||||
isSelected: false
|
isSelected: false
|
||||||
}),
|
}),
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 2,
|
id: 2,
|
||||||
message: 'Test Comment',
|
message: 'Test Comment',
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
createdBy: {
|
createdBy: commentUser,
|
||||||
enabled: true,
|
|
||||||
firstName: 'hruser',
|
|
||||||
displayName: 'hruser',
|
|
||||||
quota: -1,
|
|
||||||
quotaUsed: 12,
|
|
||||||
emailNotificationsEnabled: true,
|
|
||||||
company: {
|
|
||||||
organization: 'test',
|
|
||||||
address1: 'test',
|
|
||||||
address2: 'test',
|
|
||||||
address3: 'test',
|
|
||||||
postcode: 'test',
|
|
||||||
telephone: 'test',
|
|
||||||
fax: 'test',
|
|
||||||
email: 'test'
|
|
||||||
},
|
|
||||||
id: 'hruser',
|
|
||||||
email: 'test',
|
|
||||||
isAdmin: () => false
|
|
||||||
} as UserLike,
|
|
||||||
isSelected: false
|
isSelected: false
|
||||||
}),
|
}),
|
||||||
new CommentModel({
|
new CommentModel({
|
||||||
id: 3,
|
id: 3,
|
||||||
message: 'Test Comment',
|
message: 'Test Comment',
|
||||||
created: new Date(),
|
created: new Date(),
|
||||||
createdBy: {
|
createdBy: commentUser,
|
||||||
enabled: true,
|
|
||||||
firstName: 'hruser',
|
|
||||||
displayName: 'hruser',
|
|
||||||
quota: -1,
|
|
||||||
quotaUsed: 12,
|
|
||||||
emailNotificationsEnabled: true,
|
|
||||||
company: {
|
|
||||||
organization: 'test',
|
|
||||||
address1: 'test',
|
|
||||||
address2: 'test',
|
|
||||||
address3: 'test',
|
|
||||||
postcode: 'test',
|
|
||||||
telephone: 'test',
|
|
||||||
fax: 'test',
|
|
||||||
email: 'test'
|
|
||||||
},
|
|
||||||
id: 'hruser',
|
|
||||||
email: 'test',
|
|
||||||
isAdmin: () => false
|
|
||||||
} as UserLike,
|
|
||||||
isSelected: false
|
isSelected: false
|
||||||
})
|
})
|
||||||
]),
|
]),
|
||||||
|
@ -18,14 +18,14 @@
|
|||||||
import { User } from './general-user.model';
|
import { User } from './general-user.model';
|
||||||
|
|
||||||
export class CommentModel {
|
export class CommentModel {
|
||||||
id: number;
|
id: string | number;
|
||||||
message: string;
|
message: string;
|
||||||
created: Date;
|
created: Date;
|
||||||
createdBy: User;
|
createdBy: User;
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
|
|
||||||
get hasAvatarPicture(): boolean {
|
get hasAvatarPicture(): boolean {
|
||||||
return !!(this.createdBy['pictureId'] || this.createdBy['avatarId']);
|
return !!this.createdBy && !!(this.createdBy['pictureId'] || this.createdBy['avatarId']);
|
||||||
}
|
}
|
||||||
|
|
||||||
get userDisplayName(): string {
|
get userDisplayName(): string {
|
||||||
@ -51,7 +51,7 @@ export class CommentModel {
|
|||||||
return result.toUpperCase();
|
return result.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(obj?: any) {
|
constructor(obj?: Partial<CommentModel>) {
|
||||||
if (obj) {
|
if (obj) {
|
||||||
this.id = obj.id;
|
this.id = obj.id;
|
||||||
this.message = obj.message;
|
this.message = obj.message;
|
||||||
|
@ -15,6 +15,23 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IdentityUserModel } from '../auth/models/identity-user.model';
|
export class User {
|
||||||
|
displayName?: string;
|
||||||
|
username?: string;
|
||||||
|
id?: string | number;
|
||||||
|
firstName?: string;
|
||||||
|
lastName?: string;
|
||||||
|
email?: string;
|
||||||
|
createdTimestamp?: any;
|
||||||
|
emailVerified?: boolean;
|
||||||
|
enabled?: boolean;
|
||||||
|
readonly?: boolean;
|
||||||
|
pictureId?: number;
|
||||||
|
avatarId: string;
|
||||||
|
|
||||||
export type User = (IdentityUserModel) & { displayName?: string } & { username?: string };
|
constructor(user?: Partial<User>) {
|
||||||
|
if (user) {
|
||||||
|
Object.assign(this, user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/common": ">=14.1.3",
|
"@angular/common": ">=14.1.3",
|
||||||
"@angular/core": ">=14.1.3",
|
"@angular/core": ">=14.1.3",
|
||||||
"@alfresco/js-api": ">=6.3.0-1108"
|
"@alfresco/js-api": ">=6.3.0-1271"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"extensions",
|
"extensions",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"@angular/platform-browser": ">=14.1.3",
|
"@angular/platform-browser": ">=14.1.3",
|
||||||
"@angular/platform-browser-dynamic": ">=14.1.3",
|
"@angular/platform-browser-dynamic": ">=14.1.3",
|
||||||
"@angular/router": ">=14.1.3",
|
"@angular/router": ">=14.1.3",
|
||||||
"@alfresco/js-api": ">=6.3.0-1108",
|
"@alfresco/js-api": ">=6.3.0-1271",
|
||||||
"@alfresco/adf-core": ">=6.2.0",
|
"@alfresco/adf-core": ">=6.2.0",
|
||||||
"@alfresco/adf-content-services": ">=6.2.0",
|
"@alfresco/adf-content-services": ">=6.2.0",
|
||||||
"@apollo/client": "^3.7.2",
|
"@apollo/client": "^3.7.2",
|
||||||
|
@ -104,7 +104,7 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi
|
|||||||
file,
|
file,
|
||||||
'',
|
'',
|
||||||
nodeId,
|
nodeId,
|
||||||
'',
|
null,
|
||||||
{ overwrite: true }
|
{ overwrite: true }
|
||||||
)).pipe(
|
)).pipe(
|
||||||
map((res: any) => res.entry)
|
map((res: any) => res.entry)
|
||||||
|
@ -58,7 +58,7 @@ export class ProcessCloudContentService {
|
|||||||
): Observable<Node> {
|
): Observable<Node> {
|
||||||
|
|
||||||
return from(
|
return from(
|
||||||
this.uploadApi.uploadFile(file, '', nodeId, '', {overwrite: true})
|
this.uploadApi.uploadFile(file, '', nodeId, null, {overwrite: true})
|
||||||
).pipe(
|
).pipe(
|
||||||
map((res: any) => ({
|
map((res: any) => ({
|
||||||
...res.entry,
|
...res.entry,
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"@angular/platform-browser": ">=14.1.3",
|
"@angular/platform-browser": ">=14.1.3",
|
||||||
"@angular/platform-browser-dynamic": ">=14.1.3",
|
"@angular/platform-browser-dynamic": ">=14.1.3",
|
||||||
"@angular/router": ">=14.1.3",
|
"@angular/router": ">=14.1.3",
|
||||||
"@alfresco/js-api": ">=6.3.0-1108",
|
"@alfresco/js-api": ">=6.3.0-1271",
|
||||||
"@alfresco/adf-core": ">=6.2.0",
|
"@alfresco/adf-core": ">=6.2.0",
|
||||||
"@alfresco/adf-content-services": ">=6.2.0",
|
"@alfresco/adf-content-services": ">=6.2.0",
|
||||||
"@ngx-translate/core": ">=14.0.0",
|
"@ngx-translate/core": ">=14.0.0",
|
||||||
|
@ -64,7 +64,7 @@ export class ActivitiContentService {
|
|||||||
* @param tenantId
|
* @param tenantId
|
||||||
* @param includeAccount
|
* @param includeAccount
|
||||||
*/
|
*/
|
||||||
getAlfrescoRepositories(tenantId?: number, includeAccount?: boolean): Observable<any> {
|
getAlfrescoRepositories(tenantId?: string, includeAccount?: boolean): Observable<any> {
|
||||||
const opts = {
|
const opts = {
|
||||||
tenantId,
|
tenantId,
|
||||||
includeAccounts: includeAccount ? includeAccount : true
|
includeAccounts: includeAccount ? includeAccount : true
|
||||||
|
@ -25,7 +25,7 @@ import { AuthenticationService, AlfrescoApiService } from '@alfresco/adf-core';
|
|||||||
import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface';
|
import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface';
|
||||||
import { of, throwError } from 'rxjs';
|
import { of, throwError } from 'rxjs';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Node, SiteEntry, NodeEntry, SitePaging } from '@alfresco/js-api';
|
import { Node, SiteEntry, NodeEntry, SitePaging, SitePagingList } from '@alfresco/js-api';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
describe('AttachFileWidgetDialogComponent', () => {
|
describe('AttachFileWidgetDialogComponent', () => {
|
||||||
@ -78,7 +78,7 @@ describe('AttachFileWidgetDialogComponent', () => {
|
|||||||
spyOn(nodeService, 'getNode').and.returnValue(of(new Node({ id: 'fake-node', path: { elements: [{ nodeType: 'st:site', name: 'fake-site'}] } })));
|
spyOn(nodeService, 'getNode').and.returnValue(of(new Node({ id: 'fake-node', path: { elements: [{ nodeType: 'st:site', name: 'fake-site'}] } })));
|
||||||
|
|
||||||
spyOn(siteService, 'getSite').and.returnValue(of(fakeSite));
|
spyOn(siteService, 'getSite').and.returnValue(of(fakeSite));
|
||||||
spyOn(siteService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
spyOn(siteService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
|
||||||
spyOn(widget, 'isLoggedIn').and.callFake(() => isLogged);
|
spyOn(widget, 'isLoggedIn').and.callFake(() => isLogged);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ import { ProcessContentService } from '../../services/process-content.service';
|
|||||||
const fakePngAnswer = new RelatedContentRepresentation({
|
const fakePngAnswer = new RelatedContentRepresentation({
|
||||||
id: 1155,
|
id: 1155,
|
||||||
name: 'a_png_file.png',
|
name: 'a_png_file.png',
|
||||||
created: '2017-07-25T17:17:37.099Z',
|
created: new Date('2017-07-25T17:17:37.099Z'),
|
||||||
createdBy: {id: 1001, firstName: 'Admin', lastName: 'admin', email: 'admin'},
|
createdBy: {id: 1001, firstName: 'Admin', lastName: 'admin', email: 'admin'},
|
||||||
relatedContent: false,
|
relatedContent: false,
|
||||||
contentAvailable: true,
|
contentAvailable: true,
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CommentModel } from '@alfresco/adf-core';
|
import { CommentModel, User } from '@alfresco/adf-core';
|
||||||
|
|
||||||
export const mockProcessInstanceComments = [
|
export const mockProcessInstanceComments = [
|
||||||
new CommentModel({ message: 'Test1', created: Date.now(), createdBy: {firstName: 'Admin', lastName: 'User'} }),
|
new CommentModel({ message: 'Test1', created: new Date(), createdBy: new User({firstName: 'Admin', lastName: 'User'}) }),
|
||||||
new CommentModel({ message: 'Test2', created: Date.now(), createdBy: {firstName: 'Admin', lastName: 'User'} }),
|
new CommentModel({ message: 'Test2', created: new Date(), createdBy: new User({firstName: 'Admin', lastName: 'User'}) }),
|
||||||
new CommentModel({ message: 'Test3', created: Date.now(), createdBy: {firstName: 'Admin', lastName: 'User'} })
|
new CommentModel({ message: 'Test3', created: new Date(), createdBy: new User({firstName: 'Admin', lastName: 'User'}) })
|
||||||
];
|
];
|
||||||
|
@ -911,8 +911,8 @@ export const fakeUser = new UserRepresentation({
|
|||||||
password: null,
|
password: null,
|
||||||
type: 'enterprise',
|
type: 'enterprise',
|
||||||
status: 'active',
|
status: 'active',
|
||||||
created: '2020-08-14T09:21:52.306Z',
|
created: new Date('2020-08-14T09:21:52.306Z'),
|
||||||
lastUpdate: '2020-08-14T09:22:48.147Z',
|
lastUpdate: new Date('2020-08-14T09:22:48.147Z'),
|
||||||
tenantId: 310,
|
tenantId: 310,
|
||||||
groups: [
|
groups: [
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable, from, throwError } from 'rxjs';
|
import { Observable, from, throwError } from 'rxjs';
|
||||||
import { CommentModel, AlfrescoApiService, LogService, CommentsService } from '@alfresco/adf-core';
|
import { CommentModel, AlfrescoApiService, LogService, CommentsService, User } from '@alfresco/adf-core';
|
||||||
import { map, catchError } from 'rxjs/operators';
|
import { map, catchError } from 'rxjs/operators';
|
||||||
import { ActivitiCommentsApi } from '@alfresco/js-api';
|
import { ActivitiCommentsApi } from '@alfresco/js-api';
|
||||||
import { PeopleProcessService } from '../../common/services/people-process.service';
|
import { PeopleProcessService } from '../../common/services/people-process.service';
|
||||||
@ -57,7 +57,7 @@ export class CommentProcessService implements CommentsService {
|
|||||||
id: comment.id,
|
id: comment.id,
|
||||||
message: comment.message,
|
message: comment.message,
|
||||||
created: comment.created,
|
created: comment.created,
|
||||||
createdBy: user
|
createdBy: new User(user)
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
return comments;
|
return comments;
|
||||||
@ -81,7 +81,7 @@ export class CommentProcessService implements CommentsService {
|
|||||||
id: response.id,
|
id: response.id,
|
||||||
message: response.message,
|
message: response.message,
|
||||||
created: response.created,
|
created: response.created,
|
||||||
createdBy: response.createdBy
|
createdBy: new User(response.createdBy)
|
||||||
})),
|
})),
|
||||||
catchError((err: any) => this.handleError(err))
|
catchError((err: any) => this.handleError(err))
|
||||||
);
|
);
|
||||||
@ -92,7 +92,7 @@ export class CommentProcessService implements CommentsService {
|
|||||||
return throwError(error || 'Server error');
|
return throwError(error || 'Server error');
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserImage(user: any): string {
|
getUserImage(user: UserProcessModel): string {
|
||||||
return this.peopleProcessService.getUserImage(user);
|
return this.peopleProcessService.getUserImage(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ProcessFilterRequestRepresentation,
|
ProcessInstanceQueryRepresentation,
|
||||||
ProcessInstanceFilterRepresentation,
|
ProcessInstanceFilterRepresentation,
|
||||||
UserProcessInstanceFilterRepresentation
|
UserProcessInstanceFilterRepresentation
|
||||||
} from '@alfresco/js-api';
|
} from '@alfresco/js-api';
|
||||||
@ -50,7 +50,7 @@ export class FilterProcessRepresentationModel implements UserProcessInstanceFilt
|
|||||||
/**
|
/**
|
||||||
* This object represent the parameters of a process filter.
|
* This object represent the parameters of a process filter.
|
||||||
*/
|
*/
|
||||||
export class ProcessFilterParamRepresentationModel implements ProcessFilterRequestRepresentation {
|
export class ProcessFilterParamRepresentationModel implements ProcessInstanceQueryRepresentation {
|
||||||
|
|
||||||
processDefinitionId?: string;
|
processDefinitionId?: string;
|
||||||
processInstanceId?: string;
|
processInstanceId?: string;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AlfrescoApiService, CommentModel, CommentsService } from '@alfresco/adf-core';
|
import { AlfrescoApiService, CommentModel, CommentsService, User } from '@alfresco/adf-core';
|
||||||
import { ActivitiCommentsApi, CommentRepresentation } from '@alfresco/js-api';
|
import { ActivitiCommentsApi, CommentRepresentation } from '@alfresco/js-api';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { from, Observable, throwError } from 'rxjs';
|
import { from, Observable, throwError } from 'rxjs';
|
||||||
@ -100,7 +100,7 @@ export class TaskCommentsService implements CommentsService {
|
|||||||
id: representation.id,
|
id: representation.id,
|
||||||
message: representation.message,
|
message: representation.message,
|
||||||
created: representation.created,
|
created: representation.created,
|
||||||
createdBy: representation.createdBy
|
createdBy: new User(representation.createdBy)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ import {
|
|||||||
FormOutcomeEvent,
|
FormOutcomeEvent,
|
||||||
FormOutcomeModel,
|
FormOutcomeModel,
|
||||||
LogService,
|
LogService,
|
||||||
CommentModel
|
CommentModel,
|
||||||
|
User
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
import { TaskDetailsModel } from '../models/task-details.model';
|
||||||
import {
|
import {
|
||||||
@ -101,9 +102,9 @@ describe('TaskDetailsComponent', () => {
|
|||||||
taskCommentsService = TestBed.inject(TaskCommentsService);
|
taskCommentsService = TestBed.inject(TaskCommentsService);
|
||||||
|
|
||||||
spyOn(taskCommentsService, 'get').and.returnValue(of([
|
spyOn(taskCommentsService, 'get').and.returnValue(of([
|
||||||
new CommentModel({ message: 'Test1', created: Date.now(), createdBy: { firstName: 'Admin', lastName: 'User' } }),
|
new CommentModel({ message: 'Test1', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }),
|
||||||
new CommentModel({ message: 'Test2', created: Date.now(), createdBy: { firstName: 'Admin', lastName: 'User' } }),
|
new CommentModel({ message: 'Test2', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }),
|
||||||
new CommentModel({ message: 'Test3', created: Date.now(), createdBy: { firstName: 'Admin', lastName: 'User' } })
|
new CommentModel({ message: 'Test3', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) })
|
||||||
]));
|
]));
|
||||||
|
|
||||||
fixture = TestBed.createComponent(TaskDetailsComponent);
|
fixture = TestBed.createComponent(TaskDetailsComponent);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
|
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@alfresco/js-api": ">=6.3.0-1108"
|
"@alfresco/js-api": ">=6.3.0-1271"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"testing",
|
"testing",
|
||||||
|
@ -49,7 +49,7 @@ export class ModelActions {
|
|||||||
return this.customModelApi.deactivateCustomModel(modelName);
|
return this.customModelApi.deactivateCustomModel(modelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteCustomModel(modelName: string): Promise<{ entry: CustomModel }> {
|
async deleteCustomModel(modelName: string): Promise<void> {
|
||||||
return this.customModelApi.deleteCustomModel(modelName);
|
return this.customModelApi.deleteCustomModel(modelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
package-lock.json
generated
8
package-lock.json
generated
@ -10,7 +10,7 @@
|
|||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alfresco/js-api": "6.3.0-1108",
|
"@alfresco/js-api": "6.3.0-1271",
|
||||||
"@angular/animations": "14.1.3",
|
"@angular/animations": "14.1.3",
|
||||||
"@angular/cdk": "14.1.2",
|
"@angular/cdk": "14.1.2",
|
||||||
"@angular/common": "14.1.3",
|
"@angular/common": "14.1.3",
|
||||||
@ -158,9 +158,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@alfresco/js-api": {
|
"node_modules/@alfresco/js-api": {
|
||||||
"version": "6.3.0-1108",
|
"version": "6.3.0-1271",
|
||||||
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-6.3.0-1108.tgz",
|
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-6.3.0-1271.tgz",
|
||||||
"integrity": "sha512-U7YlT6HVsO14OdTi4g0l4MckgugioSfHCUnoAk0KVDQWk/j5CKl+GGIq71mf2ram2L3o9XB/oNhbFSo2cfilTA==",
|
"integrity": "sha512-Q/zZeZt9V5di8acKeSEPXGmTf5gNyj7PQgPvVFq3Fgvsqjj4P2v5WcRQJbumeMK/Snk8bsWwYQk5Lh/Aau3cyA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"event-emitter": "^0.3.5",
|
"event-emitter": "^0.3.5",
|
||||||
"superagent": "^8.0.9",
|
"superagent": "^8.0.9",
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
"process services-cloud"
|
"process services-cloud"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alfresco/js-api": "6.3.0-1108",
|
"@alfresco/js-api": "6.3.0-1271",
|
||||||
"@angular/animations": "14.1.3",
|
"@angular/animations": "14.1.3",
|
||||||
"@angular/cdk": "14.1.2",
|
"@angular/cdk": "14.1.2",
|
||||||
"@angular/common": "14.1.3",
|
"@angular/common": "14.1.3",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user