mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +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:
committed by
Eugenio Romano
parent
c61de922af
commit
e806e97c75
@@ -134,8 +134,8 @@ describe('UploadWidgetComponent', () => {
|
||||
});
|
||||
|
||||
uploadWidgetComponent.removeFile(uploadWidgetComponent.field.value[0]);
|
||||
expect(uploadWidgetComponent.field.value.length).toBe(0);
|
||||
expect(uploadWidgetComponent.field.json.value.length).toBe(0);
|
||||
expect(uploadWidgetComponent.field.value).toBeNull();
|
||||
expect(uploadWidgetComponent.field.json.value).toBeNull();
|
||||
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);
|
||||
|
||||
if (index !== -1) {
|
||||
@@ -119,17 +119,13 @@ export class UploadWidgetComponent extends WidgetComponent implements OnInit {
|
||||
|
||||
this.hasFile = this.field.value.length > 0;
|
||||
|
||||
this.resetFormValueWithNoFiles();
|
||||
}
|
||||
|
||||
private resetFormValueWithNoFiles() {
|
||||
if (this.field.value.length === 0) {
|
||||
this.field.value = [];
|
||||
this.field.json.value = [];
|
||||
if (!this.hasFile) {
|
||||
this.field.value = null;
|
||||
this.field.json.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
getIcon(mimeType) {
|
||||
getIcon(mimeType: string): string {
|
||||
return this.thumbnailService.getMimeTypeIcon(mimeType);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user