fixed some bugs in on select changes
This commit is contained in:
parent
2552f5179b
commit
9b5c247737
2 changed files with 30 additions and 10 deletions
|
@ -120,7 +120,7 @@ function onTypeChange(node) {
|
|||
var1Input.value = var1Value;
|
||||
var1Input.classList.add("form-control");
|
||||
var1Label.innerHTML = "XPath";
|
||||
var1Input.placeholder = "//a[@class='price";
|
||||
var1Input.placeholder = "//a[@class='price]";
|
||||
var1Div.appendChild(var1Input);
|
||||
var var2Input = document.createElement("input");
|
||||
var2Input.name = "var2";
|
||||
|
@ -441,7 +441,7 @@ function onTypeChange(node) {
|
|||
higherThan.value = "highert";
|
||||
higherThan.innerHTML = "Higher Than";
|
||||
conditionSelect.appendChild(higherThan);
|
||||
conditionSelect.onchange = function () { onConditionChange(node); };
|
||||
conditionSelect.onchange = function () { onConditionChange(); };
|
||||
var1Div.appendChild(conditionSelect);
|
||||
var var2Input = document.createElement("input");
|
||||
var2Input.name = "var2";
|
||||
|
@ -459,6 +459,7 @@ function onTypeChange(node) {
|
|||
var3Input.disabled = true;
|
||||
var3Label.innerHTML = "-";
|
||||
var3Div.appendChild(var3Input);
|
||||
onConditionChange(node);
|
||||
break;
|
||||
}
|
||||
case "notify": {
|
||||
|
@ -527,15 +528,23 @@ function onConditionChange(node) {
|
|||
var var2Label = document.getElementById("var2Label");
|
||||
var var3Input = document.getElementById("var3Input");
|
||||
var var3Label = document.getElementById("var3Label");
|
||||
var var1Value = "";
|
||||
var var2Value = "";
|
||||
var var3Value = "";
|
||||
if (node != null) {
|
||||
// @ts-ignore
|
||||
var1Value = node.meta.var1;
|
||||
var1Input.value = var1Value;
|
||||
// @ts-ignore
|
||||
var2Value = node.meta.var2;
|
||||
// @ts-ignore
|
||||
var3Value = node.meta.var3;
|
||||
}
|
||||
switch (var1Input.value) {
|
||||
else {
|
||||
var1Value = var1Input.value;
|
||||
}
|
||||
var1Label.innerHTML = "Condition";
|
||||
switch (var1Value) {
|
||||
case "lowert": {
|
||||
var2Input.disabled = false;
|
||||
var2Input.type = "number";
|
||||
|
@ -611,10 +620,11 @@ function editNode(node) {
|
|||
cardBody.classList.add("card-body", "text-center");
|
||||
var pre = document.createElement("pre");
|
||||
var code = document.createElement("code");
|
||||
if (result.length > 50) {
|
||||
code.innerHTML = "String of length >50";
|
||||
if (result.length > 200) {
|
||||
code.innerHTML = "String of length >200";
|
||||
}
|
||||
else {
|
||||
result = result.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
code.innerHTML = "'" + result + "'";
|
||||
}
|
||||
cardDiv.appendChild(cardBody);
|
||||
|
|
|
@ -97,7 +97,7 @@ function onTypeChange(node: DiagramNode | null = null){
|
|||
var1Input.value = var1Value;
|
||||
var1Input.classList.add("form-control")
|
||||
var1Label.innerHTML = "XPath";
|
||||
var1Input.placeholder = "//a[@class='price";
|
||||
var1Input.placeholder = "//a[@class='price]";
|
||||
var1Div.appendChild(var1Input);
|
||||
|
||||
let var2Input = document.createElement("input");
|
||||
|
@ -433,7 +433,7 @@ function onTypeChange(node: DiagramNode | null = null){
|
|||
higherThan.value = "highert"
|
||||
higherThan.innerHTML = "Higher Than";
|
||||
conditionSelect.appendChild(higherThan);
|
||||
conditionSelect.onchange = function() {onConditionChange(node)}
|
||||
conditionSelect.onchange = function() {onConditionChange()}
|
||||
var1Div.appendChild(conditionSelect);
|
||||
|
||||
let var2Input = document.createElement("input");
|
||||
|
@ -453,6 +453,7 @@ function onTypeChange(node: DiagramNode | null = null){
|
|||
var3Input.disabled = true;
|
||||
var3Label.innerHTML = "-";
|
||||
var3Div.appendChild(var3Input);
|
||||
onConditionChange(node);
|
||||
break;
|
||||
}
|
||||
case "notify":{
|
||||
|
@ -526,16 +527,24 @@ function onConditionChange(node: DiagramNode | null = null){
|
|||
let var3Input = document.getElementById("var3Input") as HTMLInputElement;
|
||||
let var3Label = document.getElementById("var3Label") as HTMLLabelElement;
|
||||
|
||||
let var1Value = "";
|
||||
let var2Value = "";
|
||||
let var3Value = "";
|
||||
if (node != null){
|
||||
// @ts-ignore
|
||||
var1Value = node.meta.var1;
|
||||
var1Input.value = var1Value;
|
||||
// @ts-ignore
|
||||
var2Value = node.meta.var2;
|
||||
// @ts-ignore
|
||||
var3Value = node.meta.var3;
|
||||
} else {
|
||||
var1Value = var1Input.value;
|
||||
}
|
||||
|
||||
switch(var1Input.value) {
|
||||
var1Label.innerHTML = "Condition";
|
||||
|
||||
switch(var1Value) {
|
||||
case "lowert": {
|
||||
var2Input.disabled = false;
|
||||
var2Input.type = "number";
|
||||
|
@ -623,9 +632,10 @@ function editNode(node: DiagramNode){
|
|||
cardBody.classList.add("card-body", "text-center");
|
||||
let pre = document.createElement("pre");
|
||||
let code = document.createElement("code");
|
||||
if (result.length > 50){
|
||||
code.innerHTML = `String of length >50`;
|
||||
if (result.length > 200){
|
||||
code.innerHTML = `String of length >200`;
|
||||
} else {
|
||||
result = result.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
code.innerHTML = `'${result}'`;
|
||||
}
|
||||
cardDiv.appendChild(cardBody);
|
||||
|
|
Loading…
Add table
Reference in a new issue