From e1a41d0787c54d7f96e3430fdf3e071212d53edb Mon Sep 17 00:00:00 2001 From: Wizmo2 Date: Wed, 11 Oct 2023 11:55:37 -0400 Subject: [PATCH] webapp-cosmetics --- components/wifi-manager/webapp/src/index.ejs | 30 ++++++++-------- .../wifi-manager/webapp/src/js/custom.js | 36 ++++++++++--------- .../webapp/src/sass/utils/_variables.scss | 2 +- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/components/wifi-manager/webapp/src/index.ejs b/components/wifi-manager/webapp/src/index.ejs index 13bf7a4a8..2b49095fc 100644 --- a/components/wifi-manager/webapp/src/index.ejs +++ b/components/wifi-manager/webapp/src/index.ejs @@ -99,10 +99,10 @@
-
+
Software Updates
- +
@@ -145,7 +145,7 @@
-
@@ -171,7 +171,7 @@ -
+
Local Firmware Upload
@@ -194,7 +194,7 @@
-
Version
+
@@ -216,7 +216,7 @@
-
+
Usage Templates
@@ -356,7 +356,7 @@
-
+
WiFi Status
Key
+
@@ -474,7 +474,7 @@
Logs
-
Joined
+
@@ -492,7 +492,7 @@
Timestamp
+
@@ -508,7 +508,7 @@
Tasks
-
Device
+
@@ -528,7 +528,7 @@
-
+
Credits
-
+
Extras/Overrides
@@ -579,9 +579,9 @@
- -
diff --git a/components/wifi-manager/webapp/src/js/custom.js b/components/wifi-manager/webapp/src/js/custom.js index 1c45d7a47..bd42921b8 100644 --- a/components/wifi-manager/webapp/src/js/custom.js +++ b/components/wifi-manager/webapp/src/js/custom.js @@ -1982,7 +1982,6 @@ window.runCommand = function (button, reboot) { if (cmdstring === 'cfg-hw-preset') return handleHWPreset(allfields, reboot); cmdstring += ' '; if (fields) { - for (const field of allfields) { let qts = ''; let opt = ''; @@ -2075,7 +2074,7 @@ function getCommands() { const isConfig = cmdParts[0] === 'cfg'; const targetDiv = '#tab-' + cmdParts[0] + '-' + cmdParts[1]; let innerhtml = ''; - innerhtml += `
${command.help.encodeHTML().replace(/\n/g, '
')}
`; + innerhtml += `
${command.help.encodeHTML().replace(/\n/g, '
')}
`; if (command.argtable) { command.argtable.forEach(function (arg) { let placeholder = arg.datatype || ''; @@ -2087,20 +2086,18 @@ function getCommands() { attributes += 'shortopts="' + arg.shortopts + '" '; attributes += 'checkbox=' + arg.checkbox + ' '; attributes += 'cmdname="' + command.name + '" '; - attributes += - 'id="' + - ctrlname + - '" name="' + - ctrlname + - '" hasvalue="' + - arg.hasvalue + - '" '; - let extraclass = arg.mincount > 0 ? 'bg-success' : ''; + attributes += 'id="' + ctrlname + '" name="' + ctrlname + '" '; + if (arg.longopts && arg.longopts.startsWith('_')){ + attributes += "readonly "; + } + let extraclass = arg.mincount > 0 ? 'is-invalid' : ''; if (arg.glossary === 'hidden') { attributes += ' style="visibility: hidden;"'; } if (arg.checkbox) { - innerhtml += `
`; + innerhtml += `
`; + } else if (arg.remark) { + innerhtml += `
`; } else { innerhtml += `
`; if (placeholder.includes('|')) { @@ -2118,9 +2115,12 @@ function getCommands() { } else { innerhtml += ``; } - } + } - innerhtml += `${arg.checkbox ? '
' : ''}Previous value: ${arg.checkbox ? (curvalue ? 'Checked' : 'Unchecked') : (curvalue || '')}${arg.checkbox ? '' : '
'}`; + if (!arg.remark) { + innerhtml += `Previous value: ${arg.checkbox ? (curvalue ? 'Checked' : 'Unchecked') : (curvalue || '')}`; + } + innerhtml += `
`; }); } innerhtml += `
@@ -2157,7 +2157,7 @@ function getCommands() { const ctrlValue = getLongOps(data, command.name, arg.longopts); if (arg.checkbox) { $(ctrlselector)[0].checked = ctrlValue; - } else { + } else if (!arg.remark) { if (ctrlValue !== undefined) { $(ctrlselector) .val(ctrlValue) @@ -2170,6 +2170,10 @@ function getCommands() { $(ctrlselector)[0].value = '--'; } } + if (arg.mincount && arg.mincount > 0) { + $(ctrlselector).removeClass('is-invalid'); + $(ctrlselector).addClass('is-valid'); + } }); } }); @@ -2200,7 +2204,7 @@ function getConfig() { .forEach(function (key) { let val = data[key].value; if (key === 'autoexec') { - if (data.autoexec.value === '0') { +if (data.autoexec.value === '0') { $('#disable-squeezelite')[0].checked = true; } else { $('#disable-squeezelite')[0].checked = false; diff --git a/components/wifi-manager/webapp/src/sass/utils/_variables.scss b/components/wifi-manager/webapp/src/sass/utils/_variables.scss index f1e32386e..2c0a2c500 100644 --- a/components/wifi-manager/webapp/src/sass/utils/_variables.scss +++ b/components/wifi-manager/webapp/src/sass/utils/_variables.scss @@ -1,3 +1,3 @@ $enable-gradients: false; // This is needed below, otherwise colors look washed out -$table-bg-level: 0; \ No newline at end of file +//$table-bg-level: 0; \ No newline at end of file