argos/dmp-frontend/src/app/ui/admin/dataset-profile/admin/rule-editor-model.ts

33 lines
890 B
TypeScript
Raw Normal View History

2019-01-18 18:03:45 +01:00
import { FormGroup } from "@angular/forms";
import { Rule } from "../../../../core/model/admin/dataset-profile/dataset-profile";
import { BaseFormModel } from "../../../../core/model/base-form-model";
export class RuleEditorModel extends BaseFormModel {
2018-10-05 17:00:54 +02:00
public target: string;
public value: string;
public ruleType: string;
public ruleStyle: string;
public valueType: string;
2019-01-18 18:03:45 +01:00
fromModel(item: Rule): RuleEditorModel {
2018-10-05 17:00:54 +02:00
this.target = item.target;
this.value = item.value;
this.ruleType = item.ruleType;
this.ruleStyle = item.ruleStyle;
this.valueType = item.valueType;
return this;
}
2018-10-05 17:00:54 +02:00
buildForm(): FormGroup {
const formGroup = this.formBuilder.group({
2019-01-18 18:03:45 +01:00
// sourceField: [this.sourceField],
2018-10-05 17:00:54 +02:00
target: [this.target],
ruleStyle: [this.ruleStyle],
value: [this.value],
ruleType: [this.ruleType],
valueType: [this.valueType]
});
return formGroup;
}
}