mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3974] Fix temp file upload APS (#4236)
* fix temp file upload APS * fix type
This commit is contained in:
@@ -31,7 +31,7 @@ import {
|
|||||||
AppConfigService
|
AppConfigService
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { ContentNodeDialogService } from '@alfresco/adf-content-services';
|
import { ContentNodeDialogService } from '@alfresco/adf-content-services';
|
||||||
import { Node } from '@alfresco/js-api';
|
import { Node, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||||
import { from, zip, of } from 'rxjs';
|
import { from, zip, of } from 'rxjs';
|
||||||
import { mergeMap } from 'rxjs/operators';
|
import { mergeMap } from 'rxjs/operators';
|
||||||
import { AttachFileWidgetDialogService } from './attach-file-widget-dialog.service';
|
import { AttachFileWidgetDialogService } from './attach-file-widget-dialog.service';
|
||||||
@@ -147,9 +147,9 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
|||||||
this.onFileChanged(event);
|
this.onFileChanged(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
onRemoveAttachFile(file: any) {
|
onRemoveAttachFile(file: File | RelatedContentRepresentation) {
|
||||||
if (this.isTemporaryFile(file)) {
|
if (this.isTemporaryFile(file)) {
|
||||||
this.tempFilesList.splice(this.tempFilesList.indexOf(file.contentBlob), 1);
|
this.tempFilesList.splice(this.tempFilesList.indexOf((<RelatedContentRepresentation> file).contentBlob), 1);
|
||||||
}
|
}
|
||||||
this.removeFile(file);
|
this.removeFile(file);
|
||||||
}
|
}
|
||||||
@@ -166,13 +166,13 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadContent(file: any): void {
|
downloadContent(file: any | RelatedContentRepresentation): void {
|
||||||
if (this.isTemporaryFile(file)) {
|
if (this.isTemporaryFile(file)) {
|
||||||
this.contentService.downloadBlob(file, file.name);
|
this.contentService.downloadBlob((<RelatedContentRepresentation> file).contentBlob, file.name);
|
||||||
} else {
|
} else {
|
||||||
this.processContentService.getFileRawContent(file.id).subscribe(
|
this.processContentService.getFileRawContent((<any> file).id).subscribe(
|
||||||
(blob: Blob) => {
|
(blob: Blob) => {
|
||||||
this.contentService.downloadBlob(blob, file.name);
|
this.contentService.downloadBlob(blob, (<any> file).name);
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
this.logger.error('Impossible retrieve content for download');
|
this.logger.error('Impossible retrieve content for download');
|
||||||
@@ -213,19 +213,19 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.subscribe(([mimeType, res, isExternal]) => {
|
.subscribe(([mimeType, res, isExternal]) => {
|
||||||
res.mimeType = mimeType;
|
res.mimeType = mimeType;
|
||||||
res.isExternal = isExternal;
|
res.isExternal = isExternal;
|
||||||
filesSaved.push(res);
|
filesSaved.push(res);
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
this.logger.error(error);
|
this.logger.error(error);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.field.value = filesSaved;
|
this.field.value = filesSaved;
|
||||||
this.field.json.value = filesSaved;
|
this.field.json.value = filesSaved;
|
||||||
this.hasFile = true;
|
this.hasFile = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getDomainHost(urlToCheck) {
|
private getDomainHost(urlToCheck) {
|
||||||
|
Reference in New Issue
Block a user