Fixed the dmp delete function

This commit is contained in:
Diamantis Tziotzios 2019-01-29 09:56:46 +02:00
parent 7a60c3a435
commit e10179d042
1 changed files with 33 additions and 34 deletions

View File

@ -25,6 +25,7 @@ import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCru
import { DatasetDescriptionFormEditorModel } from '../../misc/dataset-description-form/dataset-description-form.model';
import { DatasetWizardEditorModel } from './dataset-wizard-editor.model';
import { SnackBarNotificationLevel, UiNotificationService } from '../../../core/services/notification/ui-notification-service';
import { ConfirmationDialogComponent } from '../../../library/confirmation-dialog/confirmation-dialog.component';
@Component({
selector: 'app-dataset-wizard-component',
@ -194,11 +195,11 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, Aft
.pipe(takeUntil(this._destroyed))
.subscribe(x => {
if (x) { this.loadDatasetProfiles(); }
else{
this.availableProfiles=[];
else {
this.availableProfiles = [];
this.formGroup.get('profile').reset();
}
});
}
}
@ -263,17 +264,17 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, Aft
this.datasetWizardService.createDataset(this.formGroup.value)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => {
this.datasetWizardService.getSingle(complete.id)
.pipe(takeUntil(this._destroyed))
.subscribe(
result => {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(result);
}
);
this.onCallbackSuccess();
},
error => this.onCallbackError(error)
complete => {
this.datasetWizardService.getSingle(complete.id)
.pipe(takeUntil(this._destroyed))
.subscribe(
result => {
this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(result);
}
);
this.onCallbackSuccess();
},
error => this.onCallbackError(error)
);
}
@ -389,25 +390,23 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, Aft
}
openConfirm(dmpLabel, id): void {
// this._dialogService.openConfirm({
// message: 'Are you sure you want to delete the "' + dmpLabel + '"',
// disableClose: true || false,
// viewContainerRef: this._viewContainerRef,
// title: 'Confirm',
// cancelButton: 'No',
// acceptButton: 'Yes'
// }).afterClosed()
// .pipe(takeUntil(this._destroyed))
// .subscribe((accept: boolean) => {
// if (accept) {
// this.datasetWizardService.delete(id)
// .pipe(takeUntil(this._destroyed))
// .subscribe(() => {
// this.router.navigate(['/datasets']);
// });
// } else {
// // DO SOMETHING ELSE
// }
// });
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CONFIRM'),
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL')
}
});
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) {
this.datasetWizardService.delete(id)
.pipe(takeUntil(this._destroyed))
.subscribe(
complete => { this.onCallbackSuccess() },
error => this.onCallbackError(error)
);
}
});
}
}