Fixes bug with quick wizard navigation after save
This commit is contained in:
parent
9a14a73b86
commit
3a3bea121e
|
@ -5,7 +5,6 @@ import { QuickWizardCreateAdd } from './quick-wizard-create-add/quick-wizard-cre
|
|||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: DashboardComponent },
|
||||
{ path: 'create-add', component: QuickWizardCreateAdd }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
|
|
@ -1,25 +1,29 @@
|
|||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { MatStepper } from '@angular/material';
|
||||
import { Router } from '@angular/router/src/router';
|
||||
import { Router } from '@angular/router';
|
||||
import { BaseComponent } from '../../core/common/base/base.component';
|
||||
import { QuickWizardService } from '../../core/services/quick-wizard/quick-wizard.service';
|
||||
import { DatasetCreateWizardModel } from './dataset-create-wizard.model';
|
||||
import { IBreadCrumbComponent } from '../misc/breadcrumb/definition/IBreadCrumbComponent';
|
||||
import { Observable } from 'rxjs';
|
||||
import { BreadcrumbItem } from '../misc/breadcrumb/definition/breadcrumb-item';
|
||||
|
||||
@Component({
|
||||
selector: 'dataset-create-wizard.component',
|
||||
templateUrl: 'dataset-create-wizard.component.html',
|
||||
styleUrls: ['./dataset-create-wizard.component.scss'],
|
||||
})
|
||||
export class DatasetCreateWizard extends BaseComponent implements OnInit {
|
||||
export class DatasetCreateWizard extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
||||
isLinear = false;
|
||||
formGroup: FormGroup;
|
||||
router: Router;
|
||||
|
||||
datasetCreateWizardModel: DatasetCreateWizardModel;
|
||||
@ViewChild('stepper') stepper: MatStepper;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private formBuilder: FormBuilder,
|
||||
public quickWizardService: QuickWizardService,
|
||||
) {
|
||||
|
@ -29,6 +33,13 @@ export class DatasetCreateWizard extends BaseComponent implements OnInit {
|
|||
ngOnInit() {
|
||||
this.datasetCreateWizardModel = new DatasetCreateWizardModel();
|
||||
this.formGroup = this.datasetCreateWizardModel.buildForm();
|
||||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: 'Dashboard',
|
||||
label: 'Quick Add Dataset',
|
||||
url: '/datasetcreatewizard'
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
||||
save() {
|
||||
|
@ -38,7 +49,7 @@ export class DatasetCreateWizard extends BaseComponent implements OnInit {
|
|||
submit() {
|
||||
this.quickWizardService.createQuickDatasetWizard(this.formGroup.value)
|
||||
.subscribe(data => {
|
||||
this.router.navigateByUrl('/create-add');
|
||||
this.router.navigateByUrl('/home');
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
|||
this.breadCrumbs = Observable.of([
|
||||
{
|
||||
parentComponentName: 'Dashboard',
|
||||
label: 'QuickCreate',
|
||||
label: 'Quick Create DMP',
|
||||
url: '/quick-wizard'
|
||||
}]
|
||||
);
|
||||
|
@ -112,7 +112,7 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
|||
|
||||
onCallbackSuccess(): void {
|
||||
this.uiNotificationService.snackBarNotification(this.isNew ? this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-CREATION') : this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.router.navigate(['/home/create-add']);
|
||||
this.router.navigate(['/home']);
|
||||
}
|
||||
|
||||
onCallbackError(errorResponse: any) {
|
||||
|
|
Loading…
Reference in New Issue