mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1368] Delete a document onto document list update even the file upload dialog (#2267)
* [ADF-1368] adding success action event even form file deleted on document actions * [ADF-1368] reflecting delete changes on documentlist * [ADF-1368] added event on upload service when a file is deleted from external source * [ADF-1368] pinned version beta8 for material * [ADF-1368] added test cases for success event on documentlist actions delete
This commit is contained in:
@@ -203,6 +203,7 @@
|
||||
[disableWithNoPermission]="true"
|
||||
(permissionEvent)="handlePermissionError($event)"
|
||||
title="{{'DOCUMENT_LIST.ACTIONS.DOCUMENT.DELETE' | translate}}"
|
||||
(success)="onDeleteActionSuccess($event)"
|
||||
handler="delete">
|
||||
</content-action>
|
||||
</content-actions>
|
||||
|
@@ -206,6 +206,10 @@ export class FilesComponent implements OnInit {
|
||||
this.notificationService.openSnackMessage(translatedMessage.value, 4000);
|
||||
}
|
||||
|
||||
onDeleteActionSuccess(message) {
|
||||
this.uploadService.fileDeleted.next(message);
|
||||
}
|
||||
|
||||
onCreateFolderClicked(event: Event) {
|
||||
let dialogRef = this.dialog.open(CreateFolderDialogComponent);
|
||||
dialogRef.afterClosed().subscribe(folderName => {
|
||||
|
@@ -63,7 +63,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -39,7 +39,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -35,7 +35,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -42,7 +42,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -41,7 +41,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -45,7 +45,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -50,7 +50,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -43,6 +43,7 @@ export class UploadService {
|
||||
fileUploadError: Subject<FileUploadErrorEvent> = new Subject<FileUploadErrorEvent>();
|
||||
fileUploadComplete: Subject<FileUploadCompleteEvent> = new Subject<FileUploadCompleteEvent>();
|
||||
fileUploadDeleted: Subject<FileUploadDeleteEvent> = new Subject<FileUploadDeleteEvent>();
|
||||
fileDeleted: Subject<string> = new Subject<string>();
|
||||
|
||||
constructor(private apiService: AlfrescoApiService, private appConfigService: AppConfigService) {
|
||||
this.excludedFileList = <String[]> this.appConfigService.get('files.excluded');
|
||||
|
@@ -41,7 +41,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -729,7 +729,7 @@ Events:
|
||||
| --- | --- | --- |
|
||||
| `execute` | All | Emitted when user clicks on the action. For combined handlers see below |
|
||||
| `permissionEvent` | All | Emitted when a permission error happens |
|
||||
| `success` | copy, move | Emitted on successful action with the success string message |
|
||||
| `success` | copy, move, delete | Emitted on successful action with the success string message |
|
||||
| `error` | copy, move | Emitted on unsuccessful action with the error event |
|
||||
|
||||
DocumentList supports declarative actions for Documents and Folders.
|
||||
|
@@ -49,7 +49,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -267,4 +267,20 @@ describe('DocumentActionsService', () => {
|
||||
expect(documentListService.deleteNode).toHaveBeenCalled();
|
||||
expect(target.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should emit success event upon node deletion', (done) => {
|
||||
service.success.subscribe((nodeId) => {
|
||||
expect(nodeId).not.toBeNull();
|
||||
done();
|
||||
});
|
||||
spyOn(documentListService, 'deleteNode').and.callThrough();
|
||||
|
||||
let target = jasmine.createSpyObj('obj', ['reload']);
|
||||
let permission = 'delete';
|
||||
let file = new FileNode();
|
||||
let fileWithPermission: any = file;
|
||||
fileWithPermission.entry.allowableOperations = [permission];
|
||||
service.getHandler('delete')(fileWithPermission, target, permission);
|
||||
|
||||
});
|
||||
});
|
||||
|
@@ -115,6 +115,7 @@ export class DocumentActionsService {
|
||||
if (target && typeof target.reload === 'function') {
|
||||
target.reload();
|
||||
}
|
||||
this.success.next(obj.entry.id);
|
||||
});
|
||||
return handlerObservable;
|
||||
} else {
|
||||
|
@@ -249,4 +249,26 @@ describe('FolderActionsService', () => {
|
||||
|
||||
expect(documentListService.deleteNode).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should emit success event upon node deletion', (done) => {
|
||||
spyOn(documentListService, 'deleteNode').and.callFake(() => {
|
||||
return new Observable<any>(observer => {
|
||||
observer.next();
|
||||
observer.complete();
|
||||
});
|
||||
});
|
||||
|
||||
service.success.subscribe((nodeId) => {
|
||||
expect(nodeId).not.toBeNull();
|
||||
done();
|
||||
});
|
||||
|
||||
let permission = 'delete';
|
||||
let target = jasmine.createSpyObj('obj', ['reload']);
|
||||
let folder = new FolderNode();
|
||||
let folderWithPermission: any = folder;
|
||||
folderWithPermission.entry.allowableOperations = [permission];
|
||||
|
||||
service.getHandler('delete')(folderWithPermission, target, permission);
|
||||
});
|
||||
});
|
||||
|
@@ -100,6 +100,7 @@ export class FolderActionsService {
|
||||
if (target && typeof target.reload === 'function') {
|
||||
target.reload();
|
||||
}
|
||||
this.success.next(obj.entry.id);
|
||||
});
|
||||
return handlerObservable;
|
||||
} else {
|
||||
|
@@ -53,7 +53,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -49,7 +49,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -29,7 +29,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -29,7 +29,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -201,6 +201,7 @@ Provides access to various APIs related to file upload features.
|
||||
| fileUploadError | FileUploadEvent | Raised when an error occurs to file upload. |
|
||||
| fileUploadComplete | FileUploadCompleteEvent | Raised when file upload is complete. |
|
||||
| fileUploadDelete | FileUploadDeleteEvent | Raised when uploaded file is removed from server. |
|
||||
| fileDeleted | string | This can be invoked when a file is deleted from an external source to upload the file dialog status. |
|
||||
|
||||
### Details
|
||||
|
||||
|
@@ -50,7 +50,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { ChangeDetectorRef, Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import { FileModel, FileUploadCompleteEvent, FileUploadDeleteEvent,
|
||||
FileUploadErrorEvent, UploadService } from 'ng2-alfresco-core';
|
||||
FileUploadErrorEvent, FileUploadStatus, UploadService } from 'ng2-alfresco-core';
|
||||
import { Observable, Subscription } from 'rxjs/Rx';
|
||||
import { FileUploadingListComponent } from './file-uploading-list.component';
|
||||
|
||||
@@ -78,6 +78,18 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
||||
.fileUpload.subscribe(() => {
|
||||
this.changeDetecor.detectChanges();
|
||||
});
|
||||
|
||||
this.uploadService.fileDeleted.subscribe((objId) => {
|
||||
if (this.filesUploadingList) {
|
||||
let file = this.filesUploadingList.find((item) => {
|
||||
return item.data.entry.id === objId;
|
||||
});
|
||||
if (file) {
|
||||
file.status = FileUploadStatus.Cancelled;
|
||||
this.changeDetecor.detectChanges();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -29,7 +29,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -44,7 +44,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -29,7 +29,7 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
|
@@ -7,8 +7,7 @@
|
||||
"clean": "rimraf node_modules",
|
||||
"clean-lock": "rimraf package-lock.json",
|
||||
"rimraf": "rimraf",
|
||||
"build": "npm run build-style && npm run toc && npm run markdownlint && npm run webpack -- --config config/webpack.build.js --progress --profile --bail",
|
||||
"build-style": "npm run webpack -- --config config/webpack.style.js --progress --profile --bail",
|
||||
"build": "npm run toc && npm run markdownlint && npm run webpack -- --config config/webpack.build.js --progress --profile --bail",
|
||||
"test": "node node_modules/karma/bin/karma start --reporters mocha,coverage --single-run --component .",
|
||||
"test-browser": "node node_modules/karma/bin/karma start karma.conf.js --reporters kjhtml",
|
||||
"coverage": "",
|
||||
@@ -69,32 +68,32 @@
|
||||
"@angular/core": "4.2.5",
|
||||
"@angular/forms": "4.2.5",
|
||||
"@angular/http": "4.2.5",
|
||||
"@angular/material": "^2.0.0-beta.8",
|
||||
"@angular/material": "2.0.0-beta.8",
|
||||
"@angular/platform-browser": "4.2.5",
|
||||
"@angular/platform-browser-dynamic": "4.2.5",
|
||||
"@angular/router": "4.2.5",
|
||||
"@ngx-translate/core": "7.0.0",
|
||||
"alfresco-js-api": "^1.8.0-9feb5d0164d6c5f994df8758e41ed126a8f69db2",
|
||||
"chart.js": "2.5.0",
|
||||
"alfresco-js-api": "1.7.0",
|
||||
"core-js": "2.4.1",
|
||||
"hammerjs": "2.0.8",
|
||||
"material-design-icons": "2.2.3",
|
||||
"material-design-lite": "1.2.1",
|
||||
"minimatch": "3.0.4",
|
||||
"moment": "2.15.1",
|
||||
"ng2-activiti-diagrams": "1.7.0",
|
||||
"ng2-activiti-form": "1.7.0",
|
||||
"ng2-activiti-tasklist": "1.7.0",
|
||||
"ng2-alfresco-core": "1.7.0",
|
||||
"ng2-alfresco-datatable": "1.7.0",
|
||||
"ng2-alfresco-documentlist": "1.7.0",
|
||||
"ng2-charts": "1.6.0",
|
||||
"pdfjs-dist": "1.5.404",
|
||||
"raphael": "2.2.7",
|
||||
"reflect-metadata": "0.1.10",
|
||||
"rxjs": "5.1.0",
|
||||
"systemjs": "0.19.27",
|
||||
"zone.js": "0.6.26"
|
||||
"zone.js": "0.6.26",
|
||||
"ng2-alfresco-core": "1.7.0",
|
||||
"raphael": "2.2.7",
|
||||
"chart.js": "2.5.0",
|
||||
"ng2-activiti-diagrams": "1.7.0",
|
||||
"ng2-charts": "1.6.0",
|
||||
"ng2-activiti-form": "1.7.0",
|
||||
"ng2-alfresco-datatable": "1.7.0",
|
||||
"ng2-activiti-tasklist": "1.7.0",
|
||||
"ng2-alfresco-documentlist": "1.7.0",
|
||||
"minimatch": "3.0.4",
|
||||
"pdfjs-dist": "1.5.404"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/hammerjs": "2.0.34",
|
||||
|
Reference in New Issue
Block a user