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