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 });
|
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();
|
const params = new BaseHttpParams();
|
||||||
params.interceptorContext = {
|
params.interceptorContext = {
|
||||||
excludedInterceptors: [InterceptorType.JSONContentType]
|
excludedInterceptors: [InterceptorType.JSONContentType]
|
||||||
};
|
};
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', file[0], labelSent);
|
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[]> {
|
searchSchematics(like: string): Observable<String[]> {
|
||||||
|
|
|
@ -60,6 +60,9 @@
|
||||||
<button mat-menu-item (click)="newVersion(row.id, row.label)">
|
<button mat-menu-item (click)="newVersion(row.id, row.label)">
|
||||||
<mat-icon>queue</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.NEW-VERSION' | translate}}
|
<mat-icon>queue</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.NEW-VERSION' | translate}}
|
||||||
</button>
|
</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)">
|
<button mat-menu-item (click)="clone(row.id)">
|
||||||
<mat-icon>filter_none</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.CLONE' | translate}}
|
<mat-icon>filter_none</mat-icon>{{'DATASET-PROFILE-LISTING.ACTIONS.CLONE' | translate}}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -123,6 +123,35 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
|
||||||
this.router.navigate(['dataset-profiles/newversion/' + id]);
|
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) {
|
viewVersions(rowId, rowLabel) {
|
||||||
this.router.navigate(['/dataset-profiles/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
|
this.router.navigate(['/dataset-profiles/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
|
||||||
}
|
}
|
||||||
|
|
|
@ -765,6 +765,12 @@
|
||||||
"UPLOAD-XML-IMPORT": "File",
|
"UPLOAD-XML-IMPORT": "File",
|
||||||
"UPLOAD-XML-FILE-CANCEL": "Cancel"
|
"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": {
|
"DIALOGUE": {
|
||||||
"TITLE": "Copy Dataset to DMP",
|
"TITLE": "Copy Dataset to DMP",
|
||||||
"DMP-SEARCH": {
|
"DMP-SEARCH": {
|
||||||
|
@ -930,6 +936,7 @@
|
||||||
"VIEW": "View",
|
"VIEW": "View",
|
||||||
"CLONE": "Clone",
|
"CLONE": "Clone",
|
||||||
"NEW-VERSION": "New Version",
|
"NEW-VERSION": "New Version",
|
||||||
|
"NEW-VERSION-FROM-FILE": "New Version from File",
|
||||||
"VIEW-VERSIONS": "All Dataset Template Versions",
|
"VIEW-VERSIONS": "All Dataset Template Versions",
|
||||||
"DELETE": "Delete",
|
"DELETE": "Delete",
|
||||||
"CREATE-DATASET-TEMPLATE": "Create Dataset Template"
|
"CREATE-DATASET-TEMPLATE": "Create Dataset Template"
|
||||||
|
|
Loading…
Reference in New Issue