mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-2055] Ability to pre-populate form with a file and values (#2834)
* fix translations form * fix style webpack script * fix tslint error problem in viewer * fix naming problems in attach file widget * add start process form values data initialization option * fix translation problems * missing return type * start process name configuration * add CS cross PS configuration * start process from file example * fix minor issues * add documentation and move the dialog in a separate component * easy test select app * alfrescoRepositoryName right property * file conversion test * fix issue after CR * Remove forgotten semicolon.
This commit is contained in:
@@ -40,11 +40,9 @@ import { Observable } from 'rxjs/Observable';
|
||||
})
|
||||
export class AttachFileWidgetComponent extends UploadWidgetComponent implements OnInit {
|
||||
|
||||
alfrescoLogoUrl: string = '../assets/images/alfresco-flower.svg';
|
||||
repositoryList = [];
|
||||
|
||||
constructor(
|
||||
public formService: FormService,
|
||||
constructor(public formService: FormService,
|
||||
private logger: LogService,
|
||||
public thumbnails: ThumbnailService,
|
||||
public processContentService: ProcessContentService,
|
||||
@@ -69,36 +67,36 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
||||
return !!this.field.params && !!this.field.params.fileSource;
|
||||
}
|
||||
|
||||
isMultipleSourceUpload() {
|
||||
isMultipleSourceUpload(): boolean {
|
||||
return !this.field.readOnly && this.isFileSourceConfigured() && !this.isOnlyLocalSourceSelected();
|
||||
}
|
||||
|
||||
isAllFileSourceSelected() {
|
||||
isAllFileSourceSelected(): boolean {
|
||||
return this.field.params &&
|
||||
this.field.params.fileSource &&
|
||||
this.field.params.fileSource.serviceId === 'all-file-sources';
|
||||
}
|
||||
|
||||
isOnlyLocalSourceSelected() {
|
||||
isOnlyLocalSourceSelected(): boolean {
|
||||
return this.field.params &&
|
||||
this.field.params.fileSource &&
|
||||
this.field.params.fileSource.serviceId === 'local-file';
|
||||
}
|
||||
|
||||
isSimpleUploadButton() {
|
||||
isSimpleUploadButton(): boolean {
|
||||
return this.isUploadButtonVisible() &&
|
||||
!this.isFileSourceConfigured() ||
|
||||
this.isOnlyLocalSourceSelected();
|
||||
!this.isFileSourceConfigured() ||
|
||||
this.isOnlyLocalSourceSelected();
|
||||
}
|
||||
|
||||
isUploadButtonVisible() {
|
||||
isUploadButtonVisible(): boolean {
|
||||
return (!this.hasFile || this.multipleOption) && !this.field.readOnly;
|
||||
}
|
||||
|
||||
isDefinedSourceFolder() {
|
||||
isDefinedSourceFolder(): boolean {
|
||||
return !!this.field.params &&
|
||||
!!this.field.params.fileSource &&
|
||||
!!this.field.params.fileSource.selectedFolder;
|
||||
!!this.field.params.fileSource &&
|
||||
!!this.field.params.fileSource.selectedFolder;
|
||||
}
|
||||
|
||||
openSelectDialogFromFileSource() {
|
||||
@@ -106,7 +104,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
||||
if (this.isDefinedSourceFolder()) {
|
||||
this.contentDialog.openFileBrowseDialogByFolderId(params.fileSource.selectedFolder.pathId).subscribe(
|
||||
(selections: MinimalNodeEntryEntity[]) => {
|
||||
this.uploadFileFromShare(selections,
|
||||
this.uploadFileFromCS(selections,
|
||||
this.field.params.fileSource.selectedFolder.accountId,
|
||||
this.field.params.fileSource.selectedFolder.siteId);
|
||||
});
|
||||
@@ -117,11 +115,11 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
||||
const accountIdentifier = 'alfresco-' + repoId + repoName;
|
||||
this.contentDialog.openFileBrowseDialogBySite().subscribe(
|
||||
(selections: MinimalNodeEntryEntity[]) => {
|
||||
this.uploadFileFromShare(selections, accountIdentifier);
|
||||
this.uploadFileFromCS(selections, accountIdentifier);
|
||||
});
|
||||
}
|
||||
|
||||
private uploadFileFromShare(fileNodeList: MinimalNodeEntryEntity[], accountId: string, siteId?: string) {
|
||||
private uploadFileFromCS(fileNodeList: MinimalNodeEntryEntity[], accountId: string, siteId?: string) {
|
||||
let filesSaved = [];
|
||||
Observable.from(fileNodeList)
|
||||
.mergeMap(node =>
|
||||
@@ -131,7 +129,9 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
||||
).subscribe((res) => {
|
||||
filesSaved.push(res);
|
||||
},
|
||||
(error) => { this.logger.error(error); },
|
||||
(error) => {
|
||||
this.logger.error(error);
|
||||
},
|
||||
() => {
|
||||
this.field.value = filesSaved;
|
||||
this.field.json.value = filesSaved;
|
||||
|
Reference in New Issue
Block a user