save dynamic form - create new form bug -> fixed

This commit is contained in:
annampak 2018-01-09 16:26:27 +02:00
parent 997d4b61da
commit 586f075d1c
4 changed files with 18 additions and 6 deletions

View File

@ -26,7 +26,7 @@
</mat-step> </mat-step>
<mat-step> <mat-step>
<ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template> <ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template>
<dynamic-form *ngIf="datasetWizardModel" [dataModel]="datasetWizardModel"></dynamic-form> <dynamic-form *ngIf="datasetWizardModel && datasetWizardModel.id" [dataModel]="datasetWizardModel"></dynamic-form>
<div> <div>
<button matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button> <button matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button>
</div> </div>

View File

@ -30,4 +30,4 @@
</mat-sidenav-content> </mat-sidenav-content>
</mat-sidenav-container> </mat-sidenav-container>
</div> </div>
<p>Form value: {{ form.value | json }}</p> <!-- <p>Form value: {{ form.value | json }}</p> -->

View File

@ -13,6 +13,9 @@ import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
import 'rxjs/add/operator/switchMap'; import 'rxjs/add/operator/switchMap';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import {MatSidenavModule} from '@angular/material/sidenav'; import {MatSidenavModule} from '@angular/material/sidenav';
import { BaseHttpService } from '@app/utilities/cite-http-service-module/base-http.service';
import { HostConfiguration } from '@app/app.constants';
import { DatasetWizardService } from '@app/services/dataset-wizard/dataset-wizard.service';
declare function simple_notifier(type: string, title: string, message: string): any; declare function simple_notifier(type: string, title: string, message: string): any;
@ -45,7 +48,9 @@ export class DynamicFormComponent implements OnInit {
constructor(private router: Router, constructor(private router: Router,
private _location: Location, private _location: Location,
private route: ActivatedRoute, private route: ActivatedRoute,
private visibilityRulesService: VisibilityRulesService private visibilityRulesService: VisibilityRulesService,
private http: BaseHttpService,
private datasetWizardService: DatasetWizardService,
) { ) {
this.datasetId = route.snapshot.params['id']; this.datasetId = route.snapshot.params['id'];
} }
@ -87,10 +92,13 @@ export class DynamicFormComponent implements OnInit {
} }
submit() { submit() {
//this.serverService.updateDataset(this.datasetId, this.form.value).subscribe()
} }
save(){
debugger; save(){
this.datasetWizardService.saveDataset(this.datasetId, this.form.value).subscribe(data => {
this.router.navigateByUrl("/datasets");
});
} }
toggleSidebar() { toggleSidebar() {

View File

@ -41,4 +41,8 @@ export class DatasetWizardService {
createDataset(datasetModel: DatasetWizardModel): Observable<DatasetWizardModel> { createDataset(datasetModel: DatasetWizardModel): Observable<DatasetWizardModel> {
return this.http.post<DatasetWizardModel>(this.actionUrl + 'createOrUpdate', datasetModel, { headers: this.headers }); return this.http.post<DatasetWizardModel>(this.actionUrl + 'createOrUpdate', datasetModel, { headers: this.headers });
} }
public saveDataset(datasetId:String, formValue){
return this.http.post(HostConfiguration.Server +'datasetprofile/save/'+datasetId, formValue, { headers: this.headers })
}
} }