Skip to content

Commit

Permalink
Merge pull request #86 from Samsung/dev
Browse files Browse the repository at this point in the history
fix-smartthings-operator, fix operator UI
  • Loading branch information
jongsu2 authored Jan 22, 2024
2 parents 30d25ea + 493510b commit faf95a9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
42 changes: 21 additions & 21 deletions 101-SmartThings.html
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ <h3>Properties</h3>
}
});

var operator = {
const operators = {
string: [
{v: "eq", t: "=="},
{v: "neq", t: "!="}
Expand All @@ -1413,20 +1413,20 @@ <h3>Properties</h3>
{v: "nin", t: "not contains"}
],
integer: [
{v: "eq", t: "=="},
{v: "neq", t: "!="},
{v: "lt", t: "<"},
{v: "lte", t: "<="},
{v: "gt", t: ">"},
{v: "gte", t: ">="}
{ v: 'eq', t: '==' },
{ v: 'neq', t: '!=' },
{ v: 'gt', t: '<' },
{ v: 'gte', t: '<=' },
{ v: 'lt', t: '>' },
{ v: 'lte', t: '>=' },
],
number: [
{v: "eq", t: "=="},
{v: "neq", t: "!="},
{v: "lt", t: "<"},
{v: "lte", t: "<="},
{v: "gt", t: ">"},
{v: "gte", t: ">="}
{ v: 'eq', t: '==' },
{ v: 'neq', t: '!=' },
{ v: 'gt', t: '<' },
{ v: 'gte', t: '<=' },
{ v: 'lt', t: '>' },
{ v: 'lte', t: '>=' },
],
object: [
{v: "o_eq", t: "all values equal"},
Expand All @@ -1437,12 +1437,12 @@ <h3>Properties</h3>
{v: "neq", t: "!="}
],
Iso8601Date: [
{v: "eq", t: "=="},
{v: "neq", t: "!="},
{v: "lt", t: "<"},
{v: "lte", t: "<="},
{v: "gt", t: ">"},
{v: "gte", t: ">="}
{ v: 'eq', t: '==' },
{ v: 'neq', t: '!=' },
{ v: 'gt', t: '<' },
{ v: 'gte', t: '<=' },
{ v: 'lt', t: '>' },
{ v: 'lte', t: '>=' },
],
json: [
{v: "o_eq", t: "all values equal "},
Expand Down Expand Up @@ -1813,8 +1813,8 @@ <h3>Properties</h3>
}
function createOperatorField(valueType){
var operatorField = $('<select/>', {class: "attrOperator ruleField", style: "width:auto; margin-right: 5px; text-align: center;max-width:25%"})
if (operator[valueType]) {
operator[valueType].forEach(function (op) {
if (operators[valueType]) {
operators[valueType].forEach(function (op) {
operatorField.append($("<option></option>").val(op.v).text(op.t))
})
}
Expand Down
6 changes: 3 additions & 3 deletions 101-SmartThings.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ module.exports = function (RED) {
} else {
ruleValue = RED.util.evaluateNodeProperty(ruleValue, rule.argType, NODE, msg);
}
opCheck = operators[rule.operator](deviceEvent.value, ruleValue);
opCheck = operators[rule.operator](ruleValue, deviceEvent.value);
}

if (opCheck) {
Expand Down Expand Up @@ -664,9 +664,9 @@ module.exports = function (RED) {
ruleValue = "\'\'";
}
if (rule.valueType == 'Iso8601Date') {
opCheck = operators[rule.operator](new Date(attributeValue), new Date(ruleValue));
opCheck = operators[rule.operator](new Date(ruleValue), new Date(attributeValue));
} else {
opCheck = operators[rule.operator](attributeValue, ruleValue);
opCheck = operators[rule.operator](ruleValue, attributeValue);
}
if (opCheck) {
// sendDebug(NODE.attributeId+"=\""+attributeValue+"\", ("+idx+")port success")
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-samsung-automation-studio-nodes",
"version": "1.1.18",
"version": "1.1.19",
"description": "Samsung Automation Studio Nodes for Node-RED",
"keywords": [
"SmartThings",
Expand Down

0 comments on commit faf95a9

Please sign in to comment.