in ui/angular/src/app/measure/create-measure/ac/ac.component.ts [367:495]
submit(form) {
// form.$setPristine();
// this.finalgrp = [];
if (!form.valid) {
this.toasterService.pop(
"error",
"Error!",
"please complete the form in this step before proceeding"
);
return false;
}
// for(let i=0;i<this.grp.length;i++){
// this.finalgrp.push(this.grp[i].value);
// }
// this.showgrp = this.finalgrp.join(",");
var rule = "";
this.newMeasure = {
name: this.name,
"measure.type": "griffin",
"dq.type": "ACCURACY",
"process.type": "BATCH",
owner: this.owner,
description: this.desc,
// "group":this.finalgrp,
"data.sources": [
{
name: "source",
connector:
{
name: this.src_name,
type: "HIVE",
version: "1.2",
"data.unit": this.src_size,
"data.time.zone": this.src_timezone,
config: {
database: this.currentDB,
"table.name": this.currentTable,
where: this.src_where
},
predicates: [
{
type: "file.exist",
config: {
"root.path": this.src_location,
path: this.src_path
}
}
]
}
},
{
name: "target",
connector:
{
name: this.tgt_name,
type: "HIVE",
version: "1.2",
"data.unit": this.tgt_size,
"data.time.zone": this.tgt_timezone,
config: {
database: this.currentDBTarget,
"table.name": this.currentTableTarget,
where: this.tgt_where
},
predicates: [
{
type: "file.exist",
config: {
"root.path": this.tgt_location,
path: this.tgt_path
}
}
]
}
}
],
"evaluate.rule": {
rules: [
{
"dsl.type": "griffin-dsl",
"dq.type": "ACCURACY",
"out.dataframe.name": "accuracy",
rule: ""
// "details": {
// "source": "source",
// "target": "target",
// "miss.records": {
// "name": "miss.records",
// "persist.type": "record"
// },
// "accuracy": {
// "name": "accu",
// "persist.type": "metric"
// },
// "miss": "miss",
// "total": "total",
// "matched": "matched"
// }
}
]
}
};
if (this.src_size.indexOf("0") == 0) {
this.deleteUnit(0);
}
if (this.tgt_size.indexOf("0") == 0) {
this.deleteUnit(1);
}
if (!this.src_needpath || this.src_path == "") {
this.deletePredicates(0);
}
if (!this.tgt_needpath || this.tgt_path == "") {
this.deletePredicates(1);
}
var mappingRule = function (src, tgt, matches) {
var rules;
rules = "source." + src + matches + "target." + tgt;
return rules;
};
var self = this;
var rules = this.mappings.map(function (item, i) {
return mappingRule(item, self.selectionTarget[i], self.matches[i]);
});
rule = rules.join(" AND ");
this.rules = rule;
this.newMeasure["evaluate.rule"].rules[0].rule = rule;
this.visible = true;
setTimeout(() => (this.visibleAnimate = true), 100);
}