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 = [
|
const routes: Routes = [
|
||||||
{ path: '', component: DashboardComponent },
|
{ path: '', component: DashboardComponent },
|
||||||
{ path: 'create-add', component: QuickWizardCreateAdd }
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|
|
@ -1,25 +1,29 @@
|
||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||||
import { MatStepper } from '@angular/material';
|
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 { BaseComponent } from '../../core/common/base/base.component';
|
||||||
import { QuickWizardService } from '../../core/services/quick-wizard/quick-wizard.service';
|
import { QuickWizardService } from '../../core/services/quick-wizard/quick-wizard.service';
|
||||||
import { DatasetCreateWizardModel } from './dataset-create-wizard.model';
|
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({
|
@Component({
|
||||||
selector: 'dataset-create-wizard.component',
|
selector: 'dataset-create-wizard.component',
|
||||||
templateUrl: 'dataset-create-wizard.component.html',
|
templateUrl: 'dataset-create-wizard.component.html',
|
||||||
styleUrls: ['./dataset-create-wizard.component.scss'],
|
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;
|
isLinear = false;
|
||||||
formGroup: FormGroup;
|
formGroup: FormGroup;
|
||||||
router: Router;
|
|
||||||
|
|
||||||
datasetCreateWizardModel: DatasetCreateWizardModel;
|
datasetCreateWizardModel: DatasetCreateWizardModel;
|
||||||
@ViewChild('stepper') stepper: MatStepper;
|
@ViewChild('stepper') stepper: MatStepper;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private router: Router,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
public quickWizardService: QuickWizardService,
|
public quickWizardService: QuickWizardService,
|
||||||
) {
|
) {
|
||||||
|
@ -29,6 +33,13 @@ export class DatasetCreateWizard extends BaseComponent implements OnInit {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.datasetCreateWizardModel = new DatasetCreateWizardModel();
|
this.datasetCreateWizardModel = new DatasetCreateWizardModel();
|
||||||
this.formGroup = this.datasetCreateWizardModel.buildForm();
|
this.formGroup = this.datasetCreateWizardModel.buildForm();
|
||||||
|
this.breadCrumbs = Observable.of([
|
||||||
|
{
|
||||||
|
parentComponentName: 'Dashboard',
|
||||||
|
label: 'Quick Add Dataset',
|
||||||
|
url: '/datasetcreatewizard'
|
||||||
|
}]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
|
@ -38,7 +49,7 @@ export class DatasetCreateWizard extends BaseComponent implements OnInit {
|
||||||
submit() {
|
submit() {
|
||||||
this.quickWizardService.createQuickDatasetWizard(this.formGroup.value)
|
this.quickWizardService.createQuickDatasetWizard(this.formGroup.value)
|
||||||
.subscribe(data => {
|
.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([
|
this.breadCrumbs = Observable.of([
|
||||||
{
|
{
|
||||||
parentComponentName: 'Dashboard',
|
parentComponentName: 'Dashboard',
|
||||||
label: 'QuickCreate',
|
label: 'Quick Create DMP',
|
||||||
url: '/quick-wizard'
|
url: '/quick-wizard'
|
||||||
}]
|
}]
|
||||||
);
|
);
|
||||||
|
@ -112,7 +112,7 @@ export class QuickWizardEditorComponent extends BaseComponent implements OnInit,
|
||||||
|
|
||||||
onCallbackSuccess(): void {
|
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.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) {
|
onCallbackError(errorResponse: any) {
|
||||||
|
|
Loading…
Reference in New Issue