From b64b1f295665766e660936ed78e89e6e48d97d0d Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 5 May 2014 21:42:01 +0100 Subject: [PATCH] Serial port select combo-box --- nodes/core/io/25-serial.html | 38 +++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/nodes/core/io/25-serial.html b/nodes/core/io/25-serial.html index 0dcba74dc..fec81b833 100644 --- a/nodes/core/io/25-serial.html +++ b/nodes/core/io/25-serial.html @@ -94,11 +94,8 @@ @@ -205,7 +206,34 @@ return this.serialport+":"+this.serialbaud+"-"+this.databits+this.parity.charAt(0).toUpperCase()+this.stopbits; }, oneditprepare: function() { - $("#node-config-select-serialport").hide(); + try { + $("#node-config-input-serialport").autocomplete( "destroy" ); + } catch(err) { + } + + $("#node-config-lookup-serial").click(function() { + $("#node-config-lookup-serial-icon").removeClass('icon-search'); + $("#node-config-lookup-serial-icon").addClass('spinner'); + $("#node-config-lookup-serial").addClass('disabled'); + + $.getJSON('serialports',function(data) { + $("#node-config-lookup-serial-icon").addClass('icon-search'); + $("#node-config-lookup-serial-icon").removeClass('spinner'); + $("#node-config-lookup-serial").removeClass('disabled'); + var ports = []; + $.each(data, function(i, port){ + ports.push(port.comName); + }); + $("#node-config-input-serialport").autocomplete({ + source:ports, + minLength:0, + close: function( event, ui ) { + $("#node-config-input-serialport").autocomplete( "destroy" ); + }, + focus: function( event, ui ) {console.log(event);} + }).autocomplete("search",""); + }); + }); } });