upload new version for dataset template from xml file
This commit is contained in:
parent
63c866d74f
commit
f822e06881
|
@ -65,14 +65,17 @@ export class DatasetProfileService extends BaseService {
|
|||
return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response', headers: headerXml });
|
||||
}
|
||||
|
||||
uploadFile(file: FileList, labelSent: string): Observable<DataTableData<DatasetListingModel>> {
|
||||
uploadFile(file: FileList, labelSent: string, datasetProfileId?: string): Observable<DataTableData<DatasetListingModel>> {
|
||||
const params = new BaseHttpParams();
|
||||
params.interceptorContext = {
|
||||
excludedInterceptors: [InterceptorType.JSONContentType]
|
||||
};
|
||||
const formData = new FormData();
|
||||
formData.append('file', file[0], labelSent);
|
||||
return this.http.post(this.actionUrl + "upload", formData, { params: params });
|
||||
return (datasetProfileId === undefined || datasetProfileId == null)
|
||||
? this.http.post(this.actionUrl + "upload", formData, { params: params })
|
||||
: this.http.post(this.actionUrl + "upload/" + datasetProfileId, formData, { params: params });
|
||||
|
||||
}
|
||||
|
||||
searchSchematics(like: string): Observable<String[]> {
|
||||
|
|
|
@ -60,6 +60,9 @@
|
|||
<button mat-menu-item (click)="newVersion(row.id, row.label)">
|
||||
<mat-icon>queue</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.NEW-VERSION' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item (click)="newVersionFromFile(row.id, row.label)">
|
||||
<mat-icon>file_copy</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.NEW-VERSION-FROM-FILE' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item (click)="clone(row.id)">
|
||||
<mat-icon>filter_none</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.CLONE' | translate}}
|
||||
</button>
|
||||
|
|
|
@ -123,6 +123,35 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
|
|||
this.router.navigate(['dataset-profiles/newversion/' + id]);
|
||||
}
|
||||
|
||||
newVersionFromFile(id: string, label: string): void {
|
||||
const dialogRef = this.dialog.open(DialogConfirmationUploadDatasetProfiles, {
|
||||
width: '500px',
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
message: this.language.instant('DATASET-WIZARD.NEW-VERSION-FROM-FILE.NEW-VERSION-XML-FILE-TITLE', {datasetName: label}),
|
||||
confirmButton: this.language.instant('DATASET-WIZARD.NEW-VERSION-FROM-FILE.NEW-VERSION-XML'),
|
||||
cancelButton: this.language.instant('DATASET-WIZARD.NEW-VERSION-FROM-FILE.NEW-VERSION-XML-FILE-CANCEL'),
|
||||
name: "",
|
||||
file: FileList,
|
||||
sucsess: false
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(data => {
|
||||
if (data && data.sucsess && data.name != null && data.file != null) {
|
||||
this.datasetService.uploadFile(data.file, data.name, id)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(_=>{
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-WIZARD.NEW-VERSION-FROM-FILE.NEW-VERSION-XML-SUCCESSFUL'), SnackBarNotificationLevel.Success);
|
||||
this.refresh();
|
||||
},
|
||||
error=>{
|
||||
this.uiNotificationService.snackBarNotification(error.message, SnackBarNotificationLevel.Error);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
viewVersions(rowId, rowLabel) {
|
||||
this.router.navigate(['/dataset-profiles/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
|
||||
}
|
||||
|
|
|
@ -765,6 +765,12 @@
|
|||
"UPLOAD-XML-IMPORT": "File",
|
||||
"UPLOAD-XML-FILE-CANCEL": "Cancel"
|
||||
},
|
||||
"NEW-VERSION-FROM-FILE": {
|
||||
"NEW-VERSION-XML": "Import",
|
||||
"NEW-VERSION-XML-FILE-TITLE": "New Version from File for {{datasetName}}",
|
||||
"NEW-VERSION-XML-FILE-CANCEL": "Cancel",
|
||||
"NEW-VERSION-XML-SUCCESSFUL": "New Version successfully uploaded"
|
||||
},
|
||||
"DIALOGUE": {
|
||||
"TITLE": "Copy Dataset to DMP",
|
||||
"DMP-SEARCH": {
|
||||
|
@ -930,6 +936,7 @@
|
|||
"VIEW": "View",
|
||||
"CLONE": "Clone",
|
||||
"NEW-VERSION": "New Version",
|
||||
"NEW-VERSION-FROM-FILE": "New Version from File",
|
||||
"VIEW-VERSIONS": "All Dataset Template Versions",
|
||||
"DELETE": "Delete",
|
||||
"CREATE-DATASET-TEMPLATE": "Create Dataset Template"
|
||||
|
|
Loading…
Reference in New Issue