#4 -- Add parsing rule with consequent
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 58s
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 58s
This commit is contained in:
parent
984a719cbf
commit
40246d913b
@ -89,12 +89,25 @@ function createRule() {
|
||||
let inpVal = $('.selectpicker.inputVal').children(':selected').map(function () {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
let out = $('.selectpicker.outVar').children(':selected').map(function () {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
let outVal = $('.selectpicker.outVal').children(':selected').map(function () {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
for (let i = 0; i < inp.length; i++) {
|
||||
if (i > 0) {
|
||||
ruleString += ' and ';
|
||||
}
|
||||
ruleString += inp[i] + " is " + inpVal[i];
|
||||
}
|
||||
ruleString += " then ";
|
||||
for (let i = 0; i < out.length; i++) {
|
||||
if (i > 0) {
|
||||
ruleString += ' and ';
|
||||
}
|
||||
ruleString += out[i] + " is " + outVal[i];
|
||||
}
|
||||
$('#ruleContent').val(ruleString);
|
||||
}
|
||||
|
||||
@ -149,14 +162,14 @@ function fuzzyTermsValueChanged() {
|
||||
createRule();
|
||||
}
|
||||
|
||||
function createVariableSelect(projectId, variableVal) {
|
||||
let variablesElement = $("<select class='selectpicker inputVar m-2' data-live-search='true data-width='70%'></select>");
|
||||
function createVariableSelect(cls, projectId, variableVal) {
|
||||
let variablesElement = $("<select class='selectpicker " + cls + " m-2' data-live-search='true data-width='70%'></select>");
|
||||
fillVariables(projectId, variablesElement, variableVal);
|
||||
return variablesElement;
|
||||
}
|
||||
|
||||
function createFuzzyTermsSelect(variablesElement, termVal) {
|
||||
let fuzzyTermsElement = $("<select class='selectpicker inputVal m-2' data-live-search='true data-width='70%'></select>");
|
||||
function createFuzzyTermsSelect(cls, variablesElement, termVal) {
|
||||
let fuzzyTermsElement = $("<select class='selectpicker " + cls + " m-2' data-live-search='true data-width='70%'></select>");
|
||||
if ($(variablesElement).val()) {
|
||||
fillFuzzyTerms(variablesElement, fuzzyTermsElement, termVal);
|
||||
}
|
||||
@ -180,8 +193,8 @@ function addAntecedent(parentElement, projectId, variableVal, termVal) {
|
||||
} else {
|
||||
$(rowElement).append("<label class='col col-md-1 m-2'> </label>");
|
||||
}
|
||||
let variablesElement = createVariableSelect(projectId, variableVal);
|
||||
let fuzzyTermsElement = createFuzzyTermsSelect(variablesElement, termVal);
|
||||
let variablesElement = createVariableSelect('inputVar', projectId, variableVal);
|
||||
let fuzzyTermsElement = createFuzzyTermsSelect('inputVal', variablesElement, termVal);
|
||||
$(variablesElement).on("change", function () {
|
||||
variableValueChanged(variablesElement, fuzzyTermsElement)
|
||||
});
|
||||
@ -204,8 +217,8 @@ function addConsequent(parentElement, projectId, variableVal, termVal) {
|
||||
} else {
|
||||
$(rowElement).append("<label class='col col-md-1 m-2'> </label>");
|
||||
}
|
||||
let variablesElement = createVariableSelect(projectId, variableVal);
|
||||
let fuzzyTermsElement = createFuzzyTermsSelect(variablesElement, termVal);
|
||||
let variablesElement = createVariableSelect('outVar', projectId, variableVal);
|
||||
let fuzzyTermsElement = createFuzzyTermsSelect('outVal', variablesElement, termVal);
|
||||
$(variablesElement).on("change", function () {
|
||||
variableValueChanged(variablesElement, fuzzyTermsElement)
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user