bump
This commit is contained in:
		
							parent
							
								
									7da2bc0024
								
							
						
					
					
						commit
						362b1da1a0
					
				| 
						 | 
				
			
			@ -338,9 +338,9 @@ var executeCommand http.HandlerFunc = func(w http.ResponseWriter, r *http.Reques
 | 
			
		|||
		for i := 0; i < len(agentNames); i++ {
 | 
			
		||||
			res := <- resultsChan
 | 
			
		||||
			if res.Err != nil {
 | 
			
		||||
				combined.WriteString(fmt.Sprintf("[%s] ERROR: %s\n", res.AgentName, res.Err.Error()))
 | 
			
		||||
				combined.WriteString(fmt.Sprintf("\n[%s] ERROR: %s\n", res.AgentName, res.Err.Error()))
 | 
			
		||||
			} else {
 | 
			
		||||
				combined.WriteString(fmt.Sprintf("[%s] %s\n", res.AgentName, res.Payload))
 | 
			
		||||
				combined.WriteString(fmt.Sprintf("\n[%s]\n%s", res.AgentName, res.Payload))
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,8 +12,12 @@ document.addEventListener('DOMContentLoaded', () => {
 | 
			
		|||
        if (event.target.id === "agentList") {
 | 
			
		||||
            restoreCheckboxState();
 | 
			
		||||
            updateAgentDropdown();
 | 
			
		||||
            bindRowClicks();
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    bindRowClicks();
 | 
			
		||||
    restoreCheckboxState();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function prepareAgentNames(event) {
 | 
			
		||||
| 
						 | 
				
			
			@ -37,6 +41,8 @@ function toggleAllCheckboxes() {
 | 
			
		|||
    const allChecked = Array.from(checkboxes).every(checkbox => checkbox.checked);
 | 
			
		||||
 | 
			
		||||
    checkboxes.forEach(checkbox => checkbox.checked = !allChecked);
 | 
			
		||||
    saveCheckboxState();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function saveCheckboxState() {
 | 
			
		||||
| 
						 | 
				
			
			@ -54,6 +60,24 @@ function restoreCheckboxState() {
 | 
			
		|||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function bindRowClicks() {
 | 
			
		||||
    const rows = document.querySelectorAll('#agentList tbody tr');
 | 
			
		||||
    rows.forEach(row => {
 | 
			
		||||
        const agentName = row.dataset.agentName || row.cells[1]?.textContent?.trim();
 | 
			
		||||
        row.dataset.agentName = agentName;
 | 
			
		||||
 | 
			
		||||
        row.addEventListener('click', (e) => {
 | 
			
		||||
            if (e.target.tagName === "BUTTON" || e.target.type === "checkbox") return;
 | 
			
		||||
 | 
			
		||||
            const checkbox = row.querySelector(`input.agent-checkbox[data-agent-name="${agentName}"]`);
 | 
			
		||||
            if (checkbox) {
 | 
			
		||||
                checkbox.checked = !checkbox.checked;
 | 
			
		||||
                saveCheckboxState();
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function updateAgentDropdown() {
 | 
			
		||||
    const select = document.getElementById("agentName");
 | 
			
		||||
    const optionValues = Array.from(select.options).map(opt => opt.value);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,9 +13,9 @@
 | 
			
		|||
#logs-container {
 | 
			
		||||
    height: 300px;           /* or any fixed height you prefer */
 | 
			
		||||
    overflow-y: auto;        /* enables vertical scroll when content overflows */
 | 
			
		||||
    border: 1px solid #ccc;  /* optional: for visual clarity */
 | 
			
		||||
    border: 1px solid #fff;  /* optional: for visual clarity */
 | 
			
		||||
    padding: 10px;           /* optional: spacing inside the container */
 | 
			
		||||
    background-color: #f8f9fa; /* optional: subtle background for log readability */
 | 
			
		||||
    /* background-color: #f8f9fa; /1* optional: subtle background for log readability *1/ */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.log-info, .log-warning, .log-error, .log-fatal, .log-debug{
 | 
			
		||||
| 
						 | 
				
			
			@ -42,3 +42,7 @@
 | 
			
		|||
#graph-container {
 | 
			
		||||
  margin: 0; padding: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
tr.selected-row {
 | 
			
		||||
  background-color: var(--bs-table-hover-bg) !important;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,7 @@
 | 
			
		|||
 | 
			
		||||
      <!-- Logs -->
 | 
			
		||||
      <div class="col-md-6 d-flex flex-column">
 | 
			
		||||
        <h3>Logs</h3>
 | 
			
		||||
        <!-- <h3>Logs</h3> -->
 | 
			
		||||
        <form id="log-filter-form"
 | 
			
		||||
              hx-get="/logs"
 | 
			
		||||
              hx-target="#logs-container"
 | 
			
		||||
| 
						 | 
				
			
			@ -71,7 +71,7 @@
 | 
			
		|||
      <!-- Command Execution -->
 | 
			
		||||
      <div class="col-md-6">
 | 
			
		||||
        <div id="agentCommands">
 | 
			
		||||
          <h5>Command Execution</h5>
 | 
			
		||||
          <!-- <h5>Command Execution</h5> -->
 | 
			
		||||
          <form hx-post="http://localhost:5555/executeCommand"
 | 
			
		||||
                hx-target="#commandOutput"
 | 
			
		||||
                hx-encoding="application/x-www-form-urlencoded"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<table class="table table-bordered">
 | 
			
		||||
<table class="table table-bordered table-hover">
 | 
			
		||||
    <thead>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <th>ID</th>
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
    </thead>
 | 
			
		||||
    <tbody>
 | 
			
		||||
        {{range .}}
 | 
			
		||||
        <tr>
 | 
			
		||||
        <tr class="clickable-row" data-agent-name="{{.AgentName}}">
 | 
			
		||||
            <td>{{.AgentID}}</td>
 | 
			
		||||
            <td>{{.AgentName}}</td>
 | 
			
		||||
            <td>{{.AgentType}}</td>
 | 
			
		||||
| 
						 | 
				
			
			@ -35,6 +35,8 @@
 | 
			
		|||
                <input type="checkbox" class="agent-checkbox" data-agent-name="{{.AgentName}}" name="agent-checkbox">
 | 
			
		||||
                <!-- <input type="checkbox" class="agent-checkbox btn-check" data-agent-name="{{.AgentName}}" id="{{.AgentName}}"> -->
 | 
			
		||||
                <!-- <label class="btn btn-outline-primary btn-sm" for="{{.AgentName}}">Select</label> -->
 | 
			
		||||
                 <!-- <input type="checkbox" class="btn-check agent-checkbox" id="btn-check-{{.AgentID}}" autocomplete="off" data-agent-name="{{.AgentName}}"> -->
 | 
			
		||||
                <!-- <label class="btn btn-outline-primary btn-sm" for="btn-check-{{.AgentID}}">Select</label> -->
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        {{end}}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue