diff --git a/nodejs/hostcontrol.js b/nodejs/hostcontrol.js deleted file mode 100755 index 8389943..0000000 --- a/nodejs/hostcontrol.js +++ /dev/null @@ -1,25 +0,0 @@ -#! /usr/bin/env node - -//you must add the absolute path to hosts.js on line 4, or this file will NOT work -const hosts = require("./models/hosts.js") - -const command = process.argv[2]; - -(async function(command){ - if (command == "--list"){ - console.log(await hosts.listAll()) - process.exit(0) - } - -})(command) -/* - if process.argv[2] == "--info" - - if process.agrv[2] == "--add" - - if process.argv[2] == "--remove" - - else{ - console.log("help text") - } -*/ \ No newline at end of file diff --git a/nodejs/public/css/styles.css b/nodejs/public/css/styles.css index 7db0c02..14a6177 100755 --- a/nodejs/public/css/styles.css +++ b/nodejs/public/css/styles.css @@ -12,3 +12,7 @@ nav.navbar{ font-weight: bold; } +.actionMessage{ + position: fixed; +} + diff --git a/nodejs/public/lib/js/app-base.js b/nodejs/public/lib/js/app-base.js index 486cb0c..517eb07 100644 --- a/nodejs/public/lib/js/app-base.js +++ b/nodejs/public/lib/js/app-base.js @@ -304,31 +304,38 @@ app.util = (function(app){ setTimeout(callback,10) } - $.fn.serializeObject = function(){ - var - arr = $(this).serializeArray(), - obj = {}; + $.fn.serializeObject = function() { + var obj = {}; - for(var i = 0; i < arr.length; i++){ - if(obj[arr[i].name] === undefined) { - if(!arr[i].value) continue; - obj[arr[i].name] = arr[i].value; - let type = $(this).parent().find(`[name="${arr[i].name}"]`).attr('type'); - if(['number', 'range'].includes(type)){ - obj[arr[i].name] = Number(arr[i].value); + // Get the form values and work over them + for (let {name, value} of $(this).serializeArray()) { + console.log(name, value) + if (obj[name] === undefined) { + if (!value + && !$(this).parent().find(`[name="${name}"]`).attr('value') + ){ + continue; } - if(['radio'].includes(type) && ['true', 'false'].includes(arr[i].value)){ - obj[arr[i].name] = arr[i].value == 'true' ? true : false; + obj[name] = value; + + let type = $(this).parent().find(`[name="${name}"]`).attr('type'); + if (['number', 'range'].includes(type)) { + obj[name] = Number(value); + } + + if (['radio'].includes(type) && ['true', 'false'].includes(value)) { + obj[name] = value == 'true' ? true : false; } } else { - if(!(obj[arr[i].name] instanceof Array)) { - obj[arr[i].name] = [obj[arr[i].name]]; + if (!(obj[name] instanceof Array)) { + obj[name] = [obj[name]]; } - obj[arr[i].name].push(arr[i].value); + obj[name].push(value); } } + return obj; }; diff --git a/nodejs/utils/model_pubsub.js b/nodejs/utils/model_pubsub.js index e24c8c1..f2ba5d1 100644 --- a/nodejs/utils/model_pubsub.js +++ b/nodejs/utils/model_pubsub.js @@ -38,6 +38,7 @@ function ModelPs(model){ publish(propKey, res, ...args); }).catch(function(error){ + // console.error("Error PS", model.name, propKey, error) console.log('toDo, publish errors...'); }); }else{ @@ -45,6 +46,7 @@ function ModelPs(model){ } return res; }catch(error){ + // console.error("Error PS", model.name, propKey, error) console.log("toDo, publish errors..."); } }