Skip to content

Commit

Permalink
Merge pull request #396 from rdmtc/dev
Browse files Browse the repository at this point in the history
added node path, introduced with node-red 2.2
  • Loading branch information
Hypnos3 authored Jan 30, 2022
2 parents 48afbf7 + e8dd33c commit a9893fb
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 14 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ This can be also used to go back to an older Version.

### 2.0.8: bug fixes

- general, but only used in blind-control + clock-time
- fixed string with placeholder output (string could not be entered)
- general, but only used in blind-control + clock-time
- added node.path (Node-Red 2.2) as possible output configuration, fallback to node.name or node.id if not defined
- fixed string with placeholder output (string could not be entered)

### 2.0.7: maintenance release

- blind-control + clock-time
Expand Down
9 changes: 6 additions & 3 deletions nodes/blind-control.html
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@
env: 'Environment variable',
jsonata: 'result of jsonata expression',
nodeId: 'additional node ID',
nodeName: this.name
nodeName: this.name,
nodePath: this._path || this.name
};

// if only payload and topic - display payload type
Expand Down Expand Up @@ -2173,7 +2174,8 @@
types.randmNumCachedDay,
types.randmNumCachedWeek,
types.nodeId,
types.nodeName
types.nodeName,
types.nodePath
]
});
setTInputValue($propertyValue, prop.v, prop.vt);
Expand Down Expand Up @@ -2418,7 +2420,8 @@
types.DayOfYearEven,
types.SunControlModeType,
types.nodeId,
types.nodeName
types.nodeName,
types.nodePath
]
});
setTInputValue($dialogCondOperand, data.value, data.valueType);
Expand Down
9 changes: 6 additions & 3 deletions nodes/clock-timer.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@
env: 'Environment variable',
jsonata: 'result of jsonata expression',
nodeId: 'additional node ID',
nodeName: this.name
nodeName: this.name,
nodePath: this._path || this.name
};

// if only payload and topic - display payload type
Expand Down Expand Up @@ -1280,7 +1281,8 @@
types.randmNumCachedDay,
types.randmNumCachedWeek,
types.nodeId,
types.nodeName
types.nodeName,
types.nodePath
]
});
setTInputValue($propertyValue, prop.v, prop.vt);
Expand Down Expand Up @@ -1524,7 +1526,8 @@
types.DayOfYear,
types.DayOfYearEven,
types.nodeId,
types.nodeName
types.nodeName,
types.nodePath
]
});
setTInputValue($dialogCondOperand, data.value, data.valueType);
Expand Down
1 change: 1 addition & 0 deletions nodes/locales/de/position-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"datespecific": "Zeitpunkt (erweitert)",
"nodeId":"Node Name",
"nodeName":"Node ID",
"nodePath":"Node Pfad",
"timeentered": "Uhrzeit (nächste)",
"dateentered": "Datum (spezieller Zeitpunkt)",
"timepredefined": "Uhrzeit speziell",
Expand Down
1 change: 1 addition & 0 deletions nodes/locales/en-US/position-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"datespecific":"timestamp enhanced",
"nodeId":"node name",
"nodeName":"node ID",
"nodePath":"node path",
"timeentered":"time (next)",
"dateentered":"date",
"timepredefined":"fixed times",
Expand Down
2 changes: 2 additions & 0 deletions nodes/position-config.html
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@
return node._('node-red-contrib-sun-position/position-config:common.types.nodeId') + suffix;
case 'nodeName':
return node._('node-red-contrib-sun-position/position-config:common.types.nodeName') + suffix;
case 'nodePath':
return node._('node-red-contrib-sun-position/position-config:common.types.nodePath') + suffix;
case 'PlT':
return node._('node-red-contrib-sun-position/position-config:common.typeOptions.PlTRes',{topic: RED.nodes.getType('position-config').clipValueLength(v, l), suffix} );
case 'msgPayload':
Expand Down
4 changes: 3 additions & 1 deletion nodes/position-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,9 @@ module.exports = function (RED) {
} else if (data.type === 'nodeId') {
return _srcNode.addId || _srcNode.id;
} else if (data.type === 'nodeName') {
return _srcNode.name || _srcNode.id; // if empty fallback to node ID
return _srcNode.name || _srcNode._path || _srcNode.id; // if empty fallback to node ID
} else if (data.type === 'nodePath') {
return _srcNode._path || _srcNode.id; // if empty fallback to node ID
} else if (data.type === 'randmNumCachedDay') {
const val = data.value.split(/((?:[1-9]|-0\.|0\.|-)\d*(?:\.\d+)?)/);
return this.getCachedRandomDayNumber(_srcNode, parseFloat(val[1]), parseFloat(val[3]), dNow);
Expand Down
5 changes: 5 additions & 0 deletions nodes/static/htmlglobal.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ function getTypes(node) { // eslint-disable-line no-unused-vars
label: node._('node-red-contrib-sun-position/position-config:common.types.nodeName','node name'),
hasValue: false
},
nodePath: {
value: 'nodePath',
label: node._('node-red-contrib-sun-position/position-config:common.types.nodePath','node name'),
hasValue: false
},
TimeEntered: {
value: 'entered',
label: node._('node-red-contrib-sun-position/position-config:common.types.timeentered','time (next)'),
Expand Down
2 changes: 1 addition & 1 deletion nodes/time-comp.html
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@
types.randmNumCachedDay,
types.randmNumCachedWeek,
types.nodeId,
types.nodeName
types.nodeNamec
]
});
setTInputValue($propertyValue, prop.v, prop.vt);
Expand Down
3 changes: 2 additions & 1 deletion nodes/time-inject.html
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,8 @@
types.randmNumCachedDay,
types.randmNumCachedWeek,
types.nodeId,
types.nodeName
types.nodeName,
types.nodePath
]
});
setTInputValue($propertyValue, prop.v, prop.vt);
Expand Down
3 changes: 2 additions & 1 deletion nodes/time-span.html
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,8 @@
types.randmNumCachedDay,
types.randmNumCachedWeek,
types.nodeId,
types.nodeName
types.nodeName,
types.nodePath
]
});
setTInputValue($propertyValue, prop.v, prop.vt);
Expand Down
6 changes: 4 additions & 2 deletions nodes/within-time-switch.html
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,8 @@
types.DayOfYear,
types.DayOfYearEven,
types.nodeId,
types.nodeName
types.nodeName,
types.nodePath
]
});
if (node.outOfTimeValueType === 'input') {
Expand Down Expand Up @@ -932,7 +933,8 @@
types.DayOfYear,
types.DayOfYearEven,
types.nodeId,
types.nodeName
types.nodeName,
types.nodePath
]
});
// #endregion Output Values
Expand Down

0 comments on commit a9893fb

Please sign in to comment.