mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
[AAE-207] support aps 1.x for upload reset (#5260)
* support aps 1.x for upload reset * update test * revert pdfjd change * fix error reporting and crash from upload button * i18n support for generic error * fix test
This commit is contained in:
parent
c61de922af
commit
e806e97c75
@ -373,8 +373,8 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openSnackMessage(event: any) {
|
openSnackMessage(message: string) {
|
||||||
this.notificationService.openSnackMessage(event);
|
this.notificationService.showError(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
emitReadyEvent(event: NodePaging) {
|
emitReadyEvent(event: NodePaging) {
|
||||||
|
@ -151,7 +151,8 @@
|
|||||||
"FILE_UPLOAD": {
|
"FILE_UPLOAD": {
|
||||||
"BUTTON": {
|
"BUTTON": {
|
||||||
"UPLOAD_FILE": "Upload file",
|
"UPLOAD_FILE": "Upload file",
|
||||||
"UPLOAD_FOLDER": "Upload folder"
|
"UPLOAD_FOLDER": "Upload folder",
|
||||||
|
"PERMISSION_CHECK_ERROR": "Error checking permission."
|
||||||
},
|
},
|
||||||
"VERSION": {
|
"VERSION": {
|
||||||
"MESSAGES": {
|
"MESSAGES": {
|
||||||
|
@ -384,7 +384,7 @@ describe('UploadButtonComponent', () => {
|
|||||||
spyOn(contentService, 'getNode').and.returnValue(throwError('error'));
|
spyOn(contentService, 'getNode').and.returnValue(throwError('error'));
|
||||||
|
|
||||||
component.error.subscribe((value) => {
|
component.error.subscribe((value) => {
|
||||||
expect(value).toBe('error');
|
expect(value).toBe('FILE_UPLOAD.BUTTON.PERMISSION_CHECK_ERROR');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -120,7 +120,13 @@ export class UploadButtonComponent extends UploadBase implements OnInit, OnChang
|
|||||||
|
|
||||||
this.contentService.getNode(this.rootFolderId, opts).subscribe(
|
this.contentService.getNode(this.rootFolderId, opts).subscribe(
|
||||||
(res) => this.permissionValue.next(this.nodeHasPermission(res.entry, AllowableOperationsEnum.CREATE)),
|
(res) => this.permissionValue.next(this.nodeHasPermission(res.entry, AllowableOperationsEnum.CREATE)),
|
||||||
(error) => this.error.emit(error)
|
(error: { error: Error }) => {
|
||||||
|
if (error && error.error) {
|
||||||
|
this.error.emit(error.error.message);
|
||||||
|
} else {
|
||||||
|
this.error.emit('FILE_UPLOAD.BUTTON.PERMISSION_CHECK_ERROR');
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,8 +134,8 @@ describe('UploadWidgetComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
uploadWidgetComponent.removeFile(uploadWidgetComponent.field.value[0]);
|
uploadWidgetComponent.removeFile(uploadWidgetComponent.field.value[0]);
|
||||||
expect(uploadWidgetComponent.field.value.length).toBe(0);
|
expect(uploadWidgetComponent.field.value).toBeNull();
|
||||||
expect(uploadWidgetComponent.field.json.value.length).toBe(0);
|
expect(uploadWidgetComponent.field.json.value).toBeNull();
|
||||||
expect(uploadWidgetComponent.hasFile).toBeFalsy();
|
expect(uploadWidgetComponent.hasFile).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ export class UploadWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private removeElementFromList(file) {
|
private removeElementFromList(file: any) {
|
||||||
const index = this.field.value.indexOf(file);
|
const index = this.field.value.indexOf(file);
|
||||||
|
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
@ -119,17 +119,13 @@ export class UploadWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
|
|
||||||
this.hasFile = this.field.value.length > 0;
|
this.hasFile = this.field.value.length > 0;
|
||||||
|
|
||||||
this.resetFormValueWithNoFiles();
|
if (!this.hasFile) {
|
||||||
}
|
this.field.value = null;
|
||||||
|
this.field.json.value = null;
|
||||||
private resetFormValueWithNoFiles() {
|
|
||||||
if (this.field.value.length === 0) {
|
|
||||||
this.field.value = [];
|
|
||||||
this.field.json.value = [];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getIcon(mimeType) {
|
getIcon(mimeType: string): string {
|
||||||
return this.thumbnailService.getMimeTypeIcon(mimeType);
|
return this.thumbnailService.getMimeTypeIcon(mimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
package-lock.json
generated
14
package-lock.json
generated
@ -12753,12 +12753,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pdfjs-dist": {
|
"pdfjs-dist": {
|
||||||
"version": "2.0.943",
|
"version": "2.0.489",
|
||||||
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.0.943.tgz",
|
"resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.0.489.tgz",
|
||||||
"integrity": "sha512-iLhNcm4XceTHRaSU5o22ZGCm4YpuW5+rf4+BJFH/feBhMQLbCGBry+Jet8Q419QDI4qgARaIQzXuiNrsNWS8Yw==",
|
"integrity": "sha1-Y+VLKSqGeQpFRpfrRNQ0e4+/rSc=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"node-ensure": "^0.0.0",
|
"node-ensure": "^0.0.0",
|
||||||
"worker-loader": "^2.0.0"
|
"worker-loader": "^1.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pend": {
|
"pend": {
|
||||||
@ -19517,9 +19517,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"worker-loader": {
|
"worker-loader": {
|
||||||
"version": "2.0.0",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-1.1.1.tgz",
|
||||||
"integrity": "sha512-tnvNp4K3KQOpfRnD20m8xltE3eWh89Ye+5oj7wXEEHKac1P4oZ6p9oTj8/8ExqoSBnk9nu5Pr4nKfQ1hn2APJw==",
|
"integrity": "sha512-qJZLVS/jMCBITDzPo/RuweYSIG8VJP5P67mP/71alGyTZRe1LYJFdwLjLalY3T5ifx0bMDRD3OB6P2p1escvlg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"loader-utils": "^1.0.0",
|
"loader-utils": "^1.0.0",
|
||||||
"schema-utils": "^0.4.0"
|
"schema-utils": "^0.4.0"
|
||||||
|
@ -114,15 +114,15 @@
|
|||||||
"moment-es6": "^1.0.0",
|
"moment-es6": "^1.0.0",
|
||||||
"ng2-charts": "1.6.0",
|
"ng2-charts": "1.6.0",
|
||||||
"ngx-monaco-editor": "7.0.0",
|
"ngx-monaco-editor": "7.0.0",
|
||||||
"pdfjs-dist": "2.0.943",
|
"pdfjs-dist": "2.0.489",
|
||||||
"raphael": "2.2.7",
|
"raphael": "2.2.7",
|
||||||
"reflect-metadata": "0.1.13",
|
"reflect-metadata": "0.1.13",
|
||||||
"remark-validate-links": "^8.0.0",
|
"remark-validate-links": "^8.0.0",
|
||||||
"rxjs": "^6.2.2",
|
"rxjs": "^6.2.2",
|
||||||
|
"snyk": "^1.250.0",
|
||||||
"systemjs": "0.19.27",
|
"systemjs": "0.19.27",
|
||||||
"web-animations-js": "2.3.1",
|
"web-animations-js": "2.3.1",
|
||||||
"zone.js": "~0.8.26",
|
"zone.js": "~0.8.26"
|
||||||
"snyk": "^1.250.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "^0.13.4",
|
"@angular-devkit/build-angular": "^0.13.4",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user