Skip to content

Commit

Permalink
keep name in channel input (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Aug 24, 2018
1 parent b943428 commit 7de5318
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions nodes/ccu-value.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@
paletteLabel: 'value',
align: 'right',
label() {
return this.name || 'value';
return this.name || String(this.channel).replace(/^[A-Za-z0-9-]+:[0-9] /, '') || 'value';
},
oneditprepare() {
const $nodeInputIface = $('#node-input-iface');
const $nodeInputMode = $('#node-input-mode');
const $nodeInputCcuConfig = $('#node-input-ccuConfig');
const $nodeInputChannel = $('#node-input-channel');
const $nodeInputName = $('#node-input-name');
const $nodeInputDatapoint = $('#node-input-datapoint');

let data;
Expand Down Expand Up @@ -108,12 +107,6 @@
$nodeInputChannel.autocomplete({
source: [],
close: () => {
const n = $nodeInputChannel.val().split(' ');
const channel = n.shift();
$nodeInputChannel.val(channel);
if (!$nodeInputName.val()) {
$nodeInputName.val(n.join(' '));
}
autocompleteDatapoint();
},
delay: 0,
Expand Down
2 changes: 1 addition & 1 deletion nodes/ccu-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = function (RED) {
iface: config.iface,
cache: config.cache,
change: config.change,
channel: (config.channel || '').split(' ')[0],
channel: String(config.channel).split(' ')[0],
datapoint: config.datapoint
};

Expand Down

0 comments on commit 7de5318

Please sign in to comment.