Skip to content
Snippets Groups Projects
Verified Commit f5a58633 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #11954 TIME 0:30 fix check convert + appdiffusionlist undefined + unload...

FEAT #11954 TIME 0:30 fix check convert + appdiffusionlist undefined + unload file if cancel file upload under chrome
parent e9e11c1f
No related branches found
No related tags found
No related merge requests found
......@@ -340,7 +340,7 @@ export class IndexingFormComponent implements OnInit {
let title = '';
let defaultVal = data.entities.filter((entity: any) => entity.enabled === true && entity.id === elem.default_value);
elem.default_value = defaultVal.length > 0 ? defaultVal[0].id : '';
elem.default_value = defaultVal.length > 0 ? defaultVal[0].id : null;
this.arrFormControl[elem.identifier].setValue(defaultVal.length > 0 ? defaultVal[0].id : '');
elem.values = data.entities.map((entity: any) => {
title = entity.entity_label;
......
......@@ -58,6 +58,7 @@ export class DocumentViewerComponent implements OnInit {
return {
extension: '.' + ext.extension.toLowerCase(),
mimeType: ext.mimeType,
canConvert: ext.canConvert
}
});
this.allowedExtensions = this.sortPipe.transform(this.allowedExtensions, 'extension');
......@@ -72,16 +73,16 @@ export class DocumentViewerComponent implements OnInit {
}
uploadTrigger(fileInput: any) {
this.file = {
name: '',
type: '',
content: null,
src: null
};
this.noConvertedFound = false;
this.loading = true;
if (fileInput.target.files && fileInput.target.files[0] && this.checkFile(fileInput.target.files[0])) {
this.file = {
name: '',
type: '',
content: null,
src: null
};
this.noConvertedFound = false;
this.loading = true;
var reader = new FileReader();
this.file.name = fileInput.target.files[0].name;
......@@ -124,17 +125,23 @@ export class DocumentViewerComponent implements OnInit {
}
convertDocument(file: any) {
this.http.post('../../rest/convertedFile', { name: file.name, base64: file.content }).pipe(
tap((data: any) => {
this.file.src = this.base64ToArrayBuffer(data.encodedResource);
}),
finalize(() => this.loading = false),
catchError((err: any) => {
this.noConvertedFound = true;
//this.notify.handleErrors(err);
return of(false);
})
).subscribe();
if (this.allowedExtensions.filter(ext => ext.canConvert === true && ext.mimeType === file.type).length > 0) {
this.http.post('../../rest/convertedFile', { name: file.name, base64: file.content }).pipe(
tap((data: any) => {
this.file.src = this.base64ToArrayBuffer(data.encodedResource);
}),
finalize(() => this.loading = false),
catchError((err: any) => {
this.noConvertedFound = true;
//this.notify.handleErrors(err);
return of(false);
})
).subscribe();
} else {
this.noConvertedFound = true;
this.loading = false
}
}
onError(error: any) {
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment