- + { it('should call refresh onContentCopied event if parent is the same', () => { const nodes = [ - { entry: { parentId: '1' } }, - { entry: { parentId: '2' } } + { entry: { parentId: '1' } }, + { entry: { parentId: '2' } } ]; - component.node = { id: '1' }; + component.node = { id: '1' }; nodeActionsService.contentCopied.next(nodes); @@ -167,11 +167,11 @@ describe('FilesComponent', () => { it('should not call refresh onContentCopied event when parent mismatch', () => { const nodes = [ - { entry: { parentId: '1' } }, - { entry: { parentId: '2' } } + { entry: { parentId: '1' } }, + { entry: { parentId: '2' } } ]; - component.node = { id: '3' }; + component.node = { id: '3' }; nodeActionsService.contentCopied.next(nodes); @@ -210,7 +210,7 @@ describe('FilesComponent', () => { it('should call refresh on fileUploadComplete event if parent node match', fakeAsync(() => { const file = { file: { options: { parentId: 'parentId' } } }; - component.node = { id: 'parentId' }; + component.node = { id: 'parentId' }; uploadService.fileUploadComplete.next(file); @@ -221,7 +221,7 @@ describe('FilesComponent', () => { it('should not call refresh on fileUploadComplete event if parent mismatch', fakeAsync(() => { const file = { file: { options: { parentId: 'otherId' } } }; - component.node = { id: 'parentId' }; + component.node = { id: 'parentId' }; uploadService.fileUploadComplete.next(file); @@ -232,7 +232,7 @@ describe('FilesComponent', () => { it('should call refresh on fileUploadDeleted event if parent node match', fakeAsync(() => { const file = { file: { options: { parentId: 'parentId' } } }; - component.node = { id: 'parentId' }; + component.node = { id: 'parentId' }; uploadService.fileUploadDeleted.next(file); @@ -243,7 +243,7 @@ describe('FilesComponent', () => { it('should not call refresh on fileUploadDeleted event if parent mismatch', fakeAsync(() => { const file: any = { file: { options: { parentId: 'otherId' } } }; - component.node = { id: 'parentId' }; + component.node = { id: 'parentId' }; uploadService.fileUploadDeleted.next(file); @@ -293,7 +293,7 @@ describe('FilesComponent', () => { }); it('should navigate home if node is root', () => { - component.node = { + component.node = { path: { elements: [{ id: 'node-id' }] } @@ -307,19 +307,19 @@ describe('FilesComponent', () => { describe('isSiteContainer', () => { it('should return false if node has no aspectNames', () => { - const mock = { aspectNames: [] }; + const mock = { aspectNames: [] }; expect(component.isSiteContainer(mock)).toBe(false); }); it('should return false if node is not site container', () => { - const mock = { aspectNames: ['something-else'] }; + const mock = { aspectNames: ['something-else'] }; expect(component.isSiteContainer(mock)).toBe(false); }); it('should return true if node is a site container', () => { - const mock = { aspectNames: ['st:siteContainer'] }; + const mock = { aspectNames: ['st:siteContainer'] }; expect(component.isSiteContainer(mock)).toBe(true); }); diff --git a/src/app/components/files/files.component.ts b/src/app/components/files/files.component.ts index 22c367f77..a907e2915 100644 --- a/src/app/components/files/files.component.ts +++ b/src/app/components/files/files.component.ts @@ -32,7 +32,7 @@ import { MinimalNodeEntryEntity, PathElement, PathElementEntity -} from 'alfresco-js-api'; +} from '@alfresco/js-api'; import { ContentManagementService } from '../../services/content-management.service'; import { NodeActionsService } from '../../services/node-actions.service'; import { AppStore } from '../../store/states/app.state'; diff --git a/src/app/components/info-drawer/comments-tab/comments-tab.component.ts b/src/app/components/info-drawer/comments-tab/comments-tab.component.ts index 91273d28b..a92b6730f 100644 --- a/src/app/components/info-drawer/comments-tab/comments-tab.component.ts +++ b/src/app/components/info-drawer/comments-tab/comments-tab.component.ts @@ -24,7 +24,7 @@ */ import { Component, Input } from '@angular/core'; -import { MinimalNodeEntryEntity } from 'alfresco-js-api'; +import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { NodePermissionService } from '../../../services/node-permission.service'; @Component({ diff --git a/src/app/components/info-drawer/info-drawer.component.spec.ts b/src/app/components/info-drawer/info-drawer.component.spec.ts index dc2311361..1aaad4c38 100644 --- a/src/app/components/info-drawer/info-drawer.component.spec.ts +++ b/src/app/components/info-drawer/info-drawer.component.spec.ts @@ -83,7 +83,7 @@ describe('InfoDrawerComponent', () => { it('should set displayNode when node is from personal list', () => { spyOn(contentApiService, 'getNodeInfo'); - const nodeMock = { entry: { id: 'nodeId' } }; + const nodeMock = { entry: { id: 'nodeId' } }; component.node = nodeMock; fixture.detectChanges(); @@ -109,9 +109,9 @@ describe('InfoDrawerComponent', () => { })); it('should call getNodeInfo() when node is a shared file', async(() => { - const response = { entry: { id: 'nodeId' } }; + const response = { entry: { id: 'nodeId' } }; spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response)); - const nodeMock = { entry: { nodeId: 'nodeId' }, isLibrary: false }; + const nodeMock = { entry: { nodeId: 'nodeId' }, isLibrary: false }; component.node = nodeMock; fixture.detectChanges(); @@ -122,7 +122,7 @@ describe('InfoDrawerComponent', () => { })); it('should call getNodeInfo() when node is a favorite file', async(() => { - const response = { entry: { id: 'nodeId' } }; + const response = { entry: { id: 'nodeId' } }; spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response)); const nodeMock = { entry: { id: 'nodeId', guid: 'guidId' }, @@ -138,7 +138,7 @@ describe('InfoDrawerComponent', () => { })); it('should call getNodeInfo() when node is a recent file', async(() => { - const response = { entry: { id: 'nodeId' } }; + const response = { entry: { id: 'nodeId' } }; spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response)); const nodeMock = { entry: { diff --git a/src/app/components/info-drawer/info-drawer.component.ts b/src/app/components/info-drawer/info-drawer.component.ts index 9572d5140..355725bc0 100644 --- a/src/app/components/info-drawer/info-drawer.component.ts +++ b/src/app/components/info-drawer/info-drawer.component.ts @@ -28,7 +28,7 @@ import { MinimalNodeEntity, MinimalNodeEntryEntity, SiteEntry -} from 'alfresco-js-api'; +} from '@alfresco/js-api'; import { ContentApiService } from '../../services/content-api.service'; import { AppExtensionService } from '../../extensions/extension.service'; import { SidebarTabRef } from '@alfresco/adf-extensions'; @@ -66,7 +66,7 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy { ngOnChanges() { if (this.node) { - const entry = this.node.entry; + const entry: any = this.node.entry; if (this.isLibraryListNode(this.node)) { return this.setDisplayNode(this.node); @@ -113,19 +113,19 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy { } } - private setDisplayNode(node: MinimalNodeEntryEntity | SiteEntry) { + private setDisplayNode(node: any) { this.displayNode = node; } - private isLibraryListNode(node: SiteEntry): boolean { - return (node).isLibrary; + private isLibraryListNode(node: any): boolean { + return node.isLibrary; } private isFavoriteListNode(node: MinimalNodeEntity): boolean { return !this.isLibraryListNode(node) && (node).entry.guid; } - private isSharedFilesNode(node: MinimalNodeEntity): boolean { + private isSharedFilesNode(node: any): boolean { return !!node.entry.nodeId; } diff --git a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts index ab7652fb6..6689d6103 100644 --- a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts +++ b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts @@ -33,7 +33,7 @@ import { Store } from '@ngrx/store'; import { UpdateLibraryAction } from '../../../store/actions'; import { AppTestingModule } from '../../../testing/app-testing.module'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { Site, SiteBody } from 'alfresco-js-api'; +import { Site, SiteBody } from '@alfresco/js-api'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core'; describe('LibraryMetadataFormComponent', () => { diff --git a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts index c9a707d9e..61f038474 100644 --- a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts +++ b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts @@ -25,7 +25,7 @@ import { Component, Input, OnInit, OnChanges, OnDestroy } from '@angular/core'; import { FormGroup, FormControl, Validators } from '@angular/forms'; -import { SiteEntry, SitePaging } from 'alfresco-js-api'; +import { SiteEntry, SitePaging } from '@alfresco/js-api'; import { Store } from '@ngrx/store'; import { UpdateLibraryAction } from '../../../store/actions'; import { AppStore } from '../../../store/states/app.state'; @@ -138,7 +138,9 @@ export class LibraryMetadataFormComponent }); } - private findLibraryByTitle(libraryTitle: string): Observable { + private findLibraryByTitle( + libraryTitle: string + ): Observable { return from( this.alfrescoApiService .getInstance() diff --git a/src/app/components/info-drawer/library-metadata-tab/library-metadata-tab.component.ts b/src/app/components/info-drawer/library-metadata-tab/library-metadata-tab.component.ts index 317d15a3f..965d318d0 100644 --- a/src/app/components/info-drawer/library-metadata-tab/library-metadata-tab.component.ts +++ b/src/app/components/info-drawer/library-metadata-tab/library-metadata-tab.component.ts @@ -24,7 +24,7 @@ */ import { Component, Input } from '@angular/core'; -import { SiteEntry } from 'alfresco-js-api'; +import { SiteEntry } from '@alfresco/js-api'; @Component({ selector: 'app-metadata-tab', diff --git a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts index 6aa52c59b..5e04507a6 100644 --- a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts +++ b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts @@ -24,7 +24,7 @@ */ import { Component, Input, ViewEncapsulation } from '@angular/core'; -import { MinimalNodeEntryEntity } from 'alfresco-js-api'; +import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { NodePermissionService } from '../../../services/node-permission.service'; import { AppExtensionService } from '../../../extensions/extension.service'; import { AppConfigService } from '@alfresco/adf-core'; diff --git a/src/app/components/info-drawer/versions-tab/versions-tab.component.ts b/src/app/components/info-drawer/versions-tab/versions-tab.component.ts index d9f3431af..bc4df8b19 100644 --- a/src/app/components/info-drawer/versions-tab/versions-tab.component.ts +++ b/src/app/components/info-drawer/versions-tab/versions-tab.component.ts @@ -24,7 +24,7 @@ */ import { Component, Input, OnChanges, OnInit } from '@angular/core'; -import { MinimalNodeEntryEntity } from 'alfresco-js-api'; +import { MinimalNodeEntryEntity } from '@alfresco/js-api'; @Component({ selector: 'app-versions-tab', @@ -65,7 +65,7 @@ export class VersionsTabComponent implements OnInit, OnChanges { } private updateState() { - if (this.node && this.node.nodeId) { + if (this.node && (this.node).nodeId) { // workaround for shared files type. this.isFileSelected = true; } else { diff --git a/src/app/components/layout/app-layout/app-layout.component.html b/src/app/components/layout/app-layout/app-layout.component.html index 59e88dcdb..477139289 100644 --- a/src/app/components/layout/app-layout/app-layout.component.html +++ b/src/app/components/layout/app-layout/app-layout.component.html @@ -1,4 +1,4 @@ - + - + diff --git a/src/app/components/layout/app-layout/app-layout.component.spec.ts b/src/app/components/layout/app-layout/app-layout.component.spec.ts index 56c5c6b80..842b32eac 100644 --- a/src/app/components/layout/app-layout/app-layout.component.spec.ts +++ b/src/app/components/layout/app-layout/app-layout.component.spec.ts @@ -140,7 +140,7 @@ describe('AppLayoutComponent', () => { it('should reset selection before navigation', done => { fixture.detectChanges(); - const selection = [{ entry: { id: 'nodeId', name: 'name' } }]; + const selection = [{ entry: { id: 'nodeId', name: 'name' } }]; store.dispatch(new SetSelectedNodesAction(selection)); router.navigateByUrl('somewhere/over/the/rainbow'); @@ -153,7 +153,7 @@ describe('AppLayoutComponent', () => { it('should not reset selection if route is `/search`', done => { fixture.detectChanges(); - const selection = [{ entry: { id: 'nodeId', name: 'name' } }]; + const selection = [{ entry: { id: 'nodeId', name: 'name' } }]; store.dispatch(new SetSelectedNodesAction(selection)); router.navigateByUrl('/search;q='); diff --git a/src/app/components/layout/layout.module.ts b/src/app/components/layout/layout.module.ts index 4ce8ba5d0..78959e455 100644 --- a/src/app/components/layout/layout.module.ts +++ b/src/app/components/layout/layout.module.ts @@ -32,7 +32,6 @@ import { RouterModule } from '@angular/router'; import { AppSidenavModule } from '../sidenav/sidenav.module'; import { AppCommonModule } from '../common/common.module'; import { AppHeaderModule } from '../header/header.module'; -import { AppUploadingDialogModule } from '../upload-dialog/upload-dialog.module'; import { PageLayoutComponent } from './page-layout/page-layout.component'; import { PageLayoutHeaderComponent } from './page-layout/page-layout-header.component'; import { PageLayoutContentComponent } from './page-layout/page-layout-content.component'; @@ -48,8 +47,7 @@ import { HttpClientModule } from '@angular/common/http'; AppCommonModule, AppSidenavModule, AppHeaderModule, - HttpClientModule, - AppUploadingDialogModule + HttpClientModule ], declarations: [ AppLayoutComponent, diff --git a/src/app/components/libraries/libraries.component.ts b/src/app/components/libraries/libraries.component.ts index 377c1f32a..ba53574e9 100644 --- a/src/app/components/libraries/libraries.component.ts +++ b/src/app/components/libraries/libraries.component.ts @@ -26,7 +26,7 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { Component, OnInit } from '@angular/core'; import { Store } from '@ngrx/store'; -import { SiteEntry } from 'alfresco-js-api'; +import { SiteEntry } from '@alfresco/js-api'; import { AppExtensionService } from '../../extensions/extension.service'; import { ContentManagementService } from '../../services/content-management.service'; import { NavigateLibraryAction } from '../../store/actions'; diff --git a/src/app/components/page.component.ts b/src/app/components/page.component.ts index 3494898c2..0e19958fe 100644 --- a/src/app/components/page.component.ts +++ b/src/app/components/page.component.ts @@ -30,7 +30,7 @@ import { import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions'; import { OnDestroy, OnInit, ViewChild } from '@angular/core'; import { Store } from '@ngrx/store'; -import { MinimalNodeEntity, MinimalNodeEntryEntity } from 'alfresco-js-api'; +import { MinimalNodeEntity, MinimalNodeEntryEntity } from '@alfresco/js-api'; import { Observable, Subject, Subscription } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { AppExtensionService } from '../extensions/extension.service'; diff --git a/src/app/components/permissions/permission-manager/permission-manager.component.ts b/src/app/components/permissions/permission-manager/permission-manager.component.ts index 0edb0f35a..dd6f0c783 100644 --- a/src/app/components/permissions/permission-manager/permission-manager.component.ts +++ b/src/app/components/permissions/permission-manager/permission-manager.component.ts @@ -30,7 +30,7 @@ import { import { Component, Input, OnInit, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material'; import { Store } from '@ngrx/store'; -import { MinimalNodeEntryEntity } from 'alfresco-js-api'; +import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { ContentApiService } from '../../../services/content-api.service'; import { SnackbarErrorAction } from '../../../store/actions/snackbar.actions'; import { AppStore } from '../../../store/states/app.state'; diff --git a/src/app/components/preview/preview-extension.component.ts b/src/app/components/preview/preview-extension.component.ts index 5e2f07c82..3c554102b 100644 --- a/src/app/components/preview/preview-extension.component.ts +++ b/src/app/components/preview/preview-extension.component.ts @@ -35,7 +35,7 @@ import { OnChanges } from '@angular/core'; import { AppExtensionService } from '../../extensions/extension.service'; -import { MinimalNodeEntryEntity } from 'alfresco-js-api'; +import { MinimalNodeEntryEntity } from '@alfresco/js-api'; @Component({ selector: 'app-preview-extension', diff --git a/src/app/components/preview/preview.component.html b/src/app/components/preview/preview.component.html index 998a327b1..16bec8ee3 100644 --- a/src/app/components/preview/preview.component.html +++ b/src/app/components/preview/preview.component.html @@ -1,8 +1,8 @@ , private appConfig: AppConfigService, - private settingsService: SettingsService, private storage: StorageService, private fb: FormBuilder ) { @@ -106,7 +101,8 @@ export class SettingsComponent implements OnInit { reset() { this.form.reset({ - ecmHost: this.storage.getItem('ecmHost') || this.settingsService.ecmHost + ecmHost: + this.storage.getItem('ecmHost') || this.appConfig.get('ecmHost') }); } diff --git a/src/app/components/shared/content-node-share/content-node-share.dialog.ts b/src/app/components/shared/content-node-share/content-node-share.dialog.ts index b6382a249..c336f885d 100644 --- a/src/app/components/shared/content-node-share/content-node-share.dialog.ts +++ b/src/app/components/shared/content-node-share/content-node-share.dialog.ts @@ -36,7 +36,7 @@ import { distinctUntilChanged } from 'rxjs/operators'; import { SharedLinksApiService, NodesApiService } from '@alfresco/adf-core'; -import { SharedLinkEntry, MinimalNodeEntryEntity } from 'alfresco-js-api'; +import { SharedLinkEntry, MinimalNodeEntryEntity } from '@alfresco/js-api'; import { ConfirmDialogComponent } from '@alfresco/adf-content-services'; import * as moment from 'moment'; diff --git a/src/app/components/upload-dialog/file-uploading-dialog.component.html b/src/app/components/upload-dialog/file-uploading-dialog.component.html deleted file mode 100644 index cda584cde..000000000 --- a/src/app/components/upload-dialog/file-uploading-dialog.component.html +++ /dev/null @@ -1,134 +0,0 @@ -
-
- - - - {{ - 'FILE_UPLOAD.MESSAGES.UPLOAD_COMPLETED' - | translate - : { - completed: totalCompleted, - total: filesUploadingList.length - } - }} - - - - {{ 'FILE_UPLOAD.MESSAGES.UPLOAD_CANCELED' | translate }} - -
- -
- {{ - (totalErrors > 1 - ? 'FILE_UPLOAD.MESSAGES.UPLOAD_ERRORS' - : 'FILE_UPLOAD.MESSAGES.UPLOAD_ERROR') - | translate: { total: totalErrors } - }} -
- -
- - - - - - - -
-

- {{ 'ADF_FILE_UPLOAD.CONFIRMATION.MESSAGE.TITLE' | translate }} -

- -

- {{ 'ADF_FILE_UPLOAD.CONFIRMATION.MESSAGE.TEXT' | translate }} -

-
-
- -
- - - -
- -
- - - -
-
diff --git a/src/app/components/upload-dialog/file-uploading-dialog.component.ts b/src/app/components/upload-dialog/file-uploading-dialog.component.ts deleted file mode 100644 index c2f4615d9..000000000 --- a/src/app/components/upload-dialog/file-uploading-dialog.component.ts +++ /dev/null @@ -1,195 +0,0 @@ -/*! - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { - FileModel, - FileUploadCompleteEvent, - FileUploadDeleteEvent, - FileUploadErrorEvent, - FileUploadStatus, - UploadService -} from '@alfresco/adf-core'; -import { - ChangeDetectorRef, - Component, - Input, - Output, - EventEmitter, - OnDestroy, - OnInit, - ViewChild -} from '@angular/core'; -import { Subscription, merge } from 'rxjs'; -import { FileUploadingListComponent } from './file-uploading-list.component'; - -// @deprecated file-uploading-dialog TODO remove in 3.0.0 -@Component({ - selector: 'app-file-uploading-dialog', - templateUrl: './file-uploading-dialog.component.html' -}) -export class FileUploadingDialogComponent implements OnInit, OnDestroy { - @ViewChild('uploadList') - uploadList: FileUploadingListComponent; - - /** Dialog position. Can be 'left' or 'right'. */ - @Input() - position = 'right'; - - /** Emitted when a file in the list has an error. */ - @Output() - error: EventEmitter = new EventEmitter(); - - filesUploadingList: FileModel[] = []; - isDialogActive = false; - totalCompleted = 0; - totalErrors = 0; - isDialogMinimized = false; - isConfirmation = false; - - private listSubscription: Subscription; - private counterSubscription: Subscription; - private fileUploadSubscription: Subscription; - private errorSubscription: Subscription; - private errors = []; - - constructor( - private uploadService: UploadService, - private changeDetector: ChangeDetectorRef - ) {} - - ngOnInit() { - this.listSubscription = this.uploadService.queueChanged.subscribe( - (fileList: FileModel[]) => { - this.filesUploadingList = fileList; - - if (this.filesUploadingList.length) { - this.isDialogActive = true; - } - } - ); - - this.counterSubscription = merge( - this.uploadService.fileUploadComplete, - this.uploadService.fileUploadDeleted - ).subscribe((event: FileUploadDeleteEvent | FileUploadCompleteEvent) => { - this.totalCompleted = event.totalComplete; - this.changeDetector.detectChanges(); - }); - - // todo: move to ADF ACA-2051 - this.errorSubscription = this.uploadService.fileUploadError.subscribe( - (event: FileUploadErrorEvent) => { - const statusCode = (event.error || {}).response - ? event.error.response.statusCode - : null; - this.errors.push({ - fileName: event.file.name, - status: statusCode, - message: this.getUploadErrorMessage(statusCode) - }); - this.totalErrors = event.totalError; - this.changeDetector.detectChanges(); - } - ); - - this.fileUploadSubscription = this.uploadService.fileUpload.subscribe( - event => { - this.changeDetector.detectChanges(); - } - ); - - this.uploadService.fileDeleted.subscribe(objId => { - if (this.filesUploadingList) { - const file = this.filesUploadingList.find(item => { - return item.data.entry.id === objId; - }); - if (file) { - file.status = FileUploadStatus.Cancelled; - this.changeDetector.detectChanges(); - } - } - }); - } - - getFileUploadError(file) { - return this.errors.find(error => (error.fileName = file.name)); - } - - /** - * Toggle confirmation message. - */ - toggleConfirmation() { - this.isConfirmation = !this.isConfirmation; - - if (this.isDialogMinimized) { - this.isDialogMinimized = false; - } - } - - /** - * Cancel uploads and hide confirmation - */ - cancelAllUploads() { - this.toggleConfirmation(); - - this.uploadList.cancelAllFiles(); - } - - /** - * Toggle dialog minimized state. - */ - toggleMinimized(): void { - this.isDialogMinimized = !this.isDialogMinimized; - this.changeDetector.detectChanges(); - } - - /** - * Dismiss dialog - */ - close(): void { - this.isConfirmation = false; - this.totalCompleted = 0; - this.totalErrors = 0; - this.filesUploadingList = []; - this.isDialogActive = false; - this.isDialogMinimized = false; - this.uploadService.clearQueue(); - this.changeDetector.detectChanges(); - this.errors = []; - } - - ngOnDestroy() { - this.uploadService.clearQueue(); - this.listSubscription.unsubscribe(); - this.counterSubscription.unsubscribe(); - this.fileUploadSubscription.unsubscribe(); - this.errorSubscription.unsubscribe(); - } - - // todo: move to ADF ACA-2051 - private getUploadErrorMessage(status) { - const messages = { - 500: 'APP.MESSAGES.UPLOAD.ERROR.500', - 504: 'APP.MESSAGES.UPLOAD.ERROR.504', - 403: 'APP.MESSAGES.UPLOAD.ERROR.403', - 404: 'APP.MESSAGES.UPLOAD.ERROR.404', - generic: 'APP.MESSAGES.UPLOAD.ERROR.GENERIC' - }; - - return messages[status] || messages['generic']; - } -} diff --git a/src/app/components/upload-dialog/file-uploading-list-row.component.html b/src/app/components/upload-dialog/file-uploading-list-row.component.html deleted file mode 100644 index 578129cf8..000000000 --- a/src/app/components/upload-dialog/file-uploading-list-row.component.html +++ /dev/null @@ -1,94 +0,0 @@ -
- - insert_drive_file - - - - {{ file.name }} - - -
- - {{ file.progress.loaded | adfFileSize }} / - {{ file.progress.total | adfFileSize }} - - - - clear - -
- -
- - check_circle - - - - remove_circle - -
- -
- - schedule - - - - remove_circle - -
- - -
- - report_problem - -
- -
- {{ 'ADF_FILE_UPLOAD.STATUS.FILE_CANCELED_STATUS' | translate }} -
-
-
diff --git a/src/app/components/upload-dialog/file-uploading-list-row.component.ts b/src/app/components/upload-dialog/file-uploading-list-row.component.ts deleted file mode 100644 index 7bb564ecc..000000000 --- a/src/app/components/upload-dialog/file-uploading-list-row.component.ts +++ /dev/null @@ -1,47 +0,0 @@ -/*! - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { FileModel, FileUploadStatus } from '@alfresco/adf-core'; -import { Component, EventEmitter, Input, Output } from '@angular/core'; - -@Component({ - selector: 'app-file-uploading-list-row', - templateUrl: './file-uploading-list-row.component.html' -}) -export class FileUploadingListRowComponent { - @Input() - file: FileModel; - - @Input() - error: any; - - @Output() - cancel: EventEmitter = new EventEmitter(); - - @Output() - remove: EventEmitter = new EventEmitter(); - - FileUploadStatus = FileUploadStatus; - - onCancel(file: FileModel): void { - this.cancel.emit(file); - } - - onRemove(file: FileModel): void { - this.remove.emit(file); - } -} diff --git a/src/app/components/upload-dialog/file-uploading-list.component.html b/src/app/components/upload-dialog/file-uploading-list.component.html deleted file mode 100644 index 475b084b1..000000000 --- a/src/app/components/upload-dialog/file-uploading-list.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
- - -
diff --git a/src/app/components/upload-dialog/file-uploading-list.component.ts b/src/app/components/upload-dialog/file-uploading-list.component.ts deleted file mode 100644 index f70e07e03..000000000 --- a/src/app/components/upload-dialog/file-uploading-list.component.ts +++ /dev/null @@ -1,180 +0,0 @@ -/*! - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { - FileModel, - FileUploadStatus, - NodesApiService, - TranslationService, - UploadService -} from '@alfresco/adf-core'; -import { - Component, - ContentChild, - Input, - Output, - TemplateRef, - EventEmitter -} from '@angular/core'; -import { Observable, forkJoin, of } from 'rxjs'; -import { map, catchError } from 'rxjs/operators'; - -@Component({ - selector: 'app-file-uploading-list', - templateUrl: './file-uploading-list.component.html' -}) -export class FileUploadingListComponent { - FileUploadStatus = FileUploadStatus; - - @ContentChild(TemplateRef) - template: any; - - @Input() - files: FileModel[] = []; - - /** Emitted when a file in the list has an error. */ - @Output() - error: EventEmitter = new EventEmitter(); - - constructor( - private uploadService: UploadService, - private nodesApi: NodesApiService, - private translateService: TranslationService - ) {} - - /** - * Cancel file upload - * - * @param file File model to cancel upload for. - * - * @memberOf FileUploadingListComponent - */ - cancelFile(file: FileModel): void { - this.uploadService.cancelUpload(file); - } - - removeFile(file: FileModel): void { - this.deleteNode(file).subscribe(() => { - if (file.status === FileUploadStatus.Error) { - this.notifyError(file); - } - - this.uploadService.cancelUpload(file); - }); - } - - /** - * Call the appropriate method for each file, depending on state - */ - cancelAllFiles(): void { - this.getUploadingFiles().forEach(file => - this.uploadService.cancelUpload(file) - ); - - const deletedFiles = this.files - .filter(file => file.status === FileUploadStatus.Complete) - .map(file => this.deleteNode(file)); - - forkJoin(...deletedFiles).subscribe((files: FileModel[]) => { - const errors = files.filter( - file => file.status === FileUploadStatus.Error - ); - - if (errors.length) { - this.notifyError(...errors); - } - - this.uploadService.cancelUpload(...files); - }); - } - - /** - * Checks if all the files are uploaded false if there is at least one file in Progress | Starting | Pending - */ - isUploadCompleted(): boolean { - return ( - !this.isUploadCancelled() && - Boolean(this.files.length) && - !this.files.some( - ({ status }) => - status === FileUploadStatus.Starting || - status === FileUploadStatus.Progress || - status === FileUploadStatus.Pending - ) - ); - } - - /** - * Check if all the files are Cancelled | Aborted | Error. false if there is at least one file in uploading states - */ - isUploadCancelled(): boolean { - return ( - !!this.files.length && - this.files.every( - ({ status }) => - status === FileUploadStatus.Aborted || - status === FileUploadStatus.Cancelled || - status === FileUploadStatus.Deleted - ) - ); - } - - private deleteNode(file: FileModel): Observable { - const { id } = file.data.entry; - - return this.nodesApi.deleteNode(id, { permanent: true }).pipe( - map(() => { - file.status = FileUploadStatus.Deleted; - return file; - }), - catchError(() => { - file.status = FileUploadStatus.Error; - return of(file); - }) - ); - } - - private notifyError(...files: FileModel[]) { - let messageError: string = null; - - if (files.length === 1) { - messageError = this.translateService.instant( - 'FILE_UPLOAD.MESSAGES.REMOVE_FILE_ERROR', - { fileName: files[0].name } - ); - } else { - messageError = this.translateService.instant( - 'FILE_UPLOAD.MESSAGES.REMOVE_FILES_ERROR', - { total: files.length } - ); - } - - this.error.emit(messageError); - } - - private getUploadingFiles() { - return this.files.filter(item => { - if ( - item.status === FileUploadStatus.Pending || - item.status === FileUploadStatus.Progress || - item.status === FileUploadStatus.Starting - ) { - return item; - } - }); - } -} diff --git a/src/app/components/upload-dialog/upload-dialog.module.ts b/src/app/components/upload-dialog/upload-dialog.module.ts deleted file mode 100644 index 24606c41e..000000000 --- a/src/app/components/upload-dialog/upload-dialog.module.ts +++ /dev/null @@ -1,46 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2018 Alfresco Software Limited - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { CoreModule } from '@alfresco/adf-core'; -import { FileUploadingDialogComponent } from './file-uploading-dialog.component'; -import { FileUploadingListRowComponent } from './file-uploading-list-row.component'; -import { FileUploadingListComponent } from './file-uploading-list.component'; - -@NgModule({ - imports: [CommonModule, CoreModule.forChild()], - declarations: [ - FileUploadingDialogComponent, - FileUploadingListRowComponent, - FileUploadingListComponent - ], - exports: [ - FileUploadingDialogComponent, - FileUploadingListRowComponent, - FileUploadingListComponent - ] -}) -export class AppUploadingDialogModule {} diff --git a/src/app/dialogs/node-versions/node-versions.dialog.ts b/src/app/dialogs/node-versions/node-versions.dialog.ts index be326220b..2e15888fd 100644 --- a/src/app/dialogs/node-versions/node-versions.dialog.ts +++ b/src/app/dialogs/node-versions/node-versions.dialog.ts @@ -25,7 +25,7 @@ import { Component, Inject, ViewEncapsulation } from '@angular/core'; import { MAT_DIALOG_DATA } from '@angular/material'; -import { MinimalNodeEntryEntity } from 'alfresco-js-api'; +import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { Store } from '@ngrx/store'; import { AppStore } from '../../store/states/app.state'; import { SnackbarErrorAction } from '../../store/actions'; diff --git a/src/app/directives/document-list.directive.ts b/src/app/directives/document-list.directive.ts index d096d29c2..2a9dd4152 100644 --- a/src/app/directives/document-list.directive.ts +++ b/src/app/directives/document-list.directive.ts @@ -31,7 +31,7 @@ import { Subscription } from 'rxjs'; import { Store } from '@ngrx/store'; import { AppStore } from '../store/states/app.state'; import { SetSelectedNodesAction } from '../store/actions'; -import { MinimalNodeEntryEntity } from 'alfresco-js-api'; +import { MinimalNodeEntryEntity } from '@alfresco/js-api'; @Directive({ selector: '[acaDocumentList]' diff --git a/src/app/directives/library-favorite.directive.spec.ts b/src/app/directives/library-favorite.directive.spec.ts index 567591a90..ceb6a31bd 100644 --- a/src/app/directives/library-favorite.directive.spec.ts +++ b/src/app/directives/library-favorite.directive.spec.ts @@ -123,7 +123,7 @@ describe('LibraryFavoriteDirective', () => { it('should call removeFavoriteSite() on click event when selection is not a favorite', async(() => { spyOn(api.peopleApi, 'getFavoriteSite').and.returnValue(Promise.resolve()); - spyOn(api.peopleApi, 'removeFavoriteSite').and.returnValue( + spyOn(api.favoritesApi, 'removeFavoriteSite').and.returnValue( Promise.resolve() ); component.selection = selection; @@ -138,7 +138,7 @@ describe('LibraryFavoriteDirective', () => { fixture.detectChanges(); - expect(api.peopleApi.removeFavoriteSite).toHaveBeenCalled(); + expect(api.favoritesApi.removeFavoriteSite).toHaveBeenCalled(); }); })); }); diff --git a/src/app/directives/library-favorite.directive.ts b/src/app/directives/library-favorite.directive.ts index 8d8026d49..8fdbac77f 100644 --- a/src/app/directives/library-favorite.directive.ts +++ b/src/app/directives/library-favorite.directive.ts @@ -31,7 +31,7 @@ import { Output, EventEmitter } from '@angular/core'; -import { SiteBody, FavoriteBody, FavoriteEntry, Site } from 'alfresco-js-api'; +import { SiteBody, FavoriteBody, FavoriteEntry, Site } from '@alfresco/js-api'; import { AlfrescoApiService } from '@alfresco/adf-core'; interface LibraryEntity { @@ -119,7 +119,7 @@ export class LibraryFavoriteDirective implements OnChanges { } private removeFavorite(favoriteId: string) { - this.alfrescoApiService.peopleApi + this.alfrescoApiService.favoritesApi .removeFavoriteSite('-me-', favoriteId) .then((libraryBody: SiteBody) => { this.targetLibrary.isFavorite = false; diff --git a/src/app/directives/library-membership.directive.ts b/src/app/directives/library-membership.directive.ts index 8eb3e2b5f..0100bb085 100644 --- a/src/app/directives/library-membership.directive.ts +++ b/src/app/directives/library-membership.directive.ts @@ -31,7 +31,7 @@ import { OnChanges, Output } from '@angular/core'; -import { SiteEntry, SiteMembershipRequestBody } from 'alfresco-js-api'; +import { SiteEntry, SiteMembershipRequestBody } from '@alfresco/js-api'; import { AlfrescoApiService } from '@alfresco/adf-core'; import { BehaviorSubject, from } from 'rxjs'; diff --git a/src/app/extensions/evaluators/app.evaluators.ts b/src/app/extensions/evaluators/app.evaluators.ts index c677fcf75..8b7ebbb29 100644 --- a/src/app/extensions/evaluators/app.evaluators.ts +++ b/src/app/extensions/evaluators/app.evaluators.ts @@ -178,7 +178,7 @@ export function canDownloadSelection( ...args: RuleParameter[] ): boolean { if (!context.selection.isEmpty) { - return context.selection.nodes.every(node => { + return context.selection.nodes.every((node: any) => { return ( node.entry && (node.entry.isFile || node.entry.isFolder || !!node.entry.nodeId) diff --git a/src/app/services/content-api.service.ts b/src/app/services/content-api.service.ts index df3696d1d..421d871ed 100644 --- a/src/app/services/content-api.service.ts +++ b/src/app/services/content-api.service.ts @@ -41,7 +41,7 @@ import { SiteBody, SiteEntry, FavoriteBody -} from 'alfresco-js-api'; +} from '@alfresco/js-api'; import { map } from 'rxjs/operators'; @Injectable({ @@ -81,13 +81,13 @@ export class ContentApiService { return from(this.api.nodesApi.getNode(nodeId, queryOptions)); } - getNodeInfo(nodeId: string, options: any = {}): Observable { + getNodeInfo(nodeId: string, options?: any): Observable { const defaults = { include: ['isFavorite', 'allowableOperations'] }; - const queryOptions = Object.assign(defaults, options); + const queryOptions = Object.assign(defaults, options || {}); - return from(this.api.nodesApi.getNodeInfo(nodeId, queryOptions)); + return from((this.api.nodesApi).getNodeInfo(nodeId, queryOptions)); } /** @@ -254,7 +254,7 @@ export class ContentApiService { addFavorite(nodes: Array): Observable { const payload: FavoriteBody[] = nodes.map(node => { - const { isFolder, nodeId, id } = node.entry; + const { isFolder, nodeId, id } = node.entry; const siteId = node.entry['guid']; const type = siteId ? 'site' : isFolder ? 'folder' : 'file'; const guid = siteId || nodeId || id; @@ -274,7 +274,7 @@ export class ContentApiService { removeFavorite(nodes: Array): Observable { return from( Promise.all( - nodes.map(node => { + nodes.map((node: any) => { const id = node.entry.nodeId || node.entry.id; return this.api.favoritesApi.removeFavoriteSite('-me-', id); }) diff --git a/src/app/services/content-management.service.spec.ts b/src/app/services/content-management.service.spec.ts index f608425cd..29845e5e8 100644 --- a/src/app/services/content-management.service.spec.ts +++ b/src/app/services/content-management.service.spec.ts @@ -91,7 +91,9 @@ describe('ContentManagementService', () => { of('OPERATION.SUCCES.CONTENT.COPY') ); - const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }]; + const selection = [ + { entry: { id: 'node-to-copy-id', name: 'name' } } + ]; const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }]; store.dispatch(new CopyNodesAction(selection)); @@ -109,16 +111,16 @@ describe('ContentManagementService', () => { ); const selection = [ - { entry: { id: 'node-to-copy-1', name: 'name1' } }, - { entry: { id: 'node-to-copy-2', name: 'name2' } } + { entry: { id: 'node-to-copy-1', name: 'name1' } }, + { entry: { id: 'node-to-copy-2', name: 'name2' } } ]; const createdItems = [ - { entry: { id: 'copy-of-node-1', name: 'name1' } }, - { entry: { id: 'copy-of-node-2', name: 'name2' } } + { entry: { id: 'copy-of-node-1', name: 'name1' } }, + { entry: { id: 'copy-of-node-2', name: 'name2' } } ]; store.dispatch(new CopyNodesAction(selection)); - nodeActions.contentCopied.next(createdItems); + nodeActions.contentCopied.next(createdItems); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(snackBar.open['calls'].argsFor(0)[0]).toBe( @@ -132,13 +134,15 @@ describe('ContentManagementService', () => { ); const selection = [ - { entry: { id: 'node-to-copy-1', name: 'name1' } }, - { entry: { id: 'node-to-copy-2', name: 'name2' } } + { entry: { id: 'node-to-copy-1', name: 'name1' } }, + { entry: { id: 'node-to-copy-2', name: 'name2' } } + ]; + const createdItems = [ + { entry: { id: 'copy-of-node-1', name: 'name1' } } ]; - const createdItems = [{ entry: { id: 'copy-of-node-1', name: 'name1' } }]; store.dispatch(new CopyNodesAction(selection)); - nodeActions.contentCopied.next(createdItems); + nodeActions.contentCopied.next(createdItems); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(snackBar.open['calls'].argsFor(0)[0]).toBe( @@ -152,17 +156,17 @@ describe('ContentManagementService', () => { ); const selection = [ - { entry: { id: 'node-to-copy-0', name: 'name0' } }, - { entry: { id: 'node-to-copy-1', name: 'name1' } }, - { entry: { id: 'node-to-copy-2', name: 'name2' } } + { entry: { id: 'node-to-copy-0', name: 'name0' } }, + { entry: { id: 'node-to-copy-1', name: 'name1' } }, + { entry: { id: 'node-to-copy-2', name: 'name2' } } ]; const createdItems = [ - { entry: { id: 'copy-of-node-0', name: 'name0' } }, - { entry: { id: 'copy-of-node-1', name: 'name1' } } + { entry: { id: 'copy-of-node-0', name: 'name0' } }, + { entry: { id: 'copy-of-node-1', name: 'name1' } } ]; store.dispatch(new CopyNodesAction(selection)); - nodeActions.contentCopied.next(createdItems); + nodeActions.contentCopied.next(createdItems); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(snackBar.open['calls'].argsFor(0)[0]).toBe( @@ -176,9 +180,9 @@ describe('ContentManagementService', () => { ); const selection = [ - { entry: { id: 'node-to-copy-0', name: 'name0' } }, - { entry: { id: 'node-to-copy-1', name: 'name1' } }, - { entry: { id: 'node-to-copy-2', name: 'name2' } } + { entry: { id: 'node-to-copy-0', name: 'name0' } }, + { entry: { id: 'node-to-copy-1', name: 'name1' } }, + { entry: { id: 'node-to-copy-2', name: 'name2' } } ]; const createdItems = []; @@ -196,7 +200,7 @@ describe('ContentManagementService', () => { of('OPERATION.SUCCES.CONTENT.COPY') ); - const selection = [{ entry: { id: 'node-to-copy', name: 'name' } }]; + const selection = [{ entry: { id: 'node-to-copy', name: 'name' } }]; const createdItems = []; store.dispatch(new CopyNodesAction(selection)); @@ -211,7 +215,9 @@ describe('ContentManagementService', () => { it('notifies error if success message was not emitted', () => { spyOn(nodeActions, 'copyNodes').and.returnValue(of('')); - const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }]; + const selection = [ + { entry: { id: 'node-to-copy-id', name: 'name' } } + ]; store.dispatch(new CopyNodesAction(selection)); nodeActions.contentCopied.next(); @@ -227,7 +233,7 @@ describe('ContentManagementService', () => { throwError(new Error(JSON.stringify({ error: { statusCode: 403 } }))) ); - const selection = [{ entry: { id: '1', name: 'name' } }]; + const selection = [{ entry: { id: '1', name: 'name' } }]; store.dispatch(new CopyNodesAction(selection)); expect(nodeActions.copyNodes).toHaveBeenCalled(); @@ -241,7 +247,7 @@ describe('ContentManagementService', () => { throwError(new Error(JSON.stringify({ error: { statusCode: 404 } }))) ); - const selection = [{ entry: { id: '1', name: 'name' } }]; + const selection = [{ entry: { id: '1', name: 'name' } }]; store.dispatch(new CopyNodesAction(selection)); @@ -266,7 +272,9 @@ describe('ContentManagementService', () => { it('should delete the newly created node on Undo action', () => { spyOn(contentApi, 'deleteNode').and.returnValue(of(null)); - const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }]; + const selection = [ + { entry: { id: 'node-to-copy-id', name: 'name' } } + ]; const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }]; store.dispatch(new CopyNodesAction(selection)); @@ -289,8 +297,8 @@ describe('ContentManagementService', () => { ); const selection = [ - { entry: { id: 'node-to-copy-1', name: 'name1' } }, - { + { entry: { id: 'node-to-copy-1', name: 'name1' } }, + { entry: { id: 'node-to-copy-2', name: 'folder-with-name-already-existing-on-destination' @@ -330,11 +338,13 @@ describe('ContentManagementService', () => { it('notifies when error occurs on Undo action', () => { spyOn(contentApi, 'deleteNode').and.returnValue(throwError(null)); - const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }]; - const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }]; + const selection = [ + { entry: { id: 'node-to-copy-id', name: 'name' } } + ]; + const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }]; store.dispatch(new CopyNodesAction(selection)); - nodeActions.contentCopied.next(createdItems); + nodeActions.contentCopied.next(createdItems); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(contentApi.deleteNode).toHaveBeenCalled(); @@ -348,11 +358,13 @@ describe('ContentManagementService', () => { throwError(new Error('oops!')) ); - const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }]; - const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }]; + const selection = [ + { entry: { id: 'node-to-copy-id', name: 'name' } } + ]; + const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }]; store.dispatch(new CopyNodesAction(selection)); - nodeActions.contentCopied.next(createdItems); + nodeActions.contentCopied.next(createdItems); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(contentApi.deleteNode).toHaveBeenCalled(); @@ -366,11 +378,13 @@ describe('ContentManagementService', () => { throwError(new Error(JSON.stringify({ error: { statusCode: 403 } }))) ); - const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }]; - const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }]; + const selection = [ + { entry: { id: 'node-to-copy-id', name: 'name' } } + ]; + const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }]; store.dispatch(new CopyNodesAction(selection)); - nodeActions.contentCopied.next(createdItems); + nodeActions.contentCopied.next(createdItems); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(contentApi.deleteNode).toHaveBeenCalled(); @@ -412,7 +426,7 @@ describe('ContentManagementService', () => { ); spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse); - const selection = node; + const selection: any = node; store.dispatch(new MoveNodesAction(selection)); nodeActions.contentMoved.next(moveResponse); @@ -439,7 +453,7 @@ describe('ContentManagementService', () => { ); spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse); - const selection = nodes; + const selection: any = nodes; store.dispatch(new MoveNodesAction(selection)); nodeActions.contentMoved.next(moveResponse); @@ -451,7 +465,7 @@ describe('ContentManagementService', () => { }); it('notifies partial move of a node', () => { - const nodes = [{ entry: { id: '1', name: 'name' } }]; + const nodes = [{ entry: { id: '1', name: 'name' } }]; const moveResponse = { succeeded: [], failed: [], @@ -476,8 +490,8 @@ describe('ContentManagementService', () => { it('notifies partial move of multiple nodes', () => { const nodes = [ - { entry: { id: '1', name: 'name' } }, - { entry: { id: '2', name: 'name2' } } + { entry: { id: '1', name: 'name' } }, + { entry: { id: '2', name: 'name2' } } ]; const moveResponse = { succeeded: [], @@ -503,8 +517,8 @@ describe('ContentManagementService', () => { it('notifies successful move and the number of nodes that could not be moved', () => { const nodes = [ - { entry: { id: '1', name: 'name' } }, - { entry: { id: '2', name: 'name2' } } + { entry: { id: '1', name: 'name' } }, + { entry: { id: '2', name: 'name2' } } ]; const moveResponse = { succeeded: [nodes[0]], @@ -529,8 +543,8 @@ describe('ContentManagementService', () => { it('notifies successful move and the number of partially moved ones', () => { const nodes = [ - { entry: { id: '1', name: 'name' } }, - { entry: { id: '2', name: 'name2' } } + { entry: { id: '1', name: 'name' } }, + { entry: { id: '2', name: 'name2' } } ]; const moveResponse = { succeeded: [nodes[0]], @@ -553,7 +567,7 @@ describe('ContentManagementService', () => { }); it('notifies error if success message was not emitted', () => { - const nodes = [{ entry: { id: 'node-to-move-id', name: 'name' } }]; + const nodes = [{ entry: { id: 'node-to-move-id', name: 'name' } }]; const moveResponse = { succeeded: [], failed: [], @@ -576,7 +590,7 @@ describe('ContentManagementService', () => { throwError(new Error(JSON.stringify({ error: { statusCode: 403 } }))) ); - const selection = [{ entry: { id: '1', name: 'name' } }]; + const selection = [{ entry: { id: '1', name: 'name' } }]; store.dispatch(new MoveNodesAction(selection)); expect(nodeActions.moveNodes).toHaveBeenCalled(); @@ -590,7 +604,7 @@ describe('ContentManagementService', () => { throwError(new Error(JSON.stringify({ error: { statusCode: 404 } }))) ); - const selection = [{ entry: { id: '1', name: 'name' } }]; + const selection = [{ entry: { id: '1', name: 'name' } }]; store.dispatch(new MoveNodesAction(selection)); expect(nodeActions.moveNodes).toHaveBeenCalled(); @@ -604,7 +618,7 @@ describe('ContentManagementService', () => { throwError(new Error(JSON.stringify({ error: { statusCode: 409 } }))) ); - const selection = [{ entry: { id: '1', name: 'name' } }]; + const selection = [{ entry: { id: '1', name: 'name' } }]; store.dispatch(new MoveNodesAction(selection)); expect(nodeActions.moveNodes).toHaveBeenCalled(); @@ -614,7 +628,7 @@ describe('ContentManagementService', () => { }); it('notifies error if move response has only failed items', () => { - const nodes = [{ entry: { id: '1', name: 'name' } }]; + const nodes = [{ entry: { id: '1', name: 'name' } }]; const moveResponse = { succeeded: [], failed: [{}], @@ -668,7 +682,7 @@ describe('ContentManagementService', () => { const node = { entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent } }; - const selection = [node]; + const selection = [node]; spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({})); @@ -699,7 +713,7 @@ describe('ContentManagementService', () => { parentId: initialParent } }; - const selection = [node]; + const selection = [node]; spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({})); @@ -734,7 +748,7 @@ describe('ContentManagementService', () => { isFolder: true } }; - const selection = [node]; + const selection = [node]; const itemMoved = {}; // folder was empty nodeActions.moveDeletedEntries = [node]; // folder got deleted @@ -770,7 +784,7 @@ describe('ContentManagementService', () => { parentId: initialParent } }; - const selection = [node]; + const selection = [node]; const afterMoveParentId = 'parent-id-1'; const childMoved = { @@ -805,7 +819,7 @@ describe('ContentManagementService', () => { ); const initialParent = 'parent-id-0'; - const node = { + const node: any = { entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent } }; const selection = [node]; @@ -841,7 +855,7 @@ describe('ContentManagementService', () => { const node = { entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent } }; - const selection = [node]; + const selection = [node]; const childMoved = { entry: { id: 'child-of-node-to-move-id', name: 'child-name' } @@ -873,7 +887,7 @@ describe('ContentManagementService', () => { }) ); - const selection = [{ entry: { id: '1', name: 'name1' } }]; + const selection = [{ entry: { id: '1', name: 'name1' } }]; store.dispatch(new DeleteNodesAction(selection)); })); @@ -888,7 +902,7 @@ describe('ContentManagementService', () => { }) ); - const selection = [{ entry: { id: '1', name: 'name1' } }]; + const selection = [{ entry: { id: '1', name: 'name1' } }]; store.dispatch(new DeleteNodesAction(selection)); })); @@ -904,8 +918,8 @@ describe('ContentManagementService', () => { ); const selection = [ - { entry: { id: '1', name: 'name1' } }, - { entry: { id: '2', name: 'name2' } } + { entry: { id: '1', name: 'name1' } }, + { entry: { id: '2', name: 'name2' } } ]; store.dispatch(new DeleteNodesAction(selection)); @@ -922,8 +936,8 @@ describe('ContentManagementService', () => { ); const selection = [ - { entry: { id: '1', name: 'name1' } }, - { entry: { id: '2', name: 'name2' } } + { entry: { id: '1', name: 'name1' } }, + { entry: { id: '2', name: 'name2' } } ]; store.dispatch(new DeleteNodesAction(selection)); @@ -946,8 +960,8 @@ describe('ContentManagementService', () => { ); const selection = [ - { entry: { id: '1', name: 'name1' } }, - { entry: { id: '2', name: 'name2' } } + { entry: { id: '1', name: 'name1' } }, + { entry: { id: '2', name: 'name2' } } ]; store.dispatch(new DeleteNodesAction(selection)); @@ -976,9 +990,9 @@ describe('ContentManagementService', () => { ); const selection = [ - { entry: { id: '1', name: 'name1' } }, - { entry: { id: '2', name: 'name2' } }, - { entry: { id: '3', name: 'name3' } } + { entry: { id: '1', name: 'name1' } }, + { entry: { id: '2', name: 'name2' } }, + { entry: { id: '3', name: 'name3' } } ]; store.dispatch(new DeleteNodesAction(selection)); @@ -1004,7 +1018,7 @@ describe('ContentManagementService', () => { it('call purge nodes if selection is not empty', fakeAsync(() => { spyOn(contentApi, 'purgeDeletedNode').and.returnValue(of({})); - const selection = [{ entry: { id: '1' } }]; + const selection = [{ entry: { id: '1' } }]; store.dispatch(new PurgeDeletedNodesAction(selection)); expect(contentApi.purgeDeletedNode).toHaveBeenCalled(); @@ -1034,9 +1048,9 @@ describe('ContentManagementService', () => { }); const selection = [ - { entry: { id: '1', name: 'name1' } }, - { entry: { id: '2', name: 'name2' } }, - { entry: { id: '3', name: 'name3' } } + { entry: { id: '1', name: 'name1' } }, + { entry: { id: '2', name: 'name2' } }, + { entry: { id: '3', name: 'name3' } } ]; store.dispatch(new PurgeDeletedNodesAction(selection)); @@ -1069,10 +1083,10 @@ describe('ContentManagementService', () => { }); const selection = [ - { entry: { id: '1', name: 'name1' } }, - { entry: { id: '2', name: 'name2' } }, - { entry: { id: '3', name: 'name3' } }, - { entry: { id: '4', name: 'name4' } } + { entry: { id: '1', name: 'name1' } }, + { entry: { id: '2', name: 'name2' } }, + { entry: { id: '3', name: 'name3' } }, + { entry: { id: '4', name: 'name4' } } ]; store.dispatch(new PurgeDeletedNodesAction(selection)); @@ -1088,7 +1102,7 @@ describe('ContentManagementService', () => { spyOn(contentApi, 'purgeDeletedNode').and.returnValue(of({})); - const selection = [{ entry: { id: '1', name: 'name1' } }]; + const selection = [{ entry: { id: '1', name: 'name1' } }]; store.dispatch(new PurgeDeletedNodesAction(selection)); })); @@ -1103,7 +1117,7 @@ describe('ContentManagementService', () => { spyOn(contentApi, 'purgeDeletedNode').and.returnValue(throwError({})); - const selection = [{ entry: { id: '1', name: 'name1' } }]; + const selection = [{ entry: { id: '1', name: 'name1' } }]; store.dispatch(new PurgeDeletedNodesAction(selection)); })); @@ -1126,8 +1140,8 @@ describe('ContentManagementService', () => { }); const selection = [ - { entry: { id: '1', name: 'name1' } }, - { entry: { id: '2', name: 'name2' } } + { entry: { id: '1', name: 'name1' } }, + { entry: { id: '2', name: 'name2' } } ]; store.dispatch(new PurgeDeletedNodesAction(selection)); @@ -1151,8 +1165,8 @@ describe('ContentManagementService', () => { }); const selection = [ - { entry: { id: '1', name: 'name1' } }, - { entry: { id: '2', name: 'name2' } } + { entry: { id: '1', name: 'name1' } }, + { entry: { id: '2', name: 'name2' } } ]; store.dispatch(new PurgeDeletedNodesAction(selection)); @@ -1173,7 +1187,7 @@ describe('ContentManagementService', () => { it('does not restore nodes if selection has nodes without path', () => { spyOn(contentApi, 'restoreNode'); - const selection = [{ entry: { id: '1' } }]; + const selection = [{ entry: { id: '1' } }]; store.dispatch(new RestoreDeletedNodesAction(selection)); @@ -1198,7 +1212,7 @@ describe('ContentManagementService', () => { }; const selection = [ - { + { entry: { id: '1', path @@ -1234,7 +1248,7 @@ describe('ContentManagementService', () => { }; const selection = [ - { + { entry: { id: '1', path @@ -1269,7 +1283,7 @@ describe('ContentManagementService', () => { }; const selection = [ - { + { entry: { id: '1', path @@ -1324,9 +1338,9 @@ describe('ContentManagementService', () => { }; const selection = [ - { entry: { id: '1', name: 'name1', path } }, - { entry: { id: '2', name: 'name2', path } }, - { entry: { id: '3', name: 'name3', path } } + { entry: { id: '1', name: 'name1', path } }, + { entry: { id: '2', name: 'name2', path } }, + { entry: { id: '3', name: 'name3', path } } ]; store.dispatch(new RestoreDeletedNodesAction(selection)); @@ -1350,7 +1364,7 @@ describe('ContentManagementService', () => { ] }; - const selection = [{ entry: { id: '1', name: 'name1', path } }]; + const selection = [{ entry: { id: '1', name: 'name1', path } }]; store.dispatch(new RestoreDeletedNodesAction(selection)); })); @@ -1374,7 +1388,7 @@ describe('ContentManagementService', () => { ] }; - const selection = [{ entry: { id: '1', name: 'name1', path } }]; + const selection = [{ entry: { id: '1', name: 'name1', path } }]; store.dispatch(new RestoreDeletedNodesAction(selection)); })); @@ -1398,7 +1412,7 @@ describe('ContentManagementService', () => { ] }; - const selection = [{ entry: { id: '1', name: 'name1', path } }]; + const selection = [{ entry: { id: '1', name: 'name1', path } }]; store.dispatch(new RestoreDeletedNodesAction(selection)); })); @@ -1429,8 +1443,8 @@ describe('ContentManagementService', () => { }; const selection = [ - { entry: { id: '1', name: 'name1', path } }, - { entry: { id: '2', name: 'name2', path } } + { entry: { id: '1', name: 'name1', path } }, + { entry: { id: '2', name: 'name2', path } } ]; store.dispatch(new RestoreDeletedNodesAction(selection)); @@ -1453,7 +1467,7 @@ describe('ContentManagementService', () => { ] }; - const selection = [{ entry: { id: '1', name: 'name1', path } }]; + const selection = [{ entry: { id: '1', name: 'name1', path } }]; store.dispatch(new RestoreDeletedNodesAction(selection)); })); @@ -1476,7 +1490,7 @@ describe('ContentManagementService', () => { }; const selection = [ - { + { entry: { id: '1', name: 'name1', @@ -1492,7 +1506,7 @@ describe('ContentManagementService', () => { describe('Share Node', () => { it('should open dialog for nodes without requesting getNodeInfo', fakeAsync(() => { - const node = { entry: { id: '1', name: 'name1' } }; + const node = { entry: { id: '1', name: 'name1' } }; spyOn(contentApi, 'getNodeInfo').and.returnValue(of({})); spyOn(dialog, 'open').and.returnValue({ afterClosed() { @@ -1507,7 +1521,7 @@ describe('ContentManagementService', () => { })); it('should open dialog with getNodeInfo data when `id` property is missing', fakeAsync(() => { - const node = { entry: { nodeId: '1', name: 'name1' } }; + const node = { entry: { nodeId: '1', name: 'name1' } }; spyOn(contentApi, 'getNodeInfo').and.returnValue(of({})); spyOn(dialog, 'open').and.returnValue({ afterClosed() { @@ -1522,7 +1536,7 @@ describe('ContentManagementService', () => { })); it('should update node selection after dialog is closed', fakeAsync(() => { - const node = { entry: { id: '1', name: 'name1' } }; + const node = { entry: { id: '1', name: 'name1' } }; spyOn(store, 'dispatch').and.callThrough(); spyOn(dialog, 'open').and.returnValue({ afterClosed() { @@ -1538,7 +1552,7 @@ describe('ContentManagementService', () => { })); it('should emit event when node is un-shared', fakeAsync(() => { - const node = { entry: { id: '1', name: 'name1' } }; + const node = { entry: { id: '1', name: 'name1' } }; spyOn(contentManagementService.linksUnshared, 'next').and.callThrough(); spyOn(dialog, 'open').and.returnValue({ afterClosed: () => of(node) diff --git a/src/app/services/content-management.service.ts b/src/app/services/content-management.service.ts index f8aa5a146..7a0c4e48e 100644 --- a/src/app/services/content-management.service.ts +++ b/src/app/services/content-management.service.ts @@ -52,7 +52,7 @@ import { DeletedNodesPaging, PathInfoEntity, SiteBody -} from 'alfresco-js-api'; +} from '@alfresco/js-api'; import { NodePermissionService } from './node-permission.service'; import { NodeInfo, DeletedNodeInfo, DeleteStatus } from '../store/models'; import { ContentApiService } from './content-api.service'; @@ -132,7 +132,7 @@ export class ContentManagementService { managePermissions(node: MinimalNodeEntity): void { if (node && node.entry) { - const { nodeId, id } = node.entry; + const { nodeId, id } = node.entry; const siteId = node.entry['guid']; const targetId = siteId || nodeId || id; @@ -150,7 +150,7 @@ export class ContentManagementService { } } - manageVersions(node: MinimalNodeEntity) { + manageVersions(node: any) { if (node && node.entry) { // shared and favorite const id = node.entry.nodeId || (node).entry.guid; @@ -165,7 +165,7 @@ export class ContentManagementService { } } - private openVersionManagerDialog(node: MinimalNodeEntryEntity) { + private openVersionManagerDialog(node: any) { // workaround Shared if (node.isFile || node.nodeId) { this.dialogRef.open(NodeVersionsDialogComponent, { @@ -180,7 +180,7 @@ export class ContentManagementService { } } - shareNode(node: MinimalNodeEntity): void { + shareNode(node: any): void { if (node && node.entry) { // shared and favorite const id = node.entry.nodeId || (node).entry.guid; @@ -389,7 +389,7 @@ export class ContentManagementService { if (result === true) { const nodesToDelete: NodeInfo[] = nodes.map(node => { const { name } = node.entry; - const id = node.entry.nodeId || node.entry.id; + const id = (node).entry.nodeId || node.entry.id; return { id, @@ -973,7 +973,7 @@ export class ContentManagementService { }); } - private deleteNode(node: MinimalNodeEntity): Observable { + private deleteNode(node: any): Observable { const { name } = node.entry; const id = node.entry.nodeId || node.entry.id; @@ -1162,10 +1162,10 @@ export class ContentManagementService { return i18nMessageString; } - printFile(node: MinimalNodeEntity) { + printFile(node: any) { if (node && node.entry) { // shared and favorite - const id = node.entry.nodeId || (node).entry.guid || node.entry.id; + const id = node.entry.nodeId || node.entry.guid || node.entry.id; const mimeType = node.entry.content.mimeType; if (id) { diff --git a/src/app/services/data.service.ts b/src/app/services/data.service.ts index 18ad94c56..847500f31 100644 --- a/src/app/services/data.service.ts +++ b/src/app/services/data.service.ts @@ -31,7 +31,7 @@ import { AlfrescoApiService } from '@alfresco/adf-core'; import { Observable } from 'rxjs'; -import { PersonEntry, SearchRequest, ResultSetPaging } from 'alfresco-js-api'; +import { PersonEntry, SearchRequest, ResultSetPaging } from '@alfresco/js-api'; @Injectable({ providedIn: 'root' diff --git a/src/app/services/node-actions.service.spec.ts b/src/app/services/node-actions.service.spec.ts index 5fb1abc6e..2534b4ba6 100644 --- a/src/app/services/node-actions.service.spec.ts +++ b/src/app/services/node-actions.service.spec.ts @@ -29,7 +29,7 @@ import { of, throwError } from 'rxjs'; import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core'; import { DocumentListService } from '@alfresco/adf-content-services'; import { NodeActionsService } from './node-actions.service'; -import { MinimalNodeEntryEntity } from 'alfresco-js-api'; +import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { AppTestingModule } from '../testing/app-testing.module'; import { ContentApiService } from '../services/content-api.service'; @@ -44,7 +44,7 @@ class TestNode { nodeType?: string, properties?: any ) { - this.entry = {}; + this.entry = {}; this.entry.id = id || 'node-id'; this.entry.isFile = isFile; this.entry.isFolder = !isFile; @@ -241,14 +241,14 @@ describe('NodeActionsService', () => { describe('getEntryParentId', () => { it('should return the parentId, if that exists on the node entry', () => { const parentID = 'parent-id'; - const entry = { nodeId: '1234', parentId: parentID }; + const entry = { nodeId: '1234', parentId: parentID }; expect(service.getEntryParentId(entry)).toBe(parentID); }); it('should give the last element in path property, if parentId is missing and path exists on the node entry', () => { const firstParentId = 'parent-0-id'; - const entry = { + const entry = { nodeId: '1234', path: { elements: [{ id: 'parent-1-id' }, { id: firstParentId }] } }; diff --git a/src/app/services/node-actions.service.ts b/src/app/services/node-actions.service.ts index d0860d2b4..aa6e1f7fe 100644 --- a/src/app/services/node-actions.service.ts +++ b/src/app/services/node-actions.service.ts @@ -41,8 +41,9 @@ import { import { MinimalNodeEntity, MinimalNodeEntryEntity, - SitePaging -} from 'alfresco-js-api'; + SitePaging, + Site +} from '@alfresco/js-api'; import { ContentApiService } from '../services/content-api.service'; import { catchError, map, mergeMap } from 'rxjs/operators'; @@ -217,24 +218,24 @@ export class NodeActionsService { contentEntities[0].entry ); - const customDropdown: SitePaging = { + const customDropdown = new SitePaging({ list: { entries: [ { - entry: { + entry: { guid: '-my-', title: 'APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL' } }, { - entry: { + entry: { guid: '-mysites-', title: 'APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL' } } ] } - }; + }); const title = this.getTitleTranslation(action, contentEntities); @@ -340,7 +341,7 @@ export class NodeActionsService { } } } else if (node === null && this.isSitesDestinationAvailable) { - node = { + node = { name: this.translation.instant('APP.BROWSE.LIBRARIES.TITLE'), path: { elements: [] } }; diff --git a/src/app/store/actions/app.actions.ts b/src/app/store/actions/app.actions.ts index 249d46ffb..880c81572 100644 --- a/src/app/store/actions/app.actions.ts +++ b/src/app/store/actions/app.actions.ts @@ -24,7 +24,7 @@ */ import { Action } from '@ngrx/store'; -import { Node, Person } from 'alfresco-js-api'; +import { Node, Person } from '@alfresco/js-api'; import { AppState } from '../states'; export const SET_INITIAL_STATE = 'SET_INITIAL_STATE'; diff --git a/src/app/store/actions/favorite.actions.ts b/src/app/store/actions/favorite.actions.ts index be7b6e595..3812b3119 100644 --- a/src/app/store/actions/favorite.actions.ts +++ b/src/app/store/actions/favorite.actions.ts @@ -24,7 +24,7 @@ */ import { Action } from '@ngrx/store'; -import { MinimalNodeEntity } from 'alfresco-js-api'; +import { MinimalNodeEntity } from '@alfresco/js-api'; export const ADD_FAVORITE = 'ADD_FAVORITE'; export const REMOVE_FAVORITE = 'REMOVE_FAVORITE'; diff --git a/src/app/store/actions/library.actions.ts b/src/app/store/actions/library.actions.ts index d44a39358..fde0298bf 100644 --- a/src/app/store/actions/library.actions.ts +++ b/src/app/store/actions/library.actions.ts @@ -24,7 +24,7 @@ */ import { Action } from '@ngrx/store'; -import { SiteBody } from 'alfresco-js-api'; +import { SiteBody } from '@alfresco/js-api'; export const DELETE_LIBRARY = 'DELETE_LIBRARY'; export const CREATE_LIBRARY = 'CREATE_LIBRARY'; diff --git a/src/app/store/actions/node.actions.ts b/src/app/store/actions/node.actions.ts index a487b52c6..586736125 100644 --- a/src/app/store/actions/node.actions.ts +++ b/src/app/store/actions/node.actions.ts @@ -24,7 +24,7 @@ */ import { Action } from '@ngrx/store'; -import { MinimalNodeEntity } from 'alfresco-js-api'; +import { MinimalNodeEntity } from '@alfresco/js-api'; export const SET_SELECTED_NODES = 'SET_SELECTED_NODES'; export const DELETE_NODES = 'DELETE_NODES'; diff --git a/src/app/store/actions/router.actions.ts b/src/app/store/actions/router.actions.ts index c118a6bcd..b2b5423f1 100644 --- a/src/app/store/actions/router.actions.ts +++ b/src/app/store/actions/router.actions.ts @@ -24,7 +24,7 @@ */ import { Action } from '@ngrx/store'; -import { MinimalNodeEntity } from 'alfresco-js-api'; +import { MinimalNodeEntity } from '@alfresco/js-api'; export const NAVIGATE_URL = 'NAVIGATE_URL'; export const NAVIGATE_ROUTE = 'NAVIGATE_ROUTE'; diff --git a/src/app/store/actions/viewer.actions.ts b/src/app/store/actions/viewer.actions.ts index cb02e33de..fc478fb69 100644 --- a/src/app/store/actions/viewer.actions.ts +++ b/src/app/store/actions/viewer.actions.ts @@ -24,7 +24,7 @@ */ import { Action } from '@ngrx/store'; -import { MinimalNodeEntity } from 'alfresco-js-api'; +import { MinimalNodeEntity } from '@alfresco/js-api'; export const VIEW_FILE = 'VIEW_FILE'; diff --git a/src/app/store/effects/download.effects.ts b/src/app/store/effects/download.effects.ts index 4d402f46b..8a49e1779 100644 --- a/src/app/store/effects/download.effects.ts +++ b/src/app/store/effects/download.effects.ts @@ -31,7 +31,7 @@ import { map, take } from 'rxjs/operators'; import { DownloadNodesAction, DOWNLOAD_NODES } from '../actions'; import { NodeInfo } from '../models'; import { ContentApiService } from '../../services/content-api.service'; -import { MinimalNodeEntity } from 'alfresco-js-api'; +import { MinimalNodeEntity } from '@alfresco/js-api'; import { Store } from '@ngrx/store'; import { AppStore } from '../states'; import { appSelection } from '../selectors/app.selectors'; @@ -66,7 +66,7 @@ export class DownloadEffects { private downloadNodes(toDownload: Array) { const nodes = toDownload.map(node => { - const { id, nodeId, name, isFile, isFolder } = node.entry; + const { id, nodeId, name, isFile, isFolder } = node.entry; return { id: nodeId || id, diff --git a/src/app/store/effects/library.effects.ts b/src/app/store/effects/library.effects.ts index 1e9c66bae..6d97d36b8 100644 --- a/src/app/store/effects/library.effects.ts +++ b/src/app/store/effects/library.effects.ts @@ -44,7 +44,6 @@ import { Store } from '@ngrx/store'; import { AppStore } from '../states'; import { appSelection } from '../selectors/app.selectors'; import { ContentApiService } from '../../services/content-api.service'; -import { SiteBody } from 'alfresco-js-api-node'; import { SnackbarErrorAction } from '../actions/snackbar.actions'; @Injectable() @@ -136,7 +135,7 @@ export class LibraryEffects { const { id } = selection.library.entry; const { title, description, visibility } = action.payload; - const siteBody = { + const siteBody = { title, description, visibility diff --git a/src/app/store/effects/router.effects.ts b/src/app/store/effects/router.effects.ts index 82136d7bd..a70c2954f 100644 --- a/src/app/store/effects/router.effects.ts +++ b/src/app/store/effects/router.effects.ts @@ -26,7 +26,7 @@ import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; import { Actions, Effect, ofType } from '@ngrx/effects'; -import { MinimalNodeEntryEntity, PathInfoEntity } from 'alfresco-js-api'; +import { MinimalNodeEntryEntity, PathInfoEntity } from '@alfresco/js-api'; import { map } from 'rxjs/operators'; import { NavigateRouteAction, diff --git a/src/app/store/effects/viewer.effects.ts b/src/app/store/effects/viewer.effects.ts index 7baa24268..ff76199a2 100644 --- a/src/app/store/effects/viewer.effects.ts +++ b/src/app/store/effects/viewer.effects.ts @@ -56,7 +56,7 @@ export class ViewerEffects { ofType(VIEW_FILE), map(action => { if (action.payload && action.payload.entry) { - const { id, nodeId, isFile } = action.payload.entry; + const { id, nodeId, isFile } = action.payload.entry; if (isFile || nodeId) { this.displayPreview(nodeId || id, action.parentId); @@ -67,7 +67,7 @@ export class ViewerEffects { .pipe(take(1)) .subscribe(result => { if (result.selection && result.selection.file) { - const { id, nodeId, isFile } = result.selection.file.entry; + const { id, nodeId, isFile } = result.selection.file.entry; if (isFile || nodeId) { const parentId = result.folder ? result.folder.id : null; diff --git a/src/app/store/reducers/app.reducer.ts b/src/app/store/reducers/app.reducer.ts index c1b8d9f86..a2b7a6d7b 100644 --- a/src/app/store/reducers/app.reducer.ts +++ b/src/app/store/reducers/app.reducer.ts @@ -189,7 +189,7 @@ function updateSelectedNodes( last = nodes[nodes.length - 1]; if (nodes.length === 1) { - file = nodes.find(entity => { + file = nodes.find((entity: any) => { // workaround Shared return entity.entry.isFile || entity.entry.nodeId ? true : false; }); @@ -197,7 +197,9 @@ function updateSelectedNodes( } } - const libraries = [...action.payload].filter((node: any) => node.isLibrary); + const libraries: any[] = [...action.payload].filter( + (node: any) => node.isLibrary + ); if (libraries.length === 1) { library = libraries[0]; }