#4 -- Fix code
Some checks failed
CI fuzzy controller / container-test-job (push) Failing after 8s

This commit is contained in:
Anton Romanov 2025-02-28 13:59:31 +04:00
parent 953e60d4a1
commit aab9d010be
3 changed files with 27 additions and 18 deletions

View File

@ -1,3 +1,24 @@
// Rules parsing
function getAntecedent(rule) {
withoutIf = rule.split('if');
return withoutIf[1].trim().split('then')[0].trim();
}
function getAntecedentComponents(antecedent) {
return antecedent.split('and').map((i) => i.trim());
}
function getVariable(antecedent) {
return antecedent.split('is')[0].trim();
}
function getVariableValue(antecedent) {
return antecedent.split('is')[1].trim();
}
// Rules creation
/* exported MessageTypesEnum */
var MessageTypesEnum = {
INFO: "info",

View File

@ -57,24 +57,8 @@
class="btn btn-outline-dark">Добавить правило</a>
</div>
</div>
<script type="text/javascript" src="/js/fuzzyRule.js"></script>
<script>
function getAntecedent(rule) {
withoutIf = rule.split('if');
return withoutIf[1].trim().split('then')[0].trim();
}
function getAntecedentComponents(antecedent) {
return antecedent.split('and').map((i) => i.trim());
}
function getVariable(antecedent) {
return antecedent.split('is')[0].trim();
}
function getVariableValue(antecedent) {
return antecedent.split('is')[1].trim();
}
function addRule(index, el, rule) {
ruleHtml = "<div class='col col-md-12'><span class='badge badge-light'>"+(index+1) +". Если</span></div>"
antecedentComponents = getAntecedentComponents(getAntecedent(rule));

View File

@ -45,7 +45,11 @@
<script type="text/javascript" src="/js/fuzzyRule.js"></script>
<script>
/*<![CDATA[*/
addAntecedent($('#rules'), [[${projectId}]]);
if ($('#ruleContent').val()) {
alert('123');
} else {
addAntecedent($('#rules'), [[${projectId}]]);
}
/*]]>*/
</script>
</form>