mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	add validation to physical web node fields
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 829 B After Width: | Height: | Size: 614 B | 
| @@ -1,7 +1,7 @@ | ||||
| { | ||||
|   "name": "node-red-node-physical-web", | ||||
|   "version": "0.0.6", | ||||
|   "description": "A set of nodes to interact with the Phyical Web", | ||||
|   "version": "0.0.7", | ||||
|   "description": "Node-RED nodes to interact with the Physical Web", | ||||
|   "main": "physical-web.js", | ||||
|   "scripts": { | ||||
|     "test": "echo \"Error: no test specified\" && exit 1" | ||||
|   | ||||
| @@ -69,7 +69,7 @@ | ||||
|     RED.nodes.registerType('PhysicalWeb in',{ | ||||
|         category: 'Physical_Web', | ||||
|         defaults: { | ||||
|             name: {value:"Eddystone"}, | ||||
|             name: {value:""}, | ||||
|             topic: {value:"eddystone"} | ||||
|         }, | ||||
|         color: "#2F7ACD", | ||||
| @@ -88,9 +88,9 @@ | ||||
| <script type="text/x-red" data-template-name="PhysicalWeb out"> | ||||
|     <div class="form-row"> | ||||
|         <label for="node-input-url"><i class="fa fa-link"></i> URL</label> | ||||
|         <input type="text" id="node-input-url" placeholder="http://..."> | ||||
|         <input type="text" id="node-input-url" style="width:250px;" placeholder="http://..."> | ||||
|         <!--<button type="button" id="node-input-url-shorten" disabled=true>Shorten</button> --> | ||||
|         <p style="margin-left:100px;width: 70%">This URL needs to be shorter than 18 bytes | ||||
|         <p style="margin-left:100px; width:70%">This URL needs to be shorter than 18 bytes | ||||
|         in length to meet Eddystone spec</p> | ||||
|     </div> | ||||
|     <div class="form-row"> | ||||
| @@ -121,10 +121,10 @@ | ||||
|     RED.nodes.registerType('PhysicalWeb out',{ | ||||
|         category: 'Physical_Web', | ||||
|         defaults: { | ||||
|             name: {value:"Eddystone"}, | ||||
|             url: {value:""}, | ||||
|             power: {value:"-21"}, | ||||
|             period: {value:"10"} | ||||
|             name: {value:""}, | ||||
|             url: {value:"",validate:function(v) {return v.length<19; }}, | ||||
|             power: {value:"-21",validate:RED.validators.number()}, | ||||
|             period: {value:"10",validate:RED.validators.number()} | ||||
|         }, | ||||
|         color: "#2F7ACD", | ||||
|         inputs:1, | ||||
|   | ||||
| @@ -30,7 +30,7 @@ module.exports = function(RED) { | ||||
|             txPowerLevel: node.power, | ||||
|             tlmPeriod: node.period, | ||||
|             tlmCount: 2 | ||||
|         } | ||||
|         }; | ||||
|  | ||||
|         if (node.url) { | ||||
|             try { | ||||
| @@ -53,7 +53,7 @@ module.exports = function(RED) { | ||||
|                 eddystoneBeacon.stop(); | ||||
|                 done(); | ||||
|             } catch(e) { | ||||
|                 node.error('error shuttingdown beacon', e); | ||||
|                 node.error('error shutting down beacon', e); | ||||
|             } | ||||
|         }); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user