Adds success message on Dataset Create Wizard.
This commit is contained in:
parent
eebe0886c4
commit
fb70345d39
|
@ -7,7 +7,10 @@ import { QuickWizardService } from '../../core/services/quick-wizard/quick-wizar
|
||||||
import { DatasetCreateWizardModel } from './dataset-create-wizard.model';
|
import { DatasetCreateWizardModel } from './dataset-create-wizard.model';
|
||||||
import { IBreadCrumbComponent } from '../misc/breadcrumb/definition/IBreadCrumbComponent';
|
import { IBreadCrumbComponent } from '../misc/breadcrumb/definition/IBreadCrumbComponent';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { BreadcrumbItem } from '../misc/breadcrumb/definition/breadcrumb-item';
|
import { BreadcrumbItem } from '../misc/breadcrumb/definition/breadcrumb-item';
|
||||||
|
import { SnackBarNotificationLevel, UiNotificationService } from '../../core/services/notification/ui-notification-service';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dataset-create-wizard.component',
|
selector: 'dataset-create-wizard.component',
|
||||||
|
@ -17,6 +20,7 @@ import { BreadcrumbItem } from '../misc/breadcrumb/definition/breadcrumb-item';
|
||||||
export class DatasetCreateWizard extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
export class DatasetCreateWizard extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
||||||
breadCrumbs: Observable<BreadcrumbItem[]>;
|
breadCrumbs: Observable<BreadcrumbItem[]>;
|
||||||
isLinear = false;
|
isLinear = false;
|
||||||
|
isNew = true;
|
||||||
formGroup: FormGroup;
|
formGroup: FormGroup;
|
||||||
|
|
||||||
datasetCreateWizardModel: DatasetCreateWizardModel;
|
datasetCreateWizardModel: DatasetCreateWizardModel;
|
||||||
|
@ -26,6 +30,8 @@ export class DatasetCreateWizard extends BaseComponent implements OnInit, IBread
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
public quickWizardService: QuickWizardService,
|
public quickWizardService: QuickWizardService,
|
||||||
|
public language: TranslateService,
|
||||||
|
private uiNotificationService: UiNotificationService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -34,12 +40,12 @@ export class DatasetCreateWizard extends BaseComponent implements OnInit, IBread
|
||||||
this.datasetCreateWizardModel = new DatasetCreateWizardModel();
|
this.datasetCreateWizardModel = new DatasetCreateWizardModel();
|
||||||
this.formGroup = this.datasetCreateWizardModel.buildForm();
|
this.formGroup = this.datasetCreateWizardModel.buildForm();
|
||||||
this.breadCrumbs = Observable.of([
|
this.breadCrumbs = Observable.of([
|
||||||
{
|
{
|
||||||
parentComponentName: 'Dashboard',
|
parentComponentName: 'Dashboard',
|
||||||
label: 'Dataset description wizard',
|
label: 'Dataset description wizard',
|
||||||
url: '/datasetcreatewizard'
|
url: '/datasetcreatewizard'
|
||||||
}]
|
}]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
|
@ -48,17 +54,23 @@ export class DatasetCreateWizard extends BaseComponent implements OnInit, IBread
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
this.quickWizardService.createQuickDatasetWizard(this.formGroup.value)
|
this.quickWizardService.createQuickDatasetWizard(this.formGroup.value)
|
||||||
.subscribe(data => {
|
.pipe(takeUntil(this._destroyed))
|
||||||
this.router.navigateByUrl('/home');
|
.subscribe(
|
||||||
})
|
complete => this.onCallbackSuccess()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
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']);
|
||||||
}
|
}
|
||||||
|
|
||||||
isActive(step: string): boolean {
|
isActive(step: string): boolean {
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case 'step1':
|
case 'step1':
|
||||||
return this.stepper.selectedIndex==0;
|
return this.stepper.selectedIndex == 0;
|
||||||
case 'step2':
|
case 'step2':
|
||||||
return this.stepper.selectedIndex==1;
|
return this.stepper.selectedIndex == 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue