save()

in ui/angular/src/app/measure/create-measure/pub/pub.component.ts [144:172]


  save() {
    var measure2Save = {
      name: this.newMeasure.name,
      "metric.name": this.newMeasure.metricName,
      "measure.type": this.newMeasure.measureType,
      description: this.newMeasure.description,
      "dq.type": this.newMeasure.dqType.toUpperCase(),
      owner: this.newMeasure.owner
    }
    console.log(measure2Save);
    var addModels = this.serviceService.config.uri.addModels;
    $("#save").attr("disabled", "true");
    this.http.post(addModels, measure2Save).subscribe(
      data => {
        this.createResult = data;
        this.hide();
        this.router.navigate(["/measures"]);
      },
      err => {
        let response = JSON.parse(err.error);
        if (response.code === '40901') {
          this.toasterService.pop("error", "Error!", "Measure name already exists!");
        } else {
          this.toasterService.pop("error", "Error!", "Error when creating measure");
        }
        console.log("Error when creating measure");
      }
    );
  }