no message

This commit is contained in:
annampak 2018-01-25 17:26:08 +02:00
parent 5ef8689e54
commit ae847c2db2
1 changed files with 29 additions and 1 deletions

View File

@ -15,11 +15,11 @@ import { DataManagementPlanModel } from "../models/data-managemnt-plans/DataMana
import { JsonSerializer } from "../utilities/JsonSerializer";
import { Observable } from "rxjs/Observable";
import { RequestItem } from "../models/criteria/RequestItem";
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component";
import { DatasetProfileModel } from '../models/datasetprofile/DatasetProfileModel';
import { ExternalSourcesItemModel } from '../models/external-sources/ExternalSourcesItemModel';
import { ExternalSourcesService } from '../services/external-sources/external-sources.service';
import { MatPaginator, MatSort, MatSnackBar, MatStepper } from "@angular/material";
@Component({
selector: 'app-dataset-wizard-component',
@ -29,12 +29,14 @@ import { ExternalSourcesService } from '../services/external-sources/external-so
encapsulation: ViewEncapsulation.None
})
export class DatasetWizardComponent {
@ViewChild('stepper') stepper: MatStepper;
//dmpAutoCompleteConfiguration: AutoCompleteConfiguration;
//datasetProfileAutoCompleteConfiguration: AutoCompleteConfiguration;
datasetWizardModel: DatasetWizardModel;
isNew = true;
formGroup: FormGroup;
form: FormGroup;
availableProfiles: DatasetProfileModel[] = [];
@ -101,6 +103,14 @@ export class DatasetWizardComponent {
}
ngAfterViewInit() {
this.route.params.subscribe((params: Params) => {
let itemId = params['id'];
if(itemId !=null) this.stepper.selectedIndex = 2;
})
}
loadDatasetProfiles() {
let datasetProfileRequestItem: RequestItem<DatasetProfileCriteria> = new RequestItem();
datasetProfileRequestItem.criteria = new DatasetProfileCriteria();
@ -117,6 +127,7 @@ export class DatasetWizardComponent {
getDefinition() {
this.datasetWizardService.getDefinition(this.datasetWizardModel.profile.id).subscribe(item => {
this.datasetWizardModel.datasetProfileDefinition = item;
this.form = this.datasetWizardModel.datasetProfileDefinition.buildForm();
})
}
@ -144,6 +155,23 @@ export class DatasetWizardComponent {
);
}
submit() {
this.datasetWizardService.saveDataset(this.datasetWizardModel, this.formGroup.value).subscribe(data => {
this.router.navigateByUrl("/datasets/" + this.datasetWizardModel.dmp.id);
});
}
save() {
this.datasetWizardModel.status = "0";
this.submit();
}
saveFinalize() {
this.datasetWizardModel.status = "1";
this.submit();
}
onCallbackSuccess(): void {
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
data: { message: this.isNew ? 'GENERAL.SNACK-BAR.SUCCESSFUL-CREATION' : 'GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE', language: this.language },