From 083567bcfc8b123eacb868a471dd2780143c9120 Mon Sep 17 00:00:00 2001 From: gurkenhabicht Date: Mon, 9 Jun 2025 00:42:40 +0200 Subject: [PATCH] changed layout --- .env | 6 +- static/gontrol-helper.js | 63 ++++++-- static/gontrol-stylesheet.css | 23 ++- templates/index.html | 231 ++++++++++++++--------------- templates/partials/agent_list.html | 2 +- 5 files changed, 191 insertions(+), 134 deletions(-) diff --git a/.env b/.env index 29b888b..21de03d 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ #!/usr/bin/env sh -export DB_HOST="127.0.0.1" +export DB_HOST="172.17.0.2" export DB_PORT=3306 -export DB_USERNAME="mysql" -export DB_PASSWORD="mysql" +export DB_USERNAME="root" +export DB_PASSWORD="root" export DB_NAME="gomatic" diff --git a/static/gontrol-helper.js b/static/gontrol-helper.js index 8aa7bcd..2fd257a 100644 --- a/static/gontrol-helper.js +++ b/static/gontrol-helper.js @@ -20,19 +20,64 @@ document.addEventListener('DOMContentLoaded', () => { restoreCheckboxState(); }); +// function prepareAgentNames(event) { +// // Determine which form was submitted +// const form = event.target; + +// // Collect selected agent names +// const selected = Array.from(document.querySelectorAll('.agent-checkbox')) +// .filter(cb => cb.checked) +// .map(cb => cb.dataset.agentName); + +// // Get the hidden input and select within the submitted form +// const hiddenInput = form.querySelector('[name="agentNames"]'); +// const agentSelect = form.querySelector('select[name="agentName"], select#agentName, select#modalAgentName'); + +// if (selected.length > 0) { +// // Remove the name from the if no checkboxes selected +// if (agentSelect) { +// agentSelect.setAttribute('name', 'agentName'); +// } +// hiddenInput.value = ''; +// } +// } + +let cachedAgentNames = ''; + function prepareAgentNames(event) { - const selected = Array.from(document.querySelectorAll('.agent-checkbox')) - .filter(cb => cb.checked) - .map(cb => cb.dataset.agentName); + const form = event.target; - const hiddenInput = document.getElementById('agentNamesInput'); + // Only set agentNames if this is the navbar form + const isNavbarForm = form.id === 'agentCommands'; - if (selected.length > 0) { - document.getElementById('agentName').removeAttribute('name'); - hiddenInput.value = selected.join(','); + // If this is the first submission (navbar), calculate agentNames + if (isNavbarForm) { + const selected = Array.from(document.querySelectorAll('.agent-checkbox')) + .filter(cb => cb.checked) + .map(cb => cb.dataset.agentName); + + cachedAgentNames = selected.join(','); + + const hiddenInput = form.querySelector('[name="agentNames"]'); + const agentSelect = form.querySelector('select'); + + if (selected.length > 0) { + if (agentSelect) agentSelect.removeAttribute('name'); + hiddenInput.value = cachedAgentNames; + } else { + if (agentSelect) agentSelect.setAttribute('name', 'agentName'); + hiddenInput.value = ''; + } } else { - document.getElementById('agentName').setAttribute('name', 'agentName'); - hiddenInput.value = ''; + // Use cached value for modal form + const hiddenInput = form.querySelector('[name="agentNames"]'); + hiddenInput.value = cachedAgentNames; } } diff --git a/static/gontrol-stylesheet.css b/static/gontrol-stylesheet.css index f3b3522..afe675d 100644 --- a/static/gontrol-stylesheet.css +++ b/static/gontrol-stylesheet.css @@ -18,8 +18,7 @@ /* background-color: #f8f9fa; /1* optional: subtle background for log readability *1/ */ } -.log-info, .log-warning, .log-error, .log-fatal, .log-debug{ - font-family: "Lucida Console", Monaco, monospace; +.log-info, .log-warning, .log-error, .log-fatal, .log-debug{ font-family: "Lucida Console", Monaco, monospace; font-size: 12px; } @@ -40,7 +39,7 @@ } .execute-navbar { - background-color: var(--bs-warning) + background-color: var(--bs-info-bg-subtle); } #graph-container { @@ -50,3 +49,21 @@ tr.selected-row { background-color: var(--bs-table-hover-bg) !important; } + +html, body { + height: 100%; + margin: 0; + display: flex; + flex-direction: column; + overflow-x: hidden; +} + +/* body > .container-fluid { */ +/* flex: 1 0 auto; */ +/* } */ + + table { + width: 100%; + table-layout: auto; + word-break: break-word; + } diff --git a/templates/index.html b/templates/index.html index a9e7f38..6be838f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -15,131 +15,126 @@ g2: gommand & gontrol -
- - -
- -
-

Agents

-
-
- - -
- -
-
- - - - - - - - - - - - - - -
-
-
- -
-
-
- - -
+
+
-
-
+
+ +
+
+
- -
- - - - - - - - - - - - - - - - - - - - - - -

-      
-      
-    
- + +
+ +
+ +
+
+ + + + + + + + + + +
+
+
+ +
+
- - - - - -
-
-
Agent Details
- -
-
- ... + +
+

Graph

+
+
+ + +
+
+
Agent Details
+ +
+
+ ... +
+
+ + + + + + diff --git a/templates/partials/agent_list.html b/templates/partials/agent_list.html index 070380c..96001e2 100644 --- a/templates/partials/agent_list.html +++ b/templates/partials/agent_list.html @@ -10,7 +10,7 @@ Status - +