[AAE-10777] Move services from Core in Content the right place (#8242)

Clean core services and directive
This commit is contained in:
Eugenio Romano 2023-03-10 09:28:24 +01:00 committed by GitHub
parent 112e272ce7
commit 2590e7d0a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
263 changed files with 884 additions and 3393 deletions

View File

@ -17,7 +17,8 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { AppExtensionService, ExtensionRef } from '@alfresco/adf-extensions'; 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 pkg from '../../../../../package.json';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
@ -34,32 +35,32 @@ export class AboutComponent implements OnInit {
bpmVersion: BpmProductVersionModel = null; bpmVersion: BpmProductVersionModel = null;
constructor( constructor(
private authService: AuthenticationService, private authenticationService: AuthenticationService,
private appExtensions: AppExtensionService, private appExtensionService: AppExtensionService,
private discovery: DiscoveryApiService private discoveryApiService: DiscoveryApiService
) { ) {
this.pkg = pkg; this.pkg = pkg;
this.extensions$ = this.appExtensions.references$; this.extensions$ = this.appExtensionService.references$;
} }
ngOnInit(): void { ngOnInit(): void {
if (this.authService.isEcmLoggedIn()) { if (this.authenticationService.isEcmLoggedIn()) {
this.setECMInfo(); this.setECMInfo();
} }
if (this.authService.isBpmLoggedIn()) { if (this.authenticationService.isBpmLoggedIn()) {
this.setBPMInfo(); this.setBPMInfo();
} }
} }
setECMInfo() { setECMInfo() {
this.discovery.getEcmProductInfo().subscribe((repository) => { this.discoveryApiService.getEcmProductInfo().subscribe((repository) => {
this.repository = repository as RepositoryInfo; this.repository = repository as RepositoryInfo;
}); });
} }
setBPMInfo() { setBPMInfo() {
this.discovery.getBpmProductInfo().subscribe((bpmVersion) => { this.discoveryApiService.getBpmProductInfo().subscribe((bpmVersion) => {
this.bpmVersion = bpmVersion; this.bpmVersion = bpmVersion;
}); });
} }

View File

@ -15,7 +15,9 @@
* limitations under the License. * 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 { Component, OnInit, Input } from '@angular/core';
import { MenuPositionX, MenuPositionY } from '@angular/material/menu'; import { MenuPositionX, MenuPositionY } from '@angular/material/menu';
import { Observable, of } from 'rxjs'; import { Observable, of } from 'rxjs';
@ -42,7 +44,7 @@ export class UserInfoComponent implements OnInit {
userInfoMode = UserInfoMode; userInfoMode = UserInfoMode;
constructor(private peopleContentService: PeopleContentService, constructor(private peopleContentService: PeopleContentService,
private bpmUserService: BpmUserService, private peopleProcessService: PeopleProcessService,
private identityUserService: IdentityUserService, private identityUserService: IdentityUserService,
private authService: AuthenticationService) { private authService: AuthenticationService) {
} }
@ -86,7 +88,7 @@ export class UserInfoComponent implements OnInit {
} }
private loadBpmUserInfo() { private loadBpmUserInfo() {
this.bpmUser$ = this.bpmUserService.getCurrentUserInfo(); this.bpmUser$ = this.peopleProcessService.getCurrentUserInfo();
} }
private loadIdentityUserInfo() { private loadIdentityUserInfo() {

View File

@ -26,7 +26,7 @@ import {
} from '@angular/core'; } from '@angular/core';
import { NodeEntry, Node } from '@alfresco/js-api'; import { NodeEntry, Node } from '@alfresco/js-api';
import { BehaviorSubject, Subject } from 'rxjs'; import { BehaviorSubject, Subject } from 'rxjs';
import { NodesApiService } from '@alfresco/adf-core'; import { NodesApiService } from '@alfresco/adf-content-services';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
@Component({ @Component({

View File

@ -17,14 +17,16 @@
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, Router, PRIMARY_OUTLET } from '@angular/router'; import { ActivatedRoute, Router, PRIMARY_OUTLET } from '@angular/router';
import {
NotificationService
} from '@alfresco/adf-core';
import { import {
ContentService, ContentService,
AllowableOperationsEnum, AllowableOperationsEnum,
PermissionsEnum, PermissionsEnum,
NodesApiService, NodesApiService,
FileUploadErrorEvent, FileUploadErrorEvent
NotificationService } from '@alfresco/adf-content-services';
} from '@alfresco/adf-core';
import { PreviewService } from '../../services/preview.service'; import { PreviewService } from '../../services/preview.service';
@Component({ @Component({

View File

@ -45,11 +45,8 @@ import {
AuthenticationService, AuthenticationService,
AppConfigService, AppConfigService,
AppConfigValues, AppConfigValues,
ContentService,
FolderCreatedEvent,
LogService, LogService,
NotificationService, NotificationService,
UploadService,
DataRow, DataRow,
UserPreferencesService, UserPreferencesService,
PaginationComponent, PaginationComponent,
@ -57,12 +54,13 @@ import {
DisplayMode, DisplayMode,
ShowHeaderMode, ShowHeaderMode,
InfinitePaginationComponent, InfinitePaginationComponent,
FormRenderingService, FormRenderingService
FileUploadEvent,
NodesApiService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { import {
ContentService,
FolderCreatedEvent,
UploadService,
DocumentListComponent, DocumentListComponent,
PermissionStyleModel, PermissionStyleModel,
UploadFilesEvent, UploadFilesEvent,
@ -71,6 +69,8 @@ import {
ContentMetadataService, ContentMetadataService,
FilterSearch, FilterSearch,
DialogAspectListService, DialogAspectListService,
FileUploadEvent,
NodesApiService,
SharedLinksApiService SharedLinksApiService
} from '@alfresco/adf-content-services'; } from '@alfresco/adf-content-services';

View File

@ -19,7 +19,8 @@ import { Component, Inject, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { MinimalNodeEntryEntity } from '@alfresco/js-api';
import { PreviewService } from '../../services/preview.service'; 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({ @Component({
templateUrl: './version-manager-dialog-adapter.component.html', templateUrl: './version-manager-dialog-adapter.component.html',

View File

@ -18,7 +18,8 @@
import { Component, Input, OnChanges, OnInit, ViewChild, OnDestroy } from '@angular/core'; import { Component, Input, OnChanges, OnInit, ViewChild, OnDestroy } from '@angular/core';
import { ProcessInstance, ProcessService , import { ProcessInstance, ProcessService ,
ProcessAttachmentListComponent, ProcessUploadService } from '@alfresco/adf-process-services'; 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 { PreviewService } from '../../services/preview.service';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';

View File

@ -22,7 +22,8 @@ import {
TaskUploadService, TaskUploadService,
TaskDetailsModel TaskDetailsModel
} from '@alfresco/adf-process-services'; } 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 { PreviewService } from '../../services/preview.service';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';

View File

@ -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) | | [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) | | [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) | | [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) | | [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 ### Dialogs
@ -160,11 +160,11 @@ for more information about installing and using the source code.
| Name | Description | Source link | | 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) | | [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/core/src/lib/models/ecm-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) | | [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) | | [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 ### 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) | | [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 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) | | [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) | | [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](<>) | | [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) | | [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) | | [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/core/src/lib/services/download-zip.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) | | [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) | | [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) | | [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) | | [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) | | [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) | | [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) | | [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) | | [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 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/core/src/lib/services/people-process.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) | | [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) | | [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) | | [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) | | [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) | | [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) | | [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) | | [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/services/user-access.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) | | [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 ### Widgets

View File

@ -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` classes without the **adf-** prefix, you will now need to update them. For example, `.card-view`
is now `.adf-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. 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. This modification has enabled us to remove some code duplication between the two modules.

View File

@ -48,7 +48,7 @@ Activates a file upload.
| Name | Type | Description | | 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. | | 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. | | 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)`<any>` | Emitted when the file is uploaded successfully. | | success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the file is uploaded successfully. |
| updateFileVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<CustomEvent<any>>` | Emitted when dropping a file over another file to update the version. | | updateFileVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<CustomEvent<any>>` | Emitted when dropping a file over another file to update the version. |

View File

@ -75,7 +75,7 @@ as the drag/drop target:
| Name | Type | Description | | 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. | | 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)`<any>` | Emitted when the file is uploaded successfully. | | success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the file is uploaded successfully. |
| updateFileVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<CustomEvent<any>>` | Emitted when dropping a file over another file to update the version. | | updateFileVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<CustomEvent<any>>` | Emitted when dropping a file over another file to update the version. |

View File

@ -51,7 +51,7 @@ to enrich the features and decrease the restrictions currently applied to node v
| Name | Type | Description | | 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. | | 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. | | 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)`<any>` | Emitted when the file is uploaded successfully. | | success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the file is uploaded successfully. |
| updateFileVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<CustomEvent<any>>` | Emitted when dropping a file over another file to update the version. | | updateFileVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<CustomEvent<any>>` | Emitted when dropping a file over another file to update the version. |

View File

@ -40,7 +40,7 @@ Displays the version history of a node with the ability to upload a new version.
| Name | Type | Description | | Name | Type | Description |
| ---- | ---- | ----------- | | ---- | ---- | ----------- |
| uploadCancel | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<boolean>` | Emitted when an cancelling during upload. | | uploadCancel | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<boolean>` | 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)`<Node>` | Emitted when a file is uploaded successfully. | | uploadSuccess | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<Node>` | Emitted when a file is uploaded successfully. |
| viewVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when viewing a version. | | viewVersion | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when viewing a version. |

View File

@ -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)`<any>` | Emitted when an cancelling during upload. | | cancel | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when an cancelling during upload. |
| commentChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when the comment is changed. | | commentChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | 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)`<any>` | Emitted when the file is uploaded successfully. | | success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | 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)`<boolean>` | Emitted when the version is changed. | | versionChanged | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<boolean>` | Emitted when the version is changed. |
## Details ## Details

View File

@ -5,7 +5,7 @@ Status: Active
Last reviewed: 2018-11-20 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. Allows folders and/or files to be downloaded, with multiple nodes packed as a '.ZIP' archive.

View File

@ -4,7 +4,7 @@ Added: v2.0.0
Status: Active 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. Contains information about a Process Services user.

View File

@ -4,7 +4,7 @@ Added: v2.0.0
Status: Active 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. Contains information about a Content Services user.

View File

@ -4,7 +4,7 @@ Added: v2.0.0
Status: Active 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. Represents a Process Services user.

View File

@ -5,7 +5,7 @@ Status: Active
Last reviewed: 2019-03-13 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. 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 - _blob:_ [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) - Data to wrap into object URL
- **Returns** `string` - URL string - **Returns** `string` - URL string
- **downloadBlob**(blob: [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob), fileName: `string`)<br/> - **downloadBlob**(blob: [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob), fileName: `string`)<br/>
(**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. - _blob:_ [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) - Content to download.
- _fileName:_ `string` - Name of the resulting file. - _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`<br/> - **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`<br/>
@ -42,15 +42,15 @@ Accesses app-generated data objects via URLs and file downloads.
Gets content for the given node. Gets content for the given node.
- _nodeId:_ `string` - ID of the target node - _nodeId:_ `string` - ID of the target node
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Content data - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Content data
- **hasAllowableOperations**(node: `Node`, allowableOperation: [`AllowableOperationsEnum`](../../../lib/core/src/lib/models/allowable-operations.enum.ts)`|string`): `boolean`<br/> - **hasAllowableOperations**(node: `Node`, allowableOperation: [`AllowableOperationsEnum`](lib/content-services/src/lib/common/models/allowable-operations.enum.ts)`|string`): `boolean`<br/>
Checks if the user has permissions on that node Checks if the user has permissions on that node
- _node:_ `Node` - Node to check allowableOperations - _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 - **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`<br/> - **hasPermissions**(node: `Node`, permission: [`PermissionsEnum`](lib/content-services/src/lib/common/models/permissions.enum.ts)`|string`, userId?: `string`): `boolean`<br/>
Checks if the user has permission on that node Checks if the user has permission on that node
- _node:_ `Node` - Node to check permissions - _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 - _userId:_ `string` - (Optional) Optional current user id will be taken by default
- **Returns** `boolean` - True if the user has the required permissions, false otherwise - **Returns** `boolean` - True if the user has the required permissions, false otherwise

View File

@ -5,7 +5,7 @@ Status: Active
Last reviewed: 2018-11-19 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. Gets version and license information for Process Services and Content Services.

View File

@ -5,7 +5,7 @@ Status: Active
Last reviewed: 2019-01-08 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. Creates and manages downloads.

View File

@ -5,7 +5,7 @@ Status: Active
Last reviewed: 2019-01-16 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. 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 - _nodeId:_ `string` - ID of the target node
- _options:_ `any` - Optional parameters supported by JS-API - _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 - **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)`>`<br/> - **getNodeMetadata**(nodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeMetadata`](lib/content-services/src/lib/common/models/node-metadata.model.ts)`>`<br/>
Get the metadata and the nodeType for a nodeId cleaned by the prefix. Get the metadata and the nodeType for a nodeId cleaned by the prefix.
- _nodeId:_ `string` - ID of the target node - _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)`>`<br/> - **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)`>`<br/>
Restores a node previously moved to the trashcan. Restores a node previously moved to the trashcan.
- _nodeId:_ `string` - ID of the node to restore - _nodeId:_ `string` - ID of the node to restore

View File

@ -5,7 +5,7 @@ Status: Active
Last reviewed: 2018-04-06 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. Gets information about a Content Services user.
@ -36,10 +36,10 @@ Gets information about a Content Services user.
- **isCurrentUserAdmin**(): `boolean`<br/> - **isCurrentUserAdmin**(): `boolean`<br/>
Used to know if the current user has the admin capability Used to know if the current user has the admin capability
- **Returns** `boolean` - true or false - **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)`>`<br/> - **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)`>`<br/>
Gets a list of people. 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 - _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/core/src/lib/services/people-content.service.ts)`>` - Response containing pagination and list of entries - **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**()<br/> - **resetLocalCurrentUser**()<br/>
Reset the local current user object 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)`>`<br/> - **updatePerson**(personId: `string`, details: `PersonBodyUpdate`, opts?: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`>`<br/>

View File

@ -5,7 +5,7 @@ Status: Active
Last reviewed: 2018-04-05 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. Gets information about Process Services users.

View File

@ -5,7 +5,7 @@ Status: Active
Last reviewed: 2019-01-16 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. 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 ### Methods
- **addToQueue**(files: [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)`[]`): [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)`[]`<br/> - **addToQueue**(files: [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]`): [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]`<br/>
Adds files to the uploading queue to be uploaded 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 - _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/core/src/lib/models/file.model.ts)`[]` - Array of files that were not blocked from upload by the ignore list - **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/core/src/lib/models/file.model.ts)`[]`)<br/> - **cancelUpload**(files: [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]`)<br/>
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. 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**()<br/> - **clearCache**()<br/>
- **clearQueue**()<br/> - **clearQueue**()<br/>
Clears the upload queue Clears the upload queue
- **getQueue**(): [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)`[]`<br/> - **getQueue**(): [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)`[]`<br/>
Gets the file Queue 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`<br/> - **getThreadsCount**(): `number`<br/>
Returns the number of concurrent threads for uploading. Returns the number of concurrent threads for uploading.
- **Returns** `number` - Number of concurrent threads (default 1) - **Returns** `number` - Number of concurrent threads (default 1)
- **getUploadPromise**(file: [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)): `any`<br/> - **getUploadPromise**(file: [`FileModel`](lib/content-services/src/lib/common/models/file.model.ts)): `any`<br/>
Gets an upload promise for a file. 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 - **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`<br/> - **isUploading**(): `boolean`<br/>
Checks whether the service still has files uploading or awaiting upload. 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 | | Name | Type | Description |
| ---- | ---- | ----------- | | ---- | ---- | ----------- |
| queueChanged | [`FileModel`](../../../lib/core/src/lib/models/file.model.ts)\[] | Emitted when the file queue changes. | | queueChanged | [`FileModel`](lib/content-services/src/lib/common/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. | | 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/core/src/lib/events/file.event.ts) | Emitted when an upload starts. | | fileUploadStarting | [`FileUploadEvent`](lib/content-services/src/lib/common/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. | | fileUploadCancelled | [`FileUploadEvent`](lib/content-services/src/lib/common/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). | | 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/core/src/lib/events/file.event.ts) | Emitted when a file upload gets aborted by the server. | | 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/core/src/lib/events/file.event.ts) | Emitted when an error occurs during a file upload. | | fileUploadError | [`FileUploadEvent`](lib/content-services/src/lib/common/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. | | fileUploadComplete | [`FileUploadCompleteEvent`](lib/content-services/src/lib/common/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. | | 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. | | fileDeleted | string | This can be invoked when a file is deleted from an external source to upload the file dialog status. |
## Details ## Details
@ -120,7 +120,7 @@ In this way all the files present in the .git folder won't be uploaded.
### Toggling Versioning Support ### 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. > 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. > Since Alfresco 6.2.3 versioningEnabled flag was introduced offering better control over the new node Versioning.

View File

@ -5,7 +5,7 @@ Status: Active
Last reviewed: 2022-06-05 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 Checks the global and application access of a user

View File

@ -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 library. You should modify your code to import these classes from
`@alfresco/adf-core`. `@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) - [`NodeDownloadDirective`](../core/directives/node-download.directive.md) (formerly Content Services)
- [`CommentsModule`](../../lib/core/src/lib/comments/comments.module.ts) (formerly Process Services) - [`CommentsModule`](../../lib/core/src/lib/comments/comments.module.ts) (formerly Process Services)
- [`CommentListComponent`](../core/components/comment-list.component.md) (formerly Process Services) - [`CommentListComponent`](../core/components/comment-list.component.md) (formerly Process Services)

View File

@ -90,10 +90,13 @@ How to fix it:
## Deprecated items ## Deprecated items
| Class | Before | After | | Class | Before | Description |
| --- | -- | --- | | --- | -- | --- |
| `LoginDialogService` | `@alfresco/adf-core`| | `LoginDialogService` | `@alfresco/adf-core`||
| `UserInfoComponent` | `@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 ### 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` | | [`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` | | [`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` | | [`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` | | [`AppsProcessService`] | `@alfresco/adf-core` | `@alfresco/adf-process-services` |
| `SharedLinksApiService` | `@alfresco/adf-core` | `@alfresco/adf-process-services` | | `SharedLinksApiService` | `@alfresco/adf-core` | `@alfresco/adf-process-services` |
| `LockService` | `@alfresco/adf-core` | `@alfresco/adf-process-services` | | `LockService` | `@alfresco/adf-core` | `@alfresco/adf-process-services` |
| `FavoritesApiService` | `@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` | | `RichTextEditorComponent` | `@alfresco/adf-core` | `@alfresco/adf-process-services-cloud` |
### Update Data-table a data change ### 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. v6.0.0 and after You will need to provide a ```DataTableService``` to update a row of your table.

View File

@ -25,7 +25,7 @@ import { AspectListDialogComponentData } from './aspect-list-dialog-data.interfa
import { AspectListService } from './services/aspect-list.service'; import { AspectListService } from './services/aspect-list.service';
import { delay } from 'rxjs/operators'; import { delay } from 'rxjs/operators';
import { AspectEntry, MinimalNode } from '@alfresco/js-api'; import { AspectEntry, MinimalNode } from '@alfresco/js-api';
import { NodesApiService } from '@alfresco/adf-core'; import { NodesApiService } from '../common/services/nodes-api.service';
const aspectListMock: AspectEntry[] = [{ const aspectListMock: AspectEntry[] = [{
entry: { entry: {

View File

@ -16,7 +16,8 @@
*/ */
import { ComponentFixture, TestBed } from '@angular/core/testing'; 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 { ContentTestingModule } from '../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { AspectListComponent } from './aspect-list.component'; import { AspectListComponent } from './aspect-list.component';

View File

@ -16,7 +16,7 @@
*/ */
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, ViewEncapsulation } from '@angular/core'; 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 { Observable, Subject, zip } from 'rxjs';
import { concatMap, map, takeUntil, tap } from 'rxjs/operators'; import { concatMap, map, takeUntil, tap } from 'rxjs/operators';
import { AspectListService } from './services/aspect-list.service'; import { AspectListService } from './services/aspect-list.service';

View File

@ -18,7 +18,8 @@
import { MinimalNode } from '@alfresco/js-api'; import { MinimalNode } from '@alfresco/js-api';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core'; 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 { EMPTY, of } from 'rxjs';
import { ContentTestingModule } from '../../testing/content.testing.module'; import { ContentTestingModule } from '../../testing/content.testing.module';
import { NodeAspectService } from './node-aspect.service'; import { NodeAspectService } from './node-aspect.service';

View File

@ -16,9 +16,9 @@
*/ */
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { NodesApiService } from '@alfresco/adf-core';
import { DialogAspectListService } from './dialog-aspect-list.service'; import { DialogAspectListService } from './dialog-aspect-list.service';
import { CardViewContentUpdateService } from '../../common/services/card-view-content-update.service'; import { CardViewContentUpdateService } from '../../common/services/card-view-content-update.service';
import { NodesApiService } from '../../common/services/nodes-api.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'

View File

@ -33,8 +33,7 @@ export class CategoryTreeDatasourceService extends TreeService<CategoryNode> {
public getSubNodes(parentNodeId: string, skipCount?: number, maxItems?: number, name?: string): Observable<TreeResponse<CategoryNode>> { public getSubNodes(parentNodeId: string, skipCount?: number, maxItems?: number, name?: string): Observable<TreeResponse<CategoryNode>> {
return !name ? this.categoryService.getSubcategories(parentNodeId, skipCount, maxItems).pipe(map((response: CategoryPaging) => { return !name ? this.categoryService.getSubcategories(parentNodeId, skipCount, maxItems).pipe(map((response: CategoryPaging) => {
const parentNode: CategoryNode = this.getParentNode(parentNodeId); const parentNode: CategoryNode = this.getParentNode(parentNodeId);
const nodesList: CategoryNode[] = response.list.entries.map((entry: CategoryEntry) => { const nodesList: CategoryNode[] = response.list.entries.map((entry: CategoryEntry) => ({
return {
id: entry.entry.id, id: entry.entry.id,
nodeName: entry.entry.name, nodeName: entry.entry.name,
parentId: entry.entry.parentId, parentId: entry.entry.parentId,
@ -42,8 +41,7 @@ export class CategoryTreeDatasourceService extends TreeService<CategoryNode> {
level: parentNode ? parentNode.level + 1 : 0, level: parentNode ? parentNode.level + 1 : 0,
isLoading: false, isLoading: false,
nodeType: TreeNodeType.RegularNode nodeType: TreeNodeType.RegularNode
}; }));
});
if (response.list.pagination.hasMoreItems && parentNode) { if (response.list.pagination.hasMoreItems && parentNode) {
const loadMoreNode: CategoryNode = { const loadMoreNode: CategoryNode = {
id: 'loadMore', id: 'loadMore',

View File

@ -15,20 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { EcmCompanyModel } from '../models/ecm-company.model';
import { PersonEntry, Person, PersonPaging } from '@alfresco/js-api'; 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 = { export const fakeEcmUser = {
id: 'fake-id', id: 'fake-id',
firstName: 'fake-ecm-first-name', firstName: 'fake-ecm-first-name',

View File

@ -18,5 +18,22 @@
export * from './services/favorites-api.service'; export * from './services/favorites-api.service';
export * from './services/card-view-content-update.service'; export * from './services/card-view-content-update.service';
export * from './services/sites.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 './interfaces/search-configuration.interface';
export * from './mocks/ecm-user.service.mock';

View File

@ -17,12 +17,8 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { ContentService } from './content.service'; import { ContentService } from './content.service';
import { AppConfigService } from '../app-config/app-config.service'; import { AppConfigService, AuthenticationService, StorageService, setupTestBed, CoreTestingModule } from '@alfresco/adf-core';
import { AuthenticationService } from '../auth/services/authentication.service';
import { StorageService } from '../common/services/storage.service';
import { setupTestBed } from '../testing/setup-test-bed';
import { Node } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { CoreTestingModule } from '../testing';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
declare let jasmine: any; 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', () => { describe('AllowableOperations', () => {
it('should hasAllowableOperations be false if allowableOperation is not present in the node', () => { it('should hasAllowableOperations be false if allowableOperation is not present in the node', () => {

View File

@ -16,17 +16,11 @@
*/ */
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser'; import { ContentApi, MinimalNode, Node, NodeEntry } from '@alfresco/js-api';
import { ContentApi, MinimalNode, Node, NodeEntry, NodesApi } from '@alfresco/js-api'; import { Subject } from 'rxjs';
import { Observable, Subject, from, throwError } from 'rxjs'; import { AlfrescoApiService, AuthenticationService } from '@alfresco/adf-core';
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 { PermissionsEnum } from '../models/permissions.enum'; import { PermissionsEnum } from '../models/permissions.enum';
import { AllowableOperationsEnum } from '../models/allowable-operations.enum'; import { AllowableOperationsEnum } from '../models/allowable-operations.enum';
import { DownloadService } from './download.service';
import { ThumbnailService } from '../common/services/thumbnail.service';
export interface FolderCreatedEvent { export interface FolderCreatedEvent {
name: string; name: string;
@ -50,53 +44,10 @@ export class ContentService {
return this._contentApi; 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, constructor(public authService: AuthenticationService,
public apiService: AlfrescoApiService, public apiService: AlfrescoApiService) {
private logService: LogService,
private sanitizer: DomSanitizer,
private downloadService: DownloadService,
private thumbnailService: ThumbnailService) {
} }
/**
* @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. * Gets a content URL for the given node.
@ -122,28 +73,8 @@ export class ContentService {
return null; return null;
} }
/** getDocumentThumbnailUrl(nodeId: string, attachment?: boolean, ticket?: string): string {
* Gets content for the given node. return this.contentApi.getDocumentThumbnailUrl(nodeId, attachment, ticket);
*
* @param nodeId ID of the target node
* @returns Content data
*/
getNodeContent(nodeId: string): Observable<any> {
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<NodeEntry> {
return from(this.nodesApi.getNode(nodeId, opts));
} }
/** /**
@ -219,8 +150,4 @@ export class ContentService {
return hasAllowableOperations; return hasAllowableOperations;
} }
private handleError(error: any) {
this.logService.error(error);
return throwError(error || 'Server error');
}
} }

View File

@ -20,9 +20,7 @@ import { from, Observable, throwError, Subject } from 'rxjs';
import { catchError, map, switchMap, filter, take } from 'rxjs/operators'; import { catchError, map, switchMap, filter, take } from 'rxjs/operators';
import { RepositoryInfo, SystemPropertiesRepresentation } from '@alfresco/js-api'; import { RepositoryInfo, SystemPropertiesRepresentation } from '@alfresco/js-api';
import { BpmProductVersionModel } from '../models/product-version.model'; import { BpmProductVersionModel, AlfrescoApiService, AuthenticationService } from '@alfresco/adf-core';
import { AlfrescoApiService } from './alfresco-api.service';
import { AuthenticationService } from '../auth/services/authentication.service';
import { ApiClientsService } from '@alfresco/adf-core/api'; import { ApiClientsService } from '@alfresco/adf-core/api';
@Injectable({ @Injectable({

View File

@ -18,8 +18,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { MinimalNode, NodeEntry, NodePaging, NodesApi, TrashcanApi, Node } from '@alfresco/js-api'; import { MinimalNode, NodeEntry, NodePaging, NodesApi, TrashcanApi, Node } from '@alfresco/js-api';
import { Subject, from, Observable, throwError } from 'rxjs'; import { Subject, from, Observable, throwError } from 'rxjs';
import { AlfrescoApiService } from './alfresco-api.service'; import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
import { UserPreferencesService } from '../common/services/user-preferences.service';
import { catchError, map } from 'rxjs/operators'; import { catchError, map } from 'rxjs/operators';
import { NodeMetadata } from '../models/node-metadata.model'; import { NodeMetadata } from '../models/node-metadata.model';
@ -198,6 +197,19 @@ export class NodesApiService {
return this.createNodeInsideRoot(name || this.generateUuid(), nodeType, properties, path); 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<any> {
return from(this.nodesApi.getNodeContent(nodeId))
.pipe(
catchError((err) => throwError(err))
);
}
/** /**
* Create a new Node inside `-root-` folder * Create a new Node inside `-root-` folder
* *

View File

@ -15,15 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
import { fakeEcmUserList, createNewPersonMock, fakeEcmUser, fakeEcmAdminUser } from '../mock/ecm-user.service.mock'; import { fakeEcmUserList, createNewPersonMock, fakeEcmUser, fakeEcmAdminUser } from '../mocks/ecm-user.service.mock';
import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock'; import { AuthenticationService, AlfrescoApiService, AlfrescoApiServiceMock, CoreTestingModule, LogService } from '@alfresco/adf-core';
import { CoreTestingModule } from '../testing/core.testing.module';
import { PeopleContentService, PeopleContentQueryRequestModel } from './people-content.service'; import { PeopleContentService, PeopleContentQueryRequestModel } from './people-content.service';
import { AlfrescoApiService } from './alfresco-api.service';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { LogService } from '../common/services/log.service';
import { AuthenticationService } from '../auth/services/authentication.service';
describe('PeopleContentService', () => { describe('PeopleContentService', () => {

View File

@ -17,12 +17,10 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable, from, throwError, of } from 'rxjs'; 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 { catchError, map, tap } from 'rxjs/operators';
import { PeopleApi, PersonBodyCreate, Pagination, PersonBodyUpdate } from '@alfresco/js-api'; import { PeopleApi, PersonBodyCreate, Pagination, PersonBodyUpdate } from '@alfresco/js-api';
import { EcmUserModel } from '../models/ecm-user.model'; 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'; import { ContentService } from './content.service';
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
@ -77,10 +75,10 @@ export class PeopleContentService {
*/ */
getPerson(personId: string): Observable<EcmUserModel> { getPerson(personId: string): Observable<EcmUserModel> {
return from(this.peopleApi.getPerson(personId)) return from(this.peopleApi.getPerson(personId))
.pipe( .pipe(
map((personEntry) => new EcmUserModel(personEntry.entry)), map((personEntry) => new EcmUserModel(personEntry.entry)),
tap( user => this.currentUser = user), tap(user => this.currentUser = user),
catchError((error) => this.handleError(error))); catchError((error) => this.handleError(error)));
} }
getCurrentPerson(): Observable<EcmUserModel> { getCurrentPerson(): Observable<EcmUserModel> {
@ -99,11 +97,11 @@ export class PeopleContentService {
return this.getPerson('-me-'); return this.getPerson('-me-');
} }
/** /**
* Used to know if the current user has the admin capability * Used to know if the current user has the admin capability
* *
* @returns true or false * @returns true or false
*/ */
isCurrentUserAdmin(): boolean { isCurrentUserAdmin(): boolean {
return this.currentUser?.isAdmin() ?? false; return this.currentUser?.isAdmin() ?? false;
} }
@ -122,7 +120,7 @@ export class PeopleContentService {
* @returns Response containing pagination and list of entries * @returns Response containing pagination and list of entries
*/ */
listPeople(requestQuery?: PeopleContentQueryRequestModel): Observable<PeopleContentQueryResponse> { listPeople(requestQuery?: PeopleContentQueryRequestModel): Observable<PeopleContentQueryResponse> {
const requestQueryParams = { skipCount: requestQuery?.skipCount, maxItems: requestQuery?.maxItems }; const requestQueryParams = {skipCount: requestQuery?.skipCount, maxItems: requestQuery?.maxItems};
const orderBy = this.buildOrderArray(requestQuery?.sorting); const orderBy = this.buildOrderArray(requestQuery?.sorting);
if (orderBy.length) { if (orderBy.length) {
requestQueryParams['orderBy'] = orderBy; requestQueryParams['orderBy'] = orderBy;
@ -173,7 +171,7 @@ export class PeopleContentService {
* @param avatarId Target avatar * @param avatarId Target avatar
* @returns Image URL * @returns Image URL
*/ */
getUserProfileImage(avatarId: string): string { getUserProfileImage(avatarId: string): string {
return this.contentService.getContentUrl(avatarId); return this.contentService.getContentUrl(avatarId);
} }

View File

@ -22,7 +22,7 @@ import { AlfrescoApiService , LogService, Track,TranslationService, ViewUtilServ
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class RenditionViewerService { export class RenditionService {
static TARGET = '_new'; static TARGET = '_new';
@ -82,8 +82,8 @@ export class RenditionViewerService {
getRenditionUrl(nodeId: string, type: string, renditionExists: boolean): string { getRenditionUrl(nodeId: string, type: string, renditionExists: boolean): string {
return (renditionExists && type !== RenditionViewerService.ContentGroup.IMAGE) ? return (renditionExists && type !== RenditionService.ContentGroup.IMAGE) ?
this.contentApi.getRenditionUrl(nodeId, RenditionViewerService.ContentGroup.PDF) : this.contentApi.getRenditionUrl(nodeId, RenditionService.ContentGroup.PDF) :
this.contentApi.getContentUrl(nodeId, false); this.contentApi.getContentUrl(nodeId, false);
} }
@ -230,20 +230,20 @@ export class RenditionViewerService {
} }
async generateMediaTracksRendition(nodeId: string): Promise<Track[]> { async generateMediaTracksRendition(nodeId: string): Promise<Track[]> {
return this.isRenditionAvailable(nodeId, RenditionViewerService.SUBTITLES_RENDITION_NAME) return this.isRenditionAvailable(nodeId, RenditionService.SUBTITLES_RENDITION_NAME)
.then((value) => { .then((value) => {
const tracks = []; const tracks = [];
if (value) { if (value) {
tracks.push({ tracks.push({
kind: 'subtitles', 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') label: this.translateService.instant('ADF_VIEWER.SUBTITLES')
}); });
} }
return tracks; return tracks;
}) })
.catch((err) => { .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); this.logService.error(err);
return []; 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 * This URL should be one that can be rendered in the browser, for example PDF, Image, or Text
*/ */
printFile(url: string, type: string): void { printFile(url: string, type: string): void {
const pwa = window.open(url, RenditionViewerService.TARGET); const pwa = window.open(url, RenditionService.TARGET);
if (pwa) { if (pwa) {
// Because of the way chrome focus and close image window vs. pdf preview window // 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 = () => { pwa.onfocus = () => {
setTimeout(() => { setTimeout(() => {
pwa.close(); pwa.close();
@ -290,12 +290,12 @@ export class RenditionViewerService {
const nodeId = objectId; const nodeId = objectId;
const type: string = this.viewUtilsService.getViewerTypeByMimeType(mimeType); const type: string = this.viewUtilsService.getViewerTypeByMimeType(mimeType);
this.getRendition(nodeId, RenditionViewerService.ContentGroup.PDF) this.getRendition(nodeId, RenditionService.ContentGroup.PDF)
.then((value) => { .then((value) => {
const url: string = this.getRenditionUrl(nodeId, type, (!!value)); const url: string = this.getRenditionUrl(nodeId, type, (!!value));
const printType = (type === RenditionViewerService.ContentGroup.PDF const printType = (type === RenditionService.ContentGroup.PDF
|| type === RenditionViewerService.ContentGroup.TEXT) || type === RenditionService.ContentGroup.TEXT)
? RenditionViewerService.ContentGroup.PDF : type; ? RenditionService.ContentGroup.PDF : type;
this.printFile(url, printType); this.printFile(url, printType);
}) })
.catch((err) => { .catch((err) => {

View File

@ -17,17 +17,13 @@
import { EventEmitter } from '@angular/core'; import { EventEmitter } from '@angular/core';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { FileModel, FileUploadStatus } from '../models/file.model'; import { AppConfigModule, AppConfigService, setupTestBed, CoreTestingModule } from '@alfresco/adf-core';
import { AppConfigModule } from '../app-config/app-config.module';
import { UploadService } from './upload.service'; 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 { RepositoryInfo } from '@alfresco/js-api';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { DiscoveryApiService } from './discovery-api.service';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
import { FileModel, FileUploadStatus } from '../../common/models/file.model';
declare let jasmine: any; declare let jasmine: any;

View File

@ -18,7 +18,6 @@
import { EventEmitter, Injectable } from '@angular/core'; import { EventEmitter, Injectable } from '@angular/core';
import { Minimatch } from 'minimatch'; import { Minimatch } from 'minimatch';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { AppConfigService } from '../app-config/app-config.service';
import { import {
FileUploadCompleteEvent, FileUploadCompleteEvent,
FileUploadDeleteEvent, FileUploadDeleteEvent,
@ -26,9 +25,9 @@ import {
FileUploadEvent FileUploadEvent
} from '../events/file.event'; } from '../events/file.event';
import { FileModel, FileUploadProgress, FileUploadStatus } from '../models/file.model'; import { FileModel, FileUploadProgress, FileUploadStatus } from '../models/file.model';
import { AlfrescoApiService } from './alfresco-api.service'; import { AppConfigService, AlfrescoApiService } from '@alfresco/adf-core';
import { DiscoveryApiService } from './discovery-api.service';
import { filter } from 'rxjs/operators'; import { filter } from 'rxjs/operators';
import { DiscoveryApiService } from '../../common/services/discovery-api.service';
import { NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api'; import { NodesApi, UploadApi, VersionsApi } from '@alfresco/js-api';
const MIN_CANCELLABLE_FILE_SIZE = 1000000; const MIN_CANCELLABLE_FILE_SIZE = 1000000;
@ -85,7 +84,7 @@ export class UploadService {
private discoveryApiService: DiscoveryApiService) { private discoveryApiService: DiscoveryApiService) {
this.discoveryApiService.ecmProductInfo$.pipe(filter(info => !!info)) this.discoveryApiService.ecmProductInfo$.pipe(filter(info => !!info))
.subscribe(({ status }) => { .subscribe(({status}) => {
this.isThumbnailGenerationEnabled = status.isThumbnailGenerationEnabled; this.isThumbnailGenerationEnabled = status.isThumbnailGenerationEnabled;
}); });
} }
@ -238,7 +237,7 @@ export class UploadService {
if (file.id) { if (file.id) {
return this.nodesApi.updateNodeContent(file.id, file.file as any, opts); return this.nodesApi.updateNodeContent(file.id, file.file as any, opts);
} else { } else {
const nodeBody = { ... file.options }; const nodeBody = {...file.options};
delete nodeBody['versioningEnabled']; delete nodeBody['versioningEnabled'];
return this.uploadApi.uploadFile( return this.uploadApi.uploadFile(
@ -275,13 +274,13 @@ export class UploadService {
.on('abort', () => { .on('abort', () => {
this.onUploadAborted(file); this.onUploadAborted(file);
if (successEmitter) { if (successEmitter) {
successEmitter.emit({ value: 'File aborted' }); successEmitter.emit({value: 'File aborted'});
} }
}) })
.on('error', (err) => { .on('error', (err) => {
this.onUploadError(file, err); this.onUploadError(file, err);
if (errorEmitter) { if (errorEmitter) {
errorEmitter.emit({ value: 'Error file uploaded' }); errorEmitter.emit({value: 'Error file uploaded'});
} }
}) })
.on('success', (data) => { .on('success', (data) => {
@ -293,12 +292,12 @@ export class UploadService {
this.deleteAbortedNodeVersion(data.entry.id, data.entry.properties['cm:versionLabel']); this.deleteAbortedNodeVersion(data.entry.id, data.entry.properties['cm:versionLabel']);
} }
if (successEmitter) { if (successEmitter) {
successEmitter.emit({ value: 'File deleted' }); successEmitter.emit({value: 'File deleted'});
} }
} else { } else {
this.onUploadComplete(file, data); this.onUploadComplete(file, data);
if (successEmitter) { if (successEmitter) {
successEmitter.emit({ value: data }); successEmitter.emit({value: data});
} }
} }
}) })
@ -416,7 +415,7 @@ export class UploadService {
} }
private deleteAbortedNode(nodeId: string) { private deleteAbortedNode(nodeId: string) {
this.nodesApi.deleteNode(nodeId, { permanent: true }) this.nodesApi.deleteNode(nodeId, {permanent: true})
.then(() => (this.abortedFile = undefined)); .then(() => (this.abortedFile = undefined));
} }

View File

@ -20,12 +20,13 @@ import { By } from '@angular/platform-browser';
import { Node } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { ContentMetadataCardComponent } from './content-metadata-card.component'; import { ContentMetadataCardComponent } from './content-metadata-card.component';
import { ContentMetadataComponent } from '../content-metadata/content-metadata.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 { ContentTestingModule } from '../../../testing/content.testing.module';
import { SimpleChange } from '@angular/core'; import { SimpleChange } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { NodeAspectService } from '../../../aspect-list/services/node-aspect.service'; import { NodeAspectService } from '../../../aspect-list/services/node-aspect.service';
import { ContentMetadataService } from '../../services/content-metadata.service'; import { ContentMetadataService } from '../../services/content-metadata.service';
import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum';
import { of } from 'rxjs'; import { of } from 'rxjs';
describe('ContentMetadataCardComponent', () => { describe('ContentMetadataCardComponent', () => {

View File

@ -17,10 +17,12 @@
import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { Node } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { ContentService, AllowableOperationsEnum } from '@alfresco/adf-core';
import { NodeAspectService } from '../../../aspect-list/services/node-aspect.service'; import { NodeAspectService } from '../../../aspect-list/services/node-aspect.service';
import { PresetConfig } from '../../interfaces/content-metadata.interfaces'; import { PresetConfig } from '../../interfaces/content-metadata.interfaces';
import { VersionCompatibilityService } from '../../../version-compatibility/version-compatibility.service'; import { VersionCompatibilityService } from '../../../version-compatibility/version-compatibility.service';
import { ContentService } from '../../../common/services/content.service';
import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum';
@Component({ @Component({
selector: 'adf-content-metadata-card', selector: 'adf-content-metadata-card',
templateUrl: './content-metadata-card.component.html', templateUrl: './content-metadata-card.component.html',

View File

@ -22,9 +22,10 @@ import { ClassesApi, MinimalNode, Node } from '@alfresco/js-api';
import { ContentMetadataComponent } from './content-metadata.component'; import { ContentMetadataComponent } from './content-metadata.component';
import { ContentMetadataService } from '../../services/content-metadata.service'; import { ContentMetadataService } from '../../services/content-metadata.service';
import { import {
CardViewBaseItemModel, CardViewComponent, NodesApiService, CardViewBaseItemModel, CardViewComponent,
LogService, setupTestBed, AppConfigService LogService, setupTestBed, AppConfigService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { NodesApiService } from '../../../common/services/nodes-api.service';
import { throwError, of } from 'rxjs'; import { throwError, of } from 'rxjs';
import { ContentTestingModule } from '../../../testing/content.testing.module'; import { ContentTestingModule } from '../../../testing/content.testing.module';
import { mockGroupProperties } from './mock-data'; import { mockGroupProperties } from './mock-data';

View File

@ -20,7 +20,6 @@ import { Node } from '@alfresco/js-api';
import { Observable, Subject, of, zip } from 'rxjs'; import { Observable, Subject, of, zip } from 'rxjs';
import { import {
CardViewItem, CardViewItem,
NodesApiService,
LogService, LogService,
TranslationService, TranslationService,
AppConfigService, AppConfigService,
@ -31,6 +30,7 @@ import { ContentMetadataService } from '../../services/content-metadata.service'
import { CardViewGroup, PresetConfig } from '../../interfaces/content-metadata.interfaces'; import { CardViewGroup, PresetConfig } from '../../interfaces/content-metadata.interfaces';
import { takeUntil, debounceTime, catchError, map } from 'rxjs/operators'; import { takeUntil, debounceTime, catchError, map } from 'rxjs/operators';
import { CardViewContentUpdateService } from '../../../common/services/card-view-content-update.service'; import { CardViewContentUpdateService } from '../../../common/services/card-view-content-update.service';
import { NodesApiService } from '../../../common/services/nodes-api.service';
const DEFAULT_SEPARATOR = ', '; const DEFAULT_SEPARATOR = ', ';

View File

@ -17,9 +17,11 @@
import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { EventEmitter, Injectable, Output } from '@angular/core'; 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 { Subject, Observable, throwError } from 'rxjs';
import { ShareDataRow } from '../document-list/data/share-data-row.model'; 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 { Node, NodeEntry, SitePaging } from '@alfresco/js-api';
import { DocumentListService } from '../document-list/services/document-list.service'; import { DocumentListService } from '../document-list/services/document-list.service';
import { ContentNodeSelectorComponent } from './content-node-selector.component'; import { ContentNodeSelectorComponent } from './content-node-selector.component';

View File

@ -28,7 +28,7 @@ import {
SiteEntry, SiteEntry,
SitePaging SitePaging
} from '@alfresco/js-api'; } from '@alfresco/js-api';
import { NodesApiService, setupTestBed } from '@alfresco/adf-core'; import { setupTestBed } from '@alfresco/adf-core';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component'; import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
import { ContentTestingModule } from '../testing/content.testing.module'; import { ContentTestingModule } from '../testing/content.testing.module';
@ -40,6 +40,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { SearchQueryBuilderService } from '../search'; import { SearchQueryBuilderService } from '../search';
import { mockQueryBody } from '../mock/search-query.mock'; import { mockQueryBody } from '../mock/search-query.mock';
import { SitesService } from '../common/services/sites.service'; import { SitesService } from '../common/services/sites.service';
import { NodesApiService } from '../common/services/nodes-api.service';
const fakeResultSetPaging: ResultSetPaging = { const fakeResultSetPaging: ResultSetPaging = {
list: { list: {

View File

@ -30,17 +30,17 @@ import {
} from '@alfresco/js-api'; } from '@alfresco/js-api';
import { import {
AppConfigService, AppConfigService,
FileModel,
FileUploadStatus,
NodesApiService,
setupTestBed, setupTestBed,
UploadService,
FileUploadCompleteEvent,
DataRow, DataRow,
ThumbnailService, ThumbnailService,
ContentService,
DataColumn DataColumn
} from '@alfresco/adf-core'; } 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 { of, throwError } from 'rxjs';
import { DropdownBreadcrumbComponent } from '../breadcrumb'; import { DropdownBreadcrumbComponent } from '../breadcrumb';
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component'; import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';

View File

@ -31,14 +31,13 @@ import {
UserPreferencesService, UserPreferencesService,
UserPreferenceValues, UserPreferenceValues,
InfinitePaginationComponent, PaginatedComponent, InfinitePaginationComponent, PaginatedComponent,
NodesApiService,
UploadService,
FileUploadCompleteEvent,
FileUploadDeleteEvent,
AppConfigService, AppConfigService,
DataSorting, DataSorting,
ShowHeaderMode ShowHeaderMode
} from '@alfresco/adf-core'; } 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 { UntypedFormControl } from '@angular/forms';
import { Node, NodePaging, Pagination, SiteEntry, SitePaging, NodeEntry, QueryBody, RequestScope } from '@alfresco/js-api'; import { Node, NodePaging, Pagination, SiteEntry, SitePaging, NodeEntry, QueryBody, RequestScope } from '@alfresco/js-api';
import { DocumentListComponent } from '../document-list/components/document-list.component'; import { DocumentListComponent } from '../document-list/components/document-list.component';

View File

@ -21,7 +21,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ContentNodeSelectorComponent } from './content-node-selector.component'; import { ContentNodeSelectorComponent } from './content-node-selector.component';
import { Node, NodeEntry, SitePaging } from '@alfresco/js-api'; import { Node, NodeEntry, SitePaging } from '@alfresco/js-api';
import { By } from '@angular/platform-browser'; 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 { of } from 'rxjs';
import { ContentTestingModule } from '../testing/content.testing.module'; import { ContentTestingModule } from '../testing/content.testing.module';
import { DocumentListService } from '../document-list/services/document-list.service'; 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 { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
import { NodeAction } from '../document-list/models/node-action.enum'; import { NodeAction } from '../document-list/models/node-action.enum';
import { SitesService } from '../common/services/sites.service'; import { SitesService } from '../common/services/sites.service';
import { NodesApiService } from '../common/services/nodes-api.service';
import { ContentService } from '../common/services/content.service';
describe('ContentNodeSelectorComponent', () => { describe('ContentNodeSelectorComponent', () => {
let component: 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.data.showLocalUploadButton = true;
component.hasAllowableOperations = true; component.hasAllowableOperations = true;

View File

@ -17,9 +17,11 @@
import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; 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 { 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 { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface';
import { NodeEntryEvent } from '../document-list/components/node.event'; import { NodeEntryEvent } from '../document-list/components/node.event';
import { NodeAction } from '../document-list/models/node-action.enum'; import { NodeAction } from '../document-list/models/node-action.enum';

View File

@ -17,14 +17,15 @@
import { TestBed, fakeAsync, ComponentFixture, tick } from '@angular/core/testing'; import { TestBed, fakeAsync, ComponentFixture, tick } from '@angular/core/testing';
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog'; import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
import { of, empty } from 'rxjs'; import { of } from 'rxjs';
import { import {
setupTestBed, setupTestBed,
NodesApiService,
NotificationService, NotificationService,
RenditionsService,
AppConfigService AppConfigService
} from '@alfresco/adf-core'; } 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 { SharedLinksApiService } from './services/shared-links-api.service';
import { ShareDialogComponent } from './content-node-share.dialog'; import { ShareDialogComponent } from './content-node-share.dialog';
import moment from 'moment'; import moment from 'moment';
@ -38,7 +39,7 @@ describe('ShareDialogComponent', () => {
openSnackMessage: jasmine.createSpy('openSnackMessage') openSnackMessage: jasmine.createSpy('openSnackMessage')
}; };
let sharedLinksApiService: SharedLinksApiService; let sharedLinksApiService: SharedLinksApiService;
let renditionService: RenditionsService; let renditionService: RenditionService;
let nodesApiService: NodesApiService; let nodesApiService: NodesApiService;
let fixture: ComponentFixture<ShareDialogComponent>; let fixture: ComponentFixture<ShareDialogComponent>;
let component: ShareDialogComponent; let component: ShareDialogComponent;
@ -50,9 +51,14 @@ describe('ShareDialogComponent', () => {
ContentTestingModule ContentTestingModule
], ],
providers: [ providers: [
{ provide: NotificationService, useValue: notificationServiceMock }, {provide: NotificationService, useValue: notificationServiceMock},
{ provide: MatDialogRef, useValue: { close: () => {}} }, {
{ provide: MAT_DIALOG_DATA, useValue: {} } provide: MatDialogRef, useValue: {
close: () => {
}
}
},
{provide: MAT_DIALOG_DATA, useValue: {}}
] ]
}); });
@ -63,7 +69,7 @@ describe('ShareDialogComponent', () => {
matDialog = TestBed.inject(MatDialog); matDialog = TestBed.inject(MatDialog);
sharedLinksApiService = TestBed.inject(SharedLinksApiService); sharedLinksApiService = TestBed.inject(SharedLinksApiService);
renditionService = TestBed.inject(RenditionsService); renditionService = TestBed.inject(RenditionService);
nodesApiService = TestBed.inject(NodesApiService); nodesApiService = TestBed.inject(NodesApiService);
appConfigService = TestBed.inject(AppConfigService); appConfigService = TestBed.inject(AppConfigService);
@ -117,9 +123,9 @@ describe('ShareDialogComponent', () => {
it(`should toggle share action when property 'sharedId' does not exists`, () => { it(`should toggle share action when property 'sharedId' does not exists`, () => {
spyOn(sharedLinksApiService, 'createSharedLinks').and.returnValue(of({ 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 = { component.data = {
node, node,
@ -129,16 +135,16 @@ describe('ShareDialogComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
expect(sharedLinksApiService.createSharedLinks).toHaveBeenCalled(); 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('input[formcontrolname="sharedUrl"]').value).toBe('some-url/sharedId');
expect(fixture.nativeElement.querySelector('.mat-slide-toggle').classList).toContain('mat-checked'); expect(fixture.nativeElement.querySelector('.mat-slide-toggle').classList).toContain('mat-checked');
}); });
it(`should not toggle share action when file has 'sharedId' property`, async () => { it(`should not toggle share action when file has 'sharedId' property`, async () => {
spyOn(sharedLinksApiService, 'createSharedLinks').and.returnValue(of({ 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'; node.entry.properties['qshare:sharedId'] = 'sharedId';
@ -158,7 +164,7 @@ describe('ShareDialogComponent', () => {
}); });
it('should open a confirmation dialog when unshare button is triggered', () => { 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(); spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId'; node.entry.properties['qshare:sharedId'] = 'sharedId';
@ -179,7 +185,7 @@ describe('ShareDialogComponent', () => {
}); });
it('should unshare file when confirmation dialog returns true', fakeAsync(() => { 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({})); spyOn(sharedLinksApiService, 'deleteSharedLink').and.returnValue(of({}));
node.entry.properties['qshare:sharedId'] = 'sharedId'; node.entry.properties['qshare:sharedId'] = 'sharedId';
@ -199,7 +205,7 @@ describe('ShareDialogComponent', () => {
})); }));
it('should not unshare file when confirmation dialog returns false', fakeAsync(() => { 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(); spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId'; node.entry.properties['qshare:sharedId'] = 'sharedId';
@ -258,7 +264,7 @@ describe('ShareDialogComponent', () => {
await fixture.whenStable(); await fixture.whenStable();
expect(nodesApiService.updateNode).toHaveBeenCalledWith('nodeId', { expect(nodesApiService.updateNode).toHaveBeenCalledWith('nodeId', {
properties: { 'qshare:expiryDate': null } properties: {'qshare:expiryDate': null}
}); });
expect( expect(
@ -297,10 +303,10 @@ describe('ShareDialogComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.nativeElement fixture.nativeElement
.querySelector( .querySelector(
'mat-slide-toggle[data-automation-id="adf-expire-toggle"] label' 'mat-slide-toggle[data-automation-id="adf-expire-toggle"] label'
) )
.dispatchEvent(new MouseEvent('click')); .dispatchEvent(new MouseEvent('click'));
fixture.componentInstance.form.controls['time'].setValue(date); fixture.componentInstance.form.controls['time'].setValue(date);
fixture.detectChanges(); fixture.detectChanges();
@ -308,7 +314,7 @@ describe('ShareDialogComponent', () => {
tick(100); tick(100);
expect(nodesApiService.updateNode).toHaveBeenCalledWith('nodeId', { 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); tick(500);
expect(nodesApiService.updateNode).toHaveBeenCalledWith('nodeId', { 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); tick(100);
expect(nodesApiService.updateNode).toHaveBeenCalledWith('nodeId', { expect(nodesApiService.updateNode).toHaveBeenCalledWith('nodeId', {
properties: { 'qshare:expiryDate': date.utc().format() } properties: {'qshare:expiryDate': date.utc().format()}
}); });
})); }));
}); });

View File

@ -28,17 +28,18 @@ import { MatSlideToggleChange } from '@angular/material/slide-toggle';
import { UntypedFormGroup, UntypedFormControl, AbstractControl } from '@angular/forms'; import { UntypedFormGroup, UntypedFormControl, AbstractControl } from '@angular/forms';
import { Observable, Subject } from 'rxjs'; import { Observable, Subject } from 'rxjs';
import { import {
NodesApiService,
ContentService,
RenditionsService,
AppConfigService AppConfigService
} from '@alfresco/adf-core'; } 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 { SharedLinksApiService } from './services/shared-links-api.service';
import { SharedLinkEntry, Node } from '@alfresco/js-api'; import { SharedLinkEntry, Node } from '@alfresco/js-api';
import { ConfirmDialogComponent } from '../dialogs/confirm.dialog'; import { ConfirmDialogComponent } from '../dialogs/confirm.dialog';
import moment from 'moment'; import moment from 'moment';
import { ContentNodeShareSettings } from './content-node-share.settings'; import { ContentNodeShareSettings } from './content-node-share.settings';
import { takeUntil, debounceTime } from 'rxjs/operators'; import { takeUntil, debounceTime } from 'rxjs/operators';
import { RenditionService } from '../common/services/rendition.service';
type DatePickerType = 'date' | 'time' | 'month' | 'datetime'; type DatePickerType = 'date' | 'time' | 'month' | 'datetime';
@ -46,7 +47,7 @@ type DatePickerType = 'date' | 'time' | 'month' | 'datetime';
selector: 'adf-share-dialog', selector: 'adf-share-dialog',
templateUrl: './content-node-share.dialog.html', templateUrl: './content-node-share.dialog.html',
styleUrls: ['./content-node-share.dialog.scss'], styleUrls: ['./content-node-share.dialog.scss'],
host: { class: 'adf-share-dialog' }, host: {class: 'adf-share-dialog'},
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class ShareDialogComponent implements OnInit, OnDestroy { export class ShareDialogComponent implements OnInit, OnDestroy {
@ -59,15 +60,15 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
isDisabled: boolean = false; isDisabled: boolean = false;
form: UntypedFormGroup = new UntypedFormGroup({ form: UntypedFormGroup = new UntypedFormGroup({
sharedUrl: new UntypedFormControl(''), sharedUrl: new UntypedFormControl(''),
time: new UntypedFormControl({ value: '', disabled: true }) time: new UntypedFormControl({value: '', disabled: true})
}); });
type: DatePickerType = 'datetime'; type: DatePickerType = 'datetime';
maxDebounceTime = 500; maxDebounceTime = 500;
@ViewChild('slideToggleExpirationDate', { static: true }) @ViewChild('slideToggleExpirationDate', {static: true})
slideToggleExpirationDate; slideToggleExpirationDate;
@ViewChild('dateTimePickerInput', { static: true }) @ViewChild('dateTimePickerInput', {static: true})
dateTimePickerInput; dateTimePickerInput;
private onDestroy$ = new Subject<boolean>(); private onDestroy$ = new Subject<boolean>();
@ -79,9 +80,10 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
private dialog: MatDialog, private dialog: MatDialog,
private nodesApiService: NodesApiService, private nodesApiService: NodesApiService,
private contentService: ContentService, private contentService: ContentService,
private renditionService: RenditionsService, private renditionService: RenditionService,
@Inject(MAT_DIALOG_DATA) public data: ContentNodeShareSettings @Inject(MAT_DIALOG_DATA) public data: ContentNodeShareSettings
) {} ) {
}
ngOnInit() { ngOnInit() {
this.type = this.appConfigService.get<DatePickerType>('sharedLinkDateTimePickerType', 'datetime'); this.type = this.appConfigService.get<DatePickerType>('sharedLinkDateTimePickerType', 'datetime');
@ -133,7 +135,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
} }
get canUpdate() { get canUpdate() {
const { entry } = this.data.node; const {entry} = this.data.node;
if (entry && entry.allowableOperations) { if (entry && entry.allowableOperations) {
return this.contentService.hasAllowableOperations(entry, 'update'); return this.contentService.hasAllowableOperations(entry, 'update');
@ -199,9 +201,9 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
} }
this.isDisabled = false; this.isDisabled = false;
this.isFileShared = true; this.isFileShared = true;
this.renditionService
.generateRenditionForNode(this.data.node.entry.id) // eslint-disable-next-line
.subscribe(() => {}); this.renditionService.getNodeRendition(this.data.node.entry.id);
this.updateForm(); this.updateForm();
} }
@ -219,19 +221,19 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
this.sharedLinksApiService this.sharedLinksApiService
.deleteSharedLink(sharedId) .deleteSharedLink(sharedId)
.subscribe((response: any) => { .subscribe((response: any) => {
if (response instanceof Error) { if (response instanceof Error) {
this.isDisabled = false; this.isDisabled = false;
this.isFileShared = true; this.isFileShared = true;
this.handleError(response); this.handleError(response);
} else { } else {
if (this.data.node.entry.properties) { if (this.data.node.entry.properties) {
this.data.node.entry.properties['qshare:sharedId'] = null; this.data.node.entry.properties['qshare:sharedId'] = null;
this.data.node.entry.properties['qshare:expiryDate'] = null; this.data.node.entry.properties['qshare:expiryDate'] = null;
}
this.dialogRef.close(false);
} }
this.dialogRef.close(false);
} }
} );
);
} }
private handleError(error: Error) { private handleError(error: Error) {
@ -240,7 +242,8 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
try { try {
statusCode = JSON.parse(error.message).error.statusCode; statusCode = JSON.parse(error.message).error.statusCode;
} catch {} } catch {
}
if (statusCode === 403) { if (statusCode === 403) {
message = 'SHARE.UNSHARE_PERMISSION_ERROR'; message = 'SHARE.UNSHARE_PERMISSION_ERROR';
@ -253,7 +256,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
} }
private updateForm() { private updateForm() {
const { entry } = this.data.node; const {entry} = this.data.node;
let expiryDate = null; let expiryDate = null;
if (entry && entry.properties) { if (entry && entry.properties) {
@ -285,7 +288,7 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
} }
private updateEntryExpiryDate(date: moment.Moment) { private updateEntryExpiryDate(date: moment.Moment) {
const { properties } = this.data.node.entry; const {properties} = this.data.node.entry;
if (properties) { if (properties) {
properties['qshare:expiryDate'] = date properties['qshare:expiryDate'] = date

View File

@ -17,9 +17,6 @@
import { import {
CoreTestingModule, CoreTestingModule,
fakeEcmEditedUser,
fakeEcmUser,
fakeEcmUserNoImage,
IdentityUserModel, IdentityUserModel,
InitialUsernamePipe, InitialUsernamePipe,
setupTestBed, setupTestBed,
@ -29,6 +26,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import { By, DomSanitizer } from '@angular/platform-browser'; import { By, DomSanitizer } from '@angular/platform-browser';
import { TranslateModule } from '@ngx-translate/core'; 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 { ContentTestingModule } from '../testing/content.testing.module';
import { ContentUserInfoComponent } from './content-user-info.component'; import { ContentUserInfoComponent } from './content-user-info.component';
@ -238,7 +236,6 @@ describe('ContentUserInfoComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
const pipe = new InitialUsernamePipe(new FakeSanitizer()); const pipe = new InitialUsernamePipe(new FakeSanitizer());
const expected = pipe.transform({ const expected = pipe.transform({
id: 13,
firstName: 'Wilbur', firstName: 'Wilbur',
lastName: 'Adams', lastName: 'Adams',
email: 'wilbur@app.com' email: 'wilbur@app.com'

View File

@ -15,10 +15,12 @@
* limitations under the License. * 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 { Component, Input, OnDestroy, ViewChild, ViewEncapsulation } from '@angular/core';
import { MatMenuTrigger, MenuPositionX, MenuPositionY } from '@angular/material/menu'; import { MatMenuTrigger, MenuPositionX, MenuPositionY } from '@angular/material/menu';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { EcmUserModel } from '../common/models/ecm-user.model';
import { PeopleContentService } from '../common/services/people-content.service';
@Component({ @Component({
selector: 'adf-content-user-info', selector: 'adf-content-user-info',

View File

@ -28,6 +28,7 @@ import { MatDatetimepickerModule } from '@mat-datetimepicker/core';
import { MatMomentDatetimeModule } from '@mat-datetimepicker/moment'; import { MatMomentDatetimeModule } from '@mat-datetimepicker/moment';
import { LibraryDialogComponent } from './library/library.dialog'; import { LibraryDialogComponent } from './library/library.dialog';
import { ContentDirectiveModule } from '../directives'; import { ContentDirectiveModule } from '../directives';
import { DownloadZipDialogModule } from './download-zip/download-zip.dialog.module';
@NgModule({ @NgModule({
imports: [ imports: [
@ -38,7 +39,8 @@ import { ContentDirectiveModule } from '../directives';
ReactiveFormsModule, ReactiveFormsModule,
MatMomentDatetimeModule, MatMomentDatetimeModule,
MatDatetimepickerModule, MatDatetimepickerModule,
ContentDirectiveModule ContentDirectiveModule,
DownloadZipDialogModule
], ],
declarations: [ declarations: [
FolderDialogComponent, FolderDialogComponent,

View File

@ -17,7 +17,7 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { DownloadZipDialogComponent } from './download-zip.dialog'; 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 { MatDialogModule } from '@angular/material/dialog';
import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';

View File

@ -18,9 +18,8 @@
import { TestBed, ComponentFixture } from '@angular/core/testing'; import { TestBed, ComponentFixture } from '@angular/core/testing';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { DownloadZipDialogComponent } from './download-zip.dialog'; import { DownloadZipDialogComponent } from './download-zip.dialog';
import { setupTestBed } from '../../testing/setup-test-bed'; import { CoreTestingModule, setupTestBed } from '@alfresco/adf-core';
import { CoreTestingModule } from '../../testing/core.testing.module'; import { DownloadZipService } from './services/download-zip.service';
import { DownloadZipService } from '../../services/download-zip.service';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';

View File

@ -18,7 +18,7 @@
import { Component, Input, OnInit, OnChanges } from '@angular/core'; import { Component, Input, OnInit, OnChanges } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { DownloadZipDialogComponent } from './download-zip.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({ @Component({
selector: 'adf-download-zip-dialog-storybook', selector: 'adf-download-zip-dialog-storybook',

View File

@ -16,22 +16,19 @@
*/ */
import { Meta, moduleMetadata, Story } from '@storybook/angular'; 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 { MatButtonModule } from '@angular/material/button';
import {
AlfrescoApiService,
ContentService,
DownloadZipService,
NodesApiService
} from '../../services';
import { DownloadZipDialogStorybookComponent } from './download-zip.dialog.stories.component'; import { DownloadZipDialogStorybookComponent } from './download-zip.dialog.stories.component';
import { import {
AlfrescoApiServiceMock, AlfrescoApiServiceMock,
ContentApiMock, ContentApiMock,
DownloadZipMockService, DownloadZipMockService,
NodesApiMock NodesApiMock
} from '../../mock/download-zip-service.mock'; } from './mock/download-zip-service.mock';
import { DownloadZipDialogModule } from './download-zip.dialog.module'; 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 { export default {
component: DownloadZipDialogStorybookComponent, component: DownloadZipDialogStorybookComponent,
@ -39,7 +36,6 @@ export default {
decorators: [ decorators: [
moduleMetadata({ moduleMetadata({
imports: [ imports: [
CoreStoryModule,
DownloadZipDialogModule, DownloadZipDialogModule,
MatButtonModule MatButtonModule
], ],

View File

@ -18,10 +18,10 @@
import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { DownloadEntry, MinimalNode } from '@alfresco/js-api'; import { DownloadEntry, MinimalNode } from '@alfresco/js-api';
import { LogService } from '../../common/services/log.service'; import { LogService } from '@alfresco/adf-core';
import { DownloadZipService } from '../../services/download-zip.service'; import { NodesApiService } from '../../common/services/nodes-api.service';
import { ContentService } from '../../services/content.service'; import { DownloadZipService } from './services/download-zip.service';
import { NodesApiService } from '../../services/nodes-api.service'; import { ContentService } from '../../common/services/content.service';
@Component({ @Component({
selector: 'adf-download-zip-dialog', selector: 'adf-download-zip-dialog',

View File

@ -18,8 +18,7 @@
import { DownloadEntry, DownloadBodyCreate, DownloadsApi } from '@alfresco/js-api'; import { DownloadEntry, DownloadBodyCreate, DownloadsApi } from '@alfresco/js-api';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable, from, throwError } from 'rxjs'; import { Observable, from, throwError } from 'rxjs';
import { LogService } from '../common/services/log.service'; import { AlfrescoApiService, LogService } from '@alfresco/adf-core';
import { AlfrescoApiService } from './alfresco-api.service';
import { catchError } from 'rxjs/operators'; import { catchError } from 'rxjs/operators';
@Injectable({ @Injectable({

View File

@ -17,7 +17,9 @@
import { TestBed, ComponentFixture } from '@angular/core/testing'; import { TestBed, ComponentFixture } from '@angular/core/testing';
import { MatDialogRef } from '@angular/material/dialog'; 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 { FolderDialogComponent } from './folder.dialog';
import { of, throwError } from 'rxjs'; import { of, throwError } from 'rxjs';
import { ContentTestingModule } from '../testing/content.testing.module'; import { ContentTestingModule } from '../testing/content.testing.module';

View File

@ -22,7 +22,8 @@ import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Node } from '@alfresco/js-api'; 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'; import { forbidEndingDot, forbidOnlySpaces, forbidSpecialCharacters } from './folder-name.validators';

View File

@ -22,4 +22,8 @@ export * from './confirm.dialog';
export * from './dialog.module'; export * from './dialog.module';
export * from './library/library.dialog'; 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'; export * from './folder-name.validators';

View File

@ -16,7 +16,8 @@
*/ */
import { ChangeDetectorRef, Component, ElementRef, SimpleChange } from '@angular/core'; 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 { CheckAllowableOperationDirective } from './check-allowable-operation.directive';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';

View File

@ -19,7 +19,8 @@
import { ChangeDetectorRef, Directive, ElementRef, Host, Inject, Input, OnChanges, Optional, Renderer2, SimpleChanges } from '@angular/core'; import { ChangeDetectorRef, Directive, ElementRef, Host, Inject, Input, OnChanges, Optional, Renderer2, SimpleChanges } from '@angular/core';
import { NodeEntry } from '@alfresco/js-api'; 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'; import { NodeAllowableOperationSubject } from '../interfaces/node-allowable-operation-subject.interface';
@Directive({ @Directive({

View File

@ -29,6 +29,7 @@ import { LibraryMembershipDirective } from './library-membership.directive';
import { NodeDeleteDirective } from './node-delete.directive'; import { NodeDeleteDirective } from './node-delete.directive';
import { NodeFavoriteDirective } from './node-favorite.directive'; import { NodeFavoriteDirective } from './node-favorite.directive';
import { NodeRestoreDirective } from './node-restore.directive'; import { NodeRestoreDirective } from './node-restore.directive';
import { NodeDownloadDirective } from './node-download.directive';
@NgModule({ @NgModule({
imports: [ imports: [
@ -46,7 +47,8 @@ import { NodeRestoreDirective } from './node-restore.directive';
LibraryMembershipDirective, LibraryMembershipDirective,
NodeDeleteDirective, NodeDeleteDirective,
NodeFavoriteDirective, NodeFavoriteDirective,
NodeRestoreDirective NodeRestoreDirective,
NodeDownloadDirective
], ],
exports: [ exports: [
NodeLockDirective, NodeLockDirective,
@ -57,7 +59,8 @@ import { NodeRestoreDirective } from './node-restore.directive';
LibraryMembershipDirective, LibraryMembershipDirective,
NodeDeleteDirective, NodeDeleteDirective,
NodeFavoriteDirective, NodeFavoriteDirective,
NodeRestoreDirective NodeRestoreDirective,
NodeDownloadDirective
] ]
}) })
export class ContentDirectiveModule { export class ContentDirectiveModule {

View File

@ -19,11 +19,10 @@ import { TestBed, ComponentFixture } from '@angular/core/testing';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { Component, DebugElement, ViewChild } from '@angular/core'; import { Component, DebugElement, ViewChild } from '@angular/core';
import { setupTestBed } from '../testing/setup-test-bed'; import { setupTestBed, AlfrescoApiService, CoreTestingModule } from '@alfresco/adf-core';
import { AlfrescoApiService } from '../services/alfresco-api.service';
import { NodeDownloadDirective } from './node-download.directive'; import { NodeDownloadDirective } from './node-download.directive';
import { CoreTestingModule } from '../testing/core.testing.module';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { ContentDirectiveModule } from '@alfresco/adf-content-services';
@Component({ @Component({
template: '<div [adfNodeDownload]="selection" [version]="version"></div>' template: '<div [adfNodeDownload]="selection" [version]="version"></div>'
@ -54,6 +53,7 @@ describe('NodeDownloadDirective', () => {
setupTestBed({ setupTestBed({
imports: [ imports: [
ContentDirectiveModule,
TranslateModule.forRoot(), TranslateModule.forRoot(),
CoreTestingModule CoreTestingModule
], ],

View File

@ -17,10 +17,9 @@
import { Directive, Input, HostListener } from '@angular/core'; import { Directive, Input, HostListener } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; 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 { DownloadZipDialogComponent } from '../dialogs/download-zip/download-zip.dialog';
import { ContentApi, NodeEntry, VersionEntry } from '@alfresco/js-api'; 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 * Directive selectors without adf- prefix will be deprecated on 3.0.0

View File

@ -19,7 +19,8 @@
import { Directive, ElementRef, Renderer2, HostListener, Input, AfterViewInit } from '@angular/core'; import { Directive, ElementRef, Renderer2, HostListener, Input, AfterViewInit } from '@angular/core';
import { Node } from '@alfresco/js-api'; 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'; import { ContentNodeDialogService } from '../content-node-selector/content-node-dialog.service';
@Directive({ @Directive({

View File

@ -25,3 +25,4 @@ export * from './library-membership.directive';
export * from './node-delete.directive'; export * from './node-delete.directive';
export * from './node-favorite.directive'; export * from './node-favorite.directive';
export * from './node-restore.directive'; export * from './node-restore.directive';
export * from './node-download.directive';

View File

@ -17,7 +17,7 @@
import { CUSTOM_ELEMENTS_SCHEMA, SimpleChange, EventEmitter } from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA, SimpleChange, EventEmitter } from '@angular/core';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { ContentService, setupTestBed } from '@alfresco/adf-core'; import { setupTestBed } from '@alfresco/adf-core';
import { FileNode } from '../../../mock'; import { FileNode } from '../../../mock';
import { ContentActionModel } from './../../models/content-action.model'; import { ContentActionModel } from './../../models/content-action.model';
import { DocumentActionsService } from './../../services/document-actions.service'; 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 { ContentActionComponent } from './content-action.component';
import { ContentTestingModule } from '../../../testing/content.testing.module'; import { ContentTestingModule } from '../../../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { ContentService } from '../../../common/services/content.service';
describe('ContentAction', () => { describe('ContentAction', () => {
let documentList: DocumentListComponent; let documentList: DocumentListComponent;

View File

@ -27,9 +27,10 @@ import {
DataTableModule, DataTableModule,
ObjectDataTableAdapter, ObjectDataTableAdapter,
ShowHeaderMode, ShowHeaderMode,
ThumbnailService, ThumbnailService
ContentService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { ContentService } from '../../common/services/content.service';
import { Subject, of, throwError } from 'rxjs'; import { Subject, of, throwError } from 'rxjs';
import { import {
FileNode, FileNode,

View File

@ -22,9 +22,9 @@ import {
AfterContentInit, Component, ContentChild, ElementRef, EventEmitter, HostListener, Input, AfterContentInit, Component, ContentChild, ElementRef, EventEmitter, HostListener, Input,
OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild, ViewEncapsulation OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild, ViewEncapsulation
} from '@angular/core'; } from '@angular/core';
import { ContentService } from '../../common/services/content.service';
import { import {
ContentService,
DataCellEvent, DataCellEvent,
DataColumn, DataColumn,
DataRowActionEvent, DataRowActionEvent,
@ -46,9 +46,9 @@ import {
AlfrescoApiService, AlfrescoApiService,
UserPreferenceValues, UserPreferenceValues,
DataRow, DataRow,
DataTableService, DataTableService
NodesApiService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { NodesApiService } from '../../common/services/nodes-api.service';
import { Node, NodeEntry, NodePaging, NodesApi, Pagination } from '@alfresco/js-api'; import { Node, NodeEntry, NodePaging, NodesApi, Pagination } from '@alfresco/js-api';
import { Subject, BehaviorSubject, of } from 'rxjs'; import { Subject, BehaviorSubject, of } from 'rxjs';

View File

@ -26,7 +26,8 @@ import {
} from '@angular/core'; } from '@angular/core';
import { NodeEntry, Site } from '@alfresco/js-api'; import { NodeEntry, Site } from '@alfresco/js-api';
import { ShareDataRow } from '../../data/share-data-row.model'; 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 { BehaviorSubject, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';

View File

@ -24,10 +24,10 @@ import {
OnDestroy OnDestroy
} from '@angular/core'; } from '@angular/core';
import { BehaviorSubject, Subject } from 'rxjs'; import { BehaviorSubject, Subject } from 'rxjs';
import { NodesApiService } from '@alfresco/adf-core';
import { SiteEntry, Site } from '@alfresco/js-api'; import { SiteEntry, Site } from '@alfresco/js-api';
import { ShareDataRow } from '../../data/share-data-row.model'; import { ShareDataRow } from '../../data/share-data-row.model';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { NodesApiService } from '../../../common/services/nodes-api.service';
@Component({ @Component({
selector: 'adf-library-role-column', selector: 'adf-library-role-column',

View File

@ -16,7 +16,7 @@
*/ */
import { Component, Input, OnInit, OnDestroy } from '@angular/core'; 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 { BehaviorSubject, Subject } from 'rxjs';
import { Site, SiteEntry } from '@alfresco/js-api'; import { Site, SiteEntry } from '@alfresco/js-api';
import { ShareDataRow } from '../../data/share-data-row.model'; import { ShareDataRow } from '../../data/share-data-row.model';

View File

@ -26,7 +26,7 @@ import {
} from '@angular/core'; } from '@angular/core';
import { NodeEntry } from '@alfresco/js-api'; import { NodeEntry } from '@alfresco/js-api';
import { BehaviorSubject, Subject } from 'rxjs'; 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 { ShareDataRow } from '../../data/share-data-row.model';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';

View File

@ -15,9 +15,10 @@
* limitations under the License. * 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 { MinimalNode, NodeEntry } from '@alfresco/js-api';
import { PermissionStyleModel } from './../models/permissions-style.model'; 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'; export const ERR_OBJECT_NOT_FOUND: string = 'Object source not found';

View File

@ -15,13 +15,14 @@
* limitations under the License. * 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 { FileNode, FolderNode, SmartFolderNode, RuleFolderNode, LinkFolderNode } from './../../mock';
import { ERR_OBJECT_NOT_FOUND, ShareDataRow } from './share-data-row.model'; 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 { ERR_COL_NOT_FOUND, ERR_ROW_NOT_FOUND, ShareDataTableAdapter } from './share-datatable-adapter';
import { ContentTestingModule } from '../../testing/content.testing.module'; import { ContentTestingModule } from '../../testing/content.testing.module';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { ContentService } from '../../common/services/content.service';
describe('ShareDataTableAdapter', () => { describe('ShareDataTableAdapter', () => {
@ -41,7 +42,7 @@ describe('ShareDataTableAdapter', () => {
contentService = TestBed.inject(ContentService); contentService = TestBed.inject(ContentService);
thumbnailService = TestBed.inject(ThumbnailService); thumbnailService = TestBed.inject(ThumbnailService);
spyOn(thumbnailService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl); spyOn(contentService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl);
}); });
it('should use client sorting by default', () => { it('should use client sorting by default', () => {
@ -267,7 +268,6 @@ describe('ShareDataTableAdapter', () => {
const value = adapter.getValue(row, col); const value = adapter.getValue(row, col);
expect(value).toBe(imageUrl); expect(value).toBe(imageUrl);
expect(thumbnailService.getDocumentThumbnailUrl).toHaveBeenCalledWith(file);
}); });
it('should resolve fallback file icon for unknown node', () => { it('should resolve fallback file icon for unknown node', () => {

View File

@ -20,13 +20,13 @@ import {
DataRow, DataRow,
DataSorting, DataSorting,
DataTableAdapter, DataTableAdapter,
ThumbnailService, ThumbnailService
ContentService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { NodePaging, NodeEntry } from '@alfresco/js-api'; import { NodePaging, NodeEntry } from '@alfresco/js-api';
import { PermissionStyleModel } from './../models/permissions-style.model'; import { PermissionStyleModel } from './../models/permissions-style.model';
import { ShareDataRow } from './share-data-row.model'; import { ShareDataRow } from './share-data-row.model';
import { RowFilter } from './row-filter.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_ROW_NOT_FOUND: string = 'Row not found';
export const ERR_COL_NOT_FOUND: string = 'Column 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 (node.entry.isFile) {
if (this.thumbnails) { 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); 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 { getSorting(): DataSorting {
return this.sorting; return this.sorting;
} }

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { AllowableOperationsEnum } from '@alfresco/adf-core'; import { AllowableOperationsEnum } from '../../common/models/allowable-operations.enum';
export class PermissionStyleModel { export class PermissionStyleModel {
css: string; css: string;

Some files were not shown because too many files have changed in this diff Show More