mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
fix button class and serial.list promise
This commit is contained in:
parent
3ed1e72481
commit
0bef668028
@ -147,7 +147,7 @@
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-serialport"><i class="fa fa-random"></i> <span data-i18n="serial.label.serialport"></span></label>
|
||||
<input type="text" id="node-config-input-serialport" style="width:66%;" data-i18n="[placeholder]serial.placeholder.serialport">
|
||||
<a id="node-config-lookup-serial" class="btn"><i id="node-config-lookup-serial-icon" class="fa fa-search"></i></a>
|
||||
<a id="node-config-lookup-serial" class="red-ui-button"><i id="node-config-lookup-serial-icon" class="fa fa-search"></i></a>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<table width="100%"><tr>
|
||||
@ -354,10 +354,7 @@
|
||||
$("#node-config-lookup-serial").addClass('disabled');
|
||||
$.getJSON('serialports',function(data) {
|
||||
$("#node-config-lookup-serial").removeClass('disabled');
|
||||
var ports = [];
|
||||
$.each(data, function(i, port) {
|
||||
ports.push(port.comName);
|
||||
});
|
||||
var ports = data || [];
|
||||
$("#node-config-input-serialport").autocomplete({
|
||||
source:ports,
|
||||
minLength:0,
|
||||
|
@ -444,8 +444,14 @@ module.exports = function(RED) {
|
||||
}());
|
||||
|
||||
RED.httpAdmin.get("/serialports", RED.auth.needsPermission('serial.read'), function(req,res) {
|
||||
serialp.list(function (err, ports) {
|
||||
res.json(ports);
|
||||
});
|
||||
serialp.list().then(
|
||||
ports => {
|
||||
const a = ports.map(p => p.path);
|
||||
res.json(a);
|
||||
},
|
||||
err => {
|
||||
node.log('Error listing serial ports', err)
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-serialport",
|
||||
"version" : "0.9.0",
|
||||
"version" : "0.9.1",
|
||||
"description" : "Node-RED nodes to talk to serial ports",
|
||||
"dependencies" : {
|
||||
"serialport" : "^8.0.5"
|
||||
|
Loading…
Reference in New Issue
Block a user