This commit is contained in:
2025-12-31 16:02:20 -05:00
parent 5dd07edf1a
commit 1bafc99da9
4 changed files with 29 additions and 41 deletions
-25
View File
@@ -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")
}
*/
+4
View File
@@ -12,3 +12,7 @@ nav.navbar{
font-weight: bold; font-weight: bold;
} }
.actionMessage{
position: fixed;
}
+22 -15
View File
@@ -305,30 +305,37 @@ app.util = (function(app){
} }
$.fn.serializeObject = function() { $.fn.serializeObject = function() {
var var obj = {};
arr = $(this).serializeArray(),
obj = {};
for(var i = 0; i < arr.length; i++){ // Get the form values and work over them
if(obj[arr[i].name] === undefined) { for (let {name, value} of $(this).serializeArray()) {
if(!arr[i].value) continue; console.log(name, value)
obj[arr[i].name] = arr[i].value; if (obj[name] === undefined) {
let type = $(this).parent().find(`[name="${arr[i].name}"]`).attr('type'); if (!value
if(['number', 'range'].includes(type)){ && !$(this).parent().find(`[name="${name}"]`).attr('value')
obj[arr[i].name] = Number(arr[i].value); ){
continue;
} }
if(['radio'].includes(type) && ['true', 'false'].includes(arr[i].value)){ obj[name] = value;
obj[arr[i].name] = arr[i].value == 'true' ? true : false;
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 { } else {
if(!(obj[arr[i].name] instanceof Array)) { if (!(obj[name] instanceof Array)) {
obj[arr[i].name] = [obj[arr[i].name]]; obj[name] = [obj[name]];
} }
obj[arr[i].name].push(arr[i].value); obj[name].push(value);
} }
} }
return obj; return obj;
}; };
+2
View File
@@ -38,6 +38,7 @@ function ModelPs(model){
publish(propKey, res, ...args); publish(propKey, res, ...args);
}).catch(function(error){ }).catch(function(error){
// console.error("Error PS", model.name, propKey, error)
console.log('toDo, publish errors...'); console.log('toDo, publish errors...');
}); });
}else{ }else{
@@ -45,6 +46,7 @@ function ModelPs(model){
} }
return res; return res;
}catch(error){ }catch(error){
// console.error("Error PS", model.name, propKey, error)
console.log("toDo, publish errors..."); console.log("toDo, publish errors...");
} }
} }