From 2590e7d0a906fccc2374f286502a30a8a9588490 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Fri, 10 Mar 2023 09:28:24 +0100 Subject: [PATCH] [AAE-10777] Move services from Core in Content the right place (#8242) Clean core services and directive --- .../app/components/about/about.component.ts | 19 +- .../user-info/user-info.component.ts | 8 +- .../name-column/name-column.component.ts | 2 +- .../file-view/file-view.component.ts | 8 +- .../app/components/files/files.component.ts | 12 +- ...ersion-manager-dialog-adapter.component.ts | 3 +- .../process-attachments.component.ts | 3 +- .../task-attachments.component.ts | 3 +- docs/README.md | 24 +- .../breaking-change-2.6.0-3.0.0.md | 2 +- .../components/upload-button.component.md | 2 +- .../components/upload-drag-area.component.md | 2 +- .../upload-version-button.component.md | 2 +- .../components/version-manager.component.md | 2 +- .../components/version-upload.component.md | 4 +- .../directives/node-download.directive.md | 2 +- docs/core/models/bpm-user.model.md | 2 +- docs/core/models/ecm-user.model.md | 2 +- docs/core/models/user-process.model.md | 2 +- docs/core/services/content.service.md | 12 +- docs/core/services/discovery-api.service.md | 2 +- docs/core/services/download-zip.service.md | 2 +- docs/core/services/nodes-api.service.md | 6 +- docs/core/services/people-content.service.md | 8 +- docs/core/services/people-process.service.md | 2 +- docs/core/services/upload.service.md | 40 +- docs/core/services/user-access.service.md | 2 +- docs/upgrade-guide/upgrade26-30.md | 2 +- docs/upgrade-guide/upgrade50-60.md | 33 +- .../aspect-list-dialog.component.spec.ts | 2 +- .../aspect-list/aspect-list.component.spec.ts | 3 +- .../lib/aspect-list/aspect-list.component.ts | 2 +- .../services/node-aspect.service.spec.ts | 3 +- .../services/node-aspect.service.ts | 2 +- .../category-tree-datasource.service.ts | 6 +- .../src/lib/common}/events/file.event.ts | 0 .../common/mocks}/ecm-user.service.mock.ts | 12 - .../models/allowable-operations.enum.ts | 0 .../lib/common}/models/ecm-company.model.ts | 0 .../src/lib/common}/models/ecm-user.model.ts | 0 .../src/lib/common}/models/file.model.spec.ts | 0 .../src/lib/common}/models/file.model.ts | 0 .../lib/common}/models/node-metadata.model.ts | 0 .../lib/common}/models/permissions.enum.ts | 0 .../src/lib/common/public-api.ts | 17 + .../common}/services/content.service.spec.ts | 21 +- .../lib/common}/services/content.service.ts | 85 +- .../common}/services/discovery-api.service.ts | 4 +- .../lib/common}/services/nodes-api.service.ts | 16 +- .../services/people-content.service.spec.ts | 8 +- .../services/people-content.service.ts | 26 +- .../services/rendition.service.ts} | 24 +- .../common}/services/upload.service.spec.ts | 10 +- .../lib/common}/services/upload.service.ts | 19 +- .../content-metadata-card.component.spec.ts | 3 +- .../content-metadata-card.component.ts | 4 +- .../content-metadata.component.spec.ts | 3 +- .../content-metadata.component.ts | 2 +- .../content-node-dialog.service.ts | 4 +- ...de-selector-panel.component-search.spec.ts | 3 +- ...tent-node-selector-panel.component.spec.ts | 12 +- .../content-node-selector-panel.component.ts | 7 +- .../content-node-selector.component.spec.ts | 10 +- .../content-node-selector.component.ts | 6 +- .../content-node-share.dialog.spec.ts | 54 +- .../content-node-share.dialog.ts | 57 +- .../content-user-info.component.spec.ts | 5 +- .../content-user-info.component.ts | 4 +- .../src/lib/dialogs/dialog.module.ts | 4 +- .../download-zip/download-zip.dialog.html | 0 .../download-zip.dialog.module.ts | 2 +- .../download-zip/download-zip.dialog.scss | 0 .../download-zip/download-zip.dialog.spec.ts | 5 +- .../download-zip.dialog.stories.component.ts | 2 +- .../download-zip.dialog.stories.ts | 14 +- .../download-zip/download-zip.dialog.ts | 8 +- .../mock/download-zip-data.mock.ts | 0 .../mock/download-zip-service.mock.ts | 0 .../services/download-zip.service.ts | 3 +- .../src/lib/dialogs/folder.dialog.spec.ts | 4 +- .../src/lib/dialogs/folder.dialog.ts | 3 +- .../src/lib/dialogs/public-api.ts | 4 + ...heck-allowable-operation.directive.spec.ts | 3 +- .../check-allowable-operation.directive.ts | 3 +- .../directives/content-directive.module.ts | 7 +- .../node-download.directive.spec.ts | 6 +- .../lib/directives/node-download.directive.ts | 3 +- .../src/lib/directives/node-lock.directive.ts | 3 +- .../src/lib/directives/public-api.ts | 1 + .../content-action.component.spec.ts | 3 +- .../document-list.component.spec.ts | 5 +- .../components/document-list.component.ts | 6 +- .../library-name-column.component.ts | 3 +- .../library-role-column.component.ts | 2 +- .../library-status-column.component.ts | 2 +- .../name-column/name-column.component.ts | 2 +- .../data/share-data-row.model.ts | 3 +- .../data/share-datatable-adapter.spec.ts | 6 +- .../data/share-datatable-adapter.ts | 33 +- .../models/permissions-style.model.ts | 2 +- .../services/document-actions.service.ts | 3 +- .../services/document-list.service.ts | 13 +- .../services/folder-actions.service.ts | 3 +- .../services/node-actions.service.ts | 4 +- .../folder-create.directive.spec.ts | 3 +- .../folder-create.directive.ts | 2 +- .../folder-edit.directive.spec.ts | 3 +- .../folder-directive/folder-edit.directive.ts | 2 +- .../new-version-uploader.service.spec.ts | 2 +- .../new-version-uploader.service.ts | 3 +- .../node-comments/mocks/node-comments.mock.ts | 4 +- .../services/node-comments.service.ts | 14 +- .../add-permission.component.ts | 3 +- .../inherited-button.directive.spec.ts | 3 +- .../components/inherited-button.directive.ts | 4 +- .../permission-list.component.spec.ts | 3 +- .../permission-list.service.spec.ts | 3 +- .../permission-list.service.ts | 5 +- .../user-name-column.component.ts | 2 +- .../permission-manager/models/member.model.ts | 2 +- .../node-permission-dialog.service.ts | 3 +- .../services/node-permission.service.spec.ts | 3 +- .../services/node-permission.service.ts | 6 +- .../search-header-query-builder.service.ts | 3 +- .../services/tree-view.service.spec.ts | 3 +- .../tree-view/services/tree-view.service.ts | 2 +- .../base-upload/upload-base.spec.ts | 5 +- .../components/base-upload/upload-base.ts | 5 +- .../file-uploading-dialog.component.spec.ts | 5 +- .../file-uploading-dialog.component.ts | 5 +- .../file-uploading-list-row.component.spec.ts | 3 +- .../file-uploading-list-row.component.ts | 2 +- .../file-uploading-list.component.spec.ts | 5 +- .../file-uploading-list.component.ts | 8 +- .../upload-button.component.spec.ts | 29 +- .../components/upload-button.component.ts | 13 +- .../upload-drag-area.component.spec.ts | 4 +- .../components/upload-drag-area.component.ts | 8 +- .../upload/components/upload-files.event.ts | 3 +- .../upload-version-button.component.ts | 4 +- .../version-compatibility.service.spec.ts | 3 +- .../version-compatibility.service.ts | 2 +- .../version-manager/version-list.component.ts | 3 +- .../version-manager.component.spec.ts | 3 +- .../version-manager.component.ts | 4 +- .../version-upload.component.spec.ts | 4 +- .../version-upload.component.ts | 4 +- .../src/lib/viewer/alfresco-viewer.module.ts | 4 +- .../alfresco-viewer.component.spec.ts | 14 +- .../components/alfresco-viewer.component.ts | 27 +- .../src/lib/viewer/public-api.ts | 1 - .../src/lib/about/about.component.stories.ts | 3 - .../guard/auth-guard-sso-role.service.spec.ts | 61 +- .../auth/guard/auth-guard-sso-role.service.ts | 14 +- .../models/application-access.model.ts | 0 .../{ => auth}/models/user-access.model.ts | 0 lib/core/src/lib/auth/public-api.ts | 4 + .../services/user-access.service.spec.ts | 10 +- .../services/user-access.service.ts | 6 +- .../comment-list.component.stories.ts | 4 +- .../comment-list/mocks/comment-list.mock.ts | 5 +- .../comments/comments.component.stories.ts | 3 +- .../comments/mocks/comments.service.mock.ts | 10 +- .../mocks/comments.service.stories.mock.ts | 9 +- .../comments/mocks/comments.stories.mock.ts | 12 +- lib/core/src/lib/common/index.ts | 2 + .../services/download.service.spec.ts | 0 .../{ => common}/services/download.service.ts | 0 .../common/services/thumbnail.service.spec.ts | 5 - .../lib/common/services/thumbnail.service.ts | 36 +- .../lib/{ => common}/services/url.service.ts | 0 lib/core/src/lib/core.module.ts | 3 - .../location-cell/location-cell.component.ts | 3 +- lib/core/src/lib/dialogs/public-api.ts | 3 - .../src/lib/directives/directive.module.ts | 3 - lib/core/src/lib/directives/public-api.ts | 1 - lib/core/src/lib/events/public-api.ts | 1 - .../widgets/core/content-link.model.ts | 4 +- lib/core/src/lib/form/public-api.ts | 1 - .../lib/mock/discovery-api.service.mock.ts | 114 -- lib/core/src/lib/mock/form.mock.ts | 1332 ----------------- lib/core/src/lib/mock/public-api.ts | 3 - .../src/lib/mock/renditions-service.mock.ts | 186 --- lib/core/src/lib/models/comment.model.ts | 4 +- lib/core/src/lib/models/general-user.model.ts | 4 +- lib/core/src/lib/models/public-api.ts | 10 - lib/core/src/lib/pipes/full-name.pipe.ts | 8 +- lib/core/src/lib/pipes/user-initial.pipe.ts | 4 +- lib/core/src/lib/pipes/user-like.interface.ts | 23 + .../src/lib/services/bpm-user.service.spec.ts | 90 -- lib/core/src/lib/services/bpm-user.service.ts | 75 - .../lib/services/deleted-nodes-api.service.ts | 68 - .../src/lib/services/ecm-user.service.spec.ts | 71 - lib/core/src/lib/services/ecm-user.service.ts | 72 - lib/core/src/lib/services/public-api.ts | 14 - .../lib/services/renditions.service.spec.ts | 191 --- .../src/lib/services/renditions.service.ts | 199 --- .../user-content-access.service.spec.ts | 68 - .../services/user-content-access.service.ts | 44 - .../services/user-info-resolver.service.ts | 41 - .../components/img-viewer.component.spec.ts | 2 +- .../viewer/components/img-viewer.component.ts | 2 +- .../components/media-player.component.ts | 6 +- .../analytics-report-parameters.component.ts | 6 +- .../properties-viewer-wrapper.component.ts | 3 +- .../properties-viewer.widget.spec.ts | 3 +- .../properties-viewer.widget.spec.ts | 3 +- .../services/process-cloud-content.service.ts | 11 +- .../service-task-list-cloud.component.spec.ts | 4 +- .../task-list-cloud.component.spec.ts | 4 +- .../process-attachment-list.component.ts | 6 +- .../task-attachment-list.component.ts | 6 +- lib/process-services/src/lib/common/index.ts | 18 + .../src/lib/common}/models/bpm-user.model.ts | 0 .../lib/common}/models/user-process.model.ts | 0 .../src/lib/common/public-api.ts | 21 + .../services/people-process.service.spec.ts | 5 +- .../services/people-process.service.ts | 35 +- .../src/lib/form/form.component.spec.ts | 5 +- .../src/lib/form/form.component.ts | 4 +- .../lib/form/model}/form-definition.model.ts | 0 .../src/lib/form/public-api.ts | 2 + .../src/lib/form/services/editor.service.ts | 3 +- ...ttach-file-widget-dialog.component.spec.ts | 4 +- .../attach-file-widget.component.ts | 3 +- .../attach-folder-widget.component.spec.ts | 3 +- .../attach-folder-widget.component.ts | 5 +- .../widgets/document/content.widget.spec.ts | 12 +- .../form/widgets/document/content.widget.ts | 9 +- .../functional-group.widget.spec.ts | 4 +- .../functional-group.widget.ts | 3 +- .../form/widgets/people/people.widget.spec.ts | 5 +- .../lib/form/widgets/people/people.widget.ts | 4 +- .../people-list/people-list.component.spec.ts | 5 +- .../people-list/people-list.component.ts | 3 +- .../people-search-field.component.ts | 4 +- .../people-search.component.spec.ts | 5 +- .../people-search/people-search.component.ts | 2 +- .../people-selector.component.spec.ts | 3 +- .../people-selector.component.ts | 4 +- .../people/people.component.spec.ts | 4 +- .../components/people/people.component.ts | 4 +- .../perform-search-callback.interface.ts | 2 +- .../services/comment-process.service.ts | 4 +- .../mocks}/bpm-user.service.mock.ts | 2 +- .../process-user-info.component.html | 64 +- .../process-user-info.component.spec.ts | 7 +- .../process-user-info.component.ts | 9 +- .../services/task-comments.service.ts | 4 +- .../components/start-task.component.ts | 3 +- .../components/task-audit.directive.ts | 6 +- .../components/task-details.component.spec.ts | 10 +- .../components/task-details.component.ts | 3 +- .../task-form/task-form.component.spec.ts | 8 +- .../task-form/task-form.component.ts | 8 +- .../components/task-header.component.spec.ts | 10 +- .../components/task-header.component.ts | 6 +- .../lib/task-list/models/start-task.model.ts | 2 +- .../task-list/models/task-details.model.ts | 2 +- .../services/process-upload.service.ts | 3 +- .../task-list/services/task-upload.service.ts | 3 +- .../services/tasklist.service.spec.ts | 3 +- lib/process-services/src/public-api.ts | 1 + 263 files changed, 884 insertions(+), 3393 deletions(-) rename lib/{core/src/lib => content-services/src/lib/common}/events/file.event.ts (100%) rename lib/{core/src/lib/mock => content-services/src/lib/common/mocks}/ecm-user.service.mock.ts (92%) rename lib/{core/src/lib => content-services/src/lib/common}/models/allowable-operations.enum.ts (100%) rename lib/{core/src/lib => content-services/src/lib/common}/models/ecm-company.model.ts (100%) rename lib/{core/src/lib => content-services/src/lib/common}/models/ecm-user.model.ts (100%) rename lib/{core/src/lib => content-services/src/lib/common}/models/file.model.spec.ts (100%) rename lib/{core/src/lib => content-services/src/lib/common}/models/file.model.ts (100%) rename lib/{core/src/lib => content-services/src/lib/common}/models/node-metadata.model.ts (100%) rename lib/{core/src/lib => content-services/src/lib/common}/models/permissions.enum.ts (100%) rename lib/{core/src/lib => content-services/src/lib/common}/services/content.service.spec.ts (88%) rename lib/{core/src/lib => content-services/src/lib/common}/services/content.service.ts (63%) rename lib/{core/src/lib => content-services/src/lib/common}/services/discovery-api.service.ts (93%) rename lib/{core/src/lib => content-services/src/lib/common}/services/nodes-api.service.ts (95%) rename lib/{core/src/lib => content-services/src/lib/common}/services/people-content.service.spec.ts (93%) rename lib/{core/src/lib => content-services/src/lib/common}/services/people-content.service.ts (88%) rename lib/content-services/src/lib/{viewer/services/rendition-viewer.service.ts => common/services/rendition.service.ts} (92%) rename lib/{core/src/lib => content-services/src/lib/common}/services/upload.service.spec.ts (98%) rename lib/{core/src/lib => content-services/src/lib/common}/services/upload.service.ts (96%) rename lib/{core => content-services}/src/lib/dialogs/download-zip/download-zip.dialog.html (100%) rename lib/{core => content-services}/src/lib/dialogs/download-zip/download-zip.dialog.module.ts (96%) rename lib/{core => content-services}/src/lib/dialogs/download-zip/download-zip.dialog.scss (100%) rename lib/{core => content-services}/src/lib/dialogs/download-zip/download-zip.dialog.spec.ts (96%) rename lib/{core => content-services}/src/lib/dialogs/download-zip/download-zip.dialog.stories.component.ts (95%) rename lib/{core => content-services}/src/lib/dialogs/download-zip/download-zip.dialog.stories.ts (88%) rename lib/{core => content-services}/src/lib/dialogs/download-zip/download-zip.dialog.ts (93%) rename lib/{core/src/lib => content-services/src/lib/dialogs/download-zip}/mock/download-zip-data.mock.ts (100%) rename lib/{core/src/lib => content-services/src/lib/dialogs/download-zip}/mock/download-zip-service.mock.ts (100%) rename lib/{core/src/lib => content-services/src/lib/dialogs/download-zip}/services/download-zip.service.ts (95%) rename lib/{core => content-services}/src/lib/directives/node-download.directive.spec.ts (96%) rename lib/{core => content-services}/src/lib/directives/node-download.directive.ts (96%) rename lib/core/src/lib/{ => auth}/models/application-access.model.ts (100%) rename lib/core/src/lib/{ => auth}/models/user-access.model.ts (100%) rename lib/core/src/lib/{ => auth}/services/user-access.service.spec.ts (95%) rename lib/core/src/lib/{ => auth}/services/user-access.service.ts (95%) rename lib/core/src/lib/{ => common}/services/download.service.spec.ts (100%) rename lib/core/src/lib/{ => common}/services/download.service.ts (100%) rename lib/core/src/lib/{ => common}/services/url.service.ts (100%) delete mode 100644 lib/core/src/lib/mock/discovery-api.service.mock.ts delete mode 100644 lib/core/src/lib/mock/form.mock.ts delete mode 100644 lib/core/src/lib/mock/renditions-service.mock.ts create mode 100644 lib/core/src/lib/pipes/user-like.interface.ts delete mode 100644 lib/core/src/lib/services/bpm-user.service.spec.ts delete mode 100644 lib/core/src/lib/services/bpm-user.service.ts delete mode 100644 lib/core/src/lib/services/deleted-nodes-api.service.ts delete mode 100644 lib/core/src/lib/services/ecm-user.service.spec.ts delete mode 100644 lib/core/src/lib/services/ecm-user.service.ts delete mode 100644 lib/core/src/lib/services/renditions.service.spec.ts delete mode 100644 lib/core/src/lib/services/renditions.service.ts delete mode 100644 lib/core/src/lib/services/user-content-access.service.spec.ts delete mode 100644 lib/core/src/lib/services/user-content-access.service.ts delete mode 100644 lib/core/src/lib/services/user-info-resolver.service.ts create mode 100644 lib/process-services/src/lib/common/index.ts rename lib/{core/src/lib => process-services/src/lib/common}/models/bpm-user.model.ts (100%) rename lib/{core/src/lib => process-services/src/lib/common}/models/user-process.model.ts (100%) create mode 100644 lib/process-services/src/lib/common/public-api.ts rename lib/{core/src/lib => process-services/src/lib/common}/services/people-process.service.spec.ts (97%) rename lib/{core/src/lib => process-services/src/lib/common}/services/people-process.service.ts (84%) rename lib/{core/src/lib/form/models => process-services/src/lib/form/model}/form-definition.model.ts (100%) rename lib/{core/src/lib/mock => process-services/src/lib/process-user-info/mocks}/bpm-user.service.mock.ts (97%) diff --git a/demo-shell/src/app/components/about/about.component.ts b/demo-shell/src/app/components/about/about.component.ts index c93fc25e86..bb590f868b 100644 --- a/demo-shell/src/app/components/about/about.component.ts +++ b/demo-shell/src/app/components/about/about.component.ts @@ -17,7 +17,8 @@ import { Component, OnInit } from '@angular/core'; import { AppExtensionService, ExtensionRef } from '@alfresco/adf-extensions'; -import { AuthenticationService, BpmProductVersionModel, DiscoveryApiService, RepositoryInfo } from '@alfresco/adf-core'; +import { AuthenticationService, BpmProductVersionModel, RepositoryInfo } from '@alfresco/adf-core'; +import { DiscoveryApiService } from '@alfresco/adf-content-services'; import pkg from '../../../../../package.json'; import { Observable } from 'rxjs'; @@ -34,32 +35,32 @@ export class AboutComponent implements OnInit { bpmVersion: BpmProductVersionModel = null; constructor( - private authService: AuthenticationService, - private appExtensions: AppExtensionService, - private discovery: DiscoveryApiService + private authenticationService: AuthenticationService, + private appExtensionService: AppExtensionService, + private discoveryApiService: DiscoveryApiService ) { this.pkg = pkg; - this.extensions$ = this.appExtensions.references$; + this.extensions$ = this.appExtensionService.references$; } ngOnInit(): void { - if (this.authService.isEcmLoggedIn()) { + if (this.authenticationService.isEcmLoggedIn()) { this.setECMInfo(); } - if (this.authService.isBpmLoggedIn()) { + if (this.authenticationService.isBpmLoggedIn()) { this.setBPMInfo(); } } setECMInfo() { - this.discovery.getEcmProductInfo().subscribe((repository) => { + this.discoveryApiService.getEcmProductInfo().subscribe((repository) => { this.repository = repository as RepositoryInfo; }); } setBPMInfo() { - this.discovery.getBpmProductInfo().subscribe((bpmVersion) => { + this.discoveryApiService.getBpmProductInfo().subscribe((bpmVersion) => { this.bpmVersion = bpmVersion; }); } diff --git a/demo-shell/src/app/components/app-layout/user-info/user-info.component.ts b/demo-shell/src/app/components/app-layout/user-info/user-info.component.ts index ce0f699cb1..74b7ab9483 100644 --- a/demo-shell/src/app/components/app-layout/user-info/user-info.component.ts +++ b/demo-shell/src/app/components/app-layout/user-info/user-info.component.ts @@ -15,7 +15,9 @@ * limitations under the License. */ -import { AuthenticationService, BpmUserModel, BpmUserService, EcmUserModel, IdentityUserModel, IdentityUserService, PeopleContentService, UserInfoMode } from '@alfresco/adf-core'; +import { EcmUserModel, PeopleContentService } from '@alfresco/adf-content-services'; +import { BpmUserModel, PeopleProcessService } from '@alfresco/adf-process-services'; +import { AuthenticationService, IdentityUserModel, IdentityUserService, UserInfoMode } from '@alfresco/adf-core'; import { Component, OnInit, Input } from '@angular/core'; import { MenuPositionX, MenuPositionY } from '@angular/material/menu'; import { Observable, of } from 'rxjs'; @@ -42,7 +44,7 @@ export class UserInfoComponent implements OnInit { userInfoMode = UserInfoMode; constructor(private peopleContentService: PeopleContentService, - private bpmUserService: BpmUserService, + private peopleProcessService: PeopleProcessService, private identityUserService: IdentityUserService, private authService: AuthenticationService) { } @@ -86,7 +88,7 @@ export class UserInfoComponent implements OnInit { } private loadBpmUserInfo() { - this.bpmUser$ = this.bpmUserService.getCurrentUserInfo(); + this.bpmUser$ = this.peopleProcessService.getCurrentUserInfo(); } private loadIdentityUserInfo() { diff --git a/demo-shell/src/app/components/document-list/extension-presets/name-column/name-column.component.ts b/demo-shell/src/app/components/document-list/extension-presets/name-column/name-column.component.ts index 89e0efc115..1ac355741c 100644 --- a/demo-shell/src/app/components/document-list/extension-presets/name-column/name-column.component.ts +++ b/demo-shell/src/app/components/document-list/extension-presets/name-column/name-column.component.ts @@ -26,7 +26,7 @@ import { } from '@angular/core'; import { NodeEntry, Node } from '@alfresco/js-api'; import { BehaviorSubject, Subject } from 'rxjs'; -import { NodesApiService } from '@alfresco/adf-core'; +import { NodesApiService } from '@alfresco/adf-content-services'; import { takeUntil } from 'rxjs/operators'; @Component({ diff --git a/demo-shell/src/app/components/file-view/file-view.component.ts b/demo-shell/src/app/components/file-view/file-view.component.ts index 484a88abfb..3f7f910a16 100644 --- a/demo-shell/src/app/components/file-view/file-view.component.ts +++ b/demo-shell/src/app/components/file-view/file-view.component.ts @@ -17,14 +17,16 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { ActivatedRoute, Router, PRIMARY_OUTLET } from '@angular/router'; +import { + NotificationService +} from '@alfresco/adf-core'; import { ContentService, AllowableOperationsEnum, PermissionsEnum, NodesApiService, - FileUploadErrorEvent, - NotificationService -} from '@alfresco/adf-core'; + FileUploadErrorEvent +} from '@alfresco/adf-content-services'; import { PreviewService } from '../../services/preview.service'; @Component({ diff --git a/demo-shell/src/app/components/files/files.component.ts b/demo-shell/src/app/components/files/files.component.ts index 145262e991..8be126f59b 100644 --- a/demo-shell/src/app/components/files/files.component.ts +++ b/demo-shell/src/app/components/files/files.component.ts @@ -45,11 +45,8 @@ import { AuthenticationService, AppConfigService, AppConfigValues, - ContentService, - FolderCreatedEvent, LogService, NotificationService, - UploadService, DataRow, UserPreferencesService, PaginationComponent, @@ -57,12 +54,13 @@ import { DisplayMode, ShowHeaderMode, InfinitePaginationComponent, - FormRenderingService, - FileUploadEvent, - NodesApiService + FormRenderingService } from '@alfresco/adf-core'; import { + ContentService, + FolderCreatedEvent, + UploadService, DocumentListComponent, PermissionStyleModel, UploadFilesEvent, @@ -71,6 +69,8 @@ import { ContentMetadataService, FilterSearch, DialogAspectListService, + FileUploadEvent, + NodesApiService, SharedLinksApiService } from '@alfresco/adf-content-services'; diff --git a/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.ts b/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.ts index c71aebd99d..828a11bf25 100644 --- a/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.ts +++ b/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.ts @@ -19,7 +19,8 @@ import { Component, Inject, ViewEncapsulation } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { PreviewService } from '../../services/preview.service'; -import { FileUploadErrorEvent, NotificationService } from '@alfresco/adf-core'; +import { NotificationService } from '@alfresco/adf-core'; +import { FileUploadErrorEvent } from '@alfresco/adf-content-services'; @Component({ templateUrl: './version-manager-dialog-adapter.component.html', diff --git a/demo-shell/src/app/components/process-service/process-attachments.component.ts b/demo-shell/src/app/components/process-service/process-attachments.component.ts index 66b83cafac..02982347cd 100644 --- a/demo-shell/src/app/components/process-service/process-attachments.component.ts +++ b/demo-shell/src/app/components/process-service/process-attachments.component.ts @@ -18,7 +18,8 @@ import { Component, Input, OnChanges, OnInit, ViewChild, OnDestroy } from '@angular/core'; import { ProcessInstance, ProcessService , ProcessAttachmentListComponent, ProcessUploadService } from '@alfresco/adf-process-services'; -import { UploadService, AlfrescoApiService, AppConfigService, DiscoveryApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { UploadService, DiscoveryApiService } from '@alfresco/adf-content-services'; import { PreviewService } from '../../services/preview.service'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; diff --git a/demo-shell/src/app/components/process-service/task-attachments.component.ts b/demo-shell/src/app/components/process-service/task-attachments.component.ts index 38529272d5..564e8a13e6 100644 --- a/demo-shell/src/app/components/process-service/task-attachments.component.ts +++ b/demo-shell/src/app/components/process-service/task-attachments.component.ts @@ -22,7 +22,8 @@ import { TaskUploadService, TaskDetailsModel } from '@alfresco/adf-process-services'; -import { UploadService, AlfrescoApiService, AppConfigService, DiscoveryApiService } from '@alfresco/adf-core'; +import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { UploadService, DiscoveryApiService } from '@alfresco/adf-content-services'; import { PreviewService } from '../../services/preview.service'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; diff --git a/docs/README.md b/docs/README.md index 5a67b1ab08..eb4c50ced0 100644 --- a/docs/README.md +++ b/docs/README.md @@ -135,7 +135,7 @@ for more information about installing and using the source code. | [Highlight directive](core/directives/highlight.directive.md) | Adds highlighting to selected sections of an HTML element's content. | [Source](../lib/core/src/lib/directives/highlight.directive.ts) | | [Infinite Select Scroll directive](core/directives/infinite-select-scroll.directive.md) | Load more options to select component if API returns more items | [Source](../lib/core/src/lib/directives/infinite-select-scroll.directive.ts) | | [Logout directive](core/directives/logout.directive.md) | Logs the user out when the decorated element is clicked. | [Source](../lib/core/src/lib/directives/logout.directive.ts) | -| [Node Download directive](core/directives/node-download.directive.md) | Allows folders and/or files to be downloaded, with multiple nodes packed as a '.ZIP' archive. | [Source](../lib/core/src/lib/directives/node-download.directive.ts) | +| [Node Download directive](core/directives/node-download.directive.md) | Allows folders and/or files to be downloaded, with multiple nodes packed as a '.ZIP' archive. | [Source](lib/content-services/src/lib/directives/node-download.directive.ts) | | [Upload Directive](core/directives/upload.directive.md) | Uploads content in response to file drag and drop. | [Source](../lib/core/src/lib/directives/upload.directive.ts) | ### Dialogs @@ -160,11 +160,11 @@ for more information about installing and using the source code. | Name | Description | Source link | | ---- | ----------- | ----------- | -| [Bpm User model](core/models/bpm-user.model.md) | Contains information about a Process Services user. | [Source](../lib/core/src/lib/models/bpm-user.model.ts) | -| [Ecm User model](core/models/ecm-user.model.md) | Contains information about a Content Services user. | [Source](../lib/core/src/lib/models/ecm-user.model.ts) | +| [Bpm User model](core/models/bpm-user.model.md) | Contains information about a Process Services user. | [Source](lib/process-services/src/lib/common/models/bpm-user.model.ts) | +| [Ecm User model](core/models/ecm-user.model.md) | Contains information about a Content Services user. | [Source](lib/content-services/src/lib/common/models/ecm-user.model.ts) | | [Form Field model](core/models/form-field.model.md) | Contains the value and metadata for a field of a Form component. | [Source](../lib/core/src/lib/form/components/widgets/core/form-field.model.ts) | | [Product Version model](core/models/product-version.model.md) | Contains version and license information classes for Alfresco products. | [Source](../lib/core/src/lib/models/product-version.model.ts) | -| [User Process model](core/models/user-process.model.md) | Represents a Process Services user. | [Source](../lib/core/src/lib/models/user-process.model.ts) | +| [User Process model](core/models/user-process.model.md) | Represents a Process Services user. | [Source](lib/process-services/src/lib/common/models/user-process.model.ts) | ### Pipes @@ -203,12 +203,12 @@ for more information about installing and using the source code. | [Clipboard service](core/services/clipboard.service.md) | Copies text to the clipboard. | [Source](../lib/core/src/lib/clipboard/clipboard.service.ts) | | [Comment Content service](core/services/comment-content.service.md) | Adds and retrieves comments for nodes in Content Services. | [Source](../lib/core/src/lib/services/comment-content.service.ts) | | [Comment Process service](core/services/comment-process.service.md) | Adds and retrieves comments for task and process instances in Process Services. | [Source](../lib/core/src/lib/services/comment-process.service.ts) | -| [Content service](core/services/content.service.md) | Accesses app-generated data objects via URLs and file downloads. | [Source](../lib/core/src/lib/services/content.service.ts) | +| [Content service](core/services/content.service.md) | Accesses app-generated data objects via URLs and file downloads. | [Source](lib/content-services/src/lib/common/services/content.service.ts) | | [Cookie service](core/services/cookie.service.md) | Stores key-value data items as browser cookies. | [Source](../lib/core/src/lib/common/services/cookie.service.ts) | | [DataTable service](core/services/datatable.service.md) | | [Source](<>) | | [Deleted Nodes Api service](core/services/deleted-nodes-api.service.md) | Gets a list of Content Services nodes currently in the trash. | [Source](../lib/core/src/lib/services/deleted-nodes-api.service.ts) | -| [Discovery Api service](core/services/discovery-api.service.md) | Gets version and license information for Process Services and Content Services. | [Source](../lib/core/src/lib/services/discovery-api.service.ts) | -| [Download zip service](core/services/download-zip.service.md) | Creates and manages downloads. | [Source](../lib/core/src/lib/services/download-zip.service.ts) | +| [Discovery Api service](core/services/discovery-api.service.md) | Gets version and license information for Process Services and Content Services. | [Source](lib/content-services/src/lib/common/services/discovery-api.service.ts) | +| [Download zip service](core/services/download-zip.service.md) | Creates and manages downloads. | [Source](lib/content-services/src/lib/dialogs/download-zip/services/download-zip.service.ts) | | [Ecm User service](core/services/ecm-user.service.md) | Gets information about a Content Services user. | [Source](../lib/core/src/lib/services/ecm-user.service.ts) | | [Favorites Api service](core/services/favorites-api.service.md) | Gets a list of items a user has marked as their favorites. | [Source](lib/content-services/src/lib/common/services/favorites-api.service.ts) | | [Form Rendering service](core/services/form-rendering.service.md) | Maps a form field type string onto the corresponding form widget component type. | [Source](../lib/core/form/services/form-rendering.service.ts) | @@ -220,11 +220,11 @@ for more information about installing and using the source code. | [JWT helper service](core/services/jwt-helper.service.md) | Decodes a JSON Web Token (JWT) to a JavaScript object. | [Source](../lib/core/src/lib/auth/services/jwt-helper.service.ts) | | [Log Service](core/services/log.service.md) | Provides log functionality. | [Source](../lib/core/src/lib/common/services/log.service.ts) | | [Login Dialog service](core/services/login-dialog.service.md) | Manages login dialogs. | [Source](../lib/core/src/lib/services/login-dialog.service.ts) | -| [Nodes Api service](core/services/nodes-api.service.md) | Accesses and manipulates ACS document nodes using their node IDs. | [Source](../lib/core/src/lib/services/nodes-api.service.ts) | +| [Nodes Api service](core/services/nodes-api.service.md) | Accesses and manipulates ACS document nodes using their node IDs. | [Source](lib/content-services/src/lib/common/services/nodes-api.service.ts) | | [Notification Service](core/services/notification.service.md) | Shows a notification message with optional feedback. | [Source](../lib/core/src/lib/notifications/services/notification.service.ts) | | [Page Title service](core/services/page-title.service.md) | Sets the page title. | [Source](lib/core/src/lib/common/services/page-title.service.ts) | -| [People Content service](core/services/people-content.service.md) | Gets information about a Content Services user. | [Source](../lib/core/src/lib/services/people-content.service.ts) | -| [People Process service](core/services/people-process.service.md) | Gets information about Process Services users. | [Source](../lib/core/src/lib/services/people-process.service.ts) | +| [People Content service](core/services/people-content.service.md) | Gets information about a Content Services user. | [Source](lib/content-services/src/lib/common/services/people-content.service.ts) | +| [People Process service](core/services/people-process.service.md) | Gets information about Process Services users. | [Source](lib/process-services/src/lib/common/services/people-process.service.ts) | | [Process Content Service](core/services/process-content.service.md) | Manipulates content related to a Process Instance or Task Instance in APS. | [Source](../lib/process-services/src/lib/form/services/process-content.service.ts) | | [Renditions service](core/services/renditions.service.md) | Manages prearranged conversions of content to different formats. | [Source](../lib/core/src/lib/services/renditions.service.ts) | | [Search Configuration service](core/services/search-configuration.service.md) | Provides fine control of parameters to a search. | [Source](../lib/core/src/lib/services/search-configuration.service.ts) | @@ -233,8 +233,8 @@ for more information about installing and using the source code. | [Storage service](core/services/storage.service.md) | Stores items in the form of key-value pairs. | [Source](../lib/core/src/lib/services/storage.service.ts) | | [Thumbnail service](core/services/thumbnail.service.md) | Retrieves an SVG thumbnail image to represent a document type. | [Source](lib/core/src/lib/common/services/thumbnail.service.ts) | | [Translation service](core/services/translation.service.md) | Supports localisation. | [Source](lib/core/src/lib/translation/translation.service.ts) | -| [Upload Service](core/services/upload.service.md) | Provides access to various APIs related to file upload features. | [Source](../lib/core/src/lib/services/upload.service.ts) | -| [User access service](core/services/user-access.service.md) | Checks the global and application access of a user | [Source](../lib/core/src/lib/services/user-access.service.ts) | +| [Upload Service](core/services/upload.service.md) | Provides access to various APIs related to file upload features. | [Source](lib/content-services/src/lib/common/services/upload.service.ts) | +| [User access service](core/services/user-access.service.md) | Checks the global and application access of a user | [Source](lib/core/src/lib/auth/services/user-access.service.ts) | | [User Preferences Service](core/services/user-preferences.service.md) | Stores preferences for the app and for individual components. | [Source](../lib/core/src/lib/common/services/user-preferences.service.ts) | ### Widgets diff --git a/docs/breaking-changes/breaking-change-2.6.0-3.0.0.md b/docs/breaking-changes/breaking-change-2.6.0-3.0.0.md index 0a6538c370..02e3f1ef8c 100644 --- a/docs/breaking-changes/breaking-change-2.6.0-3.0.0.md +++ b/docs/breaking-changes/breaking-change-2.6.0-3.0.0.md @@ -25,7 +25,7 @@ This document lists all the deprecated ADF v2.x components that were removed for classes without the **adf-** prefix, you will now need to update them. For example, `.card-view` is now `.adf-card-view`. -- [PR ADF-1443](https://github.com/Alfresco/alfresco-ng2-components/pull/4028): [`DownloadZipDialogComponent`](../../lib/core/src/lib/dialogs/download-zip/download-zip.dialog.ts) +- [PR ADF-1443](https://github.com/Alfresco/alfresco-ng2-components/pull/4028): [`DownloadZipDialogComponent`](lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.ts) and [`NodeDownloadDirective`](../core/directives/node-download.directive.md) have been moved from the Content Services module to the Core module. This modification has enabled us to remove some code duplication between the two modules. diff --git a/docs/content-services/components/upload-button.component.md b/docs/content-services/components/upload-button.component.md index 0f36dcec0e..bad9589806 100644 --- a/docs/content-services/components/upload-button.component.md +++ b/docs/content-services/components/upload-button.component.md @@ -48,7 +48,7 @@ Activates a file upload. | Name | Type | Description | | ---- | ---- | ----------- | | beginUpload | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`UploadFilesEvent`](../../../lib/content-services/src/lib/upload/components/upload-files.event.ts)`>` | Emitted when the upload begins. | -| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadErrorEvent`](../../../lib/core/src/lib/events/file.event.ts)`>` | Emitted when an error occurs. | +| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadErrorEvent`](lib/content-services/src/lib/common/events/file.event.ts)`>` | Emitted when an error occurs. | | permissionEvent | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`PermissionModel`](../../../lib/content-services/src/lib/document-list/models/permissions.model.ts)`>` | Emitted when create permission is missing. | | success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the file is uploaded successfully. | | updateFileVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`>` | Emitted when dropping a file over another file to update the version. | diff --git a/docs/content-services/components/upload-drag-area.component.md b/docs/content-services/components/upload-drag-area.component.md index f5c9da9f2f..5fc7152aee 100644 --- a/docs/content-services/components/upload-drag-area.component.md +++ b/docs/content-services/components/upload-drag-area.component.md @@ -75,7 +75,7 @@ as the drag/drop target: | Name | Type | Description | | ---- | ---- | ----------- | | beginUpload | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`UploadFilesEvent`](../../../lib/content-services/src/lib/upload/components/upload-files.event.ts)`>` | Emitted when the upload begins. | -| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadErrorEvent`](../../../lib/core/src/lib/events/file.event.ts)`>` | Emitted when an error occurs. | +| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadErrorEvent`](lib/content-services/src/lib/common/events/file.event.ts)`>` | Emitted when an error occurs. | | success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the file is uploaded successfully. | | updateFileVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`>` | Emitted when dropping a file over another file to update the version. | diff --git a/docs/content-services/components/upload-version-button.component.md b/docs/content-services/components/upload-version-button.component.md index bfebe46325..0402ee479d 100644 --- a/docs/content-services/components/upload-version-button.component.md +++ b/docs/content-services/components/upload-version-button.component.md @@ -51,7 +51,7 @@ to enrich the features and decrease the restrictions currently applied to node v | Name | Type | Description | | ---- | ---- | ----------- | | beginUpload | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`UploadFilesEvent`](../../../lib/content-services/src/lib/upload/components/upload-files.event.ts)`>` | Emitted when the upload begins. | -| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadErrorEvent`](../../../lib/core/src/lib/events/file.event.ts)`>` | Emitted when an error occurs. | +| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadErrorEvent`](lib/content-services/src/lib/common/events/file.event.ts)`>` | Emitted when an error occurs. | | permissionEvent | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`PermissionModel`](../../../lib/content-services/src/lib/document-list/models/permissions.model.ts)`>` | Emitted when create permission is missing. | | success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the file is uploaded successfully. | | updateFileVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`>` | Emitted when dropping a file over another file to update the version. | diff --git a/docs/content-services/components/version-manager.component.md b/docs/content-services/components/version-manager.component.md index a7ccf1af50..6317d611f5 100644 --- a/docs/content-services/components/version-manager.component.md +++ b/docs/content-services/components/version-manager.component.md @@ -40,7 +40,7 @@ Displays the version history of a node with the ability to upload a new version. | Name | Type | Description | | ---- | ---- | ----------- | | uploadCancel | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when an cancelling during upload. | -| uploadError | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadErrorEvent`](../../../lib/core/src/lib/events/file.event.ts)`>` | Emitted when an error occurs during upload. | +| uploadError | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadErrorEvent`](lib/content-services/src/lib/common/events/file.event.ts)`>` | Emitted when an error occurs during upload. | | uploadSuccess | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when a file is uploaded successfully. | | viewVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when viewing a version. | diff --git a/docs/content-services/components/version-upload.component.md b/docs/content-services/components/version-upload.component.md index a6ad98352f..c870abdc26 100644 --- a/docs/content-services/components/version-upload.component.md +++ b/docs/content-services/components/version-upload.component.md @@ -33,9 +33,9 @@ Displays the new version's minor/major changes and the optional comment of a nod | ---- | ---- | ----------- | | cancel | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when an cancelling during upload. | | commentChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the comment is changed. | -| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadErrorEvent`](../../../lib/core/src/lib/events/file.event.ts)`>` | Emitted when an error occurs. | +| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadErrorEvent`](lib/content-services/src/lib/common/events/file.event.ts)`>` | Emitted when an error occurs. | | success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the file is uploaded successfully. | -| uploadStarted | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadEvent`](../../../lib/core/src/lib/events/file.event.ts)`>` | Emitted when the upload starts | +| uploadStarted | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FileUploadEvent`](lib/content-services/src/lib/common/events/file.event.ts)`>` | Emitted when the upload starts | | versionChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the version is changed. | ## Details diff --git a/docs/core/directives/node-download.directive.md b/docs/core/directives/node-download.directive.md index bd2e3d2758..4c20d961b2 100644 --- a/docs/core/directives/node-download.directive.md +++ b/docs/core/directives/node-download.directive.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2018-11-20 --- -# [Node Download directive](../../../lib/core/src/lib/directives/node-download.directive.ts "Defined in node-download.directive.ts") +# [Node Download directive](lib/content-services/src/lib/directives/node-download.directive.ts "Defined in node-download.directive.ts") Allows folders and/or files to be downloaded, with multiple nodes packed as a '.ZIP' archive. diff --git a/docs/core/models/bpm-user.model.md b/docs/core/models/bpm-user.model.md index bc9b8c70db..f94dd80626 100644 --- a/docs/core/models/bpm-user.model.md +++ b/docs/core/models/bpm-user.model.md @@ -4,7 +4,7 @@ Added: v2.0.0 Status: Active --- -# [Bpm User model](../../../lib/core/src/lib/models/bpm-user.model.ts "Defined in bpm-user.model.ts") +# [Bpm User model](lib/process-services/src/lib/common/models/bpm-user.model.ts "Defined in bpm-user.model.ts") Contains information about a Process Services user. diff --git a/docs/core/models/ecm-user.model.md b/docs/core/models/ecm-user.model.md index 23782e6689..c82062e85e 100644 --- a/docs/core/models/ecm-user.model.md +++ b/docs/core/models/ecm-user.model.md @@ -4,7 +4,7 @@ Added: v2.0.0 Status: Active --- -# [Ecm User model](../../../lib/core/src/lib/models/ecm-user.model.ts "Defined in ecm-user.model.ts") +# [Ecm User model](lib/content-services/src/lib/common/models/ecm-user.model.ts "Defined in ecm-user.model.ts") Contains information about a Content Services user. diff --git a/docs/core/models/user-process.model.md b/docs/core/models/user-process.model.md index 2fffa56a8d..b1acbd028b 100644 --- a/docs/core/models/user-process.model.md +++ b/docs/core/models/user-process.model.md @@ -4,7 +4,7 @@ Added: v2.0.0 Status: Active --- -# [User Process model](../../../lib/core/src/lib/models/user-process.model.ts "Defined in user-process.model.ts") +# [User Process model](lib/process-services/src/lib/common/models/user-process.model.ts "Defined in user-process.model.ts") Represents a Process Services user. diff --git a/docs/core/services/content.service.md b/docs/core/services/content.service.md index 9e28fc77f9..c573b48f2a 100644 --- a/docs/core/services/content.service.md +++ b/docs/core/services/content.service.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2019-03-13 --- -# [Content service](../../../lib/core/src/lib/services/content.service.ts "Defined in content.service.ts") +# [Content service](lib/content-services/src/lib/common/services/content.service.ts "Defined in content.service.ts") Accesses app-generated data objects via URLs and file downloads. @@ -18,7 +18,7 @@ Accesses app-generated data objects via URLs and file downloads. - _blob:_ [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) - Data to wrap into object URL - **Returns** `string` - URL string - **downloadBlob**(blob: [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob), fileName: `string`)
- (**Deprecated:** in 3.2.0, use [DownloadService](../../../lib/core/src/lib/services/download.service.ts) instead. Invokes content download for a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) with a file name.) + (**Deprecated:** in 3.2.0, use [DownloadService](lib/core/src/lib/common/services/download.service.ts) instead. Invokes content download for a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) with a file name.) - _blob:_ [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) - Content to download. - _fileName:_ `string` - Name of the resulting file. - **getContentUrl**(node: [`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`|string`, attachment?: `boolean`, ticket?: `string`): `string`
@@ -42,15 +42,15 @@ Accesses app-generated data objects via URLs and file downloads. Gets content for the given node. - _nodeId:_ `string` - ID of the target node - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`` - Content data -- **hasAllowableOperations**(node: `Node`, allowableOperation: [`AllowableOperationsEnum`](../../../lib/core/src/lib/models/allowable-operations.enum.ts)`|string`): `boolean`
+- **hasAllowableOperations**(node: `Node`, allowableOperation: [`AllowableOperationsEnum`](lib/content-services/src/lib/common/models/allowable-operations.enum.ts)`|string`): `boolean`
Checks if the user has permissions on that node - _node:_ `Node` - Node to check allowableOperations - - _allowableOperation:_ [`AllowableOperationsEnum`](../../../lib/core/src/lib/models/allowable-operations.enum.ts)`|string` - Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions + - _allowableOperation:_ [`AllowableOperationsEnum`](lib/content-services/src/lib/common/models/allowable-operations.enum.ts)`|string` - Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions - **Returns** `boolean` - True if the user has the required permissions, false otherwise -- **hasPermissions**(node: `Node`, permission: [`PermissionsEnum`](../../../lib/core/src/lib/models/permissions.enum.ts)`|string`, userId?: `string`): `boolean`
+- **hasPermissions**(node: `Node`, permission: [`PermissionsEnum`](lib/content-services/src/lib/common/models/permissions.enum.ts)`|string`, userId?: `string`): `boolean`
Checks if the user has permission on that node - _node:_ `Node` - Node to check permissions - - _permission:_ [`PermissionsEnum`](../../../lib/core/src/lib/models/permissions.enum.ts)`|string` - Required permission type + - _permission:_ [`PermissionsEnum`](lib/content-services/src/lib/common/models/permissions.enum.ts)`|string` - Required permission type - _userId:_ `string` - (Optional) Optional current user id will be taken by default - **Returns** `boolean` - True if the user has the required permissions, false otherwise diff --git a/docs/core/services/discovery-api.service.md b/docs/core/services/discovery-api.service.md index 299df2bf42..622b98bbe1 100644 --- a/docs/core/services/discovery-api.service.md +++ b/docs/core/services/discovery-api.service.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2018-11-19 --- -# [Discovery Api service](../../../lib/core/src/lib/services/discovery-api.service.ts "Defined in discovery-api.service.ts") +# [Discovery Api service](lib/content-services/src/lib/common/services/discovery-api.service.ts "Defined in discovery-api.service.ts") Gets version and license information for Process Services and Content Services. diff --git a/docs/core/services/download-zip.service.md b/docs/core/services/download-zip.service.md index 7657a49afc..1f772b20b5 100644 --- a/docs/core/services/download-zip.service.md +++ b/docs/core/services/download-zip.service.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2019-01-08 --- -# [Download zip service](../../../lib/core/src/lib/services/download-zip.service.ts "Defined in download-zip.service.ts") +# [Download zip service](lib/content-services/src/lib/dialogs/download-zip/services/download-zip.service.ts "Defined in download-zip.service.ts") Creates and manages downloads. diff --git a/docs/core/services/nodes-api.service.md b/docs/core/services/nodes-api.service.md index 568f058437..d51f5e1428 100644 --- a/docs/core/services/nodes-api.service.md +++ b/docs/core/services/nodes-api.service.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2019-01-16 --- -# [Nodes Api service](../../../lib/core/src/lib/services/nodes-api.service.ts "Defined in nodes-api.service.ts") +# [Nodes Api service](lib/content-services/src/lib/common/services/nodes-api.service.ts "Defined in nodes-api.service.ts") Accesses and manipulates ACS document nodes using their node IDs. @@ -66,10 +66,10 @@ Accesses and manipulates ACS document nodes using their node IDs. - _nodeId:_ `string` - ID of the target node - _options:_ `any` - Optional parameters supported by JS-API - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodePaging`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/content-rest-api/docs/NodePaging.md)`>` - List of child items from the folder -- **getNodeMetadata**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeMetadata`](../../../lib/core/src/lib/models/node-metadata.model.ts)`>`
+- **getNodeMetadata**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeMetadata`](lib/content-services/src/lib/common/models/node-metadata.model.ts)`>`
Get the metadata and the nodeType for a nodeId cleaned by the prefix. - _nodeId:_ `string` - ID of the target node - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeMetadata`](../../../lib/core/src/lib/models/node-metadata.model.ts)`>` - Node metadata + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeMetadata`](lib/content-services/src/lib/common/models/node-metadata.model.ts)`>` - Node metadata - **restoreNode**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`MinimalNode`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md)`>`
Restores a node previously moved to the trashcan. - _nodeId:_ `string` - ID of the node to restore diff --git a/docs/core/services/people-content.service.md b/docs/core/services/people-content.service.md index f0909dc337..2dc1a9c523 100644 --- a/docs/core/services/people-content.service.md +++ b/docs/core/services/people-content.service.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2018-04-06 --- -# [People Content service](../../../lib/core/src/lib/services/people-content.service.ts "Defined in people-content.service.ts") +# [People Content service](lib/content-services/src/lib/common/services/people-content.service.ts "Defined in people-content.service.ts") Gets information about a Content Services user. @@ -36,10 +36,10 @@ Gets information about a Content Services user. - **isCurrentUserAdmin**(): `boolean`
Used to know if the current user has the admin capability - **Returns** `boolean` - true or false -- **listPeople**(requestQuery?: [`PeopleContentQueryRequestModel`](../../../lib/core/src/lib/services/people-content.service.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`PeopleContentQueryResponse`](../../../lib/core/src/lib/services/people-content.service.ts)`>`
+- **listPeople**(requestQuery?: [`PeopleContentQueryRequestModel`](lib/content-services/src/lib/common/services/people-content.service.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`PeopleContentQueryResponse`](lib/content-services/src/lib/common/services/people-content.service.ts)`>`
Gets a list of people. - - _requestQuery:_ [`PeopleContentQueryRequestModel`](../../../lib/core/src/lib/services/people-content.service.ts) - (Optional) maxItems and skipCount parameters supported by JS-API - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`PeopleContentQueryResponse`](../../../lib/core/src/lib/services/people-content.service.ts)`>` - Response containing pagination and list of entries + - _requestQuery:_ [`PeopleContentQueryRequestModel`](lib/content-services/src/lib/common/services/people-content.service.ts) - (Optional) maxItems and skipCount parameters supported by JS-API + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`PeopleContentQueryResponse`](lib/content-services/src/lib/common/services/people-content.service.ts)`>` - Response containing pagination and list of entries - **resetLocalCurrentUser**()
Reset the local current user object - **updatePerson**(personId: `string`, details: `PersonBodyUpdate`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>`
diff --git a/docs/core/services/people-process.service.md b/docs/core/services/people-process.service.md index a2b9fc7145..509243920d 100644 --- a/docs/core/services/people-process.service.md +++ b/docs/core/services/people-process.service.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2018-04-05 --- -# [People Process service](../../../lib/core/src/lib/services/people-process.service.ts "Defined in people-process.service.ts") +# [People Process service](lib/process-services/src/lib/common/services/people-process.service.ts "Defined in people-process.service.ts") Gets information about Process Services users. diff --git a/docs/core/services/upload.service.md b/docs/core/services/upload.service.md index 3885cf1029..1b0c751032 100644 --- a/docs/core/services/upload.service.md +++ b/docs/core/services/upload.service.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2019-01-16 --- -# [Upload Service](../../../lib/core/src/lib/services/upload.service.ts "Defined in upload.service.ts") +# [Upload Service](lib/content-services/src/lib/common/services/upload.service.ts "Defined in upload.service.ts") Provides access to various APIs related to file upload features. @@ -13,26 +13,26 @@ Provides access to various APIs related to file upload features. ### Methods -- **addToQueue**(files: [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)`[]`): [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)`[]`
+- **addToQueue**(files: [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]`): [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]`
Adds files to the uploading queue to be uploaded - - _files:_ [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)`[]` - One or more separate parameters or an array of files to queue - - **Returns** [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)`[]` - Array of files that were not blocked from upload by the ignore list -- **cancelUpload**(files: [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)`[]`)
+ - _files:_ [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]` - One or more separate parameters or an array of files to queue + - **Returns** [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]` - Array of files that were not blocked from upload by the ignore list +- **cancelUpload**(files: [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]`)
Cancels uploading of files. If the file is smaller than 1 MB the file will be uploaded and then the node deleted to prevent having files that were aborted but still uploaded. - - _files:_ [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)`[]` - One or more separate parameters or an array of files specifying uploads to cancel + - _files:_ [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]` - One or more separate parameters or an array of files specifying uploads to cancel - **clearCache**()
- **clearQueue**()
Clears the upload queue -- **getQueue**(): [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)`[]`
+- **getQueue**(): [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]`
Gets the file Queue - - **Returns** [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)`[]` - Array of files that form the queue + - **Returns** [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]` - Array of files that form the queue - **getThreadsCount**(): `number`
Returns the number of concurrent threads for uploading. - **Returns** `number` - Number of concurrent threads (default 1) -- **getUploadPromise**(file: [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)): `any`
+- **getUploadPromise**(file: [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)): `any`
Gets an upload promise for a file. - - _file:_ [`FileModel`](../../../lib/core/src/lib/models/file.model.ts) - The target file + - _file:_ [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts) - The target file - **Returns** `any` - [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises) that is resolved if the upload is successful or error otherwise - **isUploading**(): `boolean`
Checks whether the service still has files uploading or awaiting upload. @@ -46,15 +46,15 @@ Provides access to various APIs related to file upload features. | Name | Type | Description | | ---- | ---- | ----------- | -| queueChanged | [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)\[] | Emitted when the file queue changes. | -| fileUpload | [`FileUploadEvent`](../../../lib/core/src/lib/events/file.event.ts) | Emitted when a [File model](lib/core/src/lib/models/file.model.ts) changes its state. | -| fileUploadStarting | [`FileUploadEvent`](../../../lib/core/src/lib/events/file.event.ts) | Emitted when an upload starts. | -| fileUploadCancelled | [`FileUploadEvent`](../../../lib/core/src/lib/events/file.event.ts) | Emitted when an upload gets cancelled by the user. | -| fileUploadProgress | [`FileUploadEvent`](../../../lib/core/src/lib/events/file.event.ts) | Emitted during the file upload process and contains the current progress for a particular [File model](lib/core/src/lib/models/file.model.ts). | -| fileUploadAborted | [`FileUploadEvent`](../../../lib/core/src/lib/events/file.event.ts) | Emitted when a file upload gets aborted by the server. | -| fileUploadError | [`FileUploadEvent`](../../../lib/core/src/lib/events/file.event.ts) | Emitted when an error occurs during a file upload. | -| fileUploadComplete | [`FileUploadCompleteEvent`](../../../lib/core/src/lib/events/file.event.ts) | Emitted when a file upload is complete. | -| fileUploadDelete | [`FileUploadDeleteEvent`](../../../lib/core/src/lib/events/file.event.ts) | Emitted when an uploaded file is removed from server. | +| queueChanged | [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)\[] | Emitted when the file queue changes. | +| fileUpload | [`FileUploadEvent`](lib/content-services/src/lib/common/events/file.event.ts) | Emitted when a [File model](lib/content-services/src/lib/common/models/file.model.ts) changes its state. | +| fileUploadStarting | [`FileUploadEvent`](lib/content-services/src/lib/common/events/file.event.ts) | Emitted when an upload starts. | +| fileUploadCancelled | [`FileUploadEvent`](lib/content-services/src/lib/common/events/file.event.ts) | Emitted when an upload gets cancelled by the user. | +| fileUploadProgress | [`FileUploadEvent`](lib/content-services/src/lib/common/events/file.event.ts) | Emitted during the file upload process and contains the current progress for a particular [File model](lib/content-services/src/lib/common/models/file.model.ts). | +| fileUploadAborted | [`FileUploadEvent`](lib/content-services/src/lib/common/events/file.event.ts) | Emitted when a file upload gets aborted by the server. | +| fileUploadError | [`FileUploadEvent`](lib/content-services/src/lib/common/events/file.event.ts) | Emitted when an error occurs during a file upload. | +| fileUploadComplete | [`FileUploadCompleteEvent`](lib/content-services/src/lib/common/events/file.event.ts) | Emitted when a file upload is complete. | +| fileUploadDelete | [`FileUploadDeleteEvent`](lib/content-services/src/lib/common/events/file.event.ts) | Emitted when an uploaded file is removed from server. | | fileDeleted | string | This can be invoked when a file is deleted from an external source to upload the file dialog status. | ## Details @@ -120,7 +120,7 @@ In this way all the files present in the .git folder won't be uploaded. ### Toggling Versioning Support -It is also possible to provide the `versioningEnabled` value as part of the [`FileUploadOptions`](../../../lib/core/src/lib/models/file.model.ts) when using [upload service](../../core/services/upload.service.md) from the code. +It is also possible to provide the `versioningEnabled` value as part of the [`FileUploadOptions`](lib/content-services/src/lib/common/models/file.model.ts) when using [upload service](../../core/services/upload.service.md) from the code. > Note: When creating a new node using multipart/form-data by default versioning is enabled and set to MAJOR Version. > Since Alfresco 6.2.3 versioningEnabled flag was introduced offering better control over the new node Versioning. diff --git a/docs/core/services/user-access.service.md b/docs/core/services/user-access.service.md index 4b0ae5d791..af292fb980 100644 --- a/docs/core/services/user-access.service.md +++ b/docs/core/services/user-access.service.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2022-06-05 --- -# [User access service](../../../lib/core/src/lib/services/user-access.service.ts "Defined in user-access.service.ts") +# [User access service](lib/core/src/lib/auth/services/user-access.service.ts "Defined in user-access.service.ts") Checks the global and application access of a user diff --git a/docs/upgrade-guide/upgrade26-30.md b/docs/upgrade-guide/upgrade26-30.md index 86a44e46e4..f5bb094632 100644 --- a/docs/upgrade-guide/upgrade26-30.md +++ b/docs/upgrade-guide/upgrade26-30.md @@ -259,7 +259,7 @@ The following classes have been moved from their original libraries to the Core library. You should modify your code to import these classes from `@alfresco/adf-core`. -- [`DownloadZipDialogComponent`](../../lib/core/src/lib/dialogs/download-zip/download-zip.dialog.ts) (formerly Content Services) +- [`DownloadZipDialogComponent`](lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.ts) (formerly Content Services) - [`NodeDownloadDirective`](../core/directives/node-download.directive.md) (formerly Content Services) - [`CommentsModule`](../../lib/core/src/lib/comments/comments.module.ts) (formerly Process Services) - [`CommentListComponent`](../core/components/comment-list.component.md) (formerly Process Services) diff --git a/docs/upgrade-guide/upgrade50-60.md b/docs/upgrade-guide/upgrade50-60.md index e114ea4d1f..76006fd04c 100644 --- a/docs/upgrade-guide/upgrade50-60.md +++ b/docs/upgrade-guide/upgrade50-60.md @@ -90,10 +90,13 @@ How to fix it: ## Deprecated items -| Class | Before | After | +| Class | Before | Description | | --- | -- | --- | -| `LoginDialogService` | `@alfresco/adf-core`| -| `UserInfoComponent` | `@alfresco/adf-core`| +| `LoginDialogService` | `@alfresco/adf-core`|| +| `DeletedNodesApiService` | `@alfresco/adf-core`|| +| `BpmUserService` | `@alfresco/adf-core`| you can use instead the PeopleProcessService| +| `UserContentAccessService` | `@alfresco/adf-core`| you can use instead the PeopleContentService| +| `EcmUserService` | `@alfresco/adf-core`| you can use instead the PeopleContentService| ### DataColumnModule @@ -137,13 +140,35 @@ v6.0.0 and after: | [`NodeDeleteDirective`](../content-services/directives/node-delete.directive.md)| `@alfresco/adf-core` | `@alfresco/adf-content-services` | | [`NodeFavoriteDirective`](../content-services/directives/node-favorite.directive.md)| `@alfresco/adf-core` | `@alfresco/adf-content-services` | | [`NodeRestoreDirective`](../content-services/directives/node-restore.directive.md)| `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `NodeDownloadDirective` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | | [`AppsProcessService`] | `@alfresco/adf-core` | `@alfresco/adf-process-services` | | `SharedLinksApiService` | `@alfresco/adf-core` | `@alfresco/adf-process-services` | | `LockService` | `@alfresco/adf-core` | `@alfresco/adf-process-services` | | `FavoritesApiService` | `@alfresco/adf-core` | `@alfresco/adf-process-services` | +| `SearchConfigurationInterface` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `NodeDownloadDirective` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `DownloadZipDialogComponent` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `RenditionService` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `UploadService` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `NodesApiService` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `ContentService` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `ContentService` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `PeopleContentService` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `PeopleProcessService` | `@alfresco/adf-core` | `@alfresco/adf-process-services` | +| `PermissionsEnum` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `AllowableOperationsEnum` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `FileModel` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `FileUploadStatus` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `FileUploadProgress` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `FileUploadOptions` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `FileUploadEvent` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `FileUploadCompleteEvent` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `FileUploadDeleteEvent` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `FileUploadErrorEvent` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | +| `NodeMetadata` | `@alfresco/adf-core` | `@alfresco/adf-content-services` | | `RichTextEditorComponent` | `@alfresco/adf-core` | `@alfresco/adf-process-services-cloud` | - + ### Update Data-table a data change v6.0.0 and after You will need to provide a ```DataTableService``` to update a row of your table. diff --git a/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.spec.ts b/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.spec.ts index e4b26c140d..202183d670 100644 --- a/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.spec.ts +++ b/lib/content-services/src/lib/aspect-list/aspect-list-dialog.component.spec.ts @@ -25,7 +25,7 @@ import { AspectListDialogComponentData } from './aspect-list-dialog-data.interfa import { AspectListService } from './services/aspect-list.service'; import { delay } from 'rxjs/operators'; import { AspectEntry, MinimalNode } from '@alfresco/js-api'; -import { NodesApiService } from '@alfresco/adf-core'; +import { NodesApiService } from '../common/services/nodes-api.service'; const aspectListMock: AspectEntry[] = [{ entry: { diff --git a/lib/content-services/src/lib/aspect-list/aspect-list.component.spec.ts b/lib/content-services/src/lib/aspect-list/aspect-list.component.spec.ts index 5e79b19a62..c3344cee95 100644 --- a/lib/content-services/src/lib/aspect-list/aspect-list.component.spec.ts +++ b/lib/content-services/src/lib/aspect-list/aspect-list.component.spec.ts @@ -16,7 +16,8 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { NodesApiService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; +import { NodesApiService } from '../common/services/nodes-api.service'; import { ContentTestingModule } from '../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; import { AspectListComponent } from './aspect-list.component'; diff --git a/lib/content-services/src/lib/aspect-list/aspect-list.component.ts b/lib/content-services/src/lib/aspect-list/aspect-list.component.ts index 0a6abdc040..5d79083721 100644 --- a/lib/content-services/src/lib/aspect-list/aspect-list.component.ts +++ b/lib/content-services/src/lib/aspect-list/aspect-list.component.ts @@ -16,7 +16,7 @@ */ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, ViewEncapsulation } from '@angular/core'; -import { NodesApiService } from '@alfresco/adf-core'; +import { NodesApiService } from '../common/services/nodes-api.service'; import { Observable, Subject, zip } from 'rxjs'; import { concatMap, map, takeUntil, tap } from 'rxjs/operators'; import { AspectListService } from './services/aspect-list.service'; diff --git a/lib/content-services/src/lib/aspect-list/services/node-aspect.service.spec.ts b/lib/content-services/src/lib/aspect-list/services/node-aspect.service.spec.ts index db7ef63150..b2ce9044b5 100644 --- a/lib/content-services/src/lib/aspect-list/services/node-aspect.service.spec.ts +++ b/lib/content-services/src/lib/aspect-list/services/node-aspect.service.spec.ts @@ -18,7 +18,8 @@ import { MinimalNode } from '@alfresco/js-api'; import { TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { NodesApiService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; +import { NodesApiService } from '../../common/services/nodes-api.service'; import { EMPTY, of } from 'rxjs'; import { ContentTestingModule } from '../../testing/content.testing.module'; import { NodeAspectService } from './node-aspect.service'; diff --git a/lib/content-services/src/lib/aspect-list/services/node-aspect.service.ts b/lib/content-services/src/lib/aspect-list/services/node-aspect.service.ts index e3fb0b569a..c027f54eeb 100644 --- a/lib/content-services/src/lib/aspect-list/services/node-aspect.service.ts +++ b/lib/content-services/src/lib/aspect-list/services/node-aspect.service.ts @@ -16,9 +16,9 @@ */ import { Injectable } from '@angular/core'; -import { NodesApiService } from '@alfresco/adf-core'; import { DialogAspectListService } from './dialog-aspect-list.service'; import { CardViewContentUpdateService } from '../../common/services/card-view-content-update.service'; +import { NodesApiService } from '../../common/services/nodes-api.service'; @Injectable({ providedIn: 'root' diff --git a/lib/content-services/src/lib/category/services/category-tree-datasource.service.ts b/lib/content-services/src/lib/category/services/category-tree-datasource.service.ts index bf6d36e37a..031e2e09da 100644 --- a/lib/content-services/src/lib/category/services/category-tree-datasource.service.ts +++ b/lib/content-services/src/lib/category/services/category-tree-datasource.service.ts @@ -33,8 +33,7 @@ export class CategoryTreeDatasourceService extends TreeService { public getSubNodes(parentNodeId: string, skipCount?: number, maxItems?: number, name?: string): Observable> { return !name ? this.categoryService.getSubcategories(parentNodeId, skipCount, maxItems).pipe(map((response: CategoryPaging) => { const parentNode: CategoryNode = this.getParentNode(parentNodeId); - const nodesList: CategoryNode[] = response.list.entries.map((entry: CategoryEntry) => { - return { + const nodesList: CategoryNode[] = response.list.entries.map((entry: CategoryEntry) => ({ id: entry.entry.id, nodeName: entry.entry.name, parentId: entry.entry.parentId, @@ -42,8 +41,7 @@ export class CategoryTreeDatasourceService extends TreeService { level: parentNode ? parentNode.level + 1 : 0, isLoading: false, nodeType: TreeNodeType.RegularNode - }; - }); + })); if (response.list.pagination.hasMoreItems && parentNode) { const loadMoreNode: CategoryNode = { id: 'loadMore', diff --git a/lib/core/src/lib/events/file.event.ts b/lib/content-services/src/lib/common/events/file.event.ts similarity index 100% rename from lib/core/src/lib/events/file.event.ts rename to lib/content-services/src/lib/common/events/file.event.ts diff --git a/lib/core/src/lib/mock/ecm-user.service.mock.ts b/lib/content-services/src/lib/common/mocks/ecm-user.service.mock.ts similarity index 92% rename from lib/core/src/lib/mock/ecm-user.service.mock.ts rename to lib/content-services/src/lib/common/mocks/ecm-user.service.mock.ts index 2c93f26948..689916bdf2 100644 --- a/lib/core/src/lib/mock/ecm-user.service.mock.ts +++ b/lib/content-services/src/lib/common/mocks/ecm-user.service.mock.ts @@ -15,20 +15,8 @@ * limitations under the License. */ -import { EcmCompanyModel } from '../models/ecm-company.model'; import { PersonEntry, Person, PersonPaging } from '@alfresco/js-api'; -export const fakeEcmCompany: EcmCompanyModel = { - organization: 'company-fake-name', - address1: 'fake-address-1', - address2: 'fake-address-2', - address3: 'fake-address-3', - postcode: 'fAk1', - telephone: '00000000', - fax: '11111111', - email: 'fakeCompany@fake.com' -}; - export const fakeEcmUser = { id: 'fake-id', firstName: 'fake-ecm-first-name', diff --git a/lib/core/src/lib/models/allowable-operations.enum.ts b/lib/content-services/src/lib/common/models/allowable-operations.enum.ts similarity index 100% rename from lib/core/src/lib/models/allowable-operations.enum.ts rename to lib/content-services/src/lib/common/models/allowable-operations.enum.ts diff --git a/lib/core/src/lib/models/ecm-company.model.ts b/lib/content-services/src/lib/common/models/ecm-company.model.ts similarity index 100% rename from lib/core/src/lib/models/ecm-company.model.ts rename to lib/content-services/src/lib/common/models/ecm-company.model.ts diff --git a/lib/core/src/lib/models/ecm-user.model.ts b/lib/content-services/src/lib/common/models/ecm-user.model.ts similarity index 100% rename from lib/core/src/lib/models/ecm-user.model.ts rename to lib/content-services/src/lib/common/models/ecm-user.model.ts diff --git a/lib/core/src/lib/models/file.model.spec.ts b/lib/content-services/src/lib/common/models/file.model.spec.ts similarity index 100% rename from lib/core/src/lib/models/file.model.spec.ts rename to lib/content-services/src/lib/common/models/file.model.spec.ts diff --git a/lib/core/src/lib/models/file.model.ts b/lib/content-services/src/lib/common/models/file.model.ts similarity index 100% rename from lib/core/src/lib/models/file.model.ts rename to lib/content-services/src/lib/common/models/file.model.ts diff --git a/lib/core/src/lib/models/node-metadata.model.ts b/lib/content-services/src/lib/common/models/node-metadata.model.ts similarity index 100% rename from lib/core/src/lib/models/node-metadata.model.ts rename to lib/content-services/src/lib/common/models/node-metadata.model.ts diff --git a/lib/core/src/lib/models/permissions.enum.ts b/lib/content-services/src/lib/common/models/permissions.enum.ts similarity index 100% rename from lib/core/src/lib/models/permissions.enum.ts rename to lib/content-services/src/lib/common/models/permissions.enum.ts diff --git a/lib/content-services/src/lib/common/public-api.ts b/lib/content-services/src/lib/common/public-api.ts index f3c7a8c0d9..a65510b1c7 100644 --- a/lib/content-services/src/lib/common/public-api.ts +++ b/lib/content-services/src/lib/common/public-api.ts @@ -18,5 +18,22 @@ export * from './services/favorites-api.service'; export * from './services/card-view-content-update.service'; export * from './services/sites.service'; +export * from './services/rendition.service'; +export * from './services/upload.service'; +export * from './services/nodes-api.service'; +export * from './services/discovery-api.service'; +export * from './services/people-content.service'; +export * from './services/content.service'; + +export * from './events/file.event'; + +export * from './models/ecm-user.model'; +export * from './models/ecm-company.model'; +export * from './models/file.model'; +export * from './models/node-metadata.model'; + +export * from './models/permissions.enum'; +export * from './models/allowable-operations.enum'; export * from './interfaces/search-configuration.interface'; +export * from './mocks/ecm-user.service.mock'; diff --git a/lib/core/src/lib/services/content.service.spec.ts b/lib/content-services/src/lib/common/services/content.service.spec.ts similarity index 88% rename from lib/core/src/lib/services/content.service.spec.ts rename to lib/content-services/src/lib/common/services/content.service.spec.ts index 0648add1ea..4e6ef177ad 100644 --- a/lib/core/src/lib/services/content.service.spec.ts +++ b/lib/content-services/src/lib/common/services/content.service.spec.ts @@ -17,12 +17,8 @@ import { TestBed } from '@angular/core/testing'; import { ContentService } from './content.service'; -import { AppConfigService } from '../app-config/app-config.service'; -import { AuthenticationService } from '../auth/services/authentication.service'; -import { StorageService } from '../common/services/storage.service'; -import { setupTestBed } from '../testing/setup-test-bed'; +import { AppConfigService, AuthenticationService, StorageService, setupTestBed, CoreTestingModule } from '@alfresco/adf-core'; import { Node } from '@alfresco/js-api'; -import { CoreTestingModule } from '../testing'; import { TranslateModule } from '@ngx-translate/core'; declare let jasmine: any; @@ -82,21 +78,6 @@ describe('ContentService', () => { }); }); - it('should return a valid thumbnail URL', (done) => { - authService.login('fake-username', 'fake-password').subscribe(() => { - expect(contentService.getDocumentThumbnailUrl(node)) - .toContain('/ecm/alfresco/api/-default-/public/alfresco' + - '/versions/1/nodes/fake-node-id/renditions/doclib/content?attachment=false&alf_ticket=fake-post-ticket'); - done(); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 201, - contentType: 'application/json', - responseText: JSON.stringify({ entry: { id: 'fake-post-ticket', userId: 'admin' } }) - }); - }); - describe('AllowableOperations', () => { it('should hasAllowableOperations be false if allowableOperation is not present in the node', () => { diff --git a/lib/core/src/lib/services/content.service.ts b/lib/content-services/src/lib/common/services/content.service.ts similarity index 63% rename from lib/core/src/lib/services/content.service.ts rename to lib/content-services/src/lib/common/services/content.service.ts index bb9f25e40e..1ee74766f1 100644 --- a/lib/core/src/lib/services/content.service.ts +++ b/lib/content-services/src/lib/common/services/content.service.ts @@ -16,17 +16,11 @@ */ import { Injectable } from '@angular/core'; -import { DomSanitizer } from '@angular/platform-browser'; -import { ContentApi, MinimalNode, Node, NodeEntry, NodesApi } from '@alfresco/js-api'; -import { Observable, Subject, from, throwError } from 'rxjs'; -import { AlfrescoApiService } from './alfresco-api.service'; -import { AuthenticationService } from '../auth/services/authentication.service'; -import { LogService } from '../common/services/log.service'; -import { catchError } from 'rxjs/operators'; +import { ContentApi, MinimalNode, Node, NodeEntry } from '@alfresco/js-api'; +import { Subject } from 'rxjs'; +import { AlfrescoApiService, AuthenticationService } from '@alfresco/adf-core'; import { PermissionsEnum } from '../models/permissions.enum'; import { AllowableOperationsEnum } from '../models/allowable-operations.enum'; -import { DownloadService } from './download.service'; -import { ThumbnailService } from '../common/services/thumbnail.service'; export interface FolderCreatedEvent { name: string; @@ -50,53 +44,10 @@ export class ContentService { return this._contentApi; } - private _nodesApi: NodesApi; - get nodesApi(): NodesApi { - this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance()); - return this._nodesApi; - } - constructor(public authService: AuthenticationService, - public apiService: AlfrescoApiService, - private logService: LogService, - private sanitizer: DomSanitizer, - private downloadService: DownloadService, - private thumbnailService: ThumbnailService) { + public apiService: AlfrescoApiService) { } - /** - * @deprecated in 3.2.0, use DownloadService instead. - * Invokes content download for a Blob with a file name. - * @param blob Content to download. - * @param fileName Name of the resulting file. - */ - downloadBlob(blob: Blob, fileName: string): void { - this.downloadService.downloadBlob(blob, fileName); - } - - /** - * Creates a trusted object URL from the Blob. - * WARNING: calling this method with untrusted user data exposes your application to XSS security risks! - * - * @param blob Data to wrap into object URL - * @returns URL string - */ - createTrustedUrl(blob: Blob): string { - const url = window.URL.createObjectURL(blob); - return this.sanitizer.bypassSecurityTrustUrl(url) as string; - } - - /** - * @deprecated in 3.2.0, use ThumbnailService instead. - * Gets a thumbnail URL for the given document node. - * @param node Node or Node ID to get URL for. - * @param attachment Toggles whether to retrieve content as an attachment for download - * @param ticket Custom ticket to use for authentication - * @returns URL string - */ - getDocumentThumbnailUrl(node: NodeEntry | string, attachment?: boolean, ticket?: string): string { - return this.thumbnailService.getDocumentThumbnailUrl(node, attachment, ticket); - } /** * Gets a content URL for the given node. @@ -122,28 +73,8 @@ export class ContentService { return null; } - /** - * Gets content for the given node. - * - * @param nodeId ID of the target node - * @returns Content data - */ - getNodeContent(nodeId: string): Observable { - return from(this.nodesApi.getNodeContent(nodeId)) - .pipe( - catchError((err: any) => this.handleError(err)) - ); - } - - /** - * Gets a Node via its node ID. - * - * @param nodeId ID of the target node - * @param opts Options supported by JS-API - * @returns Details of the folder - */ - getNode(nodeId: string, opts?: any): Observable { - return from(this.nodesApi.getNode(nodeId, opts)); + getDocumentThumbnailUrl(nodeId: string, attachment?: boolean, ticket?: string): string { + return this.contentApi.getDocumentThumbnailUrl(nodeId, attachment, ticket); } /** @@ -219,8 +150,4 @@ export class ContentService { return hasAllowableOperations; } - private handleError(error: any) { - this.logService.error(error); - return throwError(error || 'Server error'); - } } diff --git a/lib/core/src/lib/services/discovery-api.service.ts b/lib/content-services/src/lib/common/services/discovery-api.service.ts similarity index 93% rename from lib/core/src/lib/services/discovery-api.service.ts rename to lib/content-services/src/lib/common/services/discovery-api.service.ts index d102ea74ee..07695ca06d 100644 --- a/lib/core/src/lib/services/discovery-api.service.ts +++ b/lib/content-services/src/lib/common/services/discovery-api.service.ts @@ -20,9 +20,7 @@ import { from, Observable, throwError, Subject } from 'rxjs'; import { catchError, map, switchMap, filter, take } from 'rxjs/operators'; import { RepositoryInfo, SystemPropertiesRepresentation } from '@alfresco/js-api'; -import { BpmProductVersionModel } from '../models/product-version.model'; -import { AlfrescoApiService } from './alfresco-api.service'; -import { AuthenticationService } from '../auth/services/authentication.service'; +import { BpmProductVersionModel, AlfrescoApiService, AuthenticationService } from '@alfresco/adf-core'; import { ApiClientsService } from '@alfresco/adf-core/api'; @Injectable({ diff --git a/lib/core/src/lib/services/nodes-api.service.ts b/lib/content-services/src/lib/common/services/nodes-api.service.ts similarity index 95% rename from lib/core/src/lib/services/nodes-api.service.ts rename to lib/content-services/src/lib/common/services/nodes-api.service.ts index 0a37438813..70283c554f 100644 --- a/lib/core/src/lib/services/nodes-api.service.ts +++ b/lib/content-services/src/lib/common/services/nodes-api.service.ts @@ -18,8 +18,7 @@ import { Injectable } from '@angular/core'; import { MinimalNode, NodeEntry, NodePaging, NodesApi, TrashcanApi, Node } from '@alfresco/js-api'; import { Subject, from, Observable, throwError } from 'rxjs'; -import { AlfrescoApiService } from './alfresco-api.service'; -import { UserPreferencesService } from '../common/services/user-preferences.service'; +import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core'; import { catchError, map } from 'rxjs/operators'; import { NodeMetadata } from '../models/node-metadata.model'; @@ -198,6 +197,19 @@ export class NodesApiService { return this.createNodeInsideRoot(name || this.generateUuid(), nodeType, properties, path); } + /** + * Gets content for the given node. + * + * @param nodeId ID of the target node + * @returns Content data + */ + getNodeContent(nodeId: string): Observable { + return from(this.nodesApi.getNodeContent(nodeId)) + .pipe( + catchError((err) => throwError(err)) + ); + } + /** * Create a new Node inside `-root-` folder * diff --git a/lib/core/src/lib/services/people-content.service.spec.ts b/lib/content-services/src/lib/common/services/people-content.service.spec.ts similarity index 93% rename from lib/core/src/lib/services/people-content.service.spec.ts rename to lib/content-services/src/lib/common/services/people-content.service.spec.ts index 2c1d483a88..b1fb567e94 100644 --- a/lib/core/src/lib/services/people-content.service.spec.ts +++ b/lib/content-services/src/lib/common/services/people-content.service.spec.ts @@ -15,15 +15,11 @@ * limitations under the License. */ -import { fakeEcmUserList, createNewPersonMock, fakeEcmUser, fakeEcmAdminUser } from '../mock/ecm-user.service.mock'; -import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; -import { CoreTestingModule } from '../testing/core.testing.module'; +import { fakeEcmUserList, createNewPersonMock, fakeEcmUser, fakeEcmAdminUser } from '../mocks/ecm-user.service.mock'; +import { AuthenticationService, AlfrescoApiService, AlfrescoApiServiceMock, CoreTestingModule, LogService } from '@alfresco/adf-core'; import { PeopleContentService, PeopleContentQueryRequestModel } from './people-content.service'; -import { AlfrescoApiService } from './alfresco-api.service'; import { TranslateModule } from '@ngx-translate/core'; import { TestBed } from '@angular/core/testing'; -import { LogService } from '../common/services/log.service'; -import { AuthenticationService } from '../auth/services/authentication.service'; describe('PeopleContentService', () => { diff --git a/lib/core/src/lib/services/people-content.service.ts b/lib/content-services/src/lib/common/services/people-content.service.ts similarity index 88% rename from lib/core/src/lib/services/people-content.service.ts rename to lib/content-services/src/lib/common/services/people-content.service.ts index 536452021e..21fc2256d5 100644 --- a/lib/core/src/lib/services/people-content.service.ts +++ b/lib/content-services/src/lib/common/services/people-content.service.ts @@ -17,12 +17,10 @@ import { Injectable } from '@angular/core'; import { Observable, from, throwError, of } from 'rxjs'; -import { AlfrescoApiService } from './alfresco-api.service'; +import { AuthenticationService, AlfrescoApiService, LogService } from '@alfresco/adf-core'; import { catchError, map, tap } from 'rxjs/operators'; import { PeopleApi, PersonBodyCreate, Pagination, PersonBodyUpdate } from '@alfresco/js-api'; import { EcmUserModel } from '../models/ecm-user.model'; -import { LogService } from '../common/services/log.service'; -import { AuthenticationService } from '../auth/services/authentication.service'; import { ContentService } from './content.service'; // eslint-disable-next-line no-shadow @@ -77,10 +75,10 @@ export class PeopleContentService { */ getPerson(personId: string): Observable { return from(this.peopleApi.getPerson(personId)) - .pipe( - map((personEntry) => new EcmUserModel(personEntry.entry)), - tap( user => this.currentUser = user), - catchError((error) => this.handleError(error))); + .pipe( + map((personEntry) => new EcmUserModel(personEntry.entry)), + tap(user => this.currentUser = user), + catchError((error) => this.handleError(error))); } getCurrentPerson(): Observable { @@ -99,11 +97,11 @@ export class PeopleContentService { return this.getPerson('-me-'); } - /** - * Used to know if the current user has the admin capability - * - * @returns true or false - */ + /** + * Used to know if the current user has the admin capability + * + * @returns true or false + */ isCurrentUserAdmin(): boolean { return this.currentUser?.isAdmin() ?? false; } @@ -122,7 +120,7 @@ export class PeopleContentService { * @returns Response containing pagination and list of entries */ listPeople(requestQuery?: PeopleContentQueryRequestModel): Observable { - const requestQueryParams = { skipCount: requestQuery?.skipCount, maxItems: requestQuery?.maxItems }; + const requestQueryParams = {skipCount: requestQuery?.skipCount, maxItems: requestQuery?.maxItems}; const orderBy = this.buildOrderArray(requestQuery?.sorting); if (orderBy.length) { requestQueryParams['orderBy'] = orderBy; @@ -173,7 +171,7 @@ export class PeopleContentService { * @param avatarId Target avatar * @returns Image URL */ - getUserProfileImage(avatarId: string): string { + getUserProfileImage(avatarId: string): string { return this.contentService.getContentUrl(avatarId); } diff --git a/lib/content-services/src/lib/viewer/services/rendition-viewer.service.ts b/lib/content-services/src/lib/common/services/rendition.service.ts similarity index 92% rename from lib/content-services/src/lib/viewer/services/rendition-viewer.service.ts rename to lib/content-services/src/lib/common/services/rendition.service.ts index a9b576c51d..0ccd2b183b 100644 --- a/lib/content-services/src/lib/viewer/services/rendition-viewer.service.ts +++ b/lib/content-services/src/lib/common/services/rendition.service.ts @@ -22,7 +22,7 @@ import { AlfrescoApiService , LogService, Track,TranslationService, ViewUtilServ @Injectable({ providedIn: 'root' }) -export class RenditionViewerService { +export class RenditionService { static TARGET = '_new'; @@ -82,8 +82,8 @@ export class RenditionViewerService { getRenditionUrl(nodeId: string, type: string, renditionExists: boolean): string { - return (renditionExists && type !== RenditionViewerService.ContentGroup.IMAGE) ? - this.contentApi.getRenditionUrl(nodeId, RenditionViewerService.ContentGroup.PDF) : + return (renditionExists && type !== RenditionService.ContentGroup.IMAGE) ? + this.contentApi.getRenditionUrl(nodeId, RenditionService.ContentGroup.PDF) : this.contentApi.getContentUrl(nodeId, false); } @@ -230,20 +230,20 @@ export class RenditionViewerService { } async generateMediaTracksRendition(nodeId: string): Promise { - return this.isRenditionAvailable(nodeId, RenditionViewerService.SUBTITLES_RENDITION_NAME) + return this.isRenditionAvailable(nodeId, RenditionService.SUBTITLES_RENDITION_NAME) .then((value) => { const tracks = []; if (value) { tracks.push({ kind: 'subtitles', - src: this.contentApi.getRenditionUrl(nodeId, RenditionViewerService.SUBTITLES_RENDITION_NAME), + src: this.contentApi.getRenditionUrl(nodeId, RenditionService.SUBTITLES_RENDITION_NAME), label: this.translateService.instant('ADF_VIEWER.SUBTITLES') }); } return tracks; }) .catch((err) => { - this.logService.error('Error while retrieving ' + RenditionViewerService.SUBTITLES_RENDITION_NAME + ' rendition'); + this.logService.error('Error while retrieving ' + RenditionService.SUBTITLES_RENDITION_NAME + ' rendition'); this.logService.error(err); return []; }); @@ -262,10 +262,10 @@ export class RenditionViewerService { * This URL should be one that can be rendered in the browser, for example PDF, Image, or Text */ printFile(url: string, type: string): void { - const pwa = window.open(url, RenditionViewerService.TARGET); + const pwa = window.open(url, RenditionService.TARGET); if (pwa) { // Because of the way chrome focus and close image window vs. pdf preview window - if (type === RenditionViewerService.ContentGroup.IMAGE) { + if (type === RenditionService.ContentGroup.IMAGE) { pwa.onfocus = () => { setTimeout(() => { pwa.close(); @@ -290,12 +290,12 @@ export class RenditionViewerService { const nodeId = objectId; const type: string = this.viewUtilsService.getViewerTypeByMimeType(mimeType); - this.getRendition(nodeId, RenditionViewerService.ContentGroup.PDF) + this.getRendition(nodeId, RenditionService.ContentGroup.PDF) .then((value) => { const url: string = this.getRenditionUrl(nodeId, type, (!!value)); - const printType = (type === RenditionViewerService.ContentGroup.PDF - || type === RenditionViewerService.ContentGroup.TEXT) - ? RenditionViewerService.ContentGroup.PDF : type; + const printType = (type === RenditionService.ContentGroup.PDF + || type === RenditionService.ContentGroup.TEXT) + ? RenditionService.ContentGroup.PDF : type; this.printFile(url, printType); }) .catch((err) => { diff --git a/lib/core/src/lib/services/upload.service.spec.ts b/lib/content-services/src/lib/common/services/upload.service.spec.ts similarity index 98% rename from lib/core/src/lib/services/upload.service.spec.ts rename to lib/content-services/src/lib/common/services/upload.service.spec.ts index 4da38cb8c0..a6ef44119c 100644 --- a/lib/core/src/lib/services/upload.service.spec.ts +++ b/lib/content-services/src/lib/common/services/upload.service.spec.ts @@ -17,17 +17,13 @@ import { EventEmitter } from '@angular/core'; import { TestBed } from '@angular/core/testing'; -import { FileModel, FileUploadStatus } from '../models/file.model'; -import { AppConfigModule } from '../app-config/app-config.module'; +import { AppConfigModule, AppConfigService, setupTestBed, CoreTestingModule } from '@alfresco/adf-core'; import { UploadService } from './upload.service'; -import { AppConfigService } from '../app-config/app-config.service'; - -import { setupTestBed } from '../testing/setup-test-bed'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { RepositoryInfo } from '@alfresco/js-api'; import { TranslateModule } from '@ngx-translate/core'; -import { DiscoveryApiService } from './discovery-api.service'; import { BehaviorSubject } from 'rxjs'; +import { DiscoveryApiService } from '../../common/services/discovery-api.service'; +import { FileModel, FileUploadStatus } from '../../common/models/file.model'; declare let jasmine: any; diff --git a/lib/core/src/lib/services/upload.service.ts b/lib/content-services/src/lib/common/services/upload.service.ts similarity index 96% rename from lib/core/src/lib/services/upload.service.ts rename to lib/content-services/src/lib/common/services/upload.service.ts index 492be8afe8..0d48ebe3ea 100644 --- a/lib/core/src/lib/services/upload.service.ts +++ b/lib/content-services/src/lib/common/services/upload.service.ts @@ -18,7 +18,6 @@ import { EventEmitter, Injectable } from '@angular/core'; import { Minimatch } from 'minimatch'; import { Subject } from 'rxjs'; -import { AppConfigService } from '../app-config/app-config.service'; import { FileUploadCompleteEvent, FileUploadDeleteEvent, @@ -26,9 +25,9 @@ import { FileUploadEvent } from '../events/file.event'; import { FileModel, FileUploadProgress, FileUploadStatus } from '../models/file.model'; -import { AlfrescoApiService } from './alfresco-api.service'; -import { DiscoveryApiService } from './discovery-api.service'; +import { AppConfigService, AlfrescoApiService } from '@alfresco/adf-core'; import { filter } from 'rxjs/operators'; +import { DiscoveryApiService } from '../../common/services/discovery-api.service'; import { NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api'; const MIN_CANCELLABLE_FILE_SIZE = 1000000; @@ -85,7 +84,7 @@ export class UploadService { private discoveryApiService: DiscoveryApiService) { this.discoveryApiService.ecmProductInfo$.pipe(filter(info => !!info)) - .subscribe(({ status }) => { + .subscribe(({status}) => { this.isThumbnailGenerationEnabled = status.isThumbnailGenerationEnabled; }); } @@ -238,7 +237,7 @@ export class UploadService { if (file.id) { return this.nodesApi.updateNodeContent(file.id, file.file as any, opts); } else { - const nodeBody = { ... file.options }; + const nodeBody = {...file.options}; delete nodeBody['versioningEnabled']; return this.uploadApi.uploadFile( @@ -275,13 +274,13 @@ export class UploadService { .on('abort', () => { this.onUploadAborted(file); if (successEmitter) { - successEmitter.emit({ value: 'File aborted' }); + successEmitter.emit({value: 'File aborted'}); } }) .on('error', (err) => { this.onUploadError(file, err); if (errorEmitter) { - errorEmitter.emit({ value: 'Error file uploaded' }); + errorEmitter.emit({value: 'Error file uploaded'}); } }) .on('success', (data) => { @@ -293,12 +292,12 @@ export class UploadService { this.deleteAbortedNodeVersion(data.entry.id, data.entry.properties['cm:versionLabel']); } if (successEmitter) { - successEmitter.emit({ value: 'File deleted' }); + successEmitter.emit({value: 'File deleted'}); } } else { this.onUploadComplete(file, data); if (successEmitter) { - successEmitter.emit({ value: data }); + successEmitter.emit({value: data}); } } }) @@ -416,7 +415,7 @@ export class UploadService { } private deleteAbortedNode(nodeId: string) { - this.nodesApi.deleteNode(nodeId, { permanent: true }) + this.nodesApi.deleteNode(nodeId, {permanent: true}) .then(() => (this.abortedFile = undefined)); } diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts index a7834ec858..454f21d9be 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts @@ -20,12 +20,13 @@ import { By } from '@angular/platform-browser'; import { Node } from '@alfresco/js-api'; import { ContentMetadataCardComponent } from './content-metadata-card.component'; import { ContentMetadataComponent } from '../content-metadata/content-metadata.component'; -import { setupTestBed, AllowableOperationsEnum } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { ContentTestingModule } from '../../../testing/content.testing.module'; import { SimpleChange } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; import { NodeAspectService } from '../../../aspect-list/services/node-aspect.service'; import { ContentMetadataService } from '../../services/content-metadata.service'; +import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum'; import { of } from 'rxjs'; describe('ContentMetadataCardComponent', () => { diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.ts index 40cb20c48f..c37e0f916c 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata-card/content-metadata-card.component.ts @@ -17,10 +17,12 @@ import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { Node } from '@alfresco/js-api'; -import { ContentService, AllowableOperationsEnum } from '@alfresco/adf-core'; import { NodeAspectService } from '../../../aspect-list/services/node-aspect.service'; import { PresetConfig } from '../../interfaces/content-metadata.interfaces'; import { VersionCompatibilityService } from '../../../version-compatibility/version-compatibility.service'; +import { ContentService } from '../../../common/services/content.service'; +import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum'; + @Component({ selector: 'adf-content-metadata-card', templateUrl: './content-metadata-card.component.html', diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts index d1ddcf0c49..3ee1ff9574 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts @@ -22,9 +22,10 @@ import { ClassesApi, MinimalNode, Node } from '@alfresco/js-api'; import { ContentMetadataComponent } from './content-metadata.component'; import { ContentMetadataService } from '../../services/content-metadata.service'; import { - CardViewBaseItemModel, CardViewComponent, NodesApiService, + CardViewBaseItemModel, CardViewComponent, LogService, setupTestBed, AppConfigService } from '@alfresco/adf-core'; +import { NodesApiService } from '../../../common/services/nodes-api.service'; import { throwError, of } from 'rxjs'; import { ContentTestingModule } from '../../../testing/content.testing.module'; import { mockGroupProperties } from './mock-data'; diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts index 6af9114d2e..a27bc44732 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts @@ -20,7 +20,6 @@ import { Node } from '@alfresco/js-api'; import { Observable, Subject, of, zip } from 'rxjs'; import { CardViewItem, - NodesApiService, LogService, TranslationService, AppConfigService, @@ -31,6 +30,7 @@ import { ContentMetadataService } from '../../services/content-metadata.service' import { CardViewGroup, PresetConfig } from '../../interfaces/content-metadata.interfaces'; import { takeUntil, debounceTime, catchError, map } from 'rxjs/operators'; import { CardViewContentUpdateService } from '../../../common/services/card-view-content-update.service'; +import { NodesApiService } from '../../../common/services/nodes-api.service'; const DEFAULT_SEPARATOR = ', '; diff --git a/lib/content-services/src/lib/content-node-selector/content-node-dialog.service.ts b/lib/content-services/src/lib/content-node-selector/content-node-dialog.service.ts index 29024f425f..1c3ee39d24 100644 --- a/lib/content-services/src/lib/content-node-selector/content-node-dialog.service.ts +++ b/lib/content-services/src/lib/content-node-selector/content-node-dialog.service.ts @@ -17,9 +17,11 @@ import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { EventEmitter, Injectable, Output } from '@angular/core'; -import { ContentService, ThumbnailService, TranslationService, AllowableOperationsEnum } from '@alfresco/adf-core'; +import { ThumbnailService, TranslationService } from '@alfresco/adf-core'; import { Subject, Observable, throwError } from 'rxjs'; import { ShareDataRow } from '../document-list/data/share-data-row.model'; +import { AllowableOperationsEnum } from '../common/models/allowable-operations.enum'; +import { ContentService } from '../common/services/content.service'; import { Node, NodeEntry, SitePaging } from '@alfresco/js-api'; import { DocumentListService } from '../document-list/services/document-list.service'; import { ContentNodeSelectorComponent } from './content-node-selector.component'; diff --git a/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component-search.spec.ts b/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component-search.spec.ts index faec1ddebd..83eeab6474 100644 --- a/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component-search.spec.ts +++ b/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component-search.spec.ts @@ -28,7 +28,7 @@ import { SiteEntry, SitePaging } from '@alfresco/js-api'; -import { NodesApiService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { of } from 'rxjs'; import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component'; import { ContentTestingModule } from '../testing/content.testing.module'; @@ -40,6 +40,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { SearchQueryBuilderService } from '../search'; import { mockQueryBody } from '../mock/search-query.mock'; import { SitesService } from '../common/services/sites.service'; +import { NodesApiService } from '../common/services/nodes-api.service'; const fakeResultSetPaging: ResultSetPaging = { list: { diff --git a/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.spec.ts b/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.spec.ts index 6144b6dc47..1d43e97037 100644 --- a/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.spec.ts +++ b/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.spec.ts @@ -30,17 +30,17 @@ import { } from '@alfresco/js-api'; import { AppConfigService, - FileModel, - FileUploadStatus, - NodesApiService, setupTestBed, - UploadService, - FileUploadCompleteEvent, DataRow, ThumbnailService, - ContentService, DataColumn } from '@alfresco/adf-core'; +import { ContentService } from '../common/services/content.service'; +import { UploadService } from '../common/services/upload.service'; +import { NodesApiService } from '../common/services/nodes-api.service'; +import { FileModel, FileUploadStatus } from '../common/models/file.model'; +import { FileUploadCompleteEvent } from '../common/events/file.event'; + import { of, throwError } from 'rxjs'; import { DropdownBreadcrumbComponent } from '../breadcrumb'; import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component'; diff --git a/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts b/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts index 79e755ba55..41b6ac2c99 100644 --- a/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts +++ b/lib/content-services/src/lib/content-node-selector/content-node-selector-panel.component.ts @@ -31,14 +31,13 @@ import { UserPreferencesService, UserPreferenceValues, InfinitePaginationComponent, PaginatedComponent, - NodesApiService, - UploadService, - FileUploadCompleteEvent, - FileUploadDeleteEvent, AppConfigService, DataSorting, ShowHeaderMode } from '@alfresco/adf-core'; +import { NodesApiService } from '../common/services/nodes-api.service'; +import { UploadService } from '../common/services/upload.service'; +import { FileUploadCompleteEvent, FileUploadDeleteEvent } from '../common/events/file.event'; import { UntypedFormControl } from '@angular/forms'; import { Node, NodePaging, Pagination, SiteEntry, SitePaging, NodeEntry, QueryBody, RequestScope } from '@alfresco/js-api'; import { DocumentListComponent } from '../document-list/components/document-list.component'; diff --git a/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts b/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts index 4bc76362ea..bc1844cca7 100644 --- a/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts +++ b/lib/content-services/src/lib/content-node-selector/content-node-selector.component.spec.ts @@ -21,7 +21,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ContentNodeSelectorComponent } from './content-node-selector.component'; import { Node, NodeEntry, SitePaging } from '@alfresco/js-api'; import { By } from '@angular/platform-browser'; -import { ContentService, UploadService, FileModel, FileUploadEvent } from '@alfresco/adf-core'; +import { FileModel } from '../common/models/file.model'; +import { FileUploadEvent } from '../common/events/file.event'; +import { UploadService } from '../common/services/upload.service'; + import { of } from 'rxjs'; import { ContentTestingModule } from '../testing/content.testing.module'; import { DocumentListService } from '../document-list/services/document-list.service'; @@ -31,6 +34,8 @@ import { UploadModule } from '../upload'; import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component'; import { NodeAction } from '../document-list/models/node-action.enum'; import { SitesService } from '../common/services/sites.service'; +import { NodesApiService } from '../common/services/nodes-api.service'; +import { ContentService } from '../common/services/content.service'; describe('ContentNodeSelectorComponent', () => { let component: ContentNodeSelectorComponent; @@ -103,7 +108,8 @@ describe('ContentNodeSelectorComponent', () => { } }); - spyOn(contentService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission)); + const nodesApiService = TestBed.inject(NodesApiService); + spyOn(nodesApiService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission.entry)); component.data.showLocalUploadButton = true; component.hasAllowableOperations = true; diff --git a/lib/content-services/src/lib/content-node-selector/content-node-selector.component.ts b/lib/content-services/src/lib/content-node-selector/content-node-selector.component.ts index cf265f754f..6b01df66b3 100644 --- a/lib/content-services/src/lib/content-node-selector/content-node-selector.component.ts +++ b/lib/content-services/src/lib/content-node-selector/content-node-selector.component.ts @@ -17,9 +17,11 @@ import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { TranslationService, NotificationService, AllowableOperationsEnum, ContentService, UploadService } from '@alfresco/adf-core'; +import { TranslationService, NotificationService} from '@alfresco/adf-core'; import { Node } from '@alfresco/js-api'; - +import { AllowableOperationsEnum } from '../common/models/allowable-operations.enum'; +import { ContentService } from '../common/services/content.service'; +import { UploadService } from '../common/services/upload.service'; import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface'; import { NodeEntryEvent } from '../document-list/components/node.event'; import { NodeAction } from '../document-list/models/node-action.enum'; diff --git a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.spec.ts b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.spec.ts index 4dfd088992..c10cc6c07c 100644 --- a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.spec.ts +++ b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.spec.ts @@ -17,14 +17,15 @@ import { TestBed, fakeAsync, ComponentFixture, tick } from '@angular/core/testing'; import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog'; -import { of, empty } from 'rxjs'; +import { of } from 'rxjs'; import { setupTestBed, - NodesApiService, NotificationService, - RenditionsService, AppConfigService } from '@alfresco/adf-core'; +import { NodesApiService } from '../common/services/nodes-api.service'; +import { RenditionService } from '../common/services/rendition.service'; + import { SharedLinksApiService } from './services/shared-links-api.service'; import { ShareDialogComponent } from './content-node-share.dialog'; import moment from 'moment'; @@ -38,7 +39,7 @@ describe('ShareDialogComponent', () => { openSnackMessage: jasmine.createSpy('openSnackMessage') }; let sharedLinksApiService: SharedLinksApiService; - let renditionService: RenditionsService; + let renditionService: RenditionService; let nodesApiService: NodesApiService; let fixture: ComponentFixture; let component: ShareDialogComponent; @@ -50,9 +51,14 @@ describe('ShareDialogComponent', () => { ContentTestingModule ], providers: [ - { provide: NotificationService, useValue: notificationServiceMock }, - { provide: MatDialogRef, useValue: { close: () => {}} }, - { provide: MAT_DIALOG_DATA, useValue: {} } + {provide: NotificationService, useValue: notificationServiceMock}, + { + provide: MatDialogRef, useValue: { + close: () => { + } + } + }, + {provide: MAT_DIALOG_DATA, useValue: {}} ] }); @@ -63,7 +69,7 @@ describe('ShareDialogComponent', () => { matDialog = TestBed.inject(MatDialog); sharedLinksApiService = TestBed.inject(SharedLinksApiService); - renditionService = TestBed.inject(RenditionsService); + renditionService = TestBed.inject(RenditionService); nodesApiService = TestBed.inject(NodesApiService); appConfigService = TestBed.inject(AppConfigService); @@ -117,9 +123,9 @@ describe('ShareDialogComponent', () => { it(`should toggle share action when property 'sharedId' does not exists`, () => { spyOn(sharedLinksApiService, 'createSharedLinks').and.returnValue(of({ - entry: { id: 'sharedId', sharedId: 'sharedId' } + entry: {id: 'sharedId', sharedId: 'sharedId'} })); - spyOn(renditionService, 'generateRenditionForNode').and.returnValue(empty()); + spyOn(renditionService, 'getNodeRendition').and.returnValue(Promise.resolve({url: '', mimeType: ''})); component.data = { node, @@ -129,16 +135,16 @@ describe('ShareDialogComponent', () => { fixture.detectChanges(); expect(sharedLinksApiService.createSharedLinks).toHaveBeenCalled(); - expect(renditionService.generateRenditionForNode).toHaveBeenCalled(); + expect(renditionService.getNodeRendition).toHaveBeenCalled(); expect(fixture.nativeElement.querySelector('input[formcontrolname="sharedUrl"]').value).toBe('some-url/sharedId'); expect(fixture.nativeElement.querySelector('.mat-slide-toggle').classList).toContain('mat-checked'); }); it(`should not toggle share action when file has 'sharedId' property`, async () => { spyOn(sharedLinksApiService, 'createSharedLinks').and.returnValue(of({ - entry: { id: 'sharedId', sharedId: 'sharedId' } + entry: {id: 'sharedId', sharedId: 'sharedId'} })); - spyOn(renditionService, 'generateRenditionForNode').and.returnValue(empty()); + spyOn(renditionService, 'getNodeRendition').and.returnValue(Promise.resolve({url: '', mimeType: ''})); node.entry.properties['qshare:sharedId'] = 'sharedId'; @@ -158,7 +164,7 @@ describe('ShareDialogComponent', () => { }); it('should open a confirmation dialog when unshare button is triggered', () => { - spyOn(matDialog, 'open').and.returnValue({ beforeClosed: () => of(false) } as any); + spyOn(matDialog, 'open').and.returnValue({beforeClosed: () => of(false)} as any); spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough(); node.entry.properties['qshare:sharedId'] = 'sharedId'; @@ -179,7 +185,7 @@ describe('ShareDialogComponent', () => { }); it('should unshare file when confirmation dialog returns true', fakeAsync(() => { - spyOn(matDialog, 'open').and.returnValue({ beforeClosed: () => of(true) } as any); + spyOn(matDialog, 'open').and.returnValue({beforeClosed: () => of(true)} as any); spyOn(sharedLinksApiService, 'deleteSharedLink').and.returnValue(of({})); node.entry.properties['qshare:sharedId'] = 'sharedId'; @@ -199,7 +205,7 @@ describe('ShareDialogComponent', () => { })); it('should not unshare file when confirmation dialog returns false', fakeAsync(() => { - spyOn(matDialog, 'open').and.returnValue({ beforeClosed: () => of(false) } as any); + spyOn(matDialog, 'open').and.returnValue({beforeClosed: () => of(false)} as any); spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough(); node.entry.properties['qshare:sharedId'] = 'sharedId'; @@ -258,7 +264,7 @@ describe('ShareDialogComponent', () => { await fixture.whenStable(); expect(nodesApiService.updateNode).toHaveBeenCalledWith('nodeId', { - properties: { 'qshare:expiryDate': null } + properties: {'qshare:expiryDate': null} }); expect( @@ -297,10 +303,10 @@ describe('ShareDialogComponent', () => { fixture.detectChanges(); fixture.nativeElement - .querySelector( - 'mat-slide-toggle[data-automation-id="adf-expire-toggle"] label' - ) - .dispatchEvent(new MouseEvent('click')); + .querySelector( + 'mat-slide-toggle[data-automation-id="adf-expire-toggle"] label' + ) + .dispatchEvent(new MouseEvent('click')); fixture.componentInstance.form.controls['time'].setValue(date); fixture.detectChanges(); @@ -308,7 +314,7 @@ describe('ShareDialogComponent', () => { tick(100); expect(nodesApiService.updateNode).toHaveBeenCalledWith('nodeId', { - properties: { 'qshare:expiryDate': date.utc().format() } + properties: {'qshare:expiryDate': date.utc().format()} }); })); @@ -336,7 +342,7 @@ describe('ShareDialogComponent', () => { tick(500); expect(nodesApiService.updateNode).toHaveBeenCalledWith('nodeId', { - properties: { 'qshare:expiryDate': date.endOf('day').utc().format() } + properties: {'qshare:expiryDate': date.endOf('day').utc().format()} }); })); @@ -354,7 +360,7 @@ describe('ShareDialogComponent', () => { tick(100); expect(nodesApiService.updateNode).toHaveBeenCalledWith('nodeId', { - properties: { 'qshare:expiryDate': date.utc().format() } + properties: {'qshare:expiryDate': date.utc().format()} }); })); }); diff --git a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.ts b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.ts index 2f82793bf5..9be2ef65ab 100644 --- a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.ts +++ b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.ts @@ -28,17 +28,18 @@ import { MatSlideToggleChange } from '@angular/material/slide-toggle'; import { UntypedFormGroup, UntypedFormControl, AbstractControl } from '@angular/forms'; import { Observable, Subject } from 'rxjs'; import { - NodesApiService, - ContentService, - RenditionsService, AppConfigService } from '@alfresco/adf-core'; +import { NodesApiService } from '../common/services/nodes-api.service'; +import { ContentService } from '../common/services/content.service'; + import { SharedLinksApiService } from './services/shared-links-api.service'; import { SharedLinkEntry, Node } from '@alfresco/js-api'; import { ConfirmDialogComponent } from '../dialogs/confirm.dialog'; import moment from 'moment'; import { ContentNodeShareSettings } from './content-node-share.settings'; import { takeUntil, debounceTime } from 'rxjs/operators'; +import { RenditionService } from '../common/services/rendition.service'; type DatePickerType = 'date' | 'time' | 'month' | 'datetime'; @@ -46,7 +47,7 @@ type DatePickerType = 'date' | 'time' | 'month' | 'datetime'; selector: 'adf-share-dialog', templateUrl: './content-node-share.dialog.html', styleUrls: ['./content-node-share.dialog.scss'], - host: { class: 'adf-share-dialog' }, + host: {class: 'adf-share-dialog'}, encapsulation: ViewEncapsulation.None }) export class ShareDialogComponent implements OnInit, OnDestroy { @@ -59,15 +60,15 @@ export class ShareDialogComponent implements OnInit, OnDestroy { isDisabled: boolean = false; form: UntypedFormGroup = new UntypedFormGroup({ sharedUrl: new UntypedFormControl(''), - time: new UntypedFormControl({ value: '', disabled: true }) + time: new UntypedFormControl({value: '', disabled: true}) }); type: DatePickerType = 'datetime'; maxDebounceTime = 500; - @ViewChild('slideToggleExpirationDate', { static: true }) + @ViewChild('slideToggleExpirationDate', {static: true}) slideToggleExpirationDate; - @ViewChild('dateTimePickerInput', { static: true }) + @ViewChild('dateTimePickerInput', {static: true}) dateTimePickerInput; private onDestroy$ = new Subject(); @@ -79,9 +80,10 @@ export class ShareDialogComponent implements OnInit, OnDestroy { private dialog: MatDialog, private nodesApiService: NodesApiService, private contentService: ContentService, - private renditionService: RenditionsService, + private renditionService: RenditionService, @Inject(MAT_DIALOG_DATA) public data: ContentNodeShareSettings - ) {} + ) { + } ngOnInit() { this.type = this.appConfigService.get('sharedLinkDateTimePickerType', 'datetime'); @@ -133,7 +135,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy { } get canUpdate() { - const { entry } = this.data.node; + const {entry} = this.data.node; if (entry && entry.allowableOperations) { return this.contentService.hasAllowableOperations(entry, 'update'); @@ -199,9 +201,9 @@ export class ShareDialogComponent implements OnInit, OnDestroy { } this.isDisabled = false; this.isFileShared = true; - this.renditionService - .generateRenditionForNode(this.data.node.entry.id) - .subscribe(() => {}); + + // eslint-disable-next-line + this.renditionService.getNodeRendition(this.data.node.entry.id); this.updateForm(); } @@ -219,19 +221,19 @@ export class ShareDialogComponent implements OnInit, OnDestroy { this.sharedLinksApiService .deleteSharedLink(sharedId) .subscribe((response: any) => { - if (response instanceof Error) { - this.isDisabled = false; - this.isFileShared = true; - this.handleError(response); - } else { - if (this.data.node.entry.properties) { - this.data.node.entry.properties['qshare:sharedId'] = null; - this.data.node.entry.properties['qshare:expiryDate'] = null; + if (response instanceof Error) { + this.isDisabled = false; + this.isFileShared = true; + this.handleError(response); + } else { + if (this.data.node.entry.properties) { + this.data.node.entry.properties['qshare:sharedId'] = null; + this.data.node.entry.properties['qshare:expiryDate'] = null; + } + this.dialogRef.close(false); } - this.dialogRef.close(false); } - } - ); + ); } private handleError(error: Error) { @@ -240,7 +242,8 @@ export class ShareDialogComponent implements OnInit, OnDestroy { try { statusCode = JSON.parse(error.message).error.statusCode; - } catch {} + } catch { + } if (statusCode === 403) { message = 'SHARE.UNSHARE_PERMISSION_ERROR'; @@ -253,7 +256,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy { } private updateForm() { - const { entry } = this.data.node; + const {entry} = this.data.node; let expiryDate = null; if (entry && entry.properties) { @@ -285,7 +288,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy { } private updateEntryExpiryDate(date: moment.Moment) { - const { properties } = this.data.node.entry; + const {properties} = this.data.node.entry; if (properties) { properties['qshare:expiryDate'] = date diff --git a/lib/content-services/src/lib/content-user-info/content-user-info.component.spec.ts b/lib/content-services/src/lib/content-user-info/content-user-info.component.spec.ts index 39a3282e63..969aaa9107 100644 --- a/lib/content-services/src/lib/content-user-info/content-user-info.component.spec.ts +++ b/lib/content-services/src/lib/content-user-info/content-user-info.component.spec.ts @@ -17,9 +17,6 @@ import { CoreTestingModule, - fakeEcmEditedUser, - fakeEcmUser, - fakeEcmUserNoImage, IdentityUserModel, InitialUsernamePipe, setupTestBed, @@ -29,6 +26,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatMenuModule } from '@angular/material/menu'; import { By, DomSanitizer } from '@angular/platform-browser'; import { TranslateModule } from '@ngx-translate/core'; +import { fakeEcmEditedUser, fakeEcmUser, fakeEcmUserNoImage } from '../common/mocks/ecm-user.service.mock'; import { ContentTestingModule } from '../testing/content.testing.module'; import { ContentUserInfoComponent } from './content-user-info.component'; @@ -238,7 +236,6 @@ describe('ContentUserInfoComponent', () => { fixture.detectChanges(); const pipe = new InitialUsernamePipe(new FakeSanitizer()); const expected = pipe.transform({ - id: 13, firstName: 'Wilbur', lastName: 'Adams', email: 'wilbur@app.com' diff --git a/lib/content-services/src/lib/content-user-info/content-user-info.component.ts b/lib/content-services/src/lib/content-user-info/content-user-info.component.ts index e738a65c78..1ec5f6825a 100644 --- a/lib/content-services/src/lib/content-user-info/content-user-info.component.ts +++ b/lib/content-services/src/lib/content-user-info/content-user-info.component.ts @@ -15,10 +15,12 @@ * limitations under the License. */ -import { EcmUserModel, IdentityUserModel, PeopleContentService, UserInfoMode } from '@alfresco/adf-core'; +import { IdentityUserModel, UserInfoMode } from '@alfresco/adf-core'; import { Component, Input, OnDestroy, ViewChild, ViewEncapsulation } from '@angular/core'; import { MatMenuTrigger, MenuPositionX, MenuPositionY } from '@angular/material/menu'; import { Subject } from 'rxjs'; +import { EcmUserModel } from '../common/models/ecm-user.model'; +import { PeopleContentService } from '../common/services/people-content.service'; @Component({ selector: 'adf-content-user-info', diff --git a/lib/content-services/src/lib/dialogs/dialog.module.ts b/lib/content-services/src/lib/dialogs/dialog.module.ts index 0c02adf5f0..420c306147 100644 --- a/lib/content-services/src/lib/dialogs/dialog.module.ts +++ b/lib/content-services/src/lib/dialogs/dialog.module.ts @@ -28,6 +28,7 @@ import { MatDatetimepickerModule } from '@mat-datetimepicker/core'; import { MatMomentDatetimeModule } from '@mat-datetimepicker/moment'; import { LibraryDialogComponent } from './library/library.dialog'; import { ContentDirectiveModule } from '../directives'; +import { DownloadZipDialogModule } from './download-zip/download-zip.dialog.module'; @NgModule({ imports: [ @@ -38,7 +39,8 @@ import { ContentDirectiveModule } from '../directives'; ReactiveFormsModule, MatMomentDatetimeModule, MatDatetimepickerModule, - ContentDirectiveModule + ContentDirectiveModule, + DownloadZipDialogModule ], declarations: [ FolderDialogComponent, diff --git a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.html b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.html similarity index 100% rename from lib/core/src/lib/dialogs/download-zip/download-zip.dialog.html rename to lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.html diff --git a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.module.ts b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.module.ts similarity index 96% rename from lib/core/src/lib/dialogs/download-zip/download-zip.dialog.module.ts rename to lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.module.ts index 9878306d79..5ea282d1fe 100644 --- a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.module.ts +++ b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.module.ts @@ -17,7 +17,7 @@ import { NgModule } from '@angular/core'; import { DownloadZipDialogComponent } from './download-zip.dialog'; -import { PipeModule } from '../../pipes/pipe.module'; +import { PipeModule } from '@alfresco/adf-core'; import { MatDialogModule } from '@angular/material/dialog'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatButtonModule } from '@angular/material/button'; diff --git a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.scss b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.scss similarity index 100% rename from lib/core/src/lib/dialogs/download-zip/download-zip.dialog.scss rename to lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.scss diff --git a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.spec.ts b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.spec.ts similarity index 96% rename from lib/core/src/lib/dialogs/download-zip/download-zip.dialog.spec.ts rename to lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.spec.ts index 9e340ce314..0faa885513 100755 --- a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.spec.ts +++ b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.spec.ts @@ -18,9 +18,8 @@ import { TestBed, ComponentFixture } from '@angular/core/testing'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { DownloadZipDialogComponent } from './download-zip.dialog'; -import { setupTestBed } from '../../testing/setup-test-bed'; -import { CoreTestingModule } from '../../testing/core.testing.module'; -import { DownloadZipService } from '../../services/download-zip.service'; +import { CoreTestingModule, setupTestBed } from '@alfresco/adf-core'; +import { DownloadZipService } from './services/download-zip.service'; import { Observable } from 'rxjs'; import { TranslateModule } from '@ngx-translate/core'; diff --git a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.stories.component.ts b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.stories.component.ts similarity index 95% rename from lib/core/src/lib/dialogs/download-zip/download-zip.dialog.stories.component.ts rename to lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.stories.component.ts index 163cf24893..c33c4ff318 100644 --- a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.stories.component.ts +++ b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.stories.component.ts @@ -18,7 +18,7 @@ import { Component, Input, OnInit, OnChanges } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { DownloadZipDialogComponent } from './download-zip.dialog'; -import { zipNode, downloadEntry } from '../../mock/download-zip-data.mock'; +import { zipNode, downloadEntry } from './mock/download-zip-data.mock'; @Component({ selector: 'adf-download-zip-dialog-storybook', diff --git a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.stories.ts b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.stories.ts similarity index 88% rename from lib/core/src/lib/dialogs/download-zip/download-zip.dialog.stories.ts rename to lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.stories.ts index 19b939910d..d228d740a3 100644 --- a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.stories.ts +++ b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.stories.ts @@ -16,22 +16,19 @@ */ import { Meta, moduleMetadata, Story } from '@storybook/angular'; -import { CoreStoryModule } from '../../testing/core.story.module'; +import { AlfrescoApiService } from '@alfresco/adf-core'; import { MatButtonModule } from '@angular/material/button'; -import { - AlfrescoApiService, - ContentService, - DownloadZipService, - NodesApiService -} from '../../services'; import { DownloadZipDialogStorybookComponent } from './download-zip.dialog.stories.component'; import { AlfrescoApiServiceMock, ContentApiMock, DownloadZipMockService, NodesApiMock -} from '../../mock/download-zip-service.mock'; +} from './mock/download-zip-service.mock'; import { DownloadZipDialogModule } from './download-zip.dialog.module'; +import { DownloadZipService } from './services/download-zip.service'; +import { ContentService } from '../../common/services/content.service'; +import { NodesApiService } from '../../common/services/nodes-api.service'; export default { component: DownloadZipDialogStorybookComponent, @@ -39,7 +36,6 @@ export default { decorators: [ moduleMetadata({ imports: [ - CoreStoryModule, DownloadZipDialogModule, MatButtonModule ], diff --git a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.ts b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.ts similarity index 93% rename from lib/core/src/lib/dialogs/download-zip/download-zip.dialog.ts rename to lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.ts index 0644faf319..72b2e347da 100755 --- a/lib/core/src/lib/dialogs/download-zip/download-zip.dialog.ts +++ b/lib/content-services/src/lib/dialogs/download-zip/download-zip.dialog.ts @@ -18,10 +18,10 @@ import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { DownloadEntry, MinimalNode } from '@alfresco/js-api'; -import { LogService } from '../../common/services/log.service'; -import { DownloadZipService } from '../../services/download-zip.service'; -import { ContentService } from '../../services/content.service'; -import { NodesApiService } from '../../services/nodes-api.service'; +import { LogService } from '@alfresco/adf-core'; +import { NodesApiService } from '../../common/services/nodes-api.service'; +import { DownloadZipService } from './services/download-zip.service'; +import { ContentService } from '../../common/services/content.service'; @Component({ selector: 'adf-download-zip-dialog', diff --git a/lib/core/src/lib/mock/download-zip-data.mock.ts b/lib/content-services/src/lib/dialogs/download-zip/mock/download-zip-data.mock.ts similarity index 100% rename from lib/core/src/lib/mock/download-zip-data.mock.ts rename to lib/content-services/src/lib/dialogs/download-zip/mock/download-zip-data.mock.ts diff --git a/lib/core/src/lib/mock/download-zip-service.mock.ts b/lib/content-services/src/lib/dialogs/download-zip/mock/download-zip-service.mock.ts similarity index 100% rename from lib/core/src/lib/mock/download-zip-service.mock.ts rename to lib/content-services/src/lib/dialogs/download-zip/mock/download-zip-service.mock.ts diff --git a/lib/core/src/lib/services/download-zip.service.ts b/lib/content-services/src/lib/dialogs/download-zip/services/download-zip.service.ts similarity index 95% rename from lib/core/src/lib/services/download-zip.service.ts rename to lib/content-services/src/lib/dialogs/download-zip/services/download-zip.service.ts index 3524d738b0..d850f1aca3 100755 --- a/lib/core/src/lib/services/download-zip.service.ts +++ b/lib/content-services/src/lib/dialogs/download-zip/services/download-zip.service.ts @@ -18,8 +18,7 @@ import { DownloadEntry, DownloadBodyCreate, DownloadsApi } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; import { Observable, from, throwError } from 'rxjs'; -import { LogService } from '../common/services/log.service'; -import { AlfrescoApiService } from './alfresco-api.service'; +import { AlfrescoApiService, LogService } from '@alfresco/adf-core'; import { catchError } from 'rxjs/operators'; @Injectable({ diff --git a/lib/content-services/src/lib/dialogs/folder.dialog.spec.ts b/lib/content-services/src/lib/dialogs/folder.dialog.spec.ts index 7fb5e0ccd4..c0f104ea95 100644 --- a/lib/content-services/src/lib/dialogs/folder.dialog.spec.ts +++ b/lib/content-services/src/lib/dialogs/folder.dialog.spec.ts @@ -17,7 +17,9 @@ import { TestBed, ComponentFixture } from '@angular/core/testing'; import { MatDialogRef } from '@angular/material/dialog'; -import { NodesApiService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; +import { NodesApiService } from '../common/services/nodes-api.service'; + import { FolderDialogComponent } from './folder.dialog'; import { of, throwError } from 'rxjs'; import { ContentTestingModule } from '../testing/content.testing.module'; diff --git a/lib/content-services/src/lib/dialogs/folder.dialog.ts b/lib/content-services/src/lib/dialogs/folder.dialog.ts index 4c0856ac45..ab5e902112 100644 --- a/lib/content-services/src/lib/dialogs/folder.dialog.ts +++ b/lib/content-services/src/lib/dialogs/folder.dialog.ts @@ -22,7 +22,8 @@ import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { Node } from '@alfresco/js-api'; -import { NodesApiService, TranslationService } from '@alfresco/adf-core'; +import { TranslationService } from '@alfresco/adf-core'; +import { NodesApiService } from '../common/services/nodes-api.service'; import { forbidEndingDot, forbidOnlySpaces, forbidSpecialCharacters } from './folder-name.validators'; diff --git a/lib/content-services/src/lib/dialogs/public-api.ts b/lib/content-services/src/lib/dialogs/public-api.ts index 511c13d975..bfe00981de 100644 --- a/lib/content-services/src/lib/dialogs/public-api.ts +++ b/lib/content-services/src/lib/dialogs/public-api.ts @@ -22,4 +22,8 @@ export * from './confirm.dialog'; export * from './dialog.module'; export * from './library/library.dialog'; +export * from './download-zip/download-zip.dialog'; +export * from './download-zip/download-zip.dialog.module'; + + export * from './folder-name.validators'; diff --git a/lib/content-services/src/lib/directives/check-allowable-operation.directive.spec.ts b/lib/content-services/src/lib/directives/check-allowable-operation.directive.spec.ts index a6f3a8094f..599c169eb8 100644 --- a/lib/content-services/src/lib/directives/check-allowable-operation.directive.spec.ts +++ b/lib/content-services/src/lib/directives/check-allowable-operation.directive.spec.ts @@ -16,7 +16,8 @@ */ import { ChangeDetectorRef, Component, ElementRef, SimpleChange } from '@angular/core'; -import { ContentService, CoreTestingModule, setupTestBed } from '@alfresco/adf-core'; +import { CoreTestingModule, setupTestBed } from '@alfresco/adf-core'; +import { ContentService } from '../common/services/content.service'; import { CheckAllowableOperationDirective } from './check-allowable-operation.directive'; import { TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; diff --git a/lib/content-services/src/lib/directives/check-allowable-operation.directive.ts b/lib/content-services/src/lib/directives/check-allowable-operation.directive.ts index 9f5dab7efc..af04ae3a6c 100644 --- a/lib/content-services/src/lib/directives/check-allowable-operation.directive.ts +++ b/lib/content-services/src/lib/directives/check-allowable-operation.directive.ts @@ -19,7 +19,8 @@ import { ChangeDetectorRef, Directive, ElementRef, Host, Inject, Input, OnChanges, Optional, Renderer2, SimpleChanges } from '@angular/core'; import { NodeEntry } from '@alfresco/js-api'; -import { ContentService, EXTENDIBLE_COMPONENT } from '@alfresco/adf-core'; +import { EXTENDIBLE_COMPONENT } from '@alfresco/adf-core'; +import { ContentService } from '../common/services/content.service'; import { NodeAllowableOperationSubject } from '../interfaces/node-allowable-operation-subject.interface'; @Directive({ diff --git a/lib/content-services/src/lib/directives/content-directive.module.ts b/lib/content-services/src/lib/directives/content-directive.module.ts index d00f291389..7fb08499c7 100644 --- a/lib/content-services/src/lib/directives/content-directive.module.ts +++ b/lib/content-services/src/lib/directives/content-directive.module.ts @@ -29,6 +29,7 @@ import { LibraryMembershipDirective } from './library-membership.directive'; import { NodeDeleteDirective } from './node-delete.directive'; import { NodeFavoriteDirective } from './node-favorite.directive'; import { NodeRestoreDirective } from './node-restore.directive'; +import { NodeDownloadDirective } from './node-download.directive'; @NgModule({ imports: [ @@ -46,7 +47,8 @@ import { NodeRestoreDirective } from './node-restore.directive'; LibraryMembershipDirective, NodeDeleteDirective, NodeFavoriteDirective, - NodeRestoreDirective + NodeRestoreDirective, + NodeDownloadDirective ], exports: [ NodeLockDirective, @@ -57,7 +59,8 @@ import { NodeRestoreDirective } from './node-restore.directive'; LibraryMembershipDirective, NodeDeleteDirective, NodeFavoriteDirective, - NodeRestoreDirective + NodeRestoreDirective, + NodeDownloadDirective ] }) export class ContentDirectiveModule { diff --git a/lib/core/src/lib/directives/node-download.directive.spec.ts b/lib/content-services/src/lib/directives/node-download.directive.spec.ts similarity index 96% rename from lib/core/src/lib/directives/node-download.directive.spec.ts rename to lib/content-services/src/lib/directives/node-download.directive.spec.ts index 3b8d008c39..cd3bb495f2 100755 --- a/lib/core/src/lib/directives/node-download.directive.spec.ts +++ b/lib/content-services/src/lib/directives/node-download.directive.spec.ts @@ -19,11 +19,10 @@ import { TestBed, ComponentFixture } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { MatDialog } from '@angular/material/dialog'; import { Component, DebugElement, ViewChild } from '@angular/core'; -import { setupTestBed } from '../testing/setup-test-bed'; -import { AlfrescoApiService } from '../services/alfresco-api.service'; +import { setupTestBed, AlfrescoApiService, CoreTestingModule } from '@alfresco/adf-core'; import { NodeDownloadDirective } from './node-download.directive'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { ContentDirectiveModule } from '@alfresco/adf-content-services'; @Component({ template: '
' @@ -54,6 +53,7 @@ describe('NodeDownloadDirective', () => { setupTestBed({ imports: [ + ContentDirectiveModule, TranslateModule.forRoot(), CoreTestingModule ], diff --git a/lib/core/src/lib/directives/node-download.directive.ts b/lib/content-services/src/lib/directives/node-download.directive.ts similarity index 96% rename from lib/core/src/lib/directives/node-download.directive.ts rename to lib/content-services/src/lib/directives/node-download.directive.ts index 981fef5508..c6bf9de894 100755 --- a/lib/core/src/lib/directives/node-download.directive.ts +++ b/lib/content-services/src/lib/directives/node-download.directive.ts @@ -17,10 +17,9 @@ import { Directive, Input, HostListener } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; -import { AlfrescoApiService } from '../services/alfresco-api.service'; +import { AlfrescoApiService, DownloadService } from '@alfresco/adf-core'; import { DownloadZipDialogComponent } from '../dialogs/download-zip/download-zip.dialog'; import { ContentApi, NodeEntry, VersionEntry } from '@alfresco/js-api'; -import { DownloadService } from '../services/download.service'; /** * Directive selectors without adf- prefix will be deprecated on 3.0.0 diff --git a/lib/content-services/src/lib/directives/node-lock.directive.ts b/lib/content-services/src/lib/directives/node-lock.directive.ts index 74af59f895..c9384827fc 100644 --- a/lib/content-services/src/lib/directives/node-lock.directive.ts +++ b/lib/content-services/src/lib/directives/node-lock.directive.ts @@ -19,7 +19,8 @@ import { Directive, ElementRef, Renderer2, HostListener, Input, AfterViewInit } from '@angular/core'; import { Node } from '@alfresco/js-api'; -import { AllowableOperationsEnum, ContentService } from '@alfresco/adf-core'; +import { ContentService } from '../common/services/content.service'; +import { AllowableOperationsEnum } from '../common/models/allowable-operations.enum'; import { ContentNodeDialogService } from '../content-node-selector/content-node-dialog.service'; @Directive({ diff --git a/lib/content-services/src/lib/directives/public-api.ts b/lib/content-services/src/lib/directives/public-api.ts index 983e584274..f58d5f7a7f 100644 --- a/lib/content-services/src/lib/directives/public-api.ts +++ b/lib/content-services/src/lib/directives/public-api.ts @@ -25,3 +25,4 @@ export * from './library-membership.directive'; export * from './node-delete.directive'; export * from './node-favorite.directive'; export * from './node-restore.directive'; +export * from './node-download.directive'; diff --git a/lib/content-services/src/lib/document-list/components/content-action/content-action.component.spec.ts b/lib/content-services/src/lib/document-list/components/content-action/content-action.component.spec.ts index 06b0a38c7a..bae7d96659 100644 --- a/lib/content-services/src/lib/document-list/components/content-action/content-action.component.spec.ts +++ b/lib/content-services/src/lib/document-list/components/content-action/content-action.component.spec.ts @@ -17,7 +17,7 @@ import { CUSTOM_ELEMENTS_SCHEMA, SimpleChange, EventEmitter } from '@angular/core'; import { TestBed } from '@angular/core/testing'; -import { ContentService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { FileNode } from '../../../mock'; import { ContentActionModel } from './../../models/content-action.model'; import { DocumentActionsService } from './../../services/document-actions.service'; @@ -28,6 +28,7 @@ import { ContentActionListComponent } from './content-action-list.component'; import { ContentActionComponent } from './content-action.component'; import { ContentTestingModule } from '../../../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { ContentService } from '../../../common/services/content.service'; describe('ContentAction', () => { let documentList: DocumentListComponent; diff --git a/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts b/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts index 2b7150559c..124eb7e04b 100644 --- a/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts +++ b/lib/content-services/src/lib/document-list/components/document-list.component.spec.ts @@ -27,9 +27,10 @@ import { DataTableModule, ObjectDataTableAdapter, ShowHeaderMode, - ThumbnailService, - ContentService + ThumbnailService } from '@alfresco/adf-core'; +import { ContentService } from '../../common/services/content.service'; + import { Subject, of, throwError } from 'rxjs'; import { FileNode, diff --git a/lib/content-services/src/lib/document-list/components/document-list.component.ts b/lib/content-services/src/lib/document-list/components/document-list.component.ts index 94702b07f9..4be8ddbb66 100644 --- a/lib/content-services/src/lib/document-list/components/document-list.component.ts +++ b/lib/content-services/src/lib/document-list/components/document-list.component.ts @@ -22,9 +22,9 @@ import { AfterContentInit, Component, ContentChild, ElementRef, EventEmitter, HostListener, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild, ViewEncapsulation } from '@angular/core'; +import { ContentService } from '../../common/services/content.service'; import { - ContentService, DataCellEvent, DataColumn, DataRowActionEvent, @@ -46,9 +46,9 @@ import { AlfrescoApiService, UserPreferenceValues, DataRow, - DataTableService, - NodesApiService + DataTableService } from '@alfresco/adf-core'; +import { NodesApiService } from '../../common/services/nodes-api.service'; import { Node, NodeEntry, NodePaging, NodesApi, Pagination } from '@alfresco/js-api'; import { Subject, BehaviorSubject, of } from 'rxjs'; diff --git a/lib/content-services/src/lib/document-list/components/library-name-column/library-name-column.component.ts b/lib/content-services/src/lib/document-list/components/library-name-column/library-name-column.component.ts index dcd5c69a38..5198640b1a 100644 --- a/lib/content-services/src/lib/document-list/components/library-name-column/library-name-column.component.ts +++ b/lib/content-services/src/lib/document-list/components/library-name-column/library-name-column.component.ts @@ -26,7 +26,8 @@ import { } from '@angular/core'; import { NodeEntry, Site } from '@alfresco/js-api'; import { ShareDataRow } from '../../data/share-data-row.model'; -import { NodesApiService } from '@alfresco/adf-core'; +import { NodesApiService } from '../../../common/services/nodes-api.service'; + import { BehaviorSubject, Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; diff --git a/lib/content-services/src/lib/document-list/components/library-role-column/library-role-column.component.ts b/lib/content-services/src/lib/document-list/components/library-role-column/library-role-column.component.ts index bd4ccb2e80..87c06604fe 100644 --- a/lib/content-services/src/lib/document-list/components/library-role-column/library-role-column.component.ts +++ b/lib/content-services/src/lib/document-list/components/library-role-column/library-role-column.component.ts @@ -24,10 +24,10 @@ import { OnDestroy } from '@angular/core'; import { BehaviorSubject, Subject } from 'rxjs'; -import { NodesApiService } from '@alfresco/adf-core'; import { SiteEntry, Site } from '@alfresco/js-api'; import { ShareDataRow } from '../../data/share-data-row.model'; import { takeUntil } from 'rxjs/operators'; +import { NodesApiService } from '../../../common/services/nodes-api.service'; @Component({ selector: 'adf-library-role-column', diff --git a/lib/content-services/src/lib/document-list/components/library-status-column/library-status-column.component.ts b/lib/content-services/src/lib/document-list/components/library-status-column/library-status-column.component.ts index 745d0de642..307cfba420 100644 --- a/lib/content-services/src/lib/document-list/components/library-status-column/library-status-column.component.ts +++ b/lib/content-services/src/lib/document-list/components/library-status-column/library-status-column.component.ts @@ -16,7 +16,7 @@ */ import { Component, Input, OnInit, OnDestroy } from '@angular/core'; -import { NodesApiService } from '@alfresco/adf-core'; +import { NodesApiService } from '../../../common/services/nodes-api.service'; import { BehaviorSubject, Subject } from 'rxjs'; import { Site, SiteEntry } from '@alfresco/js-api'; import { ShareDataRow } from '../../data/share-data-row.model'; diff --git a/lib/content-services/src/lib/document-list/components/name-column/name-column.component.ts b/lib/content-services/src/lib/document-list/components/name-column/name-column.component.ts index cafbe10f5e..e53d5111df 100644 --- a/lib/content-services/src/lib/document-list/components/name-column/name-column.component.ts +++ b/lib/content-services/src/lib/document-list/components/name-column/name-column.component.ts @@ -26,7 +26,7 @@ import { } from '@angular/core'; import { NodeEntry } from '@alfresco/js-api'; import { BehaviorSubject, Subject } from 'rxjs'; -import { NodesApiService } from '@alfresco/adf-core'; +import { NodesApiService } from '../../../common/services/nodes-api.service'; import { ShareDataRow } from '../../data/share-data-row.model'; import { takeUntil } from 'rxjs/operators'; diff --git a/lib/content-services/src/lib/document-list/data/share-data-row.model.ts b/lib/content-services/src/lib/document-list/data/share-data-row.model.ts index b418617e80..efaef0e6d8 100644 --- a/lib/content-services/src/lib/document-list/data/share-data-row.model.ts +++ b/lib/content-services/src/lib/document-list/data/share-data-row.model.ts @@ -15,9 +15,10 @@ * limitations under the License. */ -import { DataRow, ObjectUtils, ThumbnailService, ContentService } from '@alfresco/adf-core'; +import { DataRow, ObjectUtils, ThumbnailService } from '@alfresco/adf-core'; import { MinimalNode, NodeEntry } from '@alfresco/js-api'; import { PermissionStyleModel } from './../models/permissions-style.model'; +import { ContentService } from './../../common/services/content.service'; export const ERR_OBJECT_NOT_FOUND: string = 'Object source not found'; diff --git a/lib/content-services/src/lib/document-list/data/share-datatable-adapter.spec.ts b/lib/content-services/src/lib/document-list/data/share-datatable-adapter.spec.ts index 5b14c65144..b852d170d1 100644 --- a/lib/content-services/src/lib/document-list/data/share-datatable-adapter.spec.ts +++ b/lib/content-services/src/lib/document-list/data/share-datatable-adapter.spec.ts @@ -15,13 +15,14 @@ * limitations under the License. */ -import { DataColumn, DataRow, DataSorting, ContentService, ThumbnailService, setupTestBed } from '@alfresco/adf-core'; +import { DataColumn, DataRow, DataSorting, ThumbnailService, setupTestBed } from '@alfresco/adf-core'; import { FileNode, FolderNode, SmartFolderNode, RuleFolderNode, LinkFolderNode } from './../../mock'; import { ERR_OBJECT_NOT_FOUND, ShareDataRow } from './share-data-row.model'; import { ERR_COL_NOT_FOUND, ERR_ROW_NOT_FOUND, ShareDataTableAdapter } from './share-datatable-adapter'; import { ContentTestingModule } from '../../testing/content.testing.module'; import { TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; +import { ContentService } from '../../common/services/content.service'; describe('ShareDataTableAdapter', () => { @@ -41,7 +42,7 @@ describe('ShareDataTableAdapter', () => { contentService = TestBed.inject(ContentService); thumbnailService = TestBed.inject(ThumbnailService); - spyOn(thumbnailService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl); + spyOn(contentService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl); }); it('should use client sorting by default', () => { @@ -267,7 +268,6 @@ describe('ShareDataTableAdapter', () => { const value = adapter.getValue(row, col); expect(value).toBe(imageUrl); - expect(thumbnailService.getDocumentThumbnailUrl).toHaveBeenCalledWith(file); }); it('should resolve fallback file icon for unknown node', () => { diff --git a/lib/content-services/src/lib/document-list/data/share-datatable-adapter.ts b/lib/content-services/src/lib/document-list/data/share-datatable-adapter.ts index d3a79e2571..8db6a5d02b 100644 --- a/lib/content-services/src/lib/document-list/data/share-datatable-adapter.ts +++ b/lib/content-services/src/lib/document-list/data/share-datatable-adapter.ts @@ -20,13 +20,13 @@ import { DataRow, DataSorting, DataTableAdapter, - ThumbnailService, - ContentService + ThumbnailService } from '@alfresco/adf-core'; import { NodePaging, NodeEntry } from '@alfresco/js-api'; import { PermissionStyleModel } from './../models/permissions-style.model'; import { ShareDataRow } from './share-data-row.model'; import { RowFilter } from './row-filter.model'; +import { ContentService } from '../../common/services/content.service'; export const ERR_ROW_NOT_FOUND: string = 'Row not found'; export const ERR_COL_NOT_FOUND: string = 'Column not found'; @@ -122,7 +122,7 @@ export class ShareDataTableAdapter implements DataTableAdapter { if (node.entry.isFile) { if (this.thumbnails) { - return this.thumbnailService.getDocumentThumbnailUrl(node); + return this.getDocumentThumbnailUrl(node); } } @@ -149,6 +149,33 @@ export class ShareDataTableAdapter implements DataTableAdapter { return dataRow.cacheValue(col.key, value); } + + /** + * Gets a thumbnail URL for the given document node. + * + * @param node Node or Node ID to get URL for. + * @param attachment Toggles whether to retrieve content as an attachment for download + * @param ticket Custom ticket to use for authentication + * @returns URL string + */ + private getDocumentThumbnailUrl(node: NodeEntry, attachment?: boolean, ticket?: string): string { + let resultUrl: string; + + if (node) { + let nodeId: string; + + if (typeof node === 'string') { + nodeId = node; + } else if (node.entry) { + nodeId = node.entry.id; + } + + resultUrl = this.contentService.getDocumentThumbnailUrl(nodeId, attachment, ticket); + } + + return resultUrl || this.thumbnailService.getMimeTypeIcon(node.entry.content.mimeType); + } + getSorting(): DataSorting { return this.sorting; } diff --git a/lib/content-services/src/lib/document-list/models/permissions-style.model.ts b/lib/content-services/src/lib/document-list/models/permissions-style.model.ts index 1d72d46d44..9a7c06d896 100644 --- a/lib/content-services/src/lib/document-list/models/permissions-style.model.ts +++ b/lib/content-services/src/lib/document-list/models/permissions-style.model.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AllowableOperationsEnum } from '@alfresco/adf-core'; +import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum'; export class PermissionStyleModel { css: string; diff --git a/lib/content-services/src/lib/document-list/services/document-actions.service.ts b/lib/content-services/src/lib/document-list/services/document-actions.service.ts index 6b38abf966..531fc9a0b6 100644 --- a/lib/content-services/src/lib/document-list/services/document-actions.service.ts +++ b/lib/content-services/src/lib/document-list/services/document-actions.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { ContentService, TranslationService } from '@alfresco/adf-core'; +import { TranslationService } from '@alfresco/adf-core'; +import { ContentService } from '../../common/services/content.service'; import { Injectable } from '@angular/core'; import { NodeEntry } from '@alfresco/js-api'; import { Observable, Subject, throwError, of } from 'rxjs'; diff --git a/lib/content-services/src/lib/document-list/services/document-list.service.ts b/lib/content-services/src/lib/document-list/services/document-list.service.ts index 28ac5503a5..996fe55e45 100644 --- a/lib/content-services/src/lib/document-list/services/document-list.service.ts +++ b/lib/content-services/src/lib/document-list/services/document-list.service.ts @@ -15,12 +15,11 @@ * limitations under the License. */ -import { - AlfrescoApiService, ContentService, LogService, PaginationModel -} from '@alfresco/adf-core'; +import { AlfrescoApiService, LogService, PaginationModel } from '@alfresco/adf-core'; +import { NodesApiService } from '../../common/services/nodes-api.service'; import { Injectable } from '@angular/core'; -import { NodeEntry, NodePaging, NodesApi } from '@alfresco/js-api'; +import { MinimalNode, NodeEntry, NodePaging, NodesApi } from '@alfresco/js-api'; import { DocumentLoaderNode } from '../models/document-folder.model'; import { Observable, from, throwError, forkJoin } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; @@ -40,7 +39,7 @@ export class DocumentListService implements DocumentListLoader { return this._nodesApi; } - constructor(private contentService: ContentService, + constructor(private nodesApiService: NodesApiService, private apiService: AlfrescoApiService, private logService: LogService, private customResourcesService: CustomResourcesService) { @@ -135,7 +134,7 @@ export class DocumentListService implements DocumentListLoader { * @param includeFields Extra information to include (available options are "aspectNames", "isLink" and "association") * @returns Details of the folder */ - getNode(nodeId: string, includeFields: string[] = []): Observable { + getNode(nodeId: string, includeFields: string[] = []): Observable { const includeFieldsRequest = ['path', 'properties', 'allowableOperations', 'permissions', 'definition', ...includeFields] .filter((element, index, array) => index === array.indexOf(element)); @@ -144,7 +143,7 @@ export class DocumentListService implements DocumentListLoader { include: includeFieldsRequest }; - return this.contentService.getNode(nodeId, opts); + return this.nodesApiService.getNode(nodeId, opts); } /** diff --git a/lib/content-services/src/lib/document-list/services/folder-actions.service.ts b/lib/content-services/src/lib/document-list/services/folder-actions.service.ts index b87c475b85..2d05c498d0 100644 --- a/lib/content-services/src/lib/document-list/services/folder-actions.service.ts +++ b/lib/content-services/src/lib/document-list/services/folder-actions.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { ContentService, TranslationService } from '@alfresco/adf-core'; +import { TranslationService } from '@alfresco/adf-core'; +import { ContentService } from '../../common/services/content.service'; import { Injectable } from '@angular/core'; import { NodeEntry } from '@alfresco/js-api'; import { Observable, Subject, throwError, of } from 'rxjs'; diff --git a/lib/content-services/src/lib/document-list/services/node-actions.service.ts b/lib/content-services/src/lib/document-list/services/node-actions.service.ts index c21c4884d4..67113e1d0d 100644 --- a/lib/content-services/src/lib/document-list/services/node-actions.service.ts +++ b/lib/content-services/src/lib/document-list/services/node-actions.service.ts @@ -18,8 +18,10 @@ import { Injectable, Output, EventEmitter } from '@angular/core'; import { Node, NodeEntry } from '@alfresco/js-api'; import { Subject } from 'rxjs'; -import { AlfrescoApiService, ContentService, NodeDownloadDirective, DownloadService } from '@alfresco/adf-core'; +import { AlfrescoApiService, DownloadService } from '@alfresco/adf-core'; import { MatDialog } from '@angular/material/dialog'; +import { ContentService } from '../../common/services/content.service'; +import { NodeDownloadDirective } from '../../directives/node-download.directive'; import { DocumentListService } from './document-list.service'; import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service'; diff --git a/lib/content-services/src/lib/folder-directive/folder-create.directive.spec.ts b/lib/content-services/src/lib/folder-directive/folder-create.directive.spec.ts index 02352539c7..20352b5362 100644 --- a/lib/content-services/src/lib/folder-directive/folder-create.directive.spec.ts +++ b/lib/content-services/src/lib/folder-directive/folder-create.directive.spec.ts @@ -21,11 +21,12 @@ import { MatDialog } from '@angular/material/dialog'; import { By } from '@angular/platform-browser'; import { Subject, of } from 'rxjs'; -import { ContentService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { FolderCreateDirective } from './folder-create.directive'; import { Node } from '@alfresco/js-api'; import { ContentTestingModule } from '../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { ContentService } from '../common/services/content.service'; @Component({ template: ` diff --git a/lib/content-services/src/lib/folder-directive/folder-create.directive.ts b/lib/content-services/src/lib/folder-directive/folder-create.directive.ts index 7b77453e71..28902adac5 100644 --- a/lib/content-services/src/lib/folder-directive/folder-create.directive.ts +++ b/lib/content-services/src/lib/folder-directive/folder-create.directive.ts @@ -21,7 +21,7 @@ import { Directive, HostListener, Input, Output, EventEmitter } from '@angular/c import { MatDialog } from '@angular/material/dialog'; import { Node } from '@alfresco/js-api'; import { FolderDialogComponent } from '../dialogs/folder.dialog'; -import { ContentService } from '@alfresco/adf-core'; +import { ContentService } from '../common/services/content.service'; const DEFAULT_FOLDER_PARENT_ID = '-my-'; const DIALOG_WIDTH: number = 400; diff --git a/lib/content-services/src/lib/folder-directive/folder-edit.directive.spec.ts b/lib/content-services/src/lib/folder-directive/folder-edit.directive.spec.ts index dc62de3345..2bfcddd5b1 100644 --- a/lib/content-services/src/lib/folder-directive/folder-edit.directive.spec.ts +++ b/lib/content-services/src/lib/folder-directive/folder-edit.directive.spec.ts @@ -21,11 +21,12 @@ import { MatDialog } from '@angular/material/dialog'; import { By } from '@angular/platform-browser'; import { Subject, of } from 'rxjs'; -import { ContentService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { FolderEditDirective } from './folder-edit.directive'; import { Node } from '@alfresco/js-api'; import { ContentTestingModule } from '../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { ContentService } from '../common/services/content.service'; @Component({ template: '
' diff --git a/lib/content-services/src/lib/folder-directive/folder-edit.directive.ts b/lib/content-services/src/lib/folder-directive/folder-edit.directive.ts index bddd5e68a6..c768eddf1c 100644 --- a/lib/content-services/src/lib/folder-directive/folder-edit.directive.ts +++ b/lib/content-services/src/lib/folder-directive/folder-edit.directive.ts @@ -21,7 +21,7 @@ import { Directive, ElementRef, HostListener, Input, Output, EventEmitter } from import { MatDialog } from '@angular/material/dialog'; import { Node } from '@alfresco/js-api'; import { FolderDialogComponent } from '../dialogs/folder.dialog'; -import { ContentService } from '@alfresco/adf-core'; +import { ContentService } from '../common/services/content.service'; const DIALOG_WIDTH: number = 400; diff --git a/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.spec.ts b/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.spec.ts index ffe3f544b6..10953f1ccf 100644 --- a/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.spec.ts +++ b/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.spec.ts @@ -15,12 +15,12 @@ * limitations under the License. */ -import { ContentService } from '@alfresco/adf-core'; import { Component, EventEmitter, Output } from '@angular/core'; import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; import { TranslateModule } from '@ngx-translate/core'; import { BehaviorSubject, of, Subject } from 'rxjs'; +import { ContentService } from '../common/services/content.service'; import { mockFile, mockNewVersionUploaderData, mockNode } from '../mock'; import { ContentTestingModule } from '../testing/content.testing.module'; import { diff --git a/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.ts b/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.ts index be38657997..920135f3cc 100644 --- a/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.ts +++ b/lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.ts @@ -17,7 +17,8 @@ import { Injectable } from '@angular/core'; import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; -import { AlfrescoApiService, ContentService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-core'; +import { ContentService } from '../common/services/content.service'; import { NewVersionUploaderDialogComponent } from './new-version-uploader.dialog'; import { VersionPaging, VersionsApi } from '@alfresco/js-api'; diff --git a/lib/content-services/src/lib/node-comments/mocks/node-comments.mock.ts b/lib/content-services/src/lib/node-comments/mocks/node-comments.mock.ts index b6965babce..84ce9b7c68 100644 --- a/lib/content-services/src/lib/node-comments/mocks/node-comments.mock.ts +++ b/lib/content-services/src/lib/node-comments/mocks/node-comments.mock.ts @@ -15,7 +15,9 @@ * limitations under the License. */ -import { CommentModel, EcmCompanyModel, EcmUserModel } from '@alfresco/adf-core'; +import { CommentModel } from '@alfresco/adf-core'; +import { EcmCompanyModel } from '../../common/models/ecm-company.model'; +import { EcmUserModel } from '../../common/models/ecm-user.model'; export const fakeUser1 = { enabled: true, diff --git a/lib/content-services/src/lib/node-comments/services/node-comments.service.ts b/lib/content-services/src/lib/node-comments/services/node-comments.service.ts index fdd0a4b59b..290b0b91fc 100644 --- a/lib/content-services/src/lib/node-comments/services/node-comments.service.ts +++ b/lib/content-services/src/lib/node-comments/services/node-comments.service.ts @@ -15,11 +15,17 @@ * limitations under the License. */ -import { AlfrescoApiService, LogService, CommentModel, CommentsService, PeopleContentService } from '@alfresco/adf-core'; +import { + AlfrescoApiService, + LogService, + CommentModel, + CommentsService +} from '@alfresco/adf-core'; import { CommentEntry, CommentsApi, Comment } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; import { Observable, from, throwError } from 'rxjs'; import { map, catchError } from 'rxjs/operators'; +import { ContentService } from '../../common/services/content.service'; @Injectable({ providedIn: 'root' @@ -35,7 +41,7 @@ export class NodeCommentsService implements CommentsService { constructor( private apiService: AlfrescoApiService, private logService: LogService, - private peopleContentService: PeopleContentService + private contentService: ContentService ) {} /** @@ -101,7 +107,7 @@ export class NodeCommentsService implements CommentsService { return throwError(error || 'Server error'); } - getUserImage(user: string): string { - return this.peopleContentService.getUserProfileImage(user); + getUserImage(avatarId: string): string { + return this.contentService.getContentUrl(avatarId); } } diff --git a/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission.component.ts b/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission.component.ts index 5e3570f422..f778025353 100644 --- a/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission.component.ts +++ b/lib/content-services/src/lib/permission-manager/components/add-permission/add-permission.component.ts @@ -15,11 +15,12 @@ * limitations under the License. */ -import { AllowableOperationsEnum, ContentService } from '@alfresco/adf-core'; import { Node, NodeEntry, PermissionElement } from '@alfresco/js-api'; import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core'; import { NodePermissionService } from '../../services/node-permission.service'; import { RoleModel } from '../../models/role.model'; +import { ContentService } from '../../../common/services/content.service'; +import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum'; @Component({ selector: 'adf-add-permission', diff --git a/lib/content-services/src/lib/permission-manager/components/inherited-button.directive.spec.ts b/lib/content-services/src/lib/permission-manager/components/inherited-button.directive.spec.ts index e09d311c68..6a455fd8d5 100644 --- a/lib/content-services/src/lib/permission-manager/components/inherited-button.directive.spec.ts +++ b/lib/content-services/src/lib/permission-manager/components/inherited-button.directive.spec.ts @@ -17,10 +17,11 @@ import { SimpleInheritedPermissionTestComponent } from '../../mock/inherited-permission.component.mock'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { NodesApiService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { of } from 'rxjs'; import { ContentTestingModule } from '../../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { NodesApiService } from '../../common/services/nodes-api.service'; const fakeNodeWithInherit: any = { id: 'fake-id', permissions : {isInheritanceEnabled : true}, allowableOperations: ['updatePermissions']}; const fakeNodeNoInherit: any = { id: 'fake-id', permissions : {isInheritanceEnabled : false}, allowableOperations: ['updatePermissions']}; diff --git a/lib/content-services/src/lib/permission-manager/components/inherited-button.directive.ts b/lib/content-services/src/lib/permission-manager/components/inherited-button.directive.ts index 4744edad70..884a32a298 100644 --- a/lib/content-services/src/lib/permission-manager/components/inherited-button.directive.ts +++ b/lib/content-services/src/lib/permission-manager/components/inherited-button.directive.ts @@ -17,8 +17,10 @@ /* eslint-disable @angular-eslint/no-input-rename */ import { Directive, Input, Output, EventEmitter } from '@angular/core'; -import { NodesApiService, ContentService, AllowableOperationsEnum } from '@alfresco/adf-core'; import { Node } from '@alfresco/js-api'; +import { ContentService } from '../../common/services/content.service'; +import { NodesApiService } from '../../common/services/nodes-api.service'; +import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum'; @Directive({ selector: 'button[adf-inherit-permission], mat-button-toggle[adf-inherit-permission]', diff --git a/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.component.spec.ts b/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.component.spec.ts index c0611ca69a..50b98e6fdd 100644 --- a/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.component.spec.ts +++ b/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { NodesApiService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { TranslateModule } from '@ngx-translate/core'; @@ -36,6 +36,7 @@ import { } from '../../../mock/permission-list.component.mock'; import { ContentTestingModule } from '../../../testing/content.testing.module'; import { MinimalNode } from '@alfresco/js-api'; +import { NodesApiService } from '../../../common/services/nodes-api.service'; describe('PermissionListComponent', () => { diff --git a/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.service.spec.ts b/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.service.spec.ts index e79fb5e915..957a07d7d6 100644 --- a/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.service.spec.ts +++ b/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.service.spec.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { NodesApiService, NotificationService, setupTestBed } from '@alfresco/adf-core'; +import { NotificationService, setupTestBed } from '@alfresco/adf-core'; +import { NodesApiService } from '../../../common/services/nodes-api.service'; import { TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { of, throwError } from 'rxjs'; diff --git a/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.service.ts b/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.service.ts index 9afaf59365..3d3497e997 100644 --- a/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.service.ts +++ b/lib/content-services/src/lib/permission-manager/components/permission-list/permission-list.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AllowableOperationsEnum, ContentService, NodesApiService, NotificationService } from '@alfresco/adf-core'; +import { NotificationService } from '@alfresco/adf-core'; import { Node, PermissionElement } from '@alfresco/js-api'; import { EventEmitter, Injectable } from '@angular/core'; import { MatSlideToggleChange } from '@angular/material/slide-toggle'; @@ -26,6 +26,9 @@ import { PermissionDisplayModel } from '../../models/permission.model'; import { NodePermissionsModel } from '../../models/member.model'; import { NodePermissionService } from '../../services/node-permission.service'; import { NodePermissionDialogService } from '../../services/node-permission-dialog.service'; +import { NodesApiService } from '../../../common/services/nodes-api.service'; +import { ContentService } from '../../../common/services/content.service'; +import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum'; const SITE_MANAGER_ROLE = 'SiteManager'; diff --git a/lib/content-services/src/lib/permission-manager/components/user-name-column/user-name-column.component.ts b/lib/content-services/src/lib/permission-manager/components/user-name-column/user-name-column.component.ts index 4c98f5f539..817d879c74 100644 --- a/lib/content-services/src/lib/permission-manager/components/user-name-column/user-name-column.component.ts +++ b/lib/content-services/src/lib/permission-manager/components/user-name-column/user-name-column.component.ts @@ -19,7 +19,7 @@ import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; import { Group, NodeEntry } from '@alfresco/js-api'; import { NodePermissionService } from '../../services/node-permission.service'; -import { EcmUserModel } from '@alfresco/adf-core'; +import { EcmUserModel } from '../../../common/models/ecm-user.model'; @Component({ selector: 'adf-user-name-column', diff --git a/lib/content-services/src/lib/permission-manager/models/member.model.ts b/lib/content-services/src/lib/permission-manager/models/member.model.ts index bee3d1a9e8..16bae334ae 100644 --- a/lib/content-services/src/lib/permission-manager/models/member.model.ts +++ b/lib/content-services/src/lib/permission-manager/models/member.model.ts @@ -18,7 +18,7 @@ import { Group, Node, NodeEntry, PermissionElement } from '@alfresco/js-api'; import { PermissionDisplayModel } from './permission.model'; import { RoleModel } from './role.model'; -import { EcmUserModel } from '@alfresco/adf-core'; +import { EcmUserModel } from '../../common/models/ecm-user.model'; export interface NodePermissionsModel { node: Node; diff --git a/lib/content-services/src/lib/permission-manager/services/node-permission-dialog.service.ts b/lib/content-services/src/lib/permission-manager/services/node-permission-dialog.service.ts index 4edb95c3ba..1f03c3b812 100644 --- a/lib/content-services/src/lib/permission-manager/services/node-permission-dialog.service.ts +++ b/lib/content-services/src/lib/permission-manager/services/node-permission-dialog.service.ts @@ -15,7 +15,6 @@ * limitations under the License. */ -import { AllowableOperationsEnum, ContentService } from '@alfresco/adf-core'; import { Node, PermissionElement } from '@alfresco/js-api'; import { MatDialog } from '@angular/material/dialog'; import { Injectable } from '@angular/core'; @@ -25,6 +24,8 @@ import { NodePermissionService } from './node-permission.service'; import { AddPermissionDialogComponent } from '../components/add-permission/add-permission-dialog.component'; import { AddPermissionDialogData } from '../components/add-permission/add-permission-dialog-data.interface'; import { RoleModel } from '../models/role.model'; +import { ContentService } from '../../common/services/content.service'; +import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum'; @Injectable({ providedIn: 'root' diff --git a/lib/content-services/src/lib/permission-manager/services/node-permission.service.spec.ts b/lib/content-services/src/lib/permission-manager/services/node-permission.service.spec.ts index dd5e581258..05283247b2 100644 --- a/lib/content-services/src/lib/permission-manager/services/node-permission.service.spec.ts +++ b/lib/content-services/src/lib/permission-manager/services/node-permission.service.spec.ts @@ -17,7 +17,7 @@ import { TestBed } from '@angular/core/testing'; import { NodePermissionService } from './node-permission.service'; -import { NodesApiService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { SearchService } from '../../search/services/search.service'; import { Node, PermissionElement } from '@alfresco/js-api'; import { of, throwError } from 'rxjs'; @@ -26,6 +26,7 @@ import { fakeEmptyResponse, fakeNodeWithOnlyLocally, fakeSiteRoles, fakeSiteNode import { fakeAuthorityResults } from '../../mock/add-permission.component.mock'; import { ContentTestingModule } from '../../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { NodesApiService } from '../../common/services/nodes-api.service'; describe('NodePermissionService', () => { diff --git a/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts b/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts index 534dbf8550..8b18981f20 100644 --- a/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts +++ b/lib/content-services/src/lib/permission-manager/services/node-permission.service.ts @@ -17,10 +17,10 @@ import { AlfrescoApiService, - NodesApiService, - TranslationService, - EcmUserModel + TranslationService } from '@alfresco/adf-core'; +import { NodesApiService } from '../../common/services/nodes-api.service'; +import { EcmUserModel } from '../../common/models/ecm-user.model'; import { Group, GroupMemberEntry, diff --git a/lib/content-services/src/lib/search/services/search-header-query-builder.service.ts b/lib/content-services/src/lib/search/services/search-header-query-builder.service.ts index 79df1cb5ec..22c0e57208 100644 --- a/lib/content-services/src/lib/search/services/search-header-query-builder.service.ts +++ b/lib/content-services/src/lib/search/services/search-header-query-builder.service.ts @@ -16,7 +16,7 @@ */ import { Injectable } from '@angular/core'; -import { AlfrescoApiService, AppConfigService, NodesApiService, DataSorting } from '@alfresco/adf-core'; +import { AlfrescoApiService, AppConfigService, DataSorting } from '@alfresco/adf-core'; import { SearchConfiguration } from '../models/search-configuration.interface'; import { BaseQueryBuilderService } from './base-query-builder.service'; import { SearchCategory } from '../models/search-category.interface'; @@ -25,6 +25,7 @@ import { filter } from 'rxjs/operators'; import { Observable } from 'rxjs'; import { SearchSortingDefinition } from '../models/search-sorting-definition.interface'; import { FilterSearch } from '../models/filter-search.interface'; +import { NodesApiService } from '../../common/services/nodes-api.service'; @Injectable({ providedIn: 'root' diff --git a/lib/content-services/src/lib/tree-view/services/tree-view.service.spec.ts b/lib/content-services/src/lib/tree-view/services/tree-view.service.spec.ts index bba011375d..a7e0ed29a0 100644 --- a/lib/content-services/src/lib/tree-view/services/tree-view.service.spec.ts +++ b/lib/content-services/src/lib/tree-view/services/tree-view.service.spec.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { setupTestBed, NodesApiService } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; +import { NodesApiService } from '../../common/services/nodes-api.service'; import { TreeViewService } from './tree-view.service'; import { TestBed } from '@angular/core/testing'; import { ContentTestingModule } from '../../testing/content.testing.module'; diff --git a/lib/content-services/src/lib/tree-view/services/tree-view.service.ts b/lib/content-services/src/lib/tree-view/services/tree-view.service.ts index 3a272a3b08..863c6758ce 100644 --- a/lib/content-services/src/lib/tree-view/services/tree-view.service.ts +++ b/lib/content-services/src/lib/tree-view/services/tree-view.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { NodesApiService } from '@alfresco/adf-core'; +import { NodesApiService } from '../../common/services/nodes-api.service'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { TreeBaseNode } from '../models/tree-view.model'; diff --git a/lib/content-services/src/lib/upload/components/base-upload/upload-base.spec.ts b/lib/content-services/src/lib/upload/components/base-upload/upload-base.spec.ts index 510a55eeb8..1799a15228 100644 --- a/lib/content-services/src/lib/upload/components/base-upload/upload-base.spec.ts +++ b/lib/content-services/src/lib/upload/components/base-upload/upload-base.spec.ts @@ -17,12 +17,15 @@ import { Component, NgZone } from '@angular/core'; import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; -import { TranslationService, UploadService, setupTestBed, FileModel, FileUploadErrorEvent } from '@alfresco/adf-core'; +import { TranslationService, setupTestBed } from '@alfresco/adf-core'; import { UploadBase } from './upload-base'; import { UploadFilesEvent } from '../upload-files.event'; import { ContentTestingModule } from '../../../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; import { mockUploadSuccessPromise } from '../../../mock/upload.service.mock'; +import { UploadService } from '../../../common/services/upload.service'; +import { FileModel } from '../../../common/models/file.model'; +import { FileUploadErrorEvent } from '../../../common/events/file.event'; @Component({ selector: 'adf-upload-button-test', diff --git a/lib/content-services/src/lib/upload/components/base-upload/upload-base.ts b/lib/content-services/src/lib/upload/components/base-upload/upload-base.ts index 80ed472138..3b4205ec55 100644 --- a/lib/content-services/src/lib/upload/components/base-upload/upload-base.ts +++ b/lib/content-services/src/lib/upload/components/base-upload/upload-base.ts @@ -15,7 +15,10 @@ * limitations under the License. */ -import { FileModel, FileInfo, UploadService, TranslationService, FileUploadErrorEvent } from '@alfresco/adf-core'; +import { FileInfo, TranslationService } from '@alfresco/adf-core'; +import { FileUploadErrorEvent } from '../../../common/events/file.event'; +import { FileModel } from '../../../common/models/file.model'; +import { UploadService } from '../../../common/services/upload.service'; import { EventEmitter, Input, Output, OnInit, OnDestroy, NgZone, Directive } from '@angular/core'; import { Subject } from 'rxjs'; import { UploadFilesEvent } from '../upload-files.event'; diff --git a/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.spec.ts b/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.spec.ts index 7a8fe348ce..a24705dcd3 100644 --- a/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.spec.ts +++ b/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.spec.ts @@ -18,12 +18,15 @@ import { EventEmitter } from '@angular/core'; import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; import { - FileModel, FileUploadCompleteEvent, FileUploadErrorEvent, UploadService, setupTestBed, UserPreferencesService + setupTestBed, UserPreferencesService } from '@alfresco/adf-core'; import { UploadModule } from '../upload.module'; import { FileUploadingDialogComponent } from './file-uploading-dialog.component'; import { ContentTestingModule } from '../../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { UploadService } from '../../common/services/upload.service'; +import { FileModel } from '../../common/models/file.model'; +import { FileUploadCompleteEvent, FileUploadErrorEvent } from '../../common/events/file.event'; describe('FileUploadingDialogComponent', () => { let fixture: ComponentFixture; diff --git a/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.ts b/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.ts index 48b1a72f9c..3a16261a3a 100644 --- a/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.ts +++ b/lib/content-services/src/lib/upload/components/file-uploading-dialog.component.ts @@ -15,12 +15,15 @@ * limitations under the License. */ -import { FileModel, FileUploadStatus, UploadService, UserPreferencesService, FileUploadDeleteEvent, FileUploadCompleteEvent } from '@alfresco/adf-core'; +import { UserPreferencesService } from '@alfresco/adf-core'; import { ChangeDetectorRef, Component, Input, Output, EventEmitter, OnDestroy, OnInit, ViewChild, HostBinding, ElementRef, ViewEncapsulation } from '@angular/core'; import { Subscription, merge, Subject } from 'rxjs'; import { FileUploadingListComponent } from './file-uploading-list.component'; import { Direction } from '@angular/cdk/bidi'; import { takeUntil, delay } from 'rxjs/operators'; +import { UploadService } from '../../common/services/upload.service'; +import { FileModel, FileUploadStatus } from '../../common/models/file.model'; +import { FileUploadDeleteEvent, FileUploadCompleteEvent } from '../../common/events/file.event'; @Component({ selector: 'adf-file-uploading-dialog', diff --git a/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.spec.ts b/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.spec.ts index 5179a7dd2c..035f6950e9 100644 --- a/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.spec.ts +++ b/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.spec.ts @@ -16,11 +16,12 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FileModel, FileUploadStatus, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { FileUploadingListRowComponent } from './file-uploading-list-row.component'; import { ContentTestingModule } from '../../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; +import { FileModel, FileUploadStatus } from '../../common/models/file.model'; describe('FileUploadingListRowComponent', () => { let fixture: ComponentFixture; diff --git a/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.ts b/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.ts index 332985bf9a..85b82ef107 100644 --- a/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.ts +++ b/lib/content-services/src/lib/upload/components/file-uploading-list-row.component.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { FileModel, FileUploadStatus } from '@alfresco/adf-core'; +import { FileModel, FileUploadStatus } from '../../common/models/file.model'; import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; @Component({ diff --git a/lib/content-services/src/lib/upload/components/file-uploading-list.component.spec.ts b/lib/content-services/src/lib/upload/components/file-uploading-list.component.spec.ts index 9a446069e4..e45755cd00 100644 --- a/lib/content-services/src/lib/upload/components/file-uploading-list.component.spec.ts +++ b/lib/content-services/src/lib/upload/components/file-uploading-list.component.spec.ts @@ -16,11 +16,14 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { TranslationService, FileUploadStatus, NodesApiService, UploadService, setupTestBed, FileModel } from '@alfresco/adf-core'; +import { TranslationService, setupTestBed } from '@alfresco/adf-core'; import { of } from 'rxjs'; import { FileUploadingListComponent } from './file-uploading-list.component'; import { ContentTestingModule } from '../../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { UploadService } from '../../common/services/upload.service'; +import { NodesApiService } from '../../common/services/nodes-api.service'; +import { FileModel, FileUploadStatus } from '../../common/models/file.model'; describe('FileUploadingListComponent', () => { let fixture: ComponentFixture; diff --git a/lib/content-services/src/lib/upload/components/file-uploading-list.component.ts b/lib/content-services/src/lib/upload/components/file-uploading-list.component.ts index 6c4eed97ab..a7ff53f73d 100644 --- a/lib/content-services/src/lib/upload/components/file-uploading-list.component.ts +++ b/lib/content-services/src/lib/upload/components/file-uploading-list.component.ts @@ -16,11 +16,11 @@ */ import { - FileModel, - FileUploadStatus, - TranslationService, - UploadService + TranslationService } from '@alfresco/adf-core'; +import { UploadService } from '../../common/services/upload.service'; +import { FileModel, FileUploadStatus } from '../../common/models/file.model'; + import { Component, ContentChild, diff --git a/lib/content-services/src/lib/upload/components/upload-button.component.spec.ts b/lib/content-services/src/lib/upload/components/upload-button.component.spec.ts index 8c428497b1..32267a2445 100644 --- a/lib/content-services/src/lib/upload/components/upload-button.component.spec.ts +++ b/lib/content-services/src/lib/upload/components/upload-button.component.spec.ts @@ -17,13 +17,15 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ContentService, UploadService, FileUploadErrorEvent } from '@alfresco/adf-core'; import { of, throwError } from 'rxjs'; import { UploadButtonComponent } from './upload-button.component'; import { NodeEntry } from '@alfresco/js-api'; import { ContentTestingModule } from '../../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; import { mockUploadErrorPromise } from '../../mock/upload.service.mock'; +import { UploadService } from '../../common/services/upload.service'; +import { NodesApiService } from '../../common/services/nodes-api.service'; +import { FileUploadErrorEvent } from '../../common/events/file.event'; describe('UploadButtonComponent', () => { @@ -50,7 +52,7 @@ describe('UploadButtonComponent', () => { let component: UploadButtonComponent; let fixture: ComponentFixture; let uploadService: UploadService; - let contentService: ContentService; + let nodesApiService: NodesApiService; beforeEach(() => { TestBed.configureTestingModule({ @@ -61,7 +63,7 @@ describe('UploadButtonComponent', () => { }); fixture = TestBed.createComponent(UploadButtonComponent); uploadService = TestBed.inject(UploadService); - contentService = TestBed.inject(ContentService); + nodesApiService = TestBed.inject(NodesApiService); component = fixture.componentInstance; fixture.detectChanges(); @@ -124,7 +126,7 @@ describe('UploadButtonComponent', () => { it('should call uploadFile with the default root folder', () => { component.rootFolderId = '-root-'; - spyOn(contentService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission)); + spyOn(nodesApiService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission.entry)); spyOn(uploadService, 'uploadFilesInTheQueue').and.stub(); component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); @@ -136,7 +138,7 @@ describe('UploadButtonComponent', () => { it('should call uploadFile with a custom root folder', () => { component.rootFolderId = '-my-'; - spyOn(contentService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission)); + spyOn(nodesApiService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission.entry)); spyOn(uploadService, 'uploadFilesInTheQueue').and.stub(); component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); @@ -159,7 +161,7 @@ describe('UploadButtonComponent', () => { it('should create a folder and emit an File uploaded event', async () => { component.rootFolderId = '-my-'; - spyOn(contentService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission)); + spyOn(nodesApiService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission.entry)); component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); fixture.detectChanges(); @@ -343,14 +345,13 @@ describe('UploadButtonComponent', () => { beforeEach(() => { spyOn(uploadService, 'uploadFilesInTheQueue').and.stub(); fakeNodeWithNoPermission = { - entry: {} }; }); it('should not call uploadFiles for node without permission', () => { component.rootFolderId = 'nodeId'; - spyOn(contentService, 'getNode').and.returnValue(of(fakeNodeWithNoPermission)); + spyOn(nodesApiService, 'getNode').and.returnValue(of(fakeNodeWithNoPermission)); component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); fixture.detectChanges(); @@ -361,7 +362,7 @@ describe('UploadButtonComponent', () => { it('should not call uploadFiles when getNode fails', () => { component.rootFolderId = 'nodeId'; - spyOn(contentService, 'getNode').and.returnValue(throwError('error')); + spyOn(nodesApiService, 'getNode').and.returnValue(throwError('error')); component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); fixture.detectChanges(); @@ -372,7 +373,7 @@ describe('UploadButtonComponent', () => { it('should emit an error message when getNode fails', async () => { component.rootFolderId = 'nodeId'; - spyOn(contentService, 'getNode').and.returnValue(throwError('error')); + spyOn(nodesApiService, 'getNode').and.returnValue(throwError('error')); await component.error.subscribe((value: FileUploadErrorEvent) => { expect(value.error).toBe('FILE_UPLOAD.BUTTON.PERMISSION_CHECK_ERROR'); @@ -387,9 +388,9 @@ describe('UploadButtonComponent', () => { it('should not call uploadFiles for node with other permissions', () => { component.rootFolderId = 'nodeId'; - fakeNodeWithNoPermission.entry.allowableOperations = ['other']; + fakeNodeWithNoPermission.allowableOperations = ['other']; - spyOn(contentService, 'getNode').and.returnValue(of(fakeNodeWithNoPermission)); + spyOn(nodesApiService, 'getNode').and.returnValue(of(fakeNodeWithNoPermission.entry)); component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); fixture.detectChanges(); @@ -400,7 +401,7 @@ describe('UploadButtonComponent', () => { it('should call uploadFiles when node has CREATE', () => { component.rootFolderId = 'nodeId'; - spyOn(contentService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission)); + spyOn(nodesApiService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission.entry)); component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); fixture.detectChanges(); @@ -411,7 +412,7 @@ describe('UploadButtonComponent', () => { describe('Events', () => { beforeEach(() => { - spyOn(contentService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission)); + spyOn(nodesApiService, 'getNode').and.returnValue(of(fakeFolderNodeWithPermission.entry)); component.rootFolderId = 'nodeId'; component.ngOnChanges({ rootFolderId: new SimpleChange(null, component.rootFolderId, true) }); fixture.detectChanges(); diff --git a/lib/content-services/src/lib/upload/components/upload-button.component.ts b/lib/content-services/src/lib/upload/components/upload-button.component.ts index 19f5689c2d..29a2a5e772 100644 --- a/lib/content-services/src/lib/upload/components/upload-button.component.ts +++ b/lib/content-services/src/lib/upload/components/upload-button.component.ts @@ -16,13 +16,17 @@ */ import { - ContentService, EXTENDIBLE_COMPONENT, FileUtils, - LogService, TranslationService, UploadService, AllowableOperationsEnum + EXTENDIBLE_COMPONENT, FileUtils, + LogService, TranslationService } from '@alfresco/adf-core'; import { Component, EventEmitter, forwardRef, Input, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation, NgZone } from '@angular/core'; +import { UploadService } from '../../common/services/upload.service'; +import { NodesApiService } from '../../common/services/nodes-api.service'; +import { ContentService } from '../../common/services/content.service'; +import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum'; import { Node } from '@alfresco/js-api'; import { Subject } from 'rxjs'; import { PermissionModel } from '../../document-list/models/permissions.model'; @@ -70,6 +74,7 @@ export class UploadButtonComponent extends UploadBase implements OnInit, OnChang constructor(protected uploadService: UploadService, private contentService: ContentService, + private nodesApiService: NodesApiService, protected translationService: TranslationService, protected logService: LogService, protected ngZone: NgZone) { @@ -135,8 +140,8 @@ export class UploadButtonComponent extends UploadBase implements OnInit, OnChang include: ['allowableOperations'] }; - this.contentService.getNode(this.rootFolderId, opts).subscribe( - (res) => this.permissionValue.next(this.nodeHasPermission(res.entry, AllowableOperationsEnum.CREATE)), + this.nodesApiService.getNode(this.rootFolderId, opts).subscribe( + (res) => this.permissionValue.next(this.nodeHasPermission(res, AllowableOperationsEnum.CREATE)), (error: { error: Error }) => { if (error && error.error) { this.error.emit({ error: error.error.message } as any); diff --git a/lib/content-services/src/lib/upload/components/upload-drag-area.component.spec.ts b/lib/content-services/src/lib/upload/components/upload-drag-area.component.spec.ts index ba25d45ed6..6786fc006c 100644 --- a/lib/content-services/src/lib/upload/components/upload-drag-area.component.spec.ts +++ b/lib/content-services/src/lib/upload/components/upload-drag-area.component.spec.ts @@ -16,11 +16,13 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FileModel, UploadService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { UploadDragAreaComponent } from './upload-drag-area.component'; import { ContentTestingModule } from '../../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; import { mockUploadSuccessPromise, mockUploadErrorPromise } from '../../mock/upload.service.mock'; +import { UploadService } from '../../common/services/upload.service'; +import { FileModel } from '../../common/models/file.model'; const getFakeShareDataRow = (allowableOperations = ['delete', 'update', 'create']) => ({ obj: { diff --git a/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts b/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts index bab59eeef6..6cca211a39 100644 --- a/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts +++ b/lib/content-services/src/lib/upload/components/upload-drag-area.component.ts @@ -16,12 +16,16 @@ */ import { - EXTENDIBLE_COMPONENT, FileInfo, FileModel, FileUtils, - NotificationService, TranslationService, UploadService, ContentService, AllowableOperationsEnum + EXTENDIBLE_COMPONENT, FileInfo, FileUtils, + NotificationService, TranslationService } from '@alfresco/adf-core'; import { Component, forwardRef, ViewEncapsulation, NgZone } from '@angular/core'; import { NodeAllowableOperationSubject } from '../../interfaces/node-allowable-operation-subject.interface'; import { UploadBase } from './base-upload/upload-base'; +import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum'; +import { UploadService } from '../../common/services/upload.service'; +import { ContentService } from '../../common/services/content.service'; +import { FileModel } from '../../common/models/file.model'; @Component({ selector: 'adf-upload-drag-area', diff --git a/lib/content-services/src/lib/upload/components/upload-files.event.ts b/lib/content-services/src/lib/upload/components/upload-files.event.ts index 3b974c9158..df2e8483ea 100644 --- a/lib/content-services/src/lib/upload/components/upload-files.event.ts +++ b/lib/content-services/src/lib/upload/components/upload-files.event.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { FileModel, UploadService } from '@alfresco/adf-core'; +import { FileModel } from '../../common/models/file.model'; +import { UploadService } from '../../common/services/upload.service'; import { EventEmitter } from '@angular/core'; export class UploadFilesEvent { diff --git a/lib/content-services/src/lib/upload/components/upload-version-button.component.ts b/lib/content-services/src/lib/upload/components/upload-version-button.component.ts index 963d5e61e7..bd86b6d4da 100644 --- a/lib/content-services/src/lib/upload/components/upload-version-button.component.ts +++ b/lib/content-services/src/lib/upload/components/upload-version-button.component.ts @@ -15,10 +15,12 @@ * limitations under the License. */ -import { AllowableOperationsEnum, FileModel, EXTENDIBLE_COMPONENT } from '@alfresco/adf-core'; +import { EXTENDIBLE_COMPONENT } from '@alfresco/adf-core'; import { Component, forwardRef, Input, OnChanges, ViewEncapsulation, OnInit } from '@angular/core'; import { Node } from '@alfresco/js-api'; import { UploadButtonComponent } from './upload-button.component'; +import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum'; +import { FileModel } from '../../common/models/file.model'; @Component({ selector: 'adf-upload-version-button', diff --git a/lib/content-services/src/lib/version-compatibility/version-compatibility.service.spec.ts b/lib/content-services/src/lib/version-compatibility/version-compatibility.service.spec.ts index a5572f75f9..4442f2f3d8 100644 --- a/lib/content-services/src/lib/version-compatibility/version-compatibility.service.spec.ts +++ b/lib/content-services/src/lib/version-compatibility/version-compatibility.service.spec.ts @@ -15,11 +15,12 @@ * limitations under the License. */ -import { CoreTestingModule, DiscoveryApiService, setupTestBed } from '@alfresco/adf-core'; +import { CoreTestingModule, setupTestBed } from '@alfresco/adf-core'; import { RepositoryInfo } from '@alfresco/js-api'; import { TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { BehaviorSubject } from 'rxjs'; +import { DiscoveryApiService } from '../common/services/discovery-api.service'; import { VersionCompatibilityService } from './version-compatibility.service'; describe('VersionCompatibilityService', () => { diff --git a/lib/content-services/src/lib/version-compatibility/version-compatibility.service.ts b/lib/content-services/src/lib/version-compatibility/version-compatibility.service.ts index 4a6c6a9a7f..cc737a6045 100644 --- a/lib/content-services/src/lib/version-compatibility/version-compatibility.service.ts +++ b/lib/content-services/src/lib/version-compatibility/version-compatibility.service.ts @@ -19,7 +19,7 @@ import { Injectable } from '@angular/core'; import { filter } from 'rxjs/operators'; import { ReplaySubject } from 'rxjs'; import { VersionInfo, RepositoryInfo } from '@alfresco/js-api'; -import { DiscoveryApiService } from '@alfresco/adf-core'; +import { DiscoveryApiService } from '../common/services/discovery-api.service'; @Injectable({ providedIn: 'root' diff --git a/lib/content-services/src/lib/version-manager/version-list.component.ts b/lib/content-services/src/lib/version-manager/version-list.component.ts index f0dc91dcb6..cda4f97ea0 100644 --- a/lib/content-services/src/lib/version-manager/version-list.component.ts +++ b/lib/content-services/src/lib/version-manager/version-list.component.ts @@ -15,12 +15,13 @@ * limitations under the License. */ -import { AlfrescoApiService, ContentService } from '@alfresco/adf-core'; +import { AlfrescoApiService } from '@alfresco/adf-core'; import { Component, Input, OnChanges, ViewEncapsulation, EventEmitter, Output } from '@angular/core'; import { VersionsApi, Node, VersionEntry, VersionPaging, NodesApi, NodeEntry, ContentApi } from '@alfresco/js-api'; import { MatDialog } from '@angular/material/dialog'; import { ConfirmDialogComponent } from '../dialogs/confirm.dialog'; import { ContentVersionService } from './content-version.service'; +import { ContentService } from '../common/services/content.service'; @Component({ selector: 'adf-version-list', diff --git a/lib/content-services/src/lib/version-manager/version-manager.component.spec.ts b/lib/content-services/src/lib/version-manager/version-manager.component.spec.ts index df60b5adf5..7d1632d748 100644 --- a/lib/content-services/src/lib/version-manager/version-manager.component.spec.ts +++ b/lib/content-services/src/lib/version-manager/version-manager.component.spec.ts @@ -18,11 +18,12 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { NodesApiService, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { Node, VersionPaging } from '@alfresco/js-api'; import { VersionManagerComponent } from './version-manager.component'; import { ContentTestingModule } from '../testing/content.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { NodesApiService } from '../common/services/nodes-api.service'; describe('VersionManagerComponent', () => { let component: VersionManagerComponent; diff --git a/lib/content-services/src/lib/version-manager/version-manager.component.ts b/lib/content-services/src/lib/version-manager/version-manager.component.ts index 28da71aeb5..b96500ae0e 100644 --- a/lib/content-services/src/lib/version-manager/version-manager.component.ts +++ b/lib/content-services/src/lib/version-manager/version-manager.component.ts @@ -18,8 +18,10 @@ import { Component, Input, ViewEncapsulation, ViewChild, Output, EventEmitter, OnInit } from '@angular/core'; import { Node } from '@alfresco/js-api'; import { VersionListComponent } from './version-list.component'; -import { ContentService, FileUploadErrorEvent, NodesApiService } from '@alfresco/adf-core'; import { trigger, state, style, animate, transition } from '@angular/animations'; +import { ContentService } from '../common/services/content.service'; +import { NodesApiService } from '../common/services/nodes-api.service'; +import { FileUploadErrorEvent } from '../common/events/file.event'; @Component({ selector: 'adf-version-manager', diff --git a/lib/content-services/src/lib/version-manager/version-upload.component.spec.ts b/lib/content-services/src/lib/version-manager/version-upload.component.spec.ts index 5a5cb77f7f..9671033a35 100644 --- a/lib/content-services/src/lib/version-manager/version-upload.component.spec.ts +++ b/lib/content-services/src/lib/version-manager/version-upload.component.spec.ts @@ -19,9 +19,11 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { VersionUploadComponent } from './version-upload.component'; -import { ContentService, setupTestBed, UploadService } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { ContentTestingModule } from '../testing/content.testing.module'; import { Node } from '@alfresco/js-api'; +import { UploadService } from '../common/services/upload.service'; +import { ContentService } from '../common/services/content.service'; describe('VersionUploadComponent', () => { let component: VersionUploadComponent; diff --git a/lib/content-services/src/lib/version-manager/version-upload.component.ts b/lib/content-services/src/lib/version-manager/version-upload.component.ts index b63048ec75..52d90e0d59 100644 --- a/lib/content-services/src/lib/version-manager/version-upload.component.ts +++ b/lib/content-services/src/lib/version-manager/version-upload.component.ts @@ -17,9 +17,11 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, ViewEncapsulation } from '@angular/core'; import { Node, Version } from '@alfresco/js-api'; -import { ContentService, FileUploadErrorEvent, FileUploadEvent, UploadService } from '@alfresco/adf-core'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; +import { ContentService } from '../common/services/content.service'; +import { UploadService } from '../common/services/upload.service'; +import { FileUploadErrorEvent, FileUploadEvent } from '../common/events/file.event'; @Component({ selector: 'adf-version-upload', diff --git a/lib/content-services/src/lib/viewer/alfresco-viewer.module.ts b/lib/content-services/src/lib/viewer/alfresco-viewer.module.ts index 8dfaee56a4..ca578168e2 100644 --- a/lib/content-services/src/lib/viewer/alfresco-viewer.module.ts +++ b/lib/content-services/src/lib/viewer/alfresco-viewer.module.ts @@ -27,6 +27,7 @@ import { MaterialModule } from '../material.module'; import { A11yModule } from '@angular/cdk/a11y'; import { AlfrescoViewerComponent } from './components/alfresco-viewer.component'; import { CoreModule } from '@alfresco/adf-core'; +import { ContentDirectiveModule } from '../directives'; @NgModule({ imports: [ @@ -38,7 +39,8 @@ import { CoreModule } from '@alfresco/adf-core'; ReactiveFormsModule, FlexLayoutModule, A11yModule, - ExtensionsModule + ExtensionsModule, + ContentDirectiveModule ], declarations: [ AlfrescoViewerComponent diff --git a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts index 4bcf8c39b7..596c142042 100644 --- a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts +++ b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.spec.ts @@ -26,14 +26,16 @@ import { AppExtensionService, ViewerExtensionRef } from '@alfresco/adf-extension import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; import { NodeEntry, VersionEntry } from '@alfresco/js-api'; -import { AlfrescoViewerComponent, RenditionViewerService } from '@alfresco/adf-content-services'; +import { AlfrescoViewerComponent, RenditionService } from '@alfresco/adf-content-services'; import { - NodesApiService, CoreTestingModule, setupTestBed, EventMock, - FileModel, UploadService, ViewUtilService + ViewUtilService } from '@alfresco/adf-core'; +import { NodesApiService } from '../../common/services/nodes-api.service'; +import { UploadService } from '../../common/services/upload.service'; +import { FileModel } from '../../common/models/file.model'; import { throwError } from 'rxjs'; import { Component } from '@angular/core'; import { ESCAPE } from '@angular/cdk/keycodes'; @@ -145,7 +147,7 @@ describe('AlfrescoViewerComponent', () => { let dialog: MatDialog; let uploadService: UploadService; let extensionService: AppExtensionService; - let renditionService: RenditionViewerService; + let renditionService: RenditionService; let viewUtilService: ViewUtilService; setupTestBed({ @@ -165,7 +167,7 @@ describe('AlfrescoViewerComponent', () => { ], providers: [ { - provide: RenditionViewerService, useValue: { + provide: RenditionService, useValue: { getNodeRendition: () => throwError('thrown'), generateMediaTracksRendition: () => {} } @@ -184,7 +186,7 @@ describe('AlfrescoViewerComponent', () => { nodesApiService = TestBed.inject(NodesApiService); dialog = TestBed.inject(MatDialog); extensionService = TestBed.inject(AppExtensionService); - renditionService = TestBed.inject(RenditionViewerService); + renditionService = TestBed.inject(RenditionService); viewUtilService = TestBed.inject(ViewUtilService); }); diff --git a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts index e8f2545479..2a14f4660f 100644 --- a/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts +++ b/lib/content-services/src/lib/viewer/components/alfresco-viewer.component.ts @@ -30,12 +30,9 @@ import { ViewEncapsulation } from '@angular/core'; import { - AlfrescoApiService, ContentService, - FileModel, + AlfrescoApiService, LogService, - NodesApiService, Track, - UploadService, ViewerComponent, ViewerMoreActionsComponent, ViewerOpenWithComponent, @@ -56,9 +53,13 @@ import { VersionEntry, VersionsApi } from '@alfresco/js-api'; -import { RenditionViewerService } from '../services/rendition-viewer.service'; +import { RenditionService } from '../../common/services/rendition.service'; import { MatDialog } from '@angular/material/dialog'; import { filter, takeUntil } from 'rxjs/operators'; +import { ContentService } from '../../common/services/content.service'; +import { NodesApiService } from '../../common/services/nodes-api.service'; +import { UploadService } from '../../common/services/upload.service'; +import { FileModel } from '../../common/models/file.model'; @Component({ selector: 'adf-alfresco-viewer', @@ -71,7 +72,7 @@ import { filter, takeUntil } from 'rxjs/operators'; export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy { @ViewChild('adfViewer') - adfViewer: ViewerComponent<{node: Node}>; + adfViewer: ViewerComponent<{ node: Node }>; @ContentChild(ViewerToolbarComponent) toolbar: ViewerToolbarComponent; @@ -231,14 +232,14 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy { constructor(private apiService: AlfrescoApiService, private nodesApiService: NodesApiService, - private renditionViewerService: RenditionViewerService, + private renditionService: RenditionService, private viewUtilService: ViewUtilService, private logService: LogService, private contentService: ContentService, private uploadService: UploadService, public dialog: MatDialog, private cdr: ChangeDetectorRef) { - renditionViewerService.maxRetries = this.maxRetries; + renditionService.maxRetries = this.maxRetries; } @@ -320,16 +321,16 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy { if (viewerType === 'unknown') { let nodeRendition; if (versionData) { - nodeRendition = await this.renditionViewerService.getNodeRendition(nodeData.id, versionData.id); + nodeRendition = await this.renditionService.getNodeRendition(nodeData.id, versionData.id); } else { - nodeRendition = await this.renditionViewerService.getNodeRendition(nodeData.id); + nodeRendition = await this.renditionService.getNodeRendition(nodeData.id); } - if(nodeRendition){ + if (nodeRendition) { urlFileContent = nodeRendition.url; mimeType = nodeRendition.mimeType; } } else if (viewerType === 'media') { - this.tracks = await this.renditionViewerService.generateMediaTracksRendition(this.nodeId); + this.tracks = await this.renditionService.generateMediaTracksRendition(this.nodeId); } this.mimeType = mimeType; @@ -394,7 +395,7 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy { onPrintContent(event: MouseEvent) { if (this.allowPrint) { if (!event.defaultPrevented) { - this.renditionViewerService.printFileGeneric(this.nodeId, this.mimeType); + this.renditionService.printFileGeneric(this.nodeId, this.mimeType); } } } diff --git a/lib/content-services/src/lib/viewer/public-api.ts b/lib/content-services/src/lib/viewer/public-api.ts index da745e3b45..b3ca172d46 100644 --- a/lib/content-services/src/lib/viewer/public-api.ts +++ b/lib/content-services/src/lib/viewer/public-api.ts @@ -15,7 +15,6 @@ * limitations under the License. */ -export * from './services/rendition-viewer.service'; export * from './components/alfresco-viewer.component'; export * from './alfresco-viewer.module'; diff --git a/lib/core/src/lib/about/about.component.stories.ts b/lib/core/src/lib/about/about.component.stories.ts index b852879dff..715b00592b 100644 --- a/lib/core/src/lib/about/about.component.stories.ts +++ b/lib/core/src/lib/about/about.component.stories.ts @@ -18,10 +18,8 @@ import { Meta, moduleMetadata, Story } from '@storybook/angular'; import { AboutComponent } from './about.component'; import { AboutModule } from './about.module'; -import { DiscoveryApiService } from '../services'; import { AuthenticationService } from '../auth/services/authentication.service'; import { AuthenticationMock } from '../auth/mock/authentication.service.mock'; -import { DiscoveryApiServiceMock } from '../mock/discovery-api.service.mock'; import { AppExtensionService, AppExtensionServiceMock } from '@alfresco/adf-extensions'; import { AppConfigService } from '../app-config/app-config.service'; import { AppConfigServiceMock } from '../common/mock/app-config.service.mock'; @@ -35,7 +33,6 @@ export default { imports: [CoreStoryModule, AboutModule], providers: [ { provide: AuthenticationService, useClass: AuthenticationMock }, - { provide: DiscoveryApiService, useClass: DiscoveryApiServiceMock }, { provide: AppExtensionService, useClass: AppExtensionServiceMock }, { provide: AppConfigService, useClass: AppConfigServiceMock } ] diff --git a/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.spec.ts b/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.spec.ts index 4230d67b31..469d4c78db 100644 --- a/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.spec.ts +++ b/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.spec.ts @@ -23,15 +23,13 @@ import { AuthGuardSsoRoleService } from './auth-guard-sso-role.service'; import { JwtHelperService } from '../services/jwt-helper.service'; import { MatDialog } from '@angular/material/dialog'; import { TranslateModule } from '@ngx-translate/core'; -import { UserAccessService } from '../../services/user-access.service'; -import { UserContentAccessService } from '../../services/user-content-access.service'; +import { UserAccessService } from '../services/user-access.service'; describe('Auth Guard SSO role service', () => { let authGuard: AuthGuardSsoRoleService; let jwtHelperService: JwtHelperService; let routerService: Router; - let userContentAccessService: UserContentAccessService; let userAccessService: UserAccessService; setupTestBed({ @@ -46,7 +44,6 @@ describe('Auth Guard SSO role service', () => { authGuard = TestBed.inject(AuthGuardSsoRoleService); jwtHelperService = TestBed.inject(JwtHelperService); routerService = TestBed.inject(Router); - userContentAccessService = TestBed.inject(UserContentAccessService); userAccessService = TestBed.inject(UserAccessService); userAccessService.resetAccess(); }); @@ -178,43 +175,6 @@ describe('Auth Guard SSO role service', () => { expect(materialDialog.closeAll).toHaveBeenCalled(); }); - describe('Content Admin', () => { - - it('Should give access to a content section (ALFRESCO_ADMINISTRATORS) when the user has content admin capability', async () => { - spyOn(userContentAccessService, 'isCurrentUserAdmin').and.returnValue(Promise.resolve(true)); - - spyUserAccess([], {}); - - const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); - router.data = { roles: ['ALFRESCO_ADMINISTRATORS'] }; - - expect(await authGuard.canActivate(router)).toBe(true); - }); - - it('Should not give access to a content section (ALFRESCO_ADMINISTRATORS) when the user does not have content admin capability', async () => { - spyOn(userContentAccessService, 'isCurrentUserAdmin').and.returnValue(Promise.resolve(false)); - - spyUserAccess([], {}); - - const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); - router.data = { roles: ['ALFRESCO_ADMINISTRATORS'] }; - - expect(await authGuard.canActivate(router)).toBe(false); - }); - - it('Should not call the service to check if the user has content admin capability when the roles do not contain ALFRESCO_ADMINISTRATORS', async () => { - const isCurrentAdminSpy = spyOn(userContentAccessService, 'isCurrentUserAdmin').and.stub(); - spyUserAccess([], {}); - - const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); - router.data = { roles: ['fakeRole'] }; - - await authGuard.canActivate(router); - - expect(isCurrentAdminSpy).not.toHaveBeenCalled(); - }); - }); - describe('Excluded Roles', () => { it('Should canActivate be false when the user has one of the excluded roles', async () => { spyUserAccess(['MOCK_USER_ROLE'], {}); @@ -234,24 +194,5 @@ describe('Auth Guard SSO role service', () => { expect(result).toBeTruthy(); }); - it('Should canActivate be true when the user has none of the excluded role and is not a content admin', async () => { - spyOn(userContentAccessService, 'isCurrentUserAdmin').and.returnValue(Promise.resolve(false)); - spyUserAccess(['MOCK_USER_ROLE'], {}); - - const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); - router.data = { roles: ['MOCK_USER_ROLE'], excludedRoles: ['ALFRESCO_ADMINISTRATORS'] }; - - expect(await authGuard.canActivate(router)).toBe(true); - }); - - it('Should canActivate be false if the user is a content admin but has one of the excluded roles', async () => { - spyOn(userContentAccessService, 'isCurrentUserAdmin').and.returnValue(Promise.resolve(false)); - spyUserAccess(['MOCK_USER_ROLE'], {}); - - const router: ActivatedRouteSnapshot = new ActivatedRouteSnapshot(); - router.data = { roles: ['ALFRESCO_ADMINISTRATORS'], excludedRoles: ['MOCK_USER_ROLE'] }; - - expect(await authGuard.canActivate(router)).toBe(false); - }); }); }); diff --git a/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.ts b/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.ts index 620512b680..212548ada6 100644 --- a/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.ts +++ b/lib/core/src/lib/auth/guard/auth-guard-sso-role.service.ts @@ -18,9 +18,7 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router'; import { MatDialog } from '@angular/material/dialog'; -import { ContentGroups } from '../../services/people-content.service'; -import { UserAccessService } from '../../services/user-access.service'; -import { UserContentAccessService } from '../../services/user-content-access.service'; +import { UserAccessService } from '../services/user-access.service'; @Injectable({ providedIn: 'root' @@ -28,8 +26,7 @@ import { UserContentAccessService } from '../../services/user-content-access.ser export class AuthGuardSsoRoleService implements CanActivate { constructor(private userAccessService: UserAccessService, private router: Router, - private dialog: MatDialog, - private userContentAccessService: UserContentAccessService) { + private dialog: MatDialog) { } async canActivate(route: ActivatedRouteSnapshot): Promise { @@ -74,14 +71,7 @@ export class AuthGuardSsoRoleService implements CanActivate { } private async hasRoles(roles: string[] = []): Promise { - if (this.containsAlfrescoAdminRole(roles)) { - return await this.userContentAccessService.isCurrentUserAdmin() || this.userAccessService.hasGlobalAccess(roles); - } return this.userAccessService.hasGlobalAccess(roles); } - private containsAlfrescoAdminRole(roles: string []): boolean { - return roles.includes(ContentGroups.ALFRESCO_ADMINISTRATORS); - } - } diff --git a/lib/core/src/lib/models/application-access.model.ts b/lib/core/src/lib/auth/models/application-access.model.ts similarity index 100% rename from lib/core/src/lib/models/application-access.model.ts rename to lib/core/src/lib/auth/models/application-access.model.ts diff --git a/lib/core/src/lib/models/user-access.model.ts b/lib/core/src/lib/auth/models/user-access.model.ts similarity index 100% rename from lib/core/src/lib/models/user-access.model.ts rename to lib/core/src/lib/auth/models/user-access.model.ts diff --git a/lib/core/src/lib/auth/public-api.ts b/lib/core/src/lib/auth/public-api.ts index c7df01d12b..c959605d58 100644 --- a/lib/core/src/lib/auth/public-api.ts +++ b/lib/core/src/lib/auth/public-api.ts @@ -29,6 +29,7 @@ export * from './services/identity-user.service'; export * from './services/identity-group.service'; export * from './services/jwt-helper.service'; export * from './services/oauth2.service'; +export * from './services/user-access.service'; export * from './interfaces/identity-user.service.interface'; export * from './interfaces/identity-group.interface'; @@ -41,4 +42,7 @@ export * from './models/identity-group.model'; export * from './models/identity-user.model'; export * from './models/identity-role.model'; +export * from './models/user-access.model'; +export * from './models/application-access.model'; + diff --git a/lib/core/src/lib/services/user-access.service.spec.ts b/lib/core/src/lib/auth/services/user-access.service.spec.ts similarity index 95% rename from lib/core/src/lib/services/user-access.service.spec.ts rename to lib/core/src/lib/auth/services/user-access.service.spec.ts index 04cd15460f..9008d645a3 100644 --- a/lib/core/src/lib/services/user-access.service.spec.ts +++ b/lib/core/src/lib/auth/services/user-access.service.spec.ts @@ -15,14 +15,14 @@ * limitations under the License. */ -import { CoreTestingModule, setupTestBed } from '../testing'; +import { CoreTestingModule, setupTestBed } from '../../testing'; import { TestBed } from '@angular/core/testing'; import { UserAccessService } from './user-access.service'; -import { JwtHelperService } from '../auth/services/jwt-helper.service'; -import { OAuth2Service } from '../auth/services/oauth2.service'; +import { JwtHelperService } from './jwt-helper.service'; +import { OAuth2Service } from './oauth2.service'; import { of, throwError } from 'rxjs'; -import { userAccessMock } from '../mock/user-access.mock'; -import { AppConfigService } from '../app-config'; +import { userAccessMock } from '../../mock/user-access.mock'; +import { AppConfigService } from '../../app-config'; describe('UserAccessService', () => { let userAccessService: UserAccessService; diff --git a/lib/core/src/lib/services/user-access.service.ts b/lib/core/src/lib/auth/services/user-access.service.ts similarity index 95% rename from lib/core/src/lib/services/user-access.service.ts rename to lib/core/src/lib/auth/services/user-access.service.ts index 857b836c97..67f2019e94 100644 --- a/lib/core/src/lib/services/user-access.service.ts +++ b/lib/core/src/lib/auth/services/user-access.service.ts @@ -16,11 +16,11 @@ */ import { Injectable } from '@angular/core'; -import { JwtHelperService } from '../auth/services/jwt-helper.service'; +import { JwtHelperService } from './jwt-helper.service'; import { ApplicationAccessModel } from '../models/application-access.model'; import { UserAccessModel } from '../models/user-access.model'; -import { AppConfigService } from '../app-config/app-config.service'; -import { OAuth2Service } from '../auth/services/oauth2.service'; +import { AppConfigService } from '../../app-config/app-config.service'; +import { OAuth2Service } from './oauth2.service'; import { catchError } from 'rxjs/operators'; import { of } from 'rxjs'; diff --git a/lib/core/src/lib/comments/comment-list/comment-list.component.stories.ts b/lib/core/src/lib/comments/comment-list/comment-list.component.stories.ts index bac59a2b22..2560b57910 100644 --- a/lib/core/src/lib/comments/comment-list/comment-list.component.stories.ts +++ b/lib/core/src/lib/comments/comment-list/comment-list.component.stories.ts @@ -20,7 +20,7 @@ import { CoreStoryModule } from '../../testing/core.story.module'; import { CommentListComponent } from './comment-list.component'; import { CommentsModule } from '../comments.module'; import { commentsTaskData, commentsNodeData } from '../mocks/comments.stories.mock'; -import { EcmUserService } from '../../services'; +import { CommentListServiceMock } from './mocks/comment-list.service.mock'; export default { component: CommentListComponent, @@ -29,7 +29,7 @@ export default { moduleMetadata({ imports: [CoreStoryModule, CommentsModule], providers: [ - { provide: EcmUserService, useValue: { getUserProfileImage: () => '../assets/images/logo.png' } } + { provide: CommentListServiceMock, useValue: { getUserProfileImage: () => '../assets/images/logo.png' } } ] }) ], diff --git a/lib/core/src/lib/comments/comment-list/mocks/comment-list.mock.ts b/lib/core/src/lib/comments/comment-list/mocks/comment-list.mock.ts index 18317c40f4..76e1059124 100644 --- a/lib/core/src/lib/comments/comment-list/mocks/comment-list.mock.ts +++ b/lib/core/src/lib/comments/comment-list/mocks/comment-list.mock.ts @@ -16,14 +16,13 @@ */ import { CommentModel } from '../../../models/comment.model'; -import { UserProcessModel } from '../../../models/user-process.model'; -export const testUser = new UserProcessModel({ +export const testUser = { id: '1', firstName: 'Test', lastName: 'User', email: 'tu@domain.com' -}); +}; export const mockCommentOne = new CommentModel({ id: 1, diff --git a/lib/core/src/lib/comments/comments.component.stories.ts b/lib/core/src/lib/comments/comments.component.stories.ts index 7c8fac9745..8b808d9cad 100644 --- a/lib/core/src/lib/comments/comments.component.stories.ts +++ b/lib/core/src/lib/comments/comments.component.stories.ts @@ -16,7 +16,6 @@ */ import { Meta, moduleMetadata, Story } from '@storybook/angular'; -import { EcmUserService } from '../services'; import { CoreStoryModule } from '../testing/core.story.module'; import { CommentsComponent } from './comments.component'; import { CommentsModule } from './comments.module'; @@ -31,7 +30,7 @@ export default { moduleMetadata({ imports: [CoreStoryModule, CommentsModule], providers: [ - { provide: EcmUserService, useValue: { getUserProfileImage: () => '../assets/images/logo.png' } }, + { provide: CommentsServiceStoriesMock, useValue: { getUserProfileImage: () => '../assets/images/logo.png' } }, { provide: ADF_COMMENTS_SERVICE, useClass: CommentsServiceStoriesMock } ] }) diff --git a/lib/core/src/lib/comments/mocks/comments.service.mock.ts b/lib/core/src/lib/comments/mocks/comments.service.mock.ts index 01a5332277..d11d677a6f 100644 --- a/lib/core/src/lib/comments/mocks/comments.service.mock.ts +++ b/lib/core/src/lib/comments/mocks/comments.service.mock.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { CommentModel, EcmUserModel } from '../../models'; +import { CommentModel, User } from '../../models'; import { Observable, of } from 'rxjs'; import { CommentsService } from '../interfaces'; @@ -57,7 +57,7 @@ export const commentsResponseMock = { id: 'hruser', email: 'test', isAdmin: () => false - } as EcmUserModel, + } as User, isSelected: false } as CommentModel, { @@ -84,7 +84,7 @@ export const commentsResponseMock = { id: 'hruser', email: 'test', isAdmin: () => false - } as EcmUserModel, + } as User, isSelected: false } as CommentModel, { @@ -111,7 +111,7 @@ export const commentsResponseMock = { id: 'hruser', email: 'test', isAdmin: () => false - } as EcmUserModel, + } as User, isSelected: false } as CommentModel ]), @@ -139,7 +139,7 @@ export const commentsResponseMock = { id: 'hruser', email: 'test', isAdmin: () => false - } as EcmUserModel, + } as User, isSelected: false } as CommentModel) }; diff --git a/lib/core/src/lib/comments/mocks/comments.service.stories.mock.ts b/lib/core/src/lib/comments/mocks/comments.service.stories.mock.ts index 3f636c21f8..18b956e61c 100644 --- a/lib/core/src/lib/comments/mocks/comments.service.stories.mock.ts +++ b/lib/core/src/lib/comments/mocks/comments.service.stories.mock.ts @@ -15,10 +15,11 @@ * limitations under the License. */ -import { CommentModel, EcmUserModel } from '../../models'; +import { CommentModel } from '../../models'; import { Observable, of } from 'rxjs'; import { CommentsService } from '../interfaces'; import { testUser } from './comments.stories.mock'; +import { UserLike } from '../../pipes/user-like.interface'; export class CommentsServiceStoriesMock implements Partial { @@ -58,7 +59,7 @@ export const commentsResponseMock = { id: 'hruser', email: 'test', isAdmin: () => false - } as EcmUserModel, + } as UserLike, isSelected: false } as CommentModel, { @@ -85,7 +86,7 @@ export const commentsResponseMock = { id: 'hruser', email: 'test', isAdmin: () => false - } as EcmUserModel, + } as UserLike, isSelected: false } as CommentModel, { @@ -112,7 +113,7 @@ export const commentsResponseMock = { id: 'hruser', email: 'test', isAdmin: () => false - } as EcmUserModel, + } as UserLike, isSelected: false } as CommentModel ]), diff --git a/lib/core/src/lib/comments/mocks/comments.stories.mock.ts b/lib/core/src/lib/comments/mocks/comments.stories.mock.ts index da5b9175b9..dfaee02d72 100644 --- a/lib/core/src/lib/comments/mocks/comments.stories.mock.ts +++ b/lib/core/src/lib/comments/mocks/comments.stories.mock.ts @@ -15,9 +15,9 @@ * limitations under the License. */ -import { CommentModel, EcmCompanyModel, EcmUserModel } from '../../models'; +import { CommentModel } from '../../models'; -const fakeCompany: EcmCompanyModel = { +const fakeCompany: any = { organization: '', address1: '', address2: '', @@ -30,7 +30,7 @@ const fakeCompany: EcmCompanyModel = { export const getDateXMinutesAgo = (minutes: number) => new Date(new Date().getTime() - minutes * 60000); -const johnDoe: EcmUserModel = { +const johnDoe: any = { id: '1', email: 'john.doe@alfresco.com', firstName: 'John', @@ -41,7 +41,7 @@ const johnDoe: EcmUserModel = { avatarId: '001' }; -const janeEod: EcmUserModel = { +const janeEod: any = { id: '2', email: 'jane.eod@alfresco.com', firstName: 'Jane', @@ -51,7 +51,7 @@ const janeEod: EcmUserModel = { isAdmin: undefined }; -const robertSmith: EcmUserModel = { +const robertSmith: any = { id: '3', email: 'robert.smith@alfresco.com', firstName: 'Robert', @@ -61,7 +61,7 @@ const robertSmith: EcmUserModel = { isAdmin: undefined }; -export const testUser: EcmUserModel = { +export const testUser: any = { id: '44', email: 'test.user@hyland.com', firstName: 'Test', diff --git a/lib/core/src/lib/common/index.ts b/lib/core/src/lib/common/index.ts index 7475094691..9bc622e6e4 100644 --- a/lib/core/src/lib/common/index.ts +++ b/lib/core/src/lib/common/index.ts @@ -25,6 +25,8 @@ export * from './services/highlight-transform.service'; export * from './services/page-title.service'; export * from './services/thumbnail.service'; export * from './services/sort-by-category.service'; +export * from './services/download.service'; +export * from './services/url.service'; export * from './models/log-levels.model'; export * from './models/user-info-mode.enum'; diff --git a/lib/core/src/lib/services/download.service.spec.ts b/lib/core/src/lib/common/services/download.service.spec.ts similarity index 100% rename from lib/core/src/lib/services/download.service.spec.ts rename to lib/core/src/lib/common/services/download.service.spec.ts diff --git a/lib/core/src/lib/services/download.service.ts b/lib/core/src/lib/common/services/download.service.ts similarity index 100% rename from lib/core/src/lib/services/download.service.ts rename to lib/core/src/lib/common/services/download.service.ts diff --git a/lib/core/src/lib/common/services/thumbnail.service.spec.ts b/lib/core/src/lib/common/services/thumbnail.service.spec.ts index aa5e5a9a2a..07d768f28c 100644 --- a/lib/core/src/lib/common/services/thumbnail.service.spec.ts +++ b/lib/core/src/lib/common/services/thumbnail.service.spec.ts @@ -52,11 +52,6 @@ describe('ThumbnailService', () => { expect(service.getMimeTypeIcon('x-unknown/yyy')).toContain('ft_ic_miscellaneous'); }); - it('should return the thumbnail URL for a content item', () => { - spyOn(service['contentApi'], 'getDocumentThumbnailUrl').and.returnValue('/fake-thumbnail.png'); - expect(service.getDocumentThumbnailUrl('some-id')).toContain('/fake-thumbnail.png'); - }); - it('should return the correct icon for a mht file', () => { expect(service.getMimeTypeIcon('multipart/related')).toContain('ft_ic_website.svg'); }); diff --git a/lib/core/src/lib/common/services/thumbnail.service.ts b/lib/core/src/lib/common/services/thumbnail.service.ts index b21d5f0373..fc94af100c 100644 --- a/lib/core/src/lib/common/services/thumbnail.service.ts +++ b/lib/core/src/lib/common/services/thumbnail.service.ts @@ -19,8 +19,6 @@ import { Injectable } from '@angular/core'; import { MatIconRegistry } from '@angular/material/icon'; import { DomSanitizer } from '@angular/platform-browser'; -import { AlfrescoApiService } from '../../services/alfresco-api.service'; -import { ContentApi, NodeEntry } from '@alfresco/js-api'; const DEFAULT_ICON = './assets/images/ft_ic_miscellaneous.svg'; @@ -163,13 +161,7 @@ export class ThumbnailService { 'multipart/related': './assets/images/ft_ic_website.svg' }; - private _contentApi: ContentApi; - get contentApi(): ContentApi { - this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance()); - return this._contentApi; - } - - constructor(protected apiService: AlfrescoApiService, matIconRegistry: MatIconRegistry, sanitizer: DomSanitizer) { + constructor(matIconRegistry: MatIconRegistry, sanitizer: DomSanitizer) { Object.keys(this.mimeTypeIcons).forEach((key) => { const url = sanitizer.bypassSecurityTrustResourceUrl(this.mimeTypeIcons[key]); @@ -178,32 +170,6 @@ export class ThumbnailService { }); } - /** - * Gets a thumbnail URL for the given document node. - * - * @param node Node or Node ID to get URL for. - * @param attachment Toggles whether to retrieve content as an attachment for download - * @param ticket Custom ticket to use for authentication - * @returns URL string - */ - getDocumentThumbnailUrl(node: NodeEntry | string, attachment?: boolean, ticket?: string): string { - let resultUrl: string; - - if (node) { - let nodeId: string; - - if (typeof node === 'string') { - nodeId = node; - } else if (node.entry) { - nodeId = node.entry.id; - } - - resultUrl = this.contentApi.getDocumentThumbnailUrl(nodeId, attachment, ticket); - } - - return resultUrl || DEFAULT_ICON; - } - /** * Gets a thumbnail URL for a MIME type. * diff --git a/lib/core/src/lib/services/url.service.ts b/lib/core/src/lib/common/services/url.service.ts similarity index 100% rename from lib/core/src/lib/services/url.service.ts rename to lib/core/src/lib/common/services/url.service.ts diff --git a/lib/core/src/lib/core.module.ts b/lib/core/src/lib/core.module.ts index 6613fbb5a6..3f366e4266 100644 --- a/lib/core/src/lib/core.module.ts +++ b/lib/core/src/lib/core.module.ts @@ -43,7 +43,6 @@ import { NotificationHistoryModule } from './notifications/notification-history. import { BlankPageModule } from './blank-page/blank-page.module'; import { DirectiveModule } from './directives/directive.module'; -import { DownloadZipDialogModule } from './dialogs/download-zip/download-zip.dialog.module'; import { PipeModule } from './pipes/pipe.module'; import { AlfrescoApiService } from './services/alfresco-api.service'; @@ -86,7 +85,6 @@ const defaultConfig: Config = { useAngularBasedHttpClientInAlfrescoJs: false }; CommonModule, IdentityUserInfoModule, DirectiveModule, - DownloadZipDialogModule, FormsModule, ReactiveFormsModule, MaterialModule, @@ -124,7 +122,6 @@ const defaultConfig: Config = { useAngularBasedHttpClientInAlfrescoJs: false }; PipeModule, CommonModule, DirectiveModule, - DownloadZipDialogModule, ClipboardModule, FormsModule, IdentityUserInfoModule, diff --git a/lib/core/src/lib/datatable/components/location-cell/location-cell.component.ts b/lib/core/src/lib/datatable/components/location-cell/location-cell.component.ts index be01811c55..b83a8f460d 100644 --- a/lib/core/src/lib/datatable/components/location-cell/location-cell.component.ts +++ b/lib/core/src/lib/datatable/components/location-cell/location-cell.component.ts @@ -22,7 +22,6 @@ import { OnInit, Optional, ViewEncapsulation } from '@angular/core'; -import { PathInfoEntity } from '@alfresco/js-api'; import { DataTableCellComponent } from '../datatable-cell/datatable-cell.component'; import { DataTableService } from '../../services/datatable.service'; @@ -50,7 +49,7 @@ export class LocationCellComponent extends DataTableCellComponent implements OnI /** @override */ ngOnInit() { if (this.column && this.column.key && this.row && this.data) { - const path: PathInfoEntity = this.data.getValue( + const path: any = this.data.getValue( this.row, this.column, this.resolverFn diff --git a/lib/core/src/lib/dialogs/public-api.ts b/lib/core/src/lib/dialogs/public-api.ts index fbf699a4fc..75a158e8ab 100755 --- a/lib/core/src/lib/dialogs/public-api.ts +++ b/lib/core/src/lib/dialogs/public-api.ts @@ -15,8 +15,5 @@ * limitations under the License. */ -export * from './download-zip/download-zip.dialog'; -export * from './download-zip/download-zip.dialog.module'; - export * from './edit-json/edit-json.dialog'; export * from './edit-json/edit-json.dialog.module'; diff --git a/lib/core/src/lib/directives/directive.module.ts b/lib/core/src/lib/directives/directive.module.ts index ce6d1cffd5..a1dd7d2bc1 100644 --- a/lib/core/src/lib/directives/directive.module.ts +++ b/lib/core/src/lib/directives/directive.module.ts @@ -22,7 +22,6 @@ import { MaterialModule } from '../material.module'; import { HighlightDirective } from './highlight.directive'; import { LogoutDirective } from './logout.directive'; import { UploadDirective } from './upload.directive'; -import { NodeDownloadDirective } from './node-download.directive'; import { TooltipCardDirective } from './tooltip-card/tooltip-card.directive'; import { OverlayModule } from '@angular/cdk/overlay'; import { TooltipCardComponent } from './tooltip-card/tooltip-card.component'; @@ -37,7 +36,6 @@ import { InfiniteSelectScrollDirective } from './infinite-select-scroll.directiv declarations: [ HighlightDirective, LogoutDirective, - NodeDownloadDirective, UploadDirective, TooltipCardDirective, TooltipCardComponent, @@ -46,7 +44,6 @@ import { InfiniteSelectScrollDirective } from './infinite-select-scroll.directiv exports: [ HighlightDirective, LogoutDirective, - NodeDownloadDirective, UploadDirective, TooltipCardDirective, InfiniteSelectScrollDirective diff --git a/lib/core/src/lib/directives/public-api.ts b/lib/core/src/lib/directives/public-api.ts index 1b0aa356e6..be03353e6a 100644 --- a/lib/core/src/lib/directives/public-api.ts +++ b/lib/core/src/lib/directives/public-api.ts @@ -17,7 +17,6 @@ export * from './highlight.directive'; export * from './logout.directive'; -export * from './node-download.directive'; export * from './upload.directive'; export * from './tooltip-card/tooltip-card.directive'; export * from './infinite-select-scroll.directive'; diff --git a/lib/core/src/lib/events/public-api.ts b/lib/core/src/lib/events/public-api.ts index 86f667fa8d..6a34c421d4 100644 --- a/lib/core/src/lib/events/public-api.ts +++ b/lib/core/src/lib/events/public-api.ts @@ -17,4 +17,3 @@ export * from './base.event'; export * from './base-ui.event'; -export * from './file.event'; diff --git a/lib/core/src/lib/form/components/widgets/core/content-link.model.ts b/lib/core/src/lib/form/components/widgets/core/content-link.model.ts index f73e5095bc..94214ca833 100644 --- a/lib/core/src/lib/form/components/widgets/core/content-link.model.ts +++ b/lib/core/src/lib/form/components/widgets/core/content-link.model.ts @@ -17,9 +17,7 @@ /* eslint-disable @angular-eslint/component-selector */ - import { RelatedContentRepresentation } from '@alfresco/js-api'; - - export class ContentLinkModel implements RelatedContentRepresentation { + export class ContentLinkModel { contentAvailable: boolean; created: Date; diff --git a/lib/core/src/lib/form/public-api.ts b/lib/core/src/lib/form/public-api.ts index 8a9d7d1e38..f7f23e213f 100644 --- a/lib/core/src/lib/form/public-api.ts +++ b/lib/core/src/lib/form/public-api.ts @@ -32,5 +32,4 @@ export * from './events'; export * from './form-base.module'; export * from './models/form-rules.model'; -export * from './models/form-definition.model'; export * from './models/task-process-variable.model'; diff --git a/lib/core/src/lib/mock/discovery-api.service.mock.ts b/lib/core/src/lib/mock/discovery-api.service.mock.ts deleted file mode 100644 index 13502f482c..0000000000 --- a/lib/core/src/lib/mock/discovery-api.service.mock.ts +++ /dev/null @@ -1,114 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Injectable } from '@angular/core'; -import { Observable, Subject, of } from 'rxjs'; -import { BpmProductVersionModel } from '../models/product-version.model'; -import { - RepositoryInfo, - SystemPropertiesRepresentation -} from '@alfresco/js-api'; - -@Injectable({ - providedIn: 'root' -}) -export class DiscoveryApiServiceMock { - - /** - * Gets product information for Content Services. - */ - ecmProductInfo$ = new Subject(); - - public getEcmProductInfo(): Observable { - return of({ - edition: 'Enterprise', - version: { - major: '7', - minor: '2', - patch: '0', - hotfix: '0', - schema: 16000, - label: 'rde8705d0-blocal', - display: '7.2.0.0 (rde8705d0-blocal) schema 16000' - }, - license: { - issuedAt: '2021-11-10T23:30:30.234+0000', - expiresAt: '2021-11-12T00:00:00.000+0000', - remainingDays: 1, - holder: 'Trial User', - mode: 'ENTERPRISE', - entitlements: { isClusterEnabled: true, isCryptodocEnabled: false } - }, - status: { - isReadOnly: false, - isAuditEnabled: true, - isQuickShareEnabled: true, - isThumbnailGenerationEnabled: true, - isDirectAccessUrlEnabled: true - }, - modules: [{ - id: 'org_alfresco_module_rm', - title: 'AGS Repo', - description: 'Alfresco Governance Services Repository Extension', - version: '14.26', - installState: 'UNKNOWN', - versionMin: '7.0.0', - versionMax: '999' - }, { - id: 'org_alfresco_integrations_S3Connector', - title: 'S3 Connector', - description: 'Provides Amazon S3 content storage for the contentstore and deleted contentstore', - version: '5.0.0-A1', - installDate: '2021-11-10T23:29:19.560+0000', - installState: 'INSTALLED', - versionMin: '7.2', - versionMax: '999' - }, { - id: 'alfresco-trashcan-cleaner', - title: 'alfresco-trashcan-cleaner project', - description: 'The Alfresco Trashcan Cleaner (Alfresco Module)', - version: '2.4.1', - installState: 'UNKNOWN', - versionMin: '0', - versionMax: '999' - }, { - id: 'alfresco-content-connector-for-salesforce-repo', - title: 'Alfresco Content Connector for Salesforce Repository AMP', - description: 'Alfresco Repository artifacts needed for the Alfresco Content Connector for Salesforce Repository Amp', - version: '2.3.0.3', - installDate: '2021-11-10T23:29:18.918+0000', - installState: 'INSTALLED', - versionMin: '6.2.0', - versionMax: '999' - }] - }); - } - - public getBpmProductInfo(): Observable { - return of({ - revisionVersion: '0-RC1', - edition: 'Alfresco Process Services (powered by Activiti)', - type: 'bpmSuite', - majorVersion: '2', - minorVersion: '1' - }); - } - - public getBPMSystemProperties(): Observable { - return of({} as any); - } -} diff --git a/lib/core/src/lib/mock/form.mock.ts b/lib/core/src/lib/mock/form.mock.ts deleted file mode 100644 index 4c2525efed..0000000000 --- a/lib/core/src/lib/mock/form.mock.ts +++ /dev/null @@ -1,1332 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export const cloudFormMock = { - id: 'form-b661635a-dc3e-4557-914a-3498ed47189c', - name: 'form-with-all-fields', - description: '', - version: 0, - tabs: [], - fields: [ - { - fieldType: 'ContainerRepresentation', - id: '26b10e64-0403-4686-a75b-0d45279ce3a8', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - fieldType: 'FormFieldRepresentation', - id: 'text1', - name: 'Text1', - type: 'text', - value: null, - required: false, - readOnly: true, - overrideId: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - minValue: null, - maxValue: null, - regexPattern: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ], - 2: [ - { - fieldType: 'FormFieldRepresentation', - id: 'text2', - name: 'Text2', - type: 'text', - value: null, - required: false, - readOnly: true, - overrideId: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - minValue: null, - maxValue: null, - regexPattern: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ] - } - }, - { - fieldType: 'ContainerRepresentation', - id: '69c1390a-8d8d-423c-8efb-8e43401efa42', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - fieldType: 'FormFieldRepresentation', - id: 'multilinetext1', - name: 'Multiline text1', - type: 'multi-line-text', - overrideId: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - regexPattern: null, - required: false, - readOnly: true, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ], - 2: [ - { - fieldType: 'FormFieldRepresentation', - id: 'multilinetext2', - name: 'Multiline text2', - type: 'multi-line-text', - overrideId: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - regexPattern: null, - required: false, - readOnly: true, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ] - } - }, - { - fieldType: 'ContainerRepresentation', - id: 'df046463-2d65-4388-9ee1-0e1517985215', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - fieldType: 'FormFieldRepresentation', - id: 'number1', - overrideId: false, - name: 'Number1', - type: 'integer', - colspan: 1, - placeholder: null, - readOnly: true, - minValue: null, - maxValue: null, - required: false, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ], - 2: [ - { - fieldType: 'FormFieldRepresentation', - id: 'number2', - overrideId: false, - name: 'Number2', - type: 'integer', - colspan: 1, - placeholder: null, - readOnly: true, - minValue: null, - maxValue: null, - required: false, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ] - } - }, - { - fieldType: 'ContainerRepresentation', - id: '9672cc7b-1959-49c9-96be-3816e57bdfc1', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - fieldType: 'FormFieldRepresentation', - id: 'checkbox1', - name: 'Checkbox1', - type: 'boolean', - required: false, - readOnly: true, - colspan: 1, - overrideId: false, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ], - 2: [ - { - fieldType: 'FormFieldRepresentation', - id: 'checkbox2', - name: 'Checkbox2', - type: 'boolean', - required: false, - readOnly: true, - colspan: 1, - overrideId: false, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ] - } - }, - { - fieldType: 'ContainerRepresentation', - id: '054d193e-a899-4494-9a3e-b489315b7d57', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - fieldType: 'FormFieldRepresentation', - id: 'dropdown1', - name: 'Dropdown1', - type: 'dropdown', - value: null, - required: false, - readOnly: true, - overrideId: false, - colspan: 1, - placeholder: null, - optionType: 'manual', - options: [], - endpoint: null, - requestHeaders: null, - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ], - 2: [ - { - fieldType: 'FormFieldRepresentation', - id: 'dropdown2', - name: 'Dropdown2', - type: 'dropdown', - value: null, - required: false, - readOnly: true, - overrideId: false, - colspan: 1, - placeholder: null, - optionType: 'manual', - options: [], - endpoint: null, - requestHeaders: null, - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ] - } - }, - { - fieldType: 'ContainerRepresentation', - id: '1f8f0b66-e022-4667-91b4-bbbf2ddc36fb', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - fieldType: 'FormFieldRepresentation', - id: 'amount1', - name: 'Amount1', - type: 'amount', - value: null, - required: false, - readOnly: true, - overrideId: false, - colspan: 1, - placeholder: '123', - minValue: null, - maxValue: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - }, - enableFractions: false, - currency: '$' - } - ], - 2: [ - { - fieldType: 'FormFieldRepresentation', - id: 'amount2', - name: 'Amount2', - type: 'amount', - value: null, - required: false, - readOnly: true, - overrideId: false, - colspan: 1, - placeholder: '123', - minValue: null, - maxValue: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - }, - enableFractions: false, - currency: '$' - } - ] - } - }, - { - fieldType: 'ContainerRepresentation', - id: '541a368b-67ee-4a7c-ae7e-232c050b9e24', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - fieldType: 'FormFieldRepresentation', - id: 'date1', - name: 'Date1', - type: 'date', - overrideId: false, - required: false, - readOnly: true, - colspan: 1, - placeholder: null, - minValue: null, - maxValue: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - }, - dateDisplayFormat: 'D-M-YYYY' - } - ], - 2: [ - { - fieldType: 'FormFieldRepresentation', - id: 'date2', - name: 'Date2', - type: 'date', - overrideId: false, - required: false, - readOnly: true, - colspan: 1, - placeholder: null, - minValue: null, - maxValue: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - }, - dateDisplayFormat: 'D-M-YYYY' - } - ] - } - }, - { - fieldType: 'ContainerRepresentation', - id: 'e79cb7e2-3dc1-4c79-8158-28662c28a9f3', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - fieldType: 'FormFieldRepresentation', - id: 'radiobuttons1', - name: 'Radio buttons1', - type: 'radio-buttons', - value: null, - required: false, - readOnly: true, - overrideId: false, - colspan: 1, - placeholder: null, - optionType: 'manual', - options: [ - { - id: 'option_1', - name: 'Option 1' - }, - { - id: 'option_2', - name: 'Option 2' - } - ], - endpoint: null, - requestHeaders: null, - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ], - 2: [ - { - fieldType: 'FormFieldRepresentation', - id: 'radiobuttons2', - name: 'Radio buttons2', - type: 'radio-buttons', - value: null, - required: false, - readOnly: true, - overrideId: false, - colspan: 1, - placeholder: null, - optionType: 'manual', - options: [ - { - id: 'option_1', - name: 'Option 1' - }, - { - id: 'option_2', - name: 'Option 2' - } - ], - endpoint: null, - requestHeaders: null, - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ] - } - }, - { - fieldType: 'ContainerRepresentation', - id: '7c01ed35-be86-4be7-9c28-ed640a5a2ae1', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - fieldType: 'AttachFileFieldRepresentation', - id: 'attachfile1', - name: 'Attach file1', - type: 'upload', - value: null, - required: false, - readOnly: true, - overrideId: false, - colspan: 1, - placeholder: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2, - fileSource: { - serviceId: 'all-file-sources', - name: 'All file sources' - }, - multiple: false, - link: false - } - } - ], - 2: [ - { - fieldType: 'AttachFileFieldRepresentation', - id: 'attachfile2', - name: 'Attach file2', - type: 'upload', - value: null, - required: false, - readOnly: true, - overrideId: false, - colspan: 1, - placeholder: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2, - fileSource: { - serviceId: 'all-file-sources', - name: 'All file sources' - }, - multiple: false, - link: false - } - } - ] - } - }, - { - fieldType: 'ContainerRepresentation', - id: '07b13b96-d469-4a1e-8a9a-9bb957c68869', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - fieldType: 'FormFieldRepresentation', - id: 'displayvalue1', - name: 'Display value1', - type: 'readonly', - value: 'No field selected', - readOnly: true, - required: false, - overrideId: false, - colspan: 1, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2, - field: { - id: 'displayvalue', - name: 'Display value', - type: 'text', - responseVariable: true - } - } - } - ], - 2: [ - { - fieldType: 'FormFieldRepresentation', - id: 'displayvalue2', - name: 'Display value2', - type: 'readonly', - value: 'No field selected', - readOnly: true, - required: false, - overrideId: false, - colspan: 1, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2, - field: { - id: 'displayvalue', - name: 'Display value', - type: 'text', - responseVariable: true - } - } - } - ] - } - }, - { - fieldType: 'ContainerRepresentation', - id: '1576ef25-c842-494c-ab84-265a1e3bf68d', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - fieldType: 'FormFieldRepresentation', - id: 'displaytext1', - name: 'Display text1', - type: 'readonly-text', - value: 'Display text as part of the form', - readOnly: true, - required: false, - overrideId: false, - colspan: 1, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ], - 2: [ - { - fieldType: 'FormFieldRepresentation', - id: 'displaytext2', - name: 'Display text2', - type: 'readonly-text', - value: 'Display text as part of the form', - readOnly: true, - required: false, - overrideId: false, - colspan: 1, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ] - } - } - ], - outcomes: [], - metadata: {}, - variables: [ - { - id: 'FormVarStrId', - name: 'FormVarStr', - type: 'string', - value: '' - }, - { - name: 'FormVarInt', - type: 'integer', - value: '' - }, - { - name: 'FormVarBool', - type: 'boolean', - value: '' - }, - { - name: 'FormVarDate', - type: 'date', - value: '' - }, - { - name: 'NewVar', - type: 'string', - value: '' - } - ] -}; - -export const fakeCloudForm = { - formRepresentation: { - id: 'form-de8895be-d0d7-4434-beef-559b15305d72', - name: 'StartEventForm', - description: '', - version: 0, - formDefinition: { - tabs: [], - fields: [ - { - type: 'container', - id: '5a6b24c1-db2b-45e9-9aff-142395433d23', - name: 'Label', - tab: null, - fields: { - 1: [ - { - type: 'text', - id: 'firstName', - name: 'firstName', - colspan: 1, - params: { - existingColspan: 1, - maxColspan: 2 - }, - visibilityCondition: null, - placeholder: null, - value: null, - required: false, - minLength: 0, - maxLength: 0, - regexPattern: null - } - ], - 2: [ - { - type: 'text', - id: 'lastName', - name: 'lastName', - colspan: 1, - params: { - existingColspan: 1, - maxColspan: 2 - }, - visibilityCondition: null, - placeholder: null, - value: null, - required: false, - minLength: 0, - maxLength: 0, - regexPattern: null - } - ] - }, - numberOfColumns: 2 - } - ], - outcomes: [], - metadata: {}, - variables: [] - } - } -}; - -export const emptyFormRepresentationJSON = { - description: '', - fields: [], - id: 'form-3de070b6-63df-4058-8028-ac82283d64fa', - metadata: {}, - name: 'form', - outcomes: [], - length: 0, - processDefinitionId: 'ed4a6233-0ad8-11ea-8616-e6267bbdb057', - processInstanceId: 'ec921948-0ad9-11ea-8616-e6267bbdb057', - processVariables: [], - standAlone: true, - tabs: [], - taskId: 'ec92194b-0ad9-11ea-8616-e6267bbdb057', - taskName: null, - variables: [], - version: 0 -}; - -export const conditionalUploadWidgetsMock: any = { - formRepresentation: { - id: 'form-fb7858f7-5cf6-4afe-b462-c15a5dc0c34c', - name: 'AttachVisibility', - description: '', - version: 0, - formDefinition: { - tabs: [], - fields: [ - { - id: '1dc63387-aa9d-4f06-adfa-37817e8fd394', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - id: 'Text0xlk8n', - name: 'Text', - type: 'text', - required: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - regexPattern: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ], - 2: [ - { - id: 'Attachfile0h9fr1', - name: 'Attach file', - type: 'upload', - required: false, - colspan: 1, - visibilityCondition: { - leftFormFieldId: 'Text0xlk8n', - leftRestResponseId: '', - operator: '==', - rightValue: 'Attach', - rightType: null, - rightFormFieldId: '', - rightRestResponseId: '', - nextConditionOperator: '', - nextCondition: null - }, - params: { - existingColspan: 1, - maxColspan: 2, - fileSource: { - serviceId: 'alfresco-content', - name: 'Alfresco Content' - }, - multiple: false, - link: false - } - } - ] - } - } - ], - outcomes: [ - { - id: '5f2f1c2d-5a79-4ed1-a262-4fef190d41eb', - name: 'Custom Outcome', - visibilityCondition: { - leftType: 'field', - leftValue: 'Text0xlk8n', - operator: '==', - rightValue: 'hi', - rightType: 'value', - nextConditionOperator: '', - nextCondition: null - } - } - ], - metadata: {}, - variables: [] - } - } -}; - -export const multilingualForm: any = { - formRepresentation: { - id: 'form-2aaaf20e-43d3-46bf-89be-859d5f512dd2', - name: 'multilingualform', - description: '', - version: 0, - formDefinition: { - tabs: [], - fields: [ - { - id: '451e2235-3310-4c2d-9b4a-08b53ae1640c', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - id: 'textField', - name: 'TEXT_FIELD.TITLE', - type: 'text', - required: false, - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - regexPattern: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ], - 2: [] - } - }, - { - id: '1c87df6c-514e-45a7-96bc-508562683bb3', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - id: 'fildUploadField', - name: 'FILE_UPLOAD_FIELD.TITLE', - type: 'multi-line-text', - colspan: 1, - placeholder: null, - minLength: 0, - maxLength: 0, - regexPattern: null, - required: false, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - } - } - ], - 2: [ - { - id: 'amountField', - name: 'AMOUNT_FIELD.TITLE', - type: 'amount', - required: false, - colspan: 1, - placeholder: '123', - minValue: null, - maxValue: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - }, - enableFractions: false, - currency: '$' - } - ] - } - }, - { - id: '33138eea-130f-4bba-b5a5-29ea60f31786', - name: 'Label', - type: 'container', - tab: null, - numberOfColumns: 2, - fields: { - 1: [ - { - id: 'dateField', - name: 'DATE_FIELD.TITLE', - type: 'date', - required: false, - colspan: 1, - placeholder: null, - minValue: null, - maxValue: null, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2 - }, - dateDisplayFormat: 'D-M-YYYY' - } - ], - 2: [] - } - } - ], - outcomes: [], - metadata: {}, - variables: [] - } - } -}; - -export const fakeMetadataForm = { - id: 'form-de8895be-d0d7-4434-beef-559b15305d72', - name: 'StartEventForm', - description: '', - version: 0, - formDefinition: { - tabs: [], - fields: [ - { - type: 'container', - id: '5a6b24c1-db2b-45e9-9aff-142395433d23', - name: 'Label', - tab: null, - fields: { - 1: [ - { - type: 'text', - id: 'pfx_property_one', - name: 'pfx_property_one', - colspan: 1, - params: { - existingColspan: 1, - maxColspan: 2 - }, - visibilityCondition: null, - placeholder: null, - value: null, - required: false, - minLength: 0, - maxLength: 0, - regexPattern: null - } - ], - 2: [ - { - type: 'boolean', - id: 'pfx_property_two', - name: 'pfx_property_two', - colspan: 1, - params: { - existingColspan: 1, - maxColspan: 2 - }, - visibilityCondition: null, - placeholder: null, - value: null, - required: false, - minLength: 0, - maxLength: 0, - regexPattern: null - } - ], - 3: [ - { - id: 'content_form_nodes', - name: 'Nodes', - type: 'upload', - readOnly: false, - required: true, - colspan: 1, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2, - fileSource: { - serviceId: 'alfresco-content', - name: 'Alfresco Content', - metadataAllowed: true - }, - multiple: true, - menuOptions: { - show: true, - download: true, - retrieveMetadata: true, - remove: true - }, - link: false - } - } - ], - 4: [ - { - id: 'pfx_property_three', - name: 'pfx_property_three', - required: false, - readOnly: false, - colspan: 1, - params: { - existingColspan: 1, - maxColspan: 2 - }, - visibilityCondition: null, - type: 'dropdown', - optionType: 'manual', - options: [ - { - id: 'empty', - name: 'Choose one...' - }, - { - id: 'opt_1', - name: 'Option 1' - }, - { - id: 'opt_2', - name: 'Option 2' - } - ], - value: 'empty', - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null - } - ], - 5: [ - { - id: 'pfx_property_four', - name: 'pfx_property_four', - required: false, - readOnly: false, - colspan: 1, - params: { - existingColspan: 1, - maxColspan: 2 - }, - visibilityCondition: null, - type: 'dropdown', - optionType: 'manual', - options: [ - { - id: 'empty', - name: 'Choose one...' - }, - { - id: 'option_1', - name: 'Option: 1' - }, - { - id: 'option_2', - name: 'Option: 2' - } - ], - value: 'empty', - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null - } - ], - 6: [ - { - id: 'pfx_property_five', - name: 'pfx_property_five', - required: false, - readOnly: false, - colspan: 1, - params: { - existingColspan: 1, - maxColspan: 2 - }, - visibilityCondition: null, - type: 'dropdown', - optionType: 'manual', - options: [ - { - id: 'empty', - name: 'Choose one...' - }, - { - id: 'green', - name: 'Colour green' - }, - { - id: 'orange', - name: 'Colour orange' - } - ], - value: 'empty', - restUrl: null, - restResponsePath: null, - restIdProperty: null, - restLabelProperty: null - } - ], - 7: [ - { - id: 'cmfb85b2a7295ba41209750bca176ccaf9a', - name: 'File viewer', - type: 'file-viewer', - readOnly: false, - required: false, - colspan: 1, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2, - uploadWidget: 'content_form_nodes' - } - } - ], - 8: [ - { - type: 'text', - id: 'pfx_property_six', - name: 'pfx_property_six', - colspan: 1, - params: { - existingColspan: 1, - maxColspan: 2 - }, - visibilityCondition: null, - placeholder: null, - value: null, - required: false, - minLength: 0, - maxLength: 0, - regexPattern: null - } - ], - 9: [ - { - type: 'text', - id: 'pfx_property_seven', - name: 'pfx_property_seven', - colspan: 1, - params: { - existingColspan: 1, - maxColspan: 2 - }, - visibilityCondition: null, - placeholder: null, - value: null, - required: false, - minLength: 0, - maxLength: 0, - regexPattern: null - } - ], - 10: [ - { - type: 'text', - id: 'pfx_property_eight', - name: 'pfx_property_eight', - colspan: 1, - params: { - existingColspan: 1, - maxColspan: 2 - }, - visibilityCondition: null, - placeholder: null, - value: null, - required: false, - minLength: 0, - maxLength: 0, - regexPattern: null - } - ] - }, - numberOfColumns: 2 - } - ], - outcomes: [], - metadata: {}, - variables: [] - } -}; - -export const fakeViewerForm = { - id: 'form-de8895be-d0d7-4434-beef-559b15305d72', - name: 'StartEventForm', - description: '', - version: 0, - formDefinition: { - tabs: [], - fields: [ - { - type: 'container', - id: '5a6b24c1-db2b-45e9-9aff-142395433d23', - name: 'Label', - tab: null, - fields: { - 1: [ - { - id: 'content_form_nodes', - name: 'Nodes', - type: 'upload', - readOnly: false, - required: true, - colspan: 1, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2, - fileSource: { - serviceId: 'alfresco-content', - name: 'Alfresco Content', - metadataAllowed: true - }, - multiple: true, - menuOptions: { - show: true, - download: true, - retrieveMetadata: true, - remove: true - }, - link: false - } - } - ], - 2: [ - { - id: 'upload_widget', - name: 'Nodes', - type: 'upload', - readOnly: false, - required: true, - colspan: 1, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2, - fileSource: { - serviceId: 'alfresco-content', - name: 'Alfresco Content', - metadataAllowed: true - }, - multiple: true, - menuOptions: { - show: true, - download: true, - retrieveMetadata: true, - remove: true - }, - link: false - } - } - ], - 3: [ - { - id: 'cmfb85b2a7295ba41209750bca176ccaf9a', - name: 'File viewer', - type: 'file-viewer', - readOnly: false, - required: false, - colspan: 1, - visibilityCondition: null, - params: { - existingColspan: 1, - maxColspan: 2, - uploadWidget: 'content_form_nodes' - } - } - ] - }, - numberOfColumns: 2 - } - ], - outcomes: [], - metadata: {}, - variables: [] - } -}; diff --git a/lib/core/src/lib/mock/public-api.ts b/lib/core/src/lib/mock/public-api.ts index 884ea63b11..9ca99b073e 100644 --- a/lib/core/src/lib/mock/public-api.ts +++ b/lib/core/src/lib/mock/public-api.ts @@ -16,11 +16,8 @@ */ export * from './alfresco-api.mock'; -export * from './bpm-user.service.mock'; export * from './cookie.service.mock'; -export * from './ecm-user.service.mock'; export * from './event.mock'; -export * from './renditions-service.mock'; export * from './translation.service.mock'; export * from './alfresco-api.service.mock'; diff --git a/lib/core/src/lib/mock/renditions-service.mock.ts b/lib/core/src/lib/mock/renditions-service.mock.ts deleted file mode 100644 index 9411de92f4..0000000000 --- a/lib/core/src/lib/mock/renditions-service.mock.ts +++ /dev/null @@ -1,186 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export const fakeRendition = { - entry: { - id: 'pdf', - content: { - mimeType: 'application/pdf', - mimeTypeName: 'Adobe PDF Document' - }, - status: 'NOT_CREATED' - } -}; - -export const fakeRenditionCreated = { - entry: { - id: 'pdf', - content: { - mimeType: 'application/pdf', - mimeTypeName: 'Adobe PDF Document' - }, - status: 'CREATED' - } -}; - -export const fakeRenditionsList = { - list: { - pagination: { - count: 6, - hasMoreItems: false, - totalItems: 6, - skipCount: 0, - maxItems: 100 - }, - entries: [ - { - entry: { - id: 'avatar', - content: { - mimeType: 'image/png', - mimeTypeName: 'PNG Image' - }, - status: 'NOT_CREATED' - } - }, - { - entry: { - id: 'avatar32', - content: { - mimeType: 'image/png', - mimeTypeName: 'PNG Image' - }, - status: 'NOT_CREATED' - } - }, - { - entry: { - id: 'doclib', - content: { - mimeType: 'image/png', - mimeTypeName: 'PNG Image' - }, - status: 'NOT_CREATED' - } - }, - { - entry: { - id: 'imgpreview', - content: { - mimeType: 'image/jpeg', - mimeTypeName: 'JPEG Image' - }, - status: 'NOT_CREATED' - } - }, - { - entry: { - id: 'medium', - content: { - mimeType: 'image/jpeg', - mimeTypeName: 'JPEG Image' - }, - status: 'NOT_CREATED' - } - }, - { - entry: { - id: 'pdf', - content: { - mimeType: 'application/pdf', - mimeTypeName: 'Adobe PDF Document' - }, - status: 'NOT_CREATED' - } - } - ] - } -}; - -export const fakeRenditionsListWithACreated = { - list: { - pagination: { - count: 6, - hasMoreItems: false, - totalItems: 6, - skipCount: 0, - maxItems: 100 - }, - entries: [ - { - entry: { - id: 'avatar', - content: { - mimeType: 'image/png', - mimeTypeName: 'PNG Image' - }, - status: 'NOT_CREATED' - } - }, - { - entry: { - id: 'avatar32', - content: { - mimeType: 'image/png', - mimeTypeName: 'PNG Image' - }, - status: 'NOT_CREATED' - } - }, - { - entry: { - id: 'doclib', - content: { - mimeType: 'image/png', - mimeTypeName: 'PNG Image' - }, - status: 'NOT_CREATED' - } - }, - { - entry: { - id: 'imgpreview', - content: { - mimeType: 'image/jpeg', - mimeTypeName: 'JPEG Image' - }, - status: 'NOT_CREATED' - } - }, - { - entry: { - id: 'medium', - content: { - mimeType: 'image/jpeg', - mimeTypeName: 'JPEG Image' - }, - status: 'NOT_CREATED' - } - }, - { - entry: { - id: 'pdf', - content: { - mimeType: 'application/pdf', - mimeTypeName: 'Adobe PDF Document' - }, - status: 'CREATED' - } - } - ] - } -}; diff --git a/lib/core/src/lib/models/comment.model.ts b/lib/core/src/lib/models/comment.model.ts index 1d59e51c3f..68c2424ab2 100644 --- a/lib/core/src/lib/models/comment.model.ts +++ b/lib/core/src/lib/models/comment.model.ts @@ -15,13 +15,13 @@ * limitations under the License. */ -import { EcmUserModel } from './ecm-user.model'; +import { User } from './general-user.model'; export class CommentModel { id: number; message: string; created: Date; - createdBy: EcmUserModel; + createdBy: User; isSelected: boolean; constructor(obj?: any) { diff --git a/lib/core/src/lib/models/general-user.model.ts b/lib/core/src/lib/models/general-user.model.ts index c0c0b45e6e..062bf9420c 100644 --- a/lib/core/src/lib/models/general-user.model.ts +++ b/lib/core/src/lib/models/general-user.model.ts @@ -15,8 +15,6 @@ * limitations under the License. */ -import { EcmUserModel } from './ecm-user.model'; import { IdentityUserModel } from '../auth/models/identity-user.model'; -import { UserProcessModel } from './user-process.model'; -export type User = (EcmUserModel | UserProcessModel | IdentityUserModel) & { displayName?: string } & { username?: string }; +export type User = (IdentityUserModel) & { displayName?: string } & { username?: string }; diff --git a/lib/core/src/lib/models/public-api.ts b/lib/core/src/lib/models/public-api.ts index efbda95b28..8062460cb2 100644 --- a/lib/core/src/lib/models/public-api.ts +++ b/lib/core/src/lib/models/public-api.ts @@ -15,19 +15,9 @@ * limitations under the License. */ -export * from './file.model'; -export * from './allowable-operations.enum'; -export * from './permissions.enum'; export * from './product-version.model'; -export * from './user-process.model'; export * from './comment.model'; -export * from './ecm-company.model'; export * from './pagination.model'; export * from './request-pagination.model'; export * from './decimal-number.model'; -export * from './bpm-user.model'; -export * from './ecm-user.model'; -export * from './node-metadata.model'; -export * from './application-access.model'; -export * from './user-access.model'; export * from './general-user.model'; diff --git a/lib/core/src/lib/pipes/full-name.pipe.ts b/lib/core/src/lib/pipes/full-name.pipe.ts index 0b28005db4..d2c1f7efdf 100644 --- a/lib/core/src/lib/pipes/full-name.pipe.ts +++ b/lib/core/src/lib/pipes/full-name.pipe.ts @@ -16,16 +16,16 @@ */ import { Pipe, PipeTransform } from '@angular/core'; -import { User } from '../models/general-user.model'; +import { UserLike } from './user-like.interface'; @Pipe({ name: 'fullName' }) export class FullNamePipe implements PipeTransform { - transform(user: User): string { + transform(user: UserLike): string { return this.buildFullName(user) ? this.buildFullName(user) : this.buildFromUsernameOrEmail(user); } - buildFullName(user: User): string { + buildFullName(user: UserLike): string { const fullName: string[] = []; fullName.push(user?.firstName); @@ -34,7 +34,7 @@ export class FullNamePipe implements PipeTransform { return fullName.join(' ').trim(); } - buildFromUsernameOrEmail(user: User): string { + buildFromUsernameOrEmail(user: UserLike): string { return (user?.username || user?.email) ?? '' ; } } diff --git a/lib/core/src/lib/pipes/user-initial.pipe.ts b/lib/core/src/lib/pipes/user-initial.pipe.ts index e8e3b586de..8cf8129002 100644 --- a/lib/core/src/lib/pipes/user-initial.pipe.ts +++ b/lib/core/src/lib/pipes/user-initial.pipe.ts @@ -17,7 +17,7 @@ import { Pipe, PipeTransform } from '@angular/core'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; -import { User } from '../models/general-user.model'; +import { UserLike } from './user-like.interface'; @Pipe({ name: 'usernameInitials' @@ -27,7 +27,7 @@ export class InitialUsernamePipe implements PipeTransform { constructor(private sanitized: DomSanitizer) { } - transform(user: User, className: string = '', delimiter: string = ''): SafeHtml { + transform(user: UserLike & { displayName?: string }, className: string = '', delimiter: string = ''): SafeHtml { let safeHtml: SafeHtml = ''; if (user) { const initialResult = this.getInitialUserName(user.firstName || user.displayName || user.username, user.lastName, delimiter); diff --git a/lib/core/src/lib/pipes/user-like.interface.ts b/lib/core/src/lib/pipes/user-like.interface.ts new file mode 100644 index 0000000000..470b9b2671 --- /dev/null +++ b/lib/core/src/lib/pipes/user-like.interface.ts @@ -0,0 +1,23 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export interface UserLike { + username?: string; + firstName?: string; + lastName?: string; + email?: string; +}; diff --git a/lib/core/src/lib/services/bpm-user.service.spec.ts b/lib/core/src/lib/services/bpm-user.service.spec.ts deleted file mode 100644 index 15824b368e..0000000000 --- a/lib/core/src/lib/services/bpm-user.service.spec.ts +++ /dev/null @@ -1,90 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { fakeAsync, TestBed } from '@angular/core/testing'; -import { BpmUserModel } from '../models/bpm-user.model'; -import { BpmUserService } from './bpm-user.service'; -import { setupTestBed } from '../testing/setup-test-bed'; -import { CoreTestingModule } from '../testing/core.testing.module'; -import { TranslateModule } from '@ngx-translate/core'; - -declare let jasmine: any; - -describe('Bpm user service', () => { - - let service: BpmUserService; - - setupTestBed({ - imports: [ - TranslateModule.forRoot(), - CoreTestingModule - ] - }); - - beforeEach(() => { - service = TestBed.inject(BpmUserService); - }); - - beforeEach(() => { - jasmine.Ajax.install(); - }); - - afterEach(() => { - jasmine.Ajax.uninstall(); - }); - - describe('when user is logged in', () => { - - it('should be able to retrieve the user information', (done) => { - service.getCurrentUserInfo().subscribe((user: BpmUserModel) => { - expect(user).toBeDefined(); - expect(user.id).toBe(1); - expect(user.lastName).toBe('fake-last-name'); - expect(user.fullname).toBe('fake-full-name'); - done(); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 200, - contentType: 'application/json', - responseText: JSON.stringify({ - lastName: 'fake-last-name', - fullname: 'fake-full-name', - groups: [], - id: 1 - }) - }); - }); - - it('should retrieve avatar url for current user', () => { - const path = service.getCurrentUserProfileImage(); - expect(path).toBeDefined(); - expect(path).toContain('/app/rest/admin/profile-picture'); - }); - - it('should catch errors on call for profile', fakeAsync(() => { - service.getCurrentUserInfo().subscribe(() => { - }, (error) => { - expect(error).toEqual({ error: new Error('Unsuccessful HTTP response') }); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 403 - }); - })); - }); -}); diff --git a/lib/core/src/lib/services/bpm-user.service.ts b/lib/core/src/lib/services/bpm-user.service.ts deleted file mode 100644 index a91eac4c6d..0000000000 --- a/lib/core/src/lib/services/bpm-user.service.ts +++ /dev/null @@ -1,75 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Injectable } from '@angular/core'; -import { Observable, from, throwError } from 'rxjs'; -import { AlfrescoApiService } from './alfresco-api.service'; -import { LogService } from '../common/services/log.service'; -import { BpmUserModel } from '../models/bpm-user.model'; -import { map, catchError } from 'rxjs/operators'; -import { UserProfileApi } from '@alfresco/js-api'; - -/** - * - * BPMUserService retrieve all the information of an Ecm user. - * - */ -@Injectable({ - providedIn: 'root' -}) -export class BpmUserService { - - private _profileApi: UserProfileApi; - get profileApi(): UserProfileApi { - this._profileApi = this._profileApi ?? new UserProfileApi(this.apiService.getInstance()); - return this._profileApi; - } - - constructor(private apiService: AlfrescoApiService, - private logService: LogService) { - } - - /** - * Gets information about the current user. - * - * @returns User information object - */ - getCurrentUserInfo(): Observable { - return from(this.profileApi.getProfile()) - .pipe( - map((userRepresentation) => new BpmUserModel(userRepresentation)), - catchError((err) => this.handleError(err)) - ); - } - - /** - * Gets the current user's profile image as a URL. - * - * @returns URL string - */ - getCurrentUserProfileImage(): string { - return this.profileApi.getProfilePictureUrl(); - } - - private handleError(error: any) { - // in a real world app, we may send the error to some remote logging infrastructure - // instead of just logging it to the console - this.logService.error(error); - return throwError(error || 'Server error'); - } - -} diff --git a/lib/core/src/lib/services/deleted-nodes-api.service.ts b/lib/core/src/lib/services/deleted-nodes-api.service.ts deleted file mode 100644 index fdda3a5c88..0000000000 --- a/lib/core/src/lib/services/deleted-nodes-api.service.ts +++ /dev/null @@ -1,68 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Injectable } from '@angular/core'; -import { Observable, from, of } from 'rxjs'; - -import { NodePaging, NodesApi, TrashcanApi } from '@alfresco/js-api'; -import { AlfrescoApiService } from './alfresco-api.service'; -import { UserPreferencesService } from '../common/services/user-preferences.service'; -import { catchError } from 'rxjs/operators'; - -@Injectable({ - providedIn: 'root' -}) -export class DeletedNodesApiService { - - private _nodesApi: NodesApi; - get nodesApi(): NodesApi { - this._nodesApi = this._nodesApi ?? new NodesApi(this.apiService.getInstance()); - return this._nodesApi; - } - - private _trashcanApi: TrashcanApi; - get trashcanApi(): TrashcanApi { - this._trashcanApi = this._trashcanApi ?? new TrashcanApi(this.apiService.getInstance()); - return this._trashcanApi; - } - - constructor( - private apiService: AlfrescoApiService, - private preferences: UserPreferencesService - ) { - } - - /** - * Gets a list of nodes in the trash. - * - * @param options Options for JS-API call - * @returns List of nodes in the trash - */ - getDeletedNodes(options?: any): Observable { - const defaultOptions = { - include: [ 'path', 'properties' ], - maxItems: this.preferences.paginationSize, - skipCount: 0 - }; - const queryOptions = Object.assign(defaultOptions, options); - const promise = this.trashcanApi.listDeletedNodes(queryOptions); - - return from(promise).pipe( - catchError((err) => of(err)) - ); - } -} diff --git a/lib/core/src/lib/services/ecm-user.service.spec.ts b/lib/core/src/lib/services/ecm-user.service.spec.ts deleted file mode 100644 index cb9d29d2de..0000000000 --- a/lib/core/src/lib/services/ecm-user.service.spec.ts +++ /dev/null @@ -1,71 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { TestBed } from '@angular/core/testing'; -import { fakeEcmUser } from '../mock/ecm-user.service.mock'; -import { EcmUserService } from './ecm-user.service'; -import { CoreTestingModule } from '../testing/core.testing.module'; -import { TranslateModule } from '@ngx-translate/core'; -import { AuthenticationService } from '../auth/services/authentication.service'; -import { ContentService } from './content.service'; - -describe('EcmUserService', () => { - - let service: EcmUserService; - let authService: AuthenticationService; - let contentService: ContentService; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - TranslateModule.forRoot(), - CoreTestingModule - ] - }); - - service = TestBed.inject(EcmUserService); - authService = TestBed.inject(AuthenticationService); - contentService = TestBed.inject(ContentService); - }); - - describe('when user is logged in', () => { - - beforeEach(() => { - spyOn(authService, 'isEcmLoggedIn').and.returnValue(true); - }); - - it('should be able to retrieve current user info', (done) => { - spyOn(service.peopleApi, 'getPerson').and.returnValue(Promise.resolve({ entry: fakeEcmUser } as any)); - service.getCurrentUserInfo().subscribe( - (user) => { - expect(user).toBeDefined(); - expect(user.firstName).toEqual('fake-ecm-first-name'); - expect(user.lastName).toEqual('fake-ecm-last-name'); - expect(user.email).toEqual('fakeEcm@ecmUser.com'); - done(); - } - ); - }); - - it('should retrieve avatar url for current user', () => { - spyOn(contentService, 'getContentUrl').and.returnValue('fake/url/image/for/ecm/user'); - const urlRs = service.getUserProfileImage('fake-avatar-id'); - - expect(urlRs).toEqual('fake/url/image/for/ecm/user'); - }); - }); -}); diff --git a/lib/core/src/lib/services/ecm-user.service.ts b/lib/core/src/lib/services/ecm-user.service.ts deleted file mode 100644 index d7672efb1e..0000000000 --- a/lib/core/src/lib/services/ecm-user.service.ts +++ /dev/null @@ -1,72 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Injectable } from '@angular/core'; -import { Observable, from } from 'rxjs'; -import { map } from 'rxjs/operators'; -import { ContentService } from './content.service'; -import { AlfrescoApiService } from './alfresco-api.service'; -import { EcmUserModel } from '../models/ecm-user.model'; -import { PeopleApi } from '@alfresco/js-api'; - -@Injectable({ - providedIn: 'root' -}) -export class EcmUserService { - - private _peopleApi: PeopleApi; - get peopleApi(): PeopleApi { - this._peopleApi = this._peopleApi ?? new PeopleApi(this.apiService.getInstance()); - return this._peopleApi; - } - - constructor(private apiService: AlfrescoApiService, - private contentService: ContentService) { - } - - /** - * Gets information about a user identified by their username. - * - * @param userName Target username - * @returns User information - */ - getUserInfo(userName: string): Observable { - return from(this.peopleApi.getPerson(userName)) - .pipe( - map((personEntry) => new EcmUserModel(personEntry.entry)) - ); - } - - /** - * Gets information about the user who is currently logged-in. - * - * @returns User information as for getUserInfo - */ - getCurrentUserInfo() { - return this.getUserInfo('-me-'); - } - - /** - * Returns a profile image as a URL. - * - * @param avatarId Target avatar - * @returns Image URL - */ - getUserProfileImage(avatarId: string): string { - return this.contentService.getContentUrl(avatarId); - } -} diff --git a/lib/core/src/lib/services/public-api.ts b/lib/core/src/lib/services/public-api.ts index 75cdd96688..cba8f3c890 100644 --- a/lib/core/src/lib/services/public-api.ts +++ b/lib/core/src/lib/services/public-api.ts @@ -16,17 +16,3 @@ */ export * from './alfresco-api.service'; -export * from './content.service'; -export * from './renditions.service'; -export * from './upload.service'; -export * from './deleted-nodes-api.service'; -export * from './nodes-api.service'; -export * from './people-content.service'; -export * from './people-process.service'; -export * from './discovery-api.service'; -export * from './download-zip.service'; -export * from './download.service'; -export * from './bpm-user.service'; -export * from './ecm-user.service'; -export * from './user-access.service'; -export * from './user-info-resolver.service'; diff --git a/lib/core/src/lib/services/renditions.service.spec.ts b/lib/core/src/lib/services/renditions.service.spec.ts deleted file mode 100644 index 95c69518f8..0000000000 --- a/lib/core/src/lib/services/renditions.service.spec.ts +++ /dev/null @@ -1,191 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { fakeAsync, TestBed } from '@angular/core/testing'; -import { fakeRendition, fakeRenditionCreated, fakeRenditionsList, fakeRenditionsListWithACreated } from '../mock/renditions-service.mock'; -import { RenditionsService } from './renditions.service'; -import { setupTestBed } from '../testing/setup-test-bed'; -import { RenditionEntry } from '@alfresco/js-api'; -import { CoreTestingModule } from '../testing/core.testing.module'; -import { TranslateModule } from '@ngx-translate/core'; - -declare let jasmine: any; - -const errorResponse = { error: new Error('Parser is unable to parse the response') }; - -describe('RenditionsService', () => { - let service: RenditionsService; - - setupTestBed({ - imports: [ - TranslateModule.forRoot(), - CoreTestingModule - ] - }); - - beforeEach(() => { - jasmine.Ajax.install(); - service = TestBed.inject(RenditionsService); - }); - - afterEach(() => { - jasmine.Ajax.uninstall(); - }); - - it('Should return the image rendition for the file if no rendition is already available', (done) => { - service.getAvailableRenditionForNode('fake-node-id').subscribe((res: RenditionEntry) => { - expect(res.entry.status).toBe('NOT_CREATED'); - expect(res.entry.id).toBe('imgpreview'); - done(); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 200, - contentType: 'application/json', - responseText: JSON.stringify(fakeRenditionsList) - }); - }); - - it('Should return the available rendition for the file', (done) => { - service.getAvailableRenditionForNode('fake-node-id').subscribe((res: RenditionEntry) => { - expect(res.entry.status).toBe('CREATED'); - expect(res.entry.id).toBe('pdf'); - done(); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 200, - contentType: 'application/json', - responseText: JSON.stringify(fakeRenditionsListWithACreated) - }); - }); - - it('Get rendition list service should return the list', (done) => { - service.getRenditionsListByNodeId('fake-node-id').subscribe((res) => { - expect(res.list.entries[0].entry.id).toBe('avatar'); - done(); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 200, - contentType: 'application/json', - responseText: JSON.stringify(fakeRenditionsList) - }); - }); - - it('Create rendition service should call the server with the ID passed and the asked encoding', (done) => { - service.createRendition('fake-node-id', 'pdf').subscribe(() => { - expect(jasmine.Ajax.requests.mostRecent().method).toBe('POST'); - expect(jasmine.Ajax.requests.mostRecent().url).toContain('/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/renditions'); - done(); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 200, - contentType: 'application/json', - responseText: '' - }); - }); - - describe('convert', () => { - - it('should call the server with the ID passed and the asked encoding for creation', (done) => { - service.convert('fake-node-id', 'pdf', 1000); - - expect(jasmine.Ajax.requests.mostRecent().method).toBe('POST'); - expect(jasmine.Ajax.requests.mostRecent().url).toContain('/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fake-node-id/renditions'); - done(); - }); - }); - - it('Get rendition service should catch the error', fakeAsync(() => { - service.getRenditionsListByNodeId('fake-node-id').subscribe(() => { - }, (error) => { - expect(error).toEqual(errorResponse); - } - ); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 403, - contentType: 'application/json', - responseText: 'error' - }); - })); - - it('isConversionPossible should return true if is possible convert', (done) => { - service.isConversionPossible('fake-node-id', 'pdf').subscribe((res) => { - expect(res).toBe(true); - done(); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 200, - contentType: 'application/json', - responseText: JSON.stringify(fakeRendition) - }); - }); - - it('isConversionPossible should return false if is not possible to convert', (done) => { - service.isConversionPossible('fake-node-id', 'pdf').subscribe((res) => { - expect(res).toBe(false); - done(); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 403, - contentType: 'application/json' - }); - }); - - it('isRenditionsAvailable should return true if the conversion exist', (done) => { - service.isRenditionAvailable('fake-node-id', 'pdf').subscribe((res) => { - expect(res).toBe(true); - done(); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 200, - contentType: 'application/json', - responseText: JSON.stringify(fakeRenditionCreated) - }); - }); - - it('isRenditionsAvailable should return false if the conversion not exist', (done) => { - service.isRenditionAvailable('fake-node-id', 'pdf').subscribe((res) => { - expect(res).toBe(false); - done(); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 200, - contentType: 'application/json', - responseText: JSON.stringify(fakeRendition) - }); - }); - - it('isRenditionsAvailable should return false if the conversion get error', (done) => { - service.isRenditionAvailable('fake-node-id', 'pdf').subscribe((res) => { - expect(res).toBe(false); - done(); - }); - - jasmine.Ajax.requests.mostRecent().respondWith({ - status: 400, - contentType: 'application/json' - }); - }); -}); diff --git a/lib/core/src/lib/services/renditions.service.ts b/lib/core/src/lib/services/renditions.service.ts deleted file mode 100644 index d8db56334d..0000000000 --- a/lib/core/src/lib/services/renditions.service.ts +++ /dev/null @@ -1,199 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Injectable } from '@angular/core'; -import { RenditionEntry, RenditionPaging, RenditionsApi, ContentApi } from '@alfresco/js-api'; -import { Observable, from, interval, empty } from 'rxjs'; -import { AlfrescoApiService } from './alfresco-api.service'; -import { concatMap, switchMap, takeWhile, map } from 'rxjs/operators'; - -@Injectable({ - providedIn: 'root' -}) -export class RenditionsService { - - private _renditionsApi: RenditionsApi; - get renditionsApi(): RenditionsApi { - this._renditionsApi = this._renditionsApi ?? new RenditionsApi(this.apiService.getInstance()); - return this._renditionsApi; - } - - private _contentApi: ContentApi; - get contentApi(): ContentApi { - this._contentApi = this._contentApi ?? new ContentApi(this.apiService.getInstance()); - return this._contentApi; - } - - constructor(private apiService: AlfrescoApiService) { - } - - /** - * Gets the first available rendition found for a node. - * - * @param nodeId ID of the target node - * @returns Information object for the rendition - */ - getAvailableRenditionForNode(nodeId: string): Observable { - return from(this.renditionsApi.listRenditions(nodeId)).pipe( - map((availableRenditions: RenditionPaging) => { - const renditionsAvailable: RenditionEntry[] = availableRenditions.list.entries.filter( - (rendition) => (rendition.entry.id === 'pdf' || rendition.entry.id === 'imgpreview')); - const existingRendition = renditionsAvailable.find((rend) => rend.entry.status === 'CREATED'); - return existingRendition ? existingRendition : renditionsAvailable[0]; - })); - } - - /** - * Generates a rendition for a node using the first available encoding. - * - * @param nodeId ID of the target node - * @returns Null response to indicate completion - */ - generateRenditionForNode(nodeId: string): Observable { - return this.getAvailableRenditionForNode(nodeId).pipe( - map((rendition: RenditionEntry) => { - if (rendition.entry.status !== 'CREATED') { - return from(this.renditionsApi.createRendition(nodeId, { id: rendition.entry.id })); - } else { - return empty(); - } - }) - ); - } - - /** - * Checks if the specified rendition is available for a node. - * - * @param nodeId ID of the target node - * @param encoding Name of the rendition encoding - * @returns True if the rendition is available, false otherwise - */ - isRenditionAvailable(nodeId: string, encoding: string): Observable { - return new Observable((observer) => { - this.getRendition(nodeId, encoding).subscribe( - (res) => { - let isAvailable = true; - if (res.entry.status.toString() === 'NOT_CREATED') { - isAvailable = false; - } - observer.next(isAvailable); - observer.complete(); - }, - () => { - observer.next(false); - observer.complete(); - } - ); - }); - } - - /** - * Checks if the node can be converted using the specified rendition. - * - * @param nodeId ID of the target node - * @param encoding Name of the rendition encoding - * @returns True if the node can be converted, false otherwise - */ - isConversionPossible(nodeId: string, encoding: string): Observable { - return new Observable((observer) => { - this.getRendition(nodeId, encoding).subscribe( - () => { - observer.next(true); - observer.complete(); - }, - () => { - observer.next(false); - observer.complete(); - } - ); - }); - } - - /** - * Gets a URL linking to the specified rendition of a node. - * - * @param nodeId ID of the target node - * @param encoding Name of the rendition encoding - * @returns URL string - */ - getRenditionUrl(nodeId: string, encoding: string): string { - return this.contentApi.getRenditionUrl(nodeId, encoding); - } - - /** - * Gets information about a rendition of a node. - * - * @param nodeId ID of the target node - * @param encoding Name of the rendition encoding - * @returns Information object about the rendition - */ - getRendition(nodeId: string, encoding: string): Observable { - return from(this.renditionsApi.getRendition(nodeId, encoding)); - } - - /** - * Gets a list of all renditions for a node. - * - * @param nodeId ID of the target node - * @returns Paged list of rendition details - */ - getRenditionsListByNodeId(nodeId: string): Observable { - return from(this.renditionsApi.listRenditions(nodeId)); - } - - /** - * Creates a rendition for a node. - * - * @param nodeId ID of the target node - * @param encoding Name of the rendition encoding - * @returns Null response to indicate completion - */ - createRendition(nodeId: string, encoding: string): Observable { - return from(this.renditionsApi.createRendition(nodeId, { id: encoding })); - } - - /** - * Repeatedly attempts to create a rendition, through to success or failure. - * - * @param nodeId ID of the target node - * @param encoding Name of the rendition encoding - * @param pollingInterval Time interval (in milliseconds) between checks for completion - * @param retries Number of attempts to make before declaring failure - * @returns True if the rendition was created, false otherwise - */ - convert(nodeId: string, encoding: string, pollingInterval: number = 1000, retries: number = 5) { - return this.createRendition(nodeId, encoding) - .pipe( - concatMap(() => this.pollRendition(nodeId, encoding, pollingInterval, retries)) - ); - } - - private pollRendition(nodeId: string, encoding: string, intervalSize: number = 1000, retries: number = 5) { - let attempts = 0; - return interval(intervalSize) - .pipe( - switchMap(() => this.getRendition(nodeId, encoding)), - takeWhile((renditionEntry: RenditionEntry) => { - attempts += 1; - if (attempts > retries) { - return false; - } - return (renditionEntry.entry.status.toString() !== 'CREATED'); - }) - ); - } -} diff --git a/lib/core/src/lib/services/user-content-access.service.spec.ts b/lib/core/src/lib/services/user-content-access.service.spec.ts deleted file mode 100644 index 2e89651218..0000000000 --- a/lib/core/src/lib/services/user-content-access.service.spec.ts +++ /dev/null @@ -1,68 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { CoreTestingModule, setupTestBed } from '../testing'; -import { TestBed } from '@angular/core/testing'; -import { of } from 'rxjs'; -import { AppConfigService } from '../app-config'; -import { UserContentAccessService } from './user-content-access.service'; -import { PeopleContentService } from './people-content.service'; - -describe('UserContentAccessService', () => { - let userContentAccessService: UserContentAccessService; - let peopleContentService: PeopleContentService; - let appConfigService: AppConfigService; - - setupTestBed({ - imports: [CoreTestingModule], - providers: [UserContentAccessService] - }); - - beforeEach(() => { - userContentAccessService = TestBed.inject(UserContentAccessService); - peopleContentService = TestBed.inject(PeopleContentService); - appConfigService = TestBed.inject(AppConfigService); - }); - - it('should return true if user is content admin and provider is ECM', async () => { - appConfigService.config.providers = 'ECM'; - spyOn(peopleContentService, 'getCurrentUserInfo').and.returnValue(of({}as any)); - spyOn(peopleContentService, 'isCurrentUserAdmin').and.returnValue(true); - const isContentAdmin = await userContentAccessService.isCurrentUserAdmin(); - - expect(isContentAdmin).toEqual(true); - }); - - it('should return true if user is content admin and provider is ALL', async () => { - appConfigService.config.providers = 'ALL'; - spyOn(peopleContentService, 'getCurrentUserInfo').and.returnValue(of({} as any)); - spyOn(peopleContentService, 'isCurrentUserAdmin').and.returnValue(true); - const isContentAdmin = await userContentAccessService.isCurrentUserAdmin(); - - expect(isContentAdmin).toEqual(true); - }); - - it('should return false if provider is BPM', async () => { - appConfigService.config.providers = 'BPM'; - const isCurrentUserAdminSpy = spyOn(peopleContentService, 'isCurrentUserAdmin').and.returnValue(true); - const isContentAdmin = await userContentAccessService.isCurrentUserAdmin(); - - expect(isContentAdmin).toEqual(false); - expect(isCurrentUserAdminSpy).not.toHaveBeenCalled(); - }); - -}); diff --git a/lib/core/src/lib/services/user-content-access.service.ts b/lib/core/src/lib/services/user-content-access.service.ts deleted file mode 100644 index 4540576fe2..0000000000 --- a/lib/core/src/lib/services/user-content-access.service.ts +++ /dev/null @@ -1,44 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Injectable } from '@angular/core'; -import { AppConfigService } from '../app-config/app-config.service'; -import { PeopleContentService } from './people-content.service'; - -@Injectable({ - providedIn: 'root' -}) -export class UserContentAccessService { - - constructor( - private appConfigService: AppConfigService, - private peopleContentService: PeopleContentService) { - } - - private hasContentProvider(): boolean { - return this.appConfigService.get('providers') === 'ECM' || this.appConfigService.get('providers') === 'ALL'; - } - - async isCurrentUserAdmin(): Promise { - if( this.hasContentProvider()) { - await this.peopleContentService.getCurrentUserInfo().toPromise(); - return this.peopleContentService.isCurrentUserAdmin(); - } - return false; - } - -} diff --git a/lib/core/src/lib/services/user-info-resolver.service.ts b/lib/core/src/lib/services/user-info-resolver.service.ts deleted file mode 100644 index 7d5ea7dfb3..0000000000 --- a/lib/core/src/lib/services/user-info-resolver.service.ts +++ /dev/null @@ -1,41 +0,0 @@ -/*! - * @license - * Copyright 2019 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Injectable } from '@angular/core'; -import { - Resolve, - ActivatedRouteSnapshot, - RouterStateSnapshot -} from '@angular/router'; -import { EcmUserModel } from '../models/ecm-user.model'; -import { Observable } from 'rxjs'; -import { PeopleContentService } from './people-content.service'; - -@Injectable({ - providedIn: 'root' -}) -export class UserInfoResolverService implements Resolve { - constructor(private peopleContentService: PeopleContentService) {} - - resolve( - _route: ActivatedRouteSnapshot, - _state: RouterStateSnapshot - ): Observable { - return this.peopleContentService.getCurrentUserInfo(); - } - -} diff --git a/lib/core/src/lib/viewer/components/img-viewer.component.spec.ts b/lib/core/src/lib/viewer/components/img-viewer.component.spec.ts index 179c891a22..dccc2ad68a 100644 --- a/lib/core/src/lib/viewer/components/img-viewer.component.spec.ts +++ b/lib/core/src/lib/viewer/components/img-viewer.component.spec.ts @@ -17,7 +17,7 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; -import { UrlService } from '../../services/url.service'; +import { UrlService } from '../../common/services/url.service'; import { ImgViewerComponent } from './img-viewer.component'; import { setupTestBed, CoreTestingModule } from '../../testing'; import { AppConfigService } from '../../app-config/app-config.service'; diff --git a/lib/core/src/lib/viewer/components/img-viewer.component.ts b/lib/core/src/lib/viewer/components/img-viewer.component.ts index 3f2d30b240..cfea00c591 100644 --- a/lib/core/src/lib/viewer/components/img-viewer.component.ts +++ b/lib/core/src/lib/viewer/components/img-viewer.component.ts @@ -26,7 +26,7 @@ import { EventEmitter, AfterViewInit, ViewChild, HostListener, OnDestroy } from '@angular/core'; import { AppConfigService } from '../../app-config/app-config.service'; -import { UrlService } from '../../services/url.service'; +import { UrlService } from '../../common/services/url.service'; import Cropper from 'cropperjs'; @Component({ diff --git a/lib/core/src/lib/viewer/components/media-player.component.ts b/lib/core/src/lib/viewer/components/media-player.component.ts index 1052adeecd..9514e04941 100644 --- a/lib/core/src/lib/viewer/components/media-player.component.ts +++ b/lib/core/src/lib/viewer/components/media-player.component.ts @@ -16,8 +16,8 @@ */ import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation, Output, EventEmitter } from '@angular/core'; -import { ContentService } from '../../services/content.service'; import { Track } from '../models/viewer.model'; +import { UrlService } from '../../common/services/url.service'; @Component({ selector: 'adf-media-player', @@ -47,14 +47,14 @@ export class MediaPlayerComponent implements OnChanges { @Output() error = new EventEmitter(); - constructor(private contentService: ContentService) { + constructor(private urlService: UrlService) { } ngOnChanges(changes: SimpleChanges) { const blobFile = changes['blobFile']; if (blobFile && blobFile.currentValue) { - this.urlFile = this.contentService.createTrustedUrl(this.blobFile); + this.urlFile = this.urlService.createTrustedUrl(this.blobFile); return; } diff --git a/lib/insights/src/lib/analytics-process/components/analytics-report-parameters.component.ts b/lib/insights/src/lib/analytics-process/components/analytics-report-parameters.component.ts index 9bdfb1d991..2a536a58f5 100644 --- a/lib/insights/src/lib/analytics-process/components/analytics-report-parameters.component.ts +++ b/lib/insights/src/lib/analytics-process/components/analytics-report-parameters.component.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { ContentService, LogService } from '@alfresco/adf-core'; +import { DownloadService, LogService } from '@alfresco/adf-core'; import { AfterContentChecked, Component, @@ -106,7 +106,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On constructor(private analyticsService: AnalyticsService, private formBuilder: UntypedFormBuilder, private logService: LogService, - private contentService: ContentService, + private downloadService: DownloadService, private dialog: MatDialog) { } @@ -296,7 +296,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges, On this.analyticsService.exportReportToCsv(this.reportId, paramQuery).subscribe( (data: any) => { const blob: Blob = new Blob([data], { type: 'text/csv' }); - this.contentService.downloadBlob(blob, paramQuery.reportName + '.csv'); + this.downloadService.downloadBlob(blob, paramQuery.reportName + '.csv'); }); } diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer-wrapper.component.ts b/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer-wrapper.component.ts index 26ab45d9ea..cf6ab37c3c 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer-wrapper.component.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer-wrapper.component.ts @@ -16,9 +16,8 @@ */ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core'; -import { NodesApiService } from '@alfresco/adf-core'; +import { PresetConfig, NodesApiService } from '@alfresco/adf-content-services'; import { Node } from '@alfresco/js-api'; -import { PresetConfig } from '@alfresco/adf-content-services'; /* eslint-disable @angular-eslint/component-selector */ diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer.widget.spec.ts index 1687fab387..d8c7122c07 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer.widget.spec.ts @@ -17,7 +17,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { - NodesApiService, setupTestBed } from '@alfresco/adf-core'; import { TranslateModule } from '@ngx-translate/core'; @@ -25,7 +24,7 @@ import { PropertiesViewerWrapperComponent } from './properties-viewer-wrapper.co import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; import { of } from 'rxjs'; import { fakeNodeWithProperties } from '../../../../mocks/attach-file-cloud-widget.mock'; -import { BasicPropertiesService } from '@alfresco/adf-content-services'; +import { NodesApiService, BasicPropertiesService } from '@alfresco/adf-content-services'; describe('PropertiesViewerWidgetComponent', () => { let component: PropertiesViewerWrapperComponent; diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer.widget.spec.ts index 42edeacb70..6495a6505b 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer.widget.spec.ts @@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormFieldModel, FormModel, - NodesApiService, setupTestBed } from '@alfresco/adf-core'; import { TranslateModule } from '@ngx-translate/core'; @@ -27,7 +26,7 @@ import { PropertiesViewerWidgetComponent } from './properties-viewer.widget'; import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { fakeNodeWithProperties } from '../../../mocks/attach-file-cloud-widget.mock'; import { PropertiesViewerWrapperComponent } from './properties-viewer-wrapper/properties-viewer-wrapper.component'; -import { BasicPropertiesService } from '@alfresco/adf-content-services'; +import { NodesApiService, BasicPropertiesService } from '@alfresco/adf-content-services'; import { of } from 'rxjs'; describe('PropertiesViewerWidgetComponent', () => { diff --git a/lib/process-services-cloud/src/lib/form/services/process-cloud-content.service.ts b/lib/process-services-cloud/src/lib/form/services/process-cloud-content.service.ts index f605df154e..f3cbe7ca2c 100644 --- a/lib/process-services-cloud/src/lib/form/services/process-cloud-content.service.ts +++ b/lib/process-services-cloud/src/lib/form/services/process-cloud-content.service.ts @@ -21,9 +21,9 @@ import { catchError, map } from 'rxjs/operators'; import { AlfrescoApiService, LogService, - ContentService, DownloadService } from '@alfresco/adf-core'; +import { ContentService, NodesApiService } from '@alfresco/adf-content-services'; import { AuthenticationApi, Node, UploadApi } from '@alfresco/js-api'; @Injectable({ @@ -46,7 +46,8 @@ export class ProcessCloudContentService { constructor( private apiService: AlfrescoApiService, private logService: LogService, - public contentService: ContentService, + private nodesApiService: NodesApiService, + private contentService: ContentService, private downloadService: DownloadService ) { } @@ -57,7 +58,7 @@ export class ProcessCloudContentService { ): Observable { return from( - this.uploadApi.uploadFile(file, '', nodeId, '', { overwrite: true }) + this.uploadApi.uploadFile(file, '', nodeId, '', {overwrite: true}) ).pipe( map((res: any) => ({ ...res.entry, @@ -68,11 +69,11 @@ export class ProcessCloudContentService { } getRawContentNode(nodeId: string): Observable { - return this.contentService.getNodeContent(nodeId); + return this.nodesApiService.getNodeContent(nodeId); } downloadNodeContent(blob: Blob, fileName: string): void { - this.contentService.downloadBlob(blob, fileName); + this.downloadService.downloadBlob(blob, fileName); } async downloadFile(nodeId: string) { diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.spec.ts index 1331bc7691..2c41b2bbfb 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.spec.ts @@ -18,7 +18,7 @@ import { Component, SimpleChange, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed, fakeAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { AppConfigService, setupTestBed, DataRowEvent, ObjectDataRow, EcmUserModel } from '@alfresco/adf-core'; +import { AppConfigService, setupTestBed, DataRowEvent, ObjectDataRow, User } from '@alfresco/adf-core'; import { ServiceTaskListCloudComponent } from './service-task-list-cloud.component'; import { fakeServiceTask, fakeCustomSchema } from '../mock/fake-task-response.mock'; import { of } from 'rxjs'; @@ -41,7 +41,7 @@ class CustomTaskListComponent { @ViewChild(ServiceTaskListCloudComponent) taskList: ServiceTaskListCloudComponent; - getFullName(person: EcmUserModel): string { + getFullName(person: User): string { return `${person.firstName} ${person.lastName}`; } } diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.spec.ts index ccf27e948f..ac3607ece1 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.spec.ts @@ -18,7 +18,7 @@ import { Component, SimpleChange, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed, fakeAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { AppConfigService, setupTestBed, DataRowEvent, ObjectDataRow, EcmUserModel, DataColumn, ColumnsSelectorComponent } from '@alfresco/adf-core'; +import { AppConfigService, setupTestBed, DataRowEvent, ObjectDataRow, User, DataColumn, ColumnsSelectorComponent } from '@alfresco/adf-core'; import { TaskListCloudService } from '../services/task-list-cloud.service'; import { TaskListCloudComponent } from './task-list-cloud.component'; import { fakeGlobalTasks, fakeCustomSchema, fakeGlobalTask } from '../mock/fake-task-response.mock'; @@ -48,7 +48,7 @@ class CustomTaskListComponent { @ViewChild(TaskListCloudComponent) taskList: TaskListCloudComponent; - getFullName(person: EcmUserModel): string { + getFullName(person: User): string { return `${person.firstName} ${person.lastName}`; } } diff --git a/lib/process-services/src/lib/attachment/process-attachment-list.component.ts b/lib/process-services/src/lib/attachment/process-attachment-list.component.ts index 772b5a83d5..70465dc04b 100644 --- a/lib/process-services/src/lib/attachment/process-attachment-list.component.ts +++ b/lib/process-services/src/lib/attachment/process-attachment-list.component.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { ContentService, EmptyListComponent, ThumbnailService } from '@alfresco/adf-core'; +import { DownloadService, EmptyListComponent, ThumbnailService } from '@alfresco/adf-core'; import { AfterContentInit, ContentChild, @@ -75,7 +75,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn isLoading: boolean = false; constructor(private activitiContentService: ProcessContentService, - private contentService: ContentService, + private downloadService: DownloadService, private thumbnailService: ThumbnailService, private ngZone: NgZone) { } @@ -179,7 +179,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn downloadContent(content: any): void { this.activitiContentService.getFileRawContent(content.id).subscribe( - (blob: Blob) => this.contentService.downloadBlob(blob, content.name), + (blob: Blob) => this.downloadService.downloadBlob(blob, content.name), (err) => { this.error.emit(err); } diff --git a/lib/process-services/src/lib/attachment/task-attachment-list.component.ts b/lib/process-services/src/lib/attachment/task-attachment-list.component.ts index b4263d084f..fee4624913 100644 --- a/lib/process-services/src/lib/attachment/task-attachment-list.component.ts +++ b/lib/process-services/src/lib/attachment/task-attachment-list.component.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { ContentService, ThumbnailService, EmptyListComponent } from '@alfresco/adf-core'; +import { ThumbnailService, EmptyListComponent, DownloadService } from '@alfresco/adf-core'; import { AfterContentInit, ContentChild, @@ -72,7 +72,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit isLoading: boolean = false; constructor(private activitiContentService: ProcessContentService, - private contentService: ContentService, + private downloadService: DownloadService, private thumbnailService: ThumbnailService, private ngZone: NgZone) { } @@ -188,7 +188,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit downloadContent(content: any): void { this.activitiContentService.getFileRawContent(content.id).subscribe( - (blob: Blob) => this.contentService.downloadBlob(blob, content.name), + (blob: Blob) => this.downloadService.downloadBlob(blob, content.name), (err) => { this.error.emit(err); } diff --git a/lib/process-services/src/lib/common/index.ts b/lib/process-services/src/lib/common/index.ts new file mode 100644 index 0000000000..a7e30cc675 --- /dev/null +++ b/lib/process-services/src/lib/common/index.ts @@ -0,0 +1,18 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './public-api'; diff --git a/lib/core/src/lib/models/bpm-user.model.ts b/lib/process-services/src/lib/common/models/bpm-user.model.ts similarity index 100% rename from lib/core/src/lib/models/bpm-user.model.ts rename to lib/process-services/src/lib/common/models/bpm-user.model.ts diff --git a/lib/core/src/lib/models/user-process.model.ts b/lib/process-services/src/lib/common/models/user-process.model.ts similarity index 100% rename from lib/core/src/lib/models/user-process.model.ts rename to lib/process-services/src/lib/common/models/user-process.model.ts diff --git a/lib/process-services/src/lib/common/public-api.ts b/lib/process-services/src/lib/common/public-api.ts new file mode 100644 index 0000000000..828f187b96 --- /dev/null +++ b/lib/process-services/src/lib/common/public-api.ts @@ -0,0 +1,21 @@ +/*! + * @license + * Copyright 2019 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from './services/people-process.service'; + +export * from './models/bpm-user.model'; +export * from './models/user-process.model'; diff --git a/lib/core/src/lib/services/people-process.service.spec.ts b/lib/process-services/src/lib/common/services/people-process.service.spec.ts similarity index 97% rename from lib/core/src/lib/services/people-process.service.spec.ts rename to lib/process-services/src/lib/common/services/people-process.service.spec.ts index 0eda0b1690..988d3d5ecf 100644 --- a/lib/core/src/lib/services/people-process.service.spec.ts +++ b/lib/process-services/src/lib/common/services/people-process.service.spec.ts @@ -16,10 +16,9 @@ */ import { fakeAsync, TestBed } from '@angular/core/testing'; -import { UserProcessModel } from '../models'; +import { UserProcessModel } from '../models/user-process.model'; import { PeopleProcessService } from './people-process.service'; -import { setupTestBed } from '../testing/setup-test-bed'; -import { CoreTestingModule } from '../testing/core.testing.module'; +import { setupTestBed, CoreTestingModule } from '@alfresco/adf-core'; import { TranslateModule } from '@ngx-translate/core'; declare let jasmine: any; diff --git a/lib/core/src/lib/services/people-process.service.ts b/lib/process-services/src/lib/common/services/people-process.service.ts similarity index 84% rename from lib/core/src/lib/services/people-process.service.ts rename to lib/process-services/src/lib/common/services/people-process.service.ts index 5ac4e974a3..c1571b9c24 100644 --- a/lib/core/src/lib/services/people-process.service.ts +++ b/lib/process-services/src/lib/common/services/people-process.service.ts @@ -17,16 +17,15 @@ import { Injectable } from '@angular/core'; import { Observable, from, throwError, of } from 'rxjs'; +import { AlfrescoApiService, LogService, GroupModel } from '@alfresco/adf-core'; +import { BpmUserModel } from '../models/bpm-user.model'; import { UserProcessModel } from '../models/user-process.model'; -import { AlfrescoApiService } from './alfresco-api.service'; -import { LogService } from '../common/services/log.service'; import { catchError, combineAll, defaultIfEmpty, map, switchMap } from 'rxjs/operators'; import { TaskActionsApi, UsersApi, - ResultListDataRepresentationLightUserRepresentation, ActivitiGroupsApi + ResultListDataRepresentationLightUserRepresentation, ActivitiGroupsApi, UserProfileApi } from '@alfresco/js-api'; -import { GroupModel } from '../form'; @Injectable({ providedIn: 'root' @@ -51,10 +50,38 @@ export class PeopleProcessService { return this._groupsApi; } + private _profileApi: UserProfileApi; + get profileApi(): UserProfileApi { + this._profileApi = this._profileApi ?? new UserProfileApi(this.apiService.getInstance()); + return this._profileApi; + } + constructor(private apiService: AlfrescoApiService, private logService: LogService) { } + /** + * Gets information about the current user. + * + * @returns User information object + */ + getCurrentUserInfo(): Observable { + return from(this.profileApi.getProfile()) + .pipe( + map((userRepresentation) => new BpmUserModel(userRepresentation)), + catchError((err) => this.handleError(err)) + ); + } + + /** + * Gets the current user's profile image as a URL. + * + * @returns URL string + */ + getCurrentUserProfileImage(): string { + return this.profileApi.getProfilePictureUrl(); + } + /** * Gets a list of groups in a workflow. * diff --git a/lib/process-services/src/lib/form/form.component.spec.ts b/lib/process-services/src/lib/form/form.component.spec.ts index dcc8fd8842..5db230e899 100644 --- a/lib/process-services/src/lib/form/form.component.spec.ts +++ b/lib/process-services/src/lib/form/form.component.spec.ts @@ -30,10 +30,9 @@ import { TestBed, ComponentFixture } from '@angular/core/testing'; import { Observable, of, throwError } from 'rxjs'; import { FormFieldModel, FormFieldTypes, FormModel, FormOutcomeEvent, FormOutcomeModel, - FormService, WidgetVisibilityService, ContainerModel, fakeForm, - setupTestBed, - NodeMetadata, NodesApiService + FormService, WidgetVisibilityService, ContainerModel, fakeForm, setupTestBed } from '@alfresco/adf-core'; +import{ NodeMetadata, NodesApiService } from '@alfresco/adf-content-services'; import { FormComponent } from './form.component'; import { ProcessFormRenderingService } from './process-form-rendering.service'; import { ProcessTestingModule } from '../testing/process.testing.module'; diff --git a/lib/process-services/src/lib/form/form.component.ts b/lib/process-services/src/lib/form/form.component.ts index 175ddca055..7ca6b7282d 100644 --- a/lib/process-services/src/lib/form/form.component.ts +++ b/lib/process-services/src/lib/form/form.component.ts @@ -38,8 +38,6 @@ import { FormOutcomeEvent, FormValues, ContentLinkModel, - NodesApiService, - FormDefinitionModel, TaskProcessVariableModel } from '@alfresco/adf-core'; import { from, Observable, of, Subject } from 'rxjs'; @@ -50,6 +48,8 @@ import { EditorService } from './services/editor.service'; import { TaskService } from './services/task.service'; import { TaskFormService } from './services/task-form.service'; import { TaskRepresentation } from '@alfresco/js-api'; +import { NodesApiService } from '@alfresco/adf-content-services'; +import { FormDefinitionModel } from './model/form-definition.model'; @Component({ selector: 'adf-form', diff --git a/lib/core/src/lib/form/models/form-definition.model.ts b/lib/process-services/src/lib/form/model/form-definition.model.ts similarity index 100% rename from lib/core/src/lib/form/models/form-definition.model.ts rename to lib/process-services/src/lib/form/model/form-definition.model.ts diff --git a/lib/process-services/src/lib/form/public-api.ts b/lib/process-services/src/lib/form/public-api.ts index d0a9b41b63..c1925427ad 100644 --- a/lib/process-services/src/lib/form/public-api.ts +++ b/lib/process-services/src/lib/form/public-api.ts @@ -30,6 +30,8 @@ export * from './process-form-rendering.service'; export * from './events/validate-dynamic-table-row.event'; +export * from './model/form-definition.model'; + export * from './form-list/form-list.component'; export * from './form.component'; diff --git a/lib/process-services/src/lib/form/services/editor.service.ts b/lib/process-services/src/lib/form/services/editor.service.ts index 6a38560f54..be7a8b3cdf 100644 --- a/lib/process-services/src/lib/form/services/editor.service.ts +++ b/lib/process-services/src/lib/form/services/editor.service.ts @@ -15,11 +15,12 @@ * limitations under the License. */ -import { AlfrescoApiService, FormDefinitionModel, LogService } from '@alfresco/adf-core'; +import { AlfrescoApiService, LogService } from '@alfresco/adf-core'; import { Injectable } from '@angular/core'; import { Observable, from, throwError } from 'rxjs'; import { FormModelsApi } from '@alfresco/js-api'; import { catchError, map } from 'rxjs/operators'; +import { FormDefinitionModel } from '../model/form-definition.model'; @Injectable({ providedIn: 'root' diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts index 8a2dae1edd..eec86c8a6d 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts @@ -17,11 +17,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { ContentModule, ContentNodeSelectorPanelComponent, DocumentListService, SitesService } from '@alfresco/adf-content-services'; +import { ContentModule, ContentNodeSelectorPanelComponent, DocumentListService, SitesService, NodesApiService } from '@alfresco/adf-content-services'; import { EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core'; import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { AttachFileWidgetDialogComponent } from './attach-file-widget-dialog.component'; -import { setupTestBed, AuthenticationService, AlfrescoApiService, NodesApiService } from '@alfresco/adf-core'; +import { setupTestBed, AuthenticationService, AlfrescoApiService } from '@alfresco/adf-core'; import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface'; import { of, throwError } from 'rxjs'; import { By } from '@angular/platform-browser'; diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.ts index 650b07b491..f34aef57e5 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.ts @@ -21,13 +21,12 @@ import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; import { AppConfigService, AppConfigValues, - ContentService, DownloadService, FormService, LogService, ThumbnailService } from '@alfresco/adf-core'; -import { ContentNodeDialogService } from '@alfresco/adf-content-services'; +import { ContentNodeDialogService, ContentService } from '@alfresco/adf-content-services'; import { AlfrescoEndpointRepresentation, Node, diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.spec.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.spec.ts index a56f829e5a..8fa6b61025 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.spec.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.spec.ts @@ -21,10 +21,9 @@ import { AttachFolderWidgetComponent } from './attach-folder-widget.component'; import { FormFieldModel, FormModel, - NodesApiService, setupTestBed } from '@alfresco/adf-core'; -import { ContentNodeDialogService } from '@alfresco/adf-content-services'; +import { ContentNodeDialogService, NodesApiService } from '@alfresco/adf-content-services'; import { of } from 'rxjs'; import { Node } from '@alfresco/js-api'; import { ProcessTestingModule } from '../../../testing/process.testing.module'; diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.ts index 8951450171..4ecf02ac88 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.ts @@ -20,10 +20,9 @@ import { Component, ViewEncapsulation, OnInit } from '@angular/core'; import { WidgetComponent, - FormService, - NodesApiService + FormService } from '@alfresco/adf-core'; -import { ContentNodeDialogService } from '@alfresco/adf-content-services'; +import { ContentNodeDialogService, NodesApiService } from '@alfresco/adf-content-services'; import { Node } from '@alfresco/js-api'; @Component({ diff --git a/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts b/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts index f52ea61d03..32bf030e91 100644 --- a/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts @@ -19,10 +19,10 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { - ContentService, ContentLinkModel, CoreTestingModule, - setupTestBed + setupTestBed, + DownloadService } from '@alfresco/adf-core'; import { of } from 'rxjs'; import { ContentWidgetComponent } from './content.widget'; @@ -38,7 +38,7 @@ describe('ContentWidgetComponent', () => { let element: HTMLElement; let processContentService: ProcessContentService; - let serviceContent: ContentService; + let downloadService: DownloadService; const createFakeImageBlob = () => { const data = atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=='); @@ -71,7 +71,7 @@ describe('ContentWidgetComponent', () => { }); beforeEach(() => { - serviceContent = TestBed.inject(ContentService); + downloadService = TestBed.inject(DownloadService); processContentService = TestBed.inject(ProcessContentService); }); @@ -253,7 +253,7 @@ describe('ContentWidgetComponent', () => { it('should download the pdf when the download button is clicked', () => { const blob = createFakePdfBlob(); spyOn(processContentService, 'getFileRawContent').and.returnValue(of(blob)); - spyOn(serviceContent, 'downloadBlob').and.callThrough(); + spyOn(downloadService, 'downloadBlob').and.callThrough(); component.content = new ContentLinkModel({ id: 4004, @@ -278,7 +278,7 @@ describe('ContentWidgetComponent', () => { const downloadButton: any = element.querySelector('#download'); downloadButton.click(); - expect(serviceContent.downloadBlob).toHaveBeenCalledWith(blob, 'FakeBlob.pdf'); + expect(downloadService.downloadBlob).toHaveBeenCalledWith(blob, 'FakeBlob.pdf'); }); }); }); diff --git a/lib/process-services/src/lib/form/widgets/document/content.widget.ts b/lib/process-services/src/lib/form/widgets/document/content.widget.ts index 614ef5f36a..f04dc26658 100644 --- a/lib/process-services/src/lib/form/widgets/document/content.widget.ts +++ b/lib/process-services/src/lib/form/widgets/document/content.widget.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { ContentService, LogService, ContentLinkModel, FormService } from '@alfresco/adf-core'; +import { UrlService, LogService, ContentLinkModel, FormService, DownloadService } from '@alfresco/adf-core'; import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { Observable } from 'rxjs'; import { ProcessContentService } from '../../services/process-content.service'; @@ -56,7 +56,8 @@ export class ContentWidgetComponent implements OnChanges { constructor(protected formService: FormService, private logService: LogService, - private contentService: ContentService, + private downloadService: DownloadService, + private urlService: UrlService, private processContentService: ProcessContentService) { } @@ -95,7 +96,7 @@ export class ContentWidgetComponent implements OnChanges { if (observable) { observable.subscribe( (response: Blob) => { - this.content.thumbnailUrl = this.contentService.createTrustedUrl(response); + this.content.thumbnailUrl = this.urlService.createTrustedUrl(response); this.thumbnailLoaded.emit(this.content.thumbnailUrl); }, (error) => { @@ -130,7 +131,7 @@ export class ContentWidgetComponent implements OnChanges { */ download(content: ContentLinkModel): void { this.processContentService.getFileRawContent(content.id).subscribe( - (blob: Blob) => this.contentService.downloadBlob(blob, content.name), + (blob: Blob) => this.downloadService.downloadBlob(blob, content.name), (error) => { this.error.emit(error); } diff --git a/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.spec.ts b/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.spec.ts index c7ff88fe96..4b225b2443 100644 --- a/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.spec.ts @@ -22,12 +22,12 @@ import { GroupModel, CoreTestingModule, setupTestBed, - FormFieldTypes, - PeopleProcessService + FormFieldTypes } from '@alfresco/adf-core'; import { FunctionalGroupWidgetComponent } from './functional-group.widget'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; +import { PeopleProcessService } from '../../../common/services/people-process.service'; describe('FunctionalGroupWidgetComponent', () => { let fixture: ComponentFixture; diff --git a/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.ts b/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.ts index 79a53fbb55..5e812fab9e 100644 --- a/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.ts +++ b/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.ts @@ -18,10 +18,11 @@ /* eslint-disable @angular-eslint/component-selector */ import { Component, ElementRef, OnInit, ViewEncapsulation } from '@angular/core'; -import { FormService, GroupModel, PeopleProcessService, WidgetComponent } from '@alfresco/adf-core'; +import { FormService, GroupModel, WidgetComponent } from '@alfresco/adf-core'; import { catchError, debounceTime, filter, switchMap, tap } from 'rxjs/operators'; import { merge, of } from 'rxjs'; import { UntypedFormControl } from '@angular/forms'; +import { PeopleProcessService } from '../../../common/services/people-process.service'; @Component({ selector: 'functional-group-widget', diff --git a/lib/process-services/src/lib/form/widgets/people/people.widget.spec.ts b/lib/process-services/src/lib/form/widgets/people/people.widget.spec.ts index d006d0f8ed..6457e2589c 100644 --- a/lib/process-services/src/lib/form/widgets/people/people.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/people/people.widget.spec.ts @@ -18,16 +18,17 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { - UserProcessModel, FormFieldTypes, FormFieldModel, FormModel, setupTestBed, - CoreTestingModule, PeopleProcessService + CoreTestingModule } from '@alfresco/adf-core'; import { Observable, of } from 'rxjs'; import { PeopleWidgetComponent } from './people.widget'; import { TranslateService, TranslateModule } from '@ngx-translate/core'; +import { PeopleProcessService } from '../../../common/services/people-process.service'; +import { UserProcessModel } from '../../../common/models/user-process.model'; describe('PeopleWidgetComponent', () => { diff --git a/lib/process-services/src/lib/form/widgets/people/people.widget.ts b/lib/process-services/src/lib/form/widgets/people/people.widget.ts index 6e5d3f61dc..e2995aa3ba 100644 --- a/lib/process-services/src/lib/form/widgets/people/people.widget.ts +++ b/lib/process-services/src/lib/form/widgets/people/people.widget.ts @@ -17,7 +17,7 @@ /* eslint-disable @angular-eslint/component-selector */ -import { UserProcessModel, PeopleProcessService, FormService, WidgetComponent } from '@alfresco/adf-core'; +import { FormService, WidgetComponent } from '@alfresco/adf-core'; import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core'; import { UntypedFormControl } from '@angular/forms'; import { Observable, of } from 'rxjs'; @@ -28,6 +28,8 @@ import { switchMap, tap } from 'rxjs/operators'; +import { UserProcessModel } from '../../../common/models/user-process.model'; +import { PeopleProcessService } from '../../../common/services/people-process.service'; @Component({ selector: 'people-widget', diff --git a/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts b/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts index d5eca2e6fd..5faf566ef5 100644 --- a/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts @@ -16,11 +16,12 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { UserProcessModel, setupTestBed, DataRowActionEvent, DataRowEvent, ObjectDataRow } from '@alfresco/adf-core'; +import { setupTestBed, DataRowActionEvent, DataRowEvent, ObjectDataRow } from '@alfresco/adf-core'; +import { TranslateModule } from '@ngx-translate/core'; import { UserEventModel } from '../../../task-list/models/user-event.model'; import { PeopleListComponent } from './people-list.component'; import { ProcessTestingModule } from '../../../testing/process.testing.module'; -import { TranslateModule } from '@ngx-translate/core'; +import { UserProcessModel } from '../../../common/models/user-process.model'; const fakeUser: UserProcessModel = new UserProcessModel({ id: 1, diff --git a/lib/process-services/src/lib/people/components/people-list/people-list.component.ts b/lib/process-services/src/lib/people/components/people-list/people-list.component.ts index 3774ef4d17..75762522a3 100644 --- a/lib/process-services/src/lib/people/components/people-list/people-list.component.ts +++ b/lib/process-services/src/lib/people/components/people-list/people-list.component.ts @@ -15,8 +15,9 @@ * limitations under the License. */ -import { DataTableComponent, DataCellEvent, DataColumnListComponent, UserProcessModel, ShowHeaderMode } from '@alfresco/adf-core'; +import { DataTableComponent, DataCellEvent, DataColumnListComponent, ShowHeaderMode } from '@alfresco/adf-core'; import { AfterContentInit, Component, ContentChild, EventEmitter, Input, Output, ViewChild } from '@angular/core'; +import { UserProcessModel } from '../../../common/models/user-process.model'; import { UserEventModel } from '../../../task-list/models/user-event.model'; @Component({ diff --git a/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.ts b/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.ts index 61628b04ef..c7486e121b 100644 --- a/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.ts +++ b/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.ts @@ -15,13 +15,15 @@ * limitations under the License. */ -import { UserProcessModel, TranslationService, PeopleProcessService } from '@alfresco/adf-core'; +import { TranslationService } from '@alfresco/adf-core'; import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; import { UntypedFormControl } from '@angular/forms'; import { debounceTime, switchMap } from 'rxjs/operators'; import { Observable, of } from 'rxjs'; import { PerformSearchCallback } from '../../interfaces/perform-search-callback.interface'; import { getDisplayUser } from '../../helpers/get-display-user'; +import { PeopleProcessService } from '../../../common/services/people-process.service'; +import { UserProcessModel } from '../../../common/models/user-process.model'; @Component({ selector: 'adf-people-search-field', diff --git a/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts b/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts index 2c136a5123..5f5777b9f4 100644 --- a/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts @@ -16,11 +16,12 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { UserProcessModel, setupTestBed } from '@alfresco/adf-core'; +import { setupTestBed } from '@alfresco/adf-core'; import { of } from 'rxjs'; +import { TranslateModule } from '@ngx-translate/core'; import { PeopleSearchComponent } from './people-search.component'; import { ProcessTestingModule } from '../../../testing/process.testing.module'; -import { TranslateModule } from '@ngx-translate/core'; +import { UserProcessModel } from '../../../common/models/user-process.model'; const fakeUser: UserProcessModel = new UserProcessModel({ id: '1', diff --git a/lib/process-services/src/lib/people/components/people-search/people-search.component.ts b/lib/process-services/src/lib/people/components/people-search/people-search.component.ts index 46f1fb1d90..4ad62e9adc 100644 --- a/lib/process-services/src/lib/people/components/people-search/people-search.component.ts +++ b/lib/process-services/src/lib/people/components/people-search/people-search.component.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { UserProcessModel } from '@alfresco/adf-core'; +import { UserProcessModel } from '../../../common/models/user-process.model'; import { Component, EventEmitter, OnInit, Input, Output, ViewEncapsulation } from '@angular/core'; import { Observable } from 'rxjs'; import { PerformSearchCallback } from '../../interfaces/perform-search-callback.interface'; diff --git a/lib/process-services/src/lib/people/components/people-selector/people-selector.component.spec.ts b/lib/process-services/src/lib/people/components/people-selector/people-selector.component.spec.ts index 42f789866a..dc1909be99 100644 --- a/lib/process-services/src/lib/people/components/people-selector/people-selector.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people-selector/people-selector.component.spec.ts @@ -16,12 +16,13 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { LogService, PeopleProcessService, setupTestBed } from '@alfresco/adf-core'; +import { LogService, setupTestBed } from '@alfresco/adf-core'; import { PeopleSelectorComponent } from './people-selector.component'; import { of, throwError } from 'rxjs'; import { By } from '@angular/platform-browser'; import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { PeopleProcessService } from '../../../common/services/people-process.service'; describe('PeopleSelectorComponent', () => { diff --git a/lib/process-services/src/lib/people/components/people-selector/people-selector.component.ts b/lib/process-services/src/lib/people/components/people-selector/people-selector.component.ts index 9e8173a646..fbae6c64e0 100644 --- a/lib/process-services/src/lib/people/components/people-selector/people-selector.component.ts +++ b/lib/process-services/src/lib/people/components/people-selector/people-selector.component.ts @@ -17,11 +17,13 @@ import { Component, ViewChild, ViewEncapsulation, EventEmitter, Input, Output } from '@angular/core'; import { PerformSearchCallback } from '../../interfaces/perform-search-callback.interface'; -import { PeopleProcessService, UserProcessModel, LogService, TranslationService } from '@alfresco/adf-core'; +import { LogService, TranslationService } from '@alfresco/adf-core'; import { PeopleSearchFieldComponent } from '../people-search-field/people-search-field.component'; import { getDisplayUser } from '../../helpers/get-display-user'; import { Observable, of } from 'rxjs'; import { catchError } from 'rxjs/operators'; +import { PeopleProcessService } from '../../../common/services/people-process.service'; +import { UserProcessModel } from '../../../common/models/user-process.model'; const DEFAULT_ASSIGNEE_PLACEHOLDER = 'ADF_TASK_LIST.PEOPLE.ASSIGNEE'; diff --git a/lib/process-services/src/lib/people/components/people/people.component.spec.ts b/lib/process-services/src/lib/people/components/people/people.component.spec.ts index f137230b4d..719f761f2a 100644 --- a/lib/process-services/src/lib/people/components/people/people.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people/people.component.spec.ts @@ -16,11 +16,13 @@ */ import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; -import { LogService, PeopleProcessService, setupTestBed, UserProcessModel } from '@alfresco/adf-core'; +import { LogService, setupTestBed } from '@alfresco/adf-core'; import { PeopleComponent } from './people.component'; import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { TranslateModule } from '@ngx-translate/core'; import { throwError } from 'rxjs'; +import { UserProcessModel } from '../../../common/models/user-process.model'; +import { PeopleProcessService } from '../../../common/services/people-process.service'; declare let jasmine: any; diff --git a/lib/process-services/src/lib/people/components/people/people.component.ts b/lib/process-services/src/lib/people/components/people/people.component.ts index acaa4f37a5..c11b5d51e0 100644 --- a/lib/process-services/src/lib/people/components/people/people.component.ts +++ b/lib/process-services/src/lib/people/components/people/people.component.ts @@ -15,12 +15,14 @@ * limitations under the License. */ -import { LogService, UserProcessModel, PeopleProcessService } from '@alfresco/adf-core'; +import { LogService } from '@alfresco/adf-core'; import { Component, Input, ViewChild, ViewEncapsulation } from '@angular/core'; import { Observable, Observer } from 'rxjs'; import { UserEventModel } from '../../../task-list/models/user-event.model'; import { PeopleSearchComponent } from '../people-search/people-search.component'; import { share } from 'rxjs/operators'; +import { UserProcessModel } from '../../../common/models/user-process.model'; +import { PeopleProcessService } from '../../../common/services/people-process.service'; @Component({ selector: 'adf-people', diff --git a/lib/process-services/src/lib/people/interfaces/perform-search-callback.interface.ts b/lib/process-services/src/lib/people/interfaces/perform-search-callback.interface.ts index a402c4d15c..5c420b4b35 100644 --- a/lib/process-services/src/lib/people/interfaces/perform-search-callback.interface.ts +++ b/lib/process-services/src/lib/people/interfaces/perform-search-callback.interface.ts @@ -16,6 +16,6 @@ */ import { Observable } from 'rxjs'; -import { UserProcessModel } from '@alfresco/adf-core'; +import { UserProcessModel } from '../../common/models/user-process.model'; export type PerformSearchCallback = (searchWord: string) => Observable; diff --git a/lib/process-services/src/lib/process-comments/services/comment-process.service.ts b/lib/process-services/src/lib/process-comments/services/comment-process.service.ts index e3c207f199..568ae39558 100644 --- a/lib/process-services/src/lib/process-comments/services/comment-process.service.ts +++ b/lib/process-services/src/lib/process-comments/services/comment-process.service.ts @@ -17,9 +17,11 @@ import { Injectable } from '@angular/core'; import { Observable, from, throwError } from 'rxjs'; -import { CommentModel, UserProcessModel, AlfrescoApiService, LogService, CommentsService, PeopleProcessService } from '@alfresco/adf-core'; +import { CommentModel, AlfrescoApiService, LogService, CommentsService } from '@alfresco/adf-core'; import { map, catchError } from 'rxjs/operators'; import { ActivitiCommentsApi } from '@alfresco/js-api'; +import { PeopleProcessService } from '../../common/services/people-process.service'; +import { UserProcessModel } from '../../common/models/user-process.model'; @Injectable({ providedIn: 'root' diff --git a/lib/core/src/lib/mock/bpm-user.service.mock.ts b/lib/process-services/src/lib/process-user-info/mocks/bpm-user.service.mock.ts similarity index 97% rename from lib/core/src/lib/mock/bpm-user.service.mock.ts rename to lib/process-services/src/lib/process-user-info/mocks/bpm-user.service.mock.ts index bed069d8c8..5b5dfc72c5 100644 --- a/lib/core/src/lib/mock/bpm-user.service.mock.ts +++ b/lib/process-services/src/lib/process-user-info/mocks/bpm-user.service.mock.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { BpmUserModel } from '../models'; +import { BpmUserModel } from '../../common/models/bpm-user.model'; export const fakeBpmUserNoImage = { apps: [], diff --git a/lib/process-services/src/lib/process-user-info/process-user-info.component.html b/lib/process-services/src/lib/process-user-info/process-user-info.component.html index bc5582dcdf..daab75e640 100644 --- a/lib/process-services/src/lib/process-user-info/process-user-info.component.html +++ b/lib/process-services/src/lib/process-user-info/process-user-info.component.html @@ -1,8 +1,8 @@ -
@@ -37,41 +37,41 @@ [overlapTrigger]="false" class="adf-userinfo-menu"> - - - -
- ecm-profile-image -
- -
-
- -
{{ecmUser | fullName}}
-
- -
-
+ + + +
+ ecm-profile-image +
+ +
+
+ +
{{ecmUser | fullName}}
+
+ +
+
{{ecmUser | fullName}} - {{ecmUser.email}} -
-
+ {{ecmUser.email}} +
+
{{ 'USER_PROFILE.LABELS.ECM.JOB_TITLE' | translate }} {{ ecmUser.jobTitle ? ecmUser.jobTitle : 'N/A' }} -
-
-
-
-
+
+
+
+
+
diff --git a/lib/process-services/src/lib/process-user-info/process-user-info.component.spec.ts b/lib/process-services/src/lib/process-user-info/process-user-info.component.spec.ts index 0af79be5c7..5407b1ce73 100644 --- a/lib/process-services/src/lib/process-user-info/process-user-info.component.spec.ts +++ b/lib/process-services/src/lib/process-user-info/process-user-info.component.spec.ts @@ -17,19 +17,18 @@ import { CoreTestingModule, - fakeBpmUser, - BpmUserModel, setupTestBed, - fakeEcmUser, - fakeEcmUserNoImage, UserInfoMode } from '@alfresco/adf-core'; +import { fakeEcmUser, fakeEcmUserNoImage } from '@alfresco/adf-content-services'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatMenuModule } from '@angular/material/menu'; import { By } from '@angular/platform-browser'; import { TranslateModule } from '@ngx-translate/core'; +import { BpmUserModel } from '../common/models/bpm-user.model'; import { ProcessUserInfoComponent } from './process-user-info.component'; +import { fakeBpmUser } from './mocks/bpm-user.service.mock'; describe('ProcessUserInfoComponent', () => { const profilePictureUrl = 'alfresco-logo.svg'; diff --git a/lib/process-services/src/lib/process-user-info/process-user-info.component.ts b/lib/process-services/src/lib/process-user-info/process-user-info.component.ts index bb076f310e..711c70367b 100644 --- a/lib/process-services/src/lib/process-user-info/process-user-info.component.ts +++ b/lib/process-services/src/lib/process-user-info/process-user-info.component.ts @@ -15,10 +15,13 @@ * limitations under the License. */ -import { BpmUserModel, BpmUserService, EcmUserModel, PeopleContentService, UserInfoMode } from '@alfresco/adf-core'; +import { UserInfoMode } from '@alfresco/adf-core'; +import { EcmUserModel, PeopleContentService } from '@alfresco/adf-content-services'; import { Component, Input, OnDestroy, ViewChild, ViewEncapsulation } from '@angular/core'; import { MatMenuTrigger, MenuPositionX, MenuPositionY } from '@angular/material/menu'; import { Subject } from 'rxjs'; +import { PeopleProcessService } from '../common/services/people-process.service'; +import { BpmUserModel } from '../common/models/bpm-user.model'; @Component({ selector: 'adf-process-user-info', @@ -72,7 +75,7 @@ export class ProcessUserInfoComponent implements OnDestroy { private destroy$ = new Subject(); - constructor(private bpmUserService: BpmUserService, private peopleContentService: PeopleContentService) { + constructor(private peopleProcessService: PeopleProcessService, private peopleContentService: PeopleContentService) { } ngOnDestroy(): void { @@ -95,7 +98,7 @@ export class ProcessUserInfoComponent implements OnDestroy { } getBpmUserImage(): string { - return this.bpmUserService.getCurrentUserProfileImage(); + return this.peopleProcessService.getCurrentUserProfileImage(); } getEcmAvatar(avatarId: string): string { diff --git a/lib/process-services/src/lib/task-comments/services/task-comments.service.ts b/lib/process-services/src/lib/task-comments/services/task-comments.service.ts index 528246696f..9ef76f4b29 100644 --- a/lib/process-services/src/lib/task-comments/services/task-comments.service.ts +++ b/lib/process-services/src/lib/task-comments/services/task-comments.service.ts @@ -15,11 +15,13 @@ * limitations under the License. */ -import { AlfrescoApiService, CommentModel, CommentsService, PeopleProcessService, UserProcessModel } from '@alfresco/adf-core'; +import { AlfrescoApiService, CommentModel, CommentsService } from '@alfresco/adf-core'; import { ActivitiCommentsApi, CommentRepresentation } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; import { from, Observable, throwError } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; +import { UserProcessModel } from '../../common/models/user-process.model'; +import { PeopleProcessService } from '../../common/services/people-process.service'; @Injectable({ providedIn: 'root' diff --git a/lib/process-services/src/lib/task-list/components/start-task.component.ts b/lib/process-services/src/lib/task-list/components/start-task.component.ts index d7b9759eb8..64c8e50e1c 100644 --- a/lib/process-services/src/lib/task-list/components/start-task.component.ts +++ b/lib/process-services/src/lib/task-list/components/start-task.component.ts @@ -16,7 +16,7 @@ */ import { - LogService, UserPreferencesService, UserPreferenceValues, UserProcessModel, FormFieldModel, FormModel, + LogService, UserPreferencesService, UserPreferenceValues, FormFieldModel, FormModel, MOMENT_DATE_FORMATS, MomentDateAdapter } from '@alfresco/adf-core'; import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDestroy } from '@angular/core'; @@ -28,6 +28,7 @@ import { TaskDetailsModel } from '../models/task-details.model'; import { TaskListService } from './../services/tasklist.service'; import { switchMap, defaultIfEmpty, takeUntil } from 'rxjs/operators'; import { UntypedFormBuilder, AbstractControl, Validators, UntypedFormGroup, UntypedFormControl } from '@angular/forms'; +import { UserProcessModel } from '../../common/models/user-process.model'; const FORMAT_DATE = 'DD/MM/YYYY'; const MAX_LENGTH = 255; diff --git a/lib/process-services/src/lib/task-list/components/task-audit.directive.ts b/lib/process-services/src/lib/task-list/components/task-audit.directive.ts index d890c216b3..579c340b20 100644 --- a/lib/process-services/src/lib/task-list/components/task-audit.directive.ts +++ b/lib/process-services/src/lib/task-list/components/task-audit.directive.ts @@ -17,7 +17,7 @@ /* eslint-disable @angular-eslint/no-input-rename */ -import { ContentService } from '@alfresco/adf-core'; +import { DownloadService } from '@alfresco/adf-core'; import { Directive, EventEmitter, Input, OnChanges, Output } from '@angular/core'; import { TaskListService } from './../services/tasklist.service'; @@ -60,7 +60,7 @@ export class TaskAuditDirective implements OnChanges { public audit: any; - constructor(private contentService: ContentService, + constructor(private downloadService: DownloadService, private taskListService: TaskListService) { } @@ -87,7 +87,7 @@ export class TaskAuditDirective implements OnChanges { (blob: Blob) => { this.audit = blob; if (this.download) { - this.contentService.downloadBlob(this.audit, this.fileName + '.pdf'); + this.downloadService.downloadBlob(this.audit, this.fileName + '.pdf'); } this.clicked.emit({ format: this.format, value: this.audit, fileName: this.fileName }); }, diff --git a/lib/process-services/src/lib/task-list/components/task-details.component.spec.ts b/lib/process-services/src/lib/task-list/components/task-details.component.spec.ts index f48ceb8070..6c508c2715 100644 --- a/lib/process-services/src/lib/task-list/components/task-details.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-details.component.spec.ts @@ -24,10 +24,7 @@ import { FormOutcomeEvent, FormOutcomeModel, setupTestBed, - BpmUserService, LogService, - UserProcessModel, - PeopleProcessService, CommentModel } from '@alfresco/adf-core'; import { TaskDetailsModel } from '../models/task-details.model'; @@ -45,6 +42,8 @@ import { TranslateModule } from '@ngx-translate/core'; import { TaskService } from '../../form/services/task.service'; import { TaskFormService } from '../../form/services/task-form.service'; import { TaskCommentsService } from '../../task-comments/services/task-comments.service'; +import { UserProcessModel } from '../../common/models/user-process.model'; +import { PeopleProcessService } from '../../common/services/people-process.service'; const fakeUser = new UserProcessModel({ id: 'fake-id', @@ -73,7 +72,6 @@ describe('TaskDetailsComponent', () => { let logService: LogService; let taskCommentsService: TaskCommentsService; let peopleProcessService: PeopleProcessService; - let bpmUserService: BpmUserService; setupTestBed({ imports: [ @@ -85,9 +83,9 @@ describe('TaskDetailsComponent', () => { beforeEach(() => { logService = TestBed.inject(LogService); + peopleProcessService = TestBed.inject(PeopleProcessService); - bpmUserService = TestBed.inject(BpmUserService); - spyOn(bpmUserService, 'getCurrentUserInfo').and.returnValue(of({ email: 'fake-email' })); + spyOn(peopleProcessService, 'getCurrentUserInfo').and.returnValue(of({ email: 'fake-email' })); taskListService = TestBed.inject(TaskListService); spyOn(taskListService, 'getTaskChecklist').and.returnValue(of(noDataMock)); diff --git a/lib/process-services/src/lib/task-list/components/task-details.component.ts b/lib/process-services/src/lib/task-list/components/task-details.component.ts index 99e603c8cf..243dd91825 100644 --- a/lib/process-services/src/lib/task-list/components/task-details.component.ts +++ b/lib/process-services/src/lib/task-list/components/task-details.component.ts @@ -16,7 +16,6 @@ */ import { - PeopleProcessService, UserProcessModel, CardViewUpdateService, ClickNotification, LogService, @@ -43,6 +42,8 @@ import { TaskDetailsModel } from '../models/task-details.model'; import { TaskListService } from './../services/tasklist.service'; import { catchError, share, takeUntil } from 'rxjs/operators'; import { TaskFormComponent } from './task-form/task-form.component'; +import { UserProcessModel } from '../../common/models/user-process.model'; +import { PeopleProcessService } from '../../common/services/people-process.service'; @Component({ selector: 'adf-task-details', diff --git a/lib/process-services/src/lib/task-list/components/task-form/task-form.component.spec.ts b/lib/process-services/src/lib/task-list/components/task-form/task-form.component.spec.ts index 6e53b84502..a38493b26e 100644 --- a/lib/process-services/src/lib/task-list/components/task-form/task-form.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-form/task-form.component.spec.ts @@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TaskFormComponent } from './task-form.component'; import { - BpmUserService, FormModel, FormOutcomeEvent, FormOutcomeModel, @@ -53,6 +52,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; import { TaskFormService } from '../../../form/services/task-form.service'; import { TaskService } from '../../../form/services/task.service'; +import { PeopleProcessService } from '../../../common/services/people-process.service'; describe('TaskFormComponent', () => { let component: TaskFormComponent; @@ -63,7 +63,7 @@ describe('TaskFormComponent', () => { let getTaskDetailsSpy: jasmine.Spy; let completeTaskSpy: jasmine.Spy; let element: HTMLElement; - let bpmUserService: BpmUserService; + let peopleProcessService: PeopleProcessService; let getBpmLoggedUserSpy: jasmine.Spy; setupTestBed({ @@ -88,8 +88,8 @@ describe('TaskFormComponent', () => { spyOn(taskFormService, 'getTaskForm').and.returnValue(of(taskFormMock)); taskDetailsMock.processDefinitionId = null; spyOn(taskService, 'getTask').and.returnValue(of(taskDetailsMock)); - bpmUserService = TestBed.inject(BpmUserService); - getBpmLoggedUserSpy = spyOn(bpmUserService, 'getCurrentUserInfo').and.returnValue(of(fakeUser)); + peopleProcessService = TestBed.inject(PeopleProcessService); + getBpmLoggedUserSpy = spyOn(peopleProcessService, 'getCurrentUserInfo').and.returnValue(of(fakeUser)); }); afterEach(async () => { diff --git a/lib/process-services/src/lib/task-list/components/task-form/task-form.component.ts b/lib/process-services/src/lib/task-list/components/task-form/task-form.component.ts index 810638dbce..84f4f85463 100644 --- a/lib/process-services/src/lib/task-list/components/task-form/task-form.component.ts +++ b/lib/process-services/src/lib/task-list/components/task-form/task-form.component.ts @@ -22,13 +22,13 @@ import { FormFieldValidator, FormOutcomeEvent, TranslationService, - FormFieldModel, - BpmUserService + FormFieldModel } from '@alfresco/adf-core'; import { TaskDetailsModel } from '../../models/task-details.model'; import { TaskListService } from '../../services/tasklist.service'; import { UserRepresentation, LightGroupRepresentation, LightUserRepresentation } from '@alfresco/js-api'; import { Observable } from 'rxjs'; +import { PeopleProcessService } from '../../../common/services/people-process.service'; @Component({ selector: 'adf-task-form', @@ -134,13 +134,13 @@ export class TaskFormComponent implements OnInit, OnChanges { constructor( private taskListService: TaskListService, - private bpmUserService: BpmUserService, + private peopleProcessService: PeopleProcessService, private translationService: TranslationService ) { } ngOnInit() { - this.bpmUserService.getCurrentUserInfo().subscribe(user => { + this.peopleProcessService.getCurrentUserInfo().subscribe(user => { this.currentLoggedUser = user; }); this.loadTask(this.taskId); diff --git a/lib/process-services/src/lib/task-list/components/task-header.component.spec.ts b/lib/process-services/src/lib/task-list/components/task-header.component.spec.ts index 3b311187ba..4721ad2f99 100644 --- a/lib/process-services/src/lib/task-list/components/task-header.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-header.component.spec.ts @@ -17,7 +17,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { AppConfigService, setupTestBed, BpmUserService, BpmUserModel } from '@alfresco/adf-core'; +import { AppConfigService, setupTestBed } from '@alfresco/adf-core'; import { of } from 'rxjs'; import { completedTaskDetailsMock, @@ -33,13 +33,15 @@ import { TaskListService } from './../services/tasklist.service'; import { TaskHeaderComponent } from './task-header.component'; import { ProcessTestingModule } from '../../testing/process.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { PeopleProcessService } from '../../common/services/people-process.service'; +import { BpmUserModel } from '../../common/models/bpm-user.model'; describe('TaskHeaderComponent', () => { let service: TaskListService; let component: TaskHeaderComponent; let fixture: ComponentFixture; - let userBpmService: BpmUserService; + let peopleProcessService: PeopleProcessService; let appConfigService: AppConfigService; const fakeBpmAssignedUser = new BpmUserModel({ @@ -67,8 +69,8 @@ describe('TaskHeaderComponent', () => { fixture = TestBed.createComponent(TaskHeaderComponent); component = fixture.componentInstance; service = TestBed.inject(TaskListService); - userBpmService = TestBed.inject(BpmUserService); - spyOn(userBpmService, 'getCurrentUserInfo').and.returnValue(of(fakeBpmAssignedUser)); + peopleProcessService = TestBed.inject(PeopleProcessService); + spyOn(peopleProcessService, 'getCurrentUserInfo').and.returnValue(of(fakeBpmAssignedUser)); component.taskDetails = new TaskDetailsModel(taskDetailsMock); appConfigService = TestBed.inject(AppConfigService); }); diff --git a/lib/process-services/src/lib/task-list/components/task-header.component.ts b/lib/process-services/src/lib/task-list/components/task-header.component.ts index 784e8a31cf..672d71a7c7 100644 --- a/lib/process-services/src/lib/task-list/components/task-header.component.ts +++ b/lib/process-services/src/lib/task-list/components/task-header.component.ts @@ -17,7 +17,6 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { - BpmUserService, CardViewDateItemModel, CardViewMapItemModel, CardViewTextItemModel, @@ -28,6 +27,7 @@ import { CardViewItemLengthValidator } from '@alfresco/adf-core'; import { TaskDetailsModel } from '../models/task-details.model'; +import { PeopleProcessService } from '../../common/services/people-process.service'; import { TaskDescriptionValidator } from '../validators/task-description.validator'; @Component({ @@ -66,7 +66,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit { private currentUserId: number; - constructor(private bpmUserService: BpmUserService, + constructor(private peopleProcessService: PeopleProcessService, private translationService: TranslationService, private appConfig: AppConfigService) { this.dateFormat = this.appConfig.get('dateValues.defaultDateFormat'); @@ -328,7 +328,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit { * Loads current bpm userId */ private loadCurrentBpmUserId(): void { - this.bpmUserService.getCurrentUserInfo().subscribe((res) => { + this.peopleProcessService.getCurrentUserInfo().subscribe((res) => { this.currentUserId = res ? +res.id : null; }); } diff --git a/lib/process-services/src/lib/task-list/models/start-task.model.ts b/lib/process-services/src/lib/task-list/models/start-task.model.ts index c6db7e9684..d2b7b58029 100644 --- a/lib/process-services/src/lib/task-list/models/start-task.model.ts +++ b/lib/process-services/src/lib/task-list/models/start-task.model.ts @@ -18,7 +18,7 @@ /** * This object represent of the StartTaskModel. */ -import { UserProcessModel } from '@alfresco/adf-core'; +import { UserProcessModel } from '../../common/models/user-process.model'; export class StartTaskModel { diff --git a/lib/process-services/src/lib/task-list/models/task-details.model.ts b/lib/process-services/src/lib/task-list/models/task-details.model.ts index fcbb7e8208..a4715767c8 100644 --- a/lib/process-services/src/lib/task-list/models/task-details.model.ts +++ b/lib/process-services/src/lib/task-list/models/task-details.model.ts @@ -18,8 +18,8 @@ /** * This object represent the details of a task. */ -import { UserProcessModel } from '@alfresco/adf-core'; import { TaskRepresentation } from '@alfresco/js-api'; +import { UserProcessModel } from '../../common/models/user-process.model'; import { UserGroupModel } from './user-group.model'; export class TaskDetailsModel implements TaskRepresentation { diff --git a/lib/process-services/src/lib/task-list/services/process-upload.service.ts b/lib/process-services/src/lib/task-list/services/process-upload.service.ts index ff8653a343..fd0ff157f4 100644 --- a/lib/process-services/src/lib/task-list/services/process-upload.service.ts +++ b/lib/process-services/src/lib/task-list/services/process-upload.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, AppConfigService, DiscoveryApiService, UploadService } from '@alfresco/adf-core'; +import { AlfrescoApiService, AppConfigService} from '@alfresco/adf-core'; +import { DiscoveryApiService, UploadService } from '@alfresco/adf-content-services'; import { ActivitiContentApi } from '@alfresco/js-api'; import { Injectable } from '@angular/core'; import { throwError } from 'rxjs'; diff --git a/lib/process-services/src/lib/task-list/services/task-upload.service.ts b/lib/process-services/src/lib/task-list/services/task-upload.service.ts index 5d353c828a..7d2b289044 100644 --- a/lib/process-services/src/lib/task-list/services/task-upload.service.ts +++ b/lib/process-services/src/lib/task-list/services/task-upload.service.ts @@ -15,7 +15,8 @@ * limitations under the License. */ -import { AlfrescoApiService, AppConfigService, DiscoveryApiService, UploadService } from '@alfresco/adf-core'; +import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core'; +import { DiscoveryApiService, UploadService } from '@alfresco/adf-content-services'; import { Injectable } from '@angular/core'; import { throwError } from 'rxjs'; import { ActivitiContentApi } from '@alfresco/js-api'; diff --git a/lib/process-services/src/lib/task-list/services/tasklist.service.spec.ts b/lib/process-services/src/lib/task-list/services/tasklist.service.spec.ts index 43847313bc..f2d29e5930 100644 --- a/lib/process-services/src/lib/task-list/services/tasklist.service.spec.ts +++ b/lib/process-services/src/lib/task-list/services/tasklist.service.spec.ts @@ -16,7 +16,7 @@ */ import { TestBed } from '@angular/core/testing'; -import { UserProcessModel, setupTestBed, CoreModule } from '@alfresco/adf-core'; +import { setupTestBed, CoreModule } from '@alfresco/adf-core'; import { of } from 'rxjs'; import { fakeCompletedTaskList, @@ -35,6 +35,7 @@ import { TaskDetailsModel } from '../models/task-details.model'; import { TaskListService } from './tasklist.service'; import { TaskRepresentation, TaskUpdateRepresentation } from '@alfresco/js-api'; import { ProcessTestingModule } from '../../testing/process.testing.module'; +import { UserProcessModel } from '../../common/models/user-process.model'; declare let jasmine: any; diff --git a/lib/process-services/src/public-api.ts b/lib/process-services/src/public-api.ts index 0ab696f107..bf15f7c192 100644 --- a/lib/process-services/src/public-api.ts +++ b/lib/process-services/src/public-api.ts @@ -15,6 +15,7 @@ * limitations under the License. */ +export * from './lib/common/index'; export * from './lib/process-list/index'; export * from './lib/task-list/index'; export * from './lib/app-list/index';