141 lines
		
	
	
		
			6.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
			
		
		
	
	
			141 lines
		
	
	
		
			6.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
<!DOCTYPE html>
 | 
						|
<html lang="en">
 | 
						|
<head>
 | 
						|
    <meta charset="UTF-8">
 | 
						|
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
						|
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
						|
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
 | 
						|
    <link rel="stylesheet" type="text/css" href="static/gontrol-stylesheet.css">
 | 
						|
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
 | 
						|
    <script src="https://unpkg.com/htmx.org@1.9.12"></script>
 | 
						|
    <!-- Include Cytoscape.js -->
 | 
						|
    <script src="https://cdn.jsdelivr.net/npm/cytoscape@3.23/dist/cytoscape.min.js"></script>
 | 
						|
    <script type="text/javascript" src="static/agents-graph.js"></script>
 | 
						|
    <script type="text/javascript" src="static/gontrol-helper.js"></script>
 | 
						|
    <title>g2: gommand & gontrol</title>
 | 
						|
</head>
 | 
						|
<body>
 | 
						|
  <div class="container-fluid px-4 py-3 pb-5">
 | 
						|
    <div class="row g-4">
 | 
						|
      <!-- Agent List -->
 | 
						|
      <div class="col-12 col-md-6">
 | 
						|
        <!-- <h3>Agents</h3> -->
 | 
						|
        <div class="table-responsive">
 | 
						|
          <div id="agentList"
 | 
						|
               hx-get="/agents"
 | 
						|
               hx-trigger="load, every 2s"
 | 
						|
               hx-swap="innerHTML">
 | 
						|
          </div>
 | 
						|
        </div>
 | 
						|
      </div>
 | 
						|
 | 
						|
      <!-- Right Column: Logs and Graph -->
 | 
						|
      <div class="col-12 col-md-6 d-flex flex-column">
 | 
						|
        <!-- Logs -->
 | 
						|
        <div class="mb-3">
 | 
						|
          <!-- <h3>Logs</h3> -->
 | 
						|
          <form id="log-filter-form"
 | 
						|
                hx-get="/logs"
 | 
						|
                hx-target="#logs-container"
 | 
						|
                hx-swap="innerHTML"
 | 
						|
                hx-trigger="change from:.log-filter, load, every 5s"
 | 
						|
                hx-include="#log-filter-form"
 | 
						|
                class="mb-2">
 | 
						|
            <div class="btn-group flex-wrap" role="group" aria-label="Log filter">
 | 
						|
              <input type="checkbox" class="btn-check log-filter" id="info" name="level" value="info" checked>
 | 
						|
              <label class="btn btn-outline-primary" for="info">Info</label>
 | 
						|
              <input type="checkbox" class="btn-check log-filter" id="warning" name="level" value="warning">
 | 
						|
              <label class="btn btn-outline-primary" for="warning">Warning</label>
 | 
						|
              <input type="checkbox" class="btn-check log-filter" id="error" name="level" value="error">
 | 
						|
              <label class="btn btn-outline-primary" for="error">Error</label>
 | 
						|
              <input type="checkbox" class="btn-check log-filter" id="fatal" name="level" value="fatal">
 | 
						|
              <label class="btn btn-outline-primary" for="fatal">Fatal</label>
 | 
						|
              <input type="checkbox" class="btn-check log-filter" id="debug" name="level" value="debug">
 | 
						|
              <label class="btn btn-outline-primary" for="debug">Debug</label>
 | 
						|
            </div>
 | 
						|
          </form>
 | 
						|
          <div id="logs-container" class="border" style="overflow-y: auto; min-height: 240px; max-height: 320px;">
 | 
						|
            <!-- Logs will load here -->
 | 
						|
          </div>
 | 
						|
        </div>
 | 
						|
 | 
						|
        <!-- Graph -->
 | 
						|
        <div>
 | 
						|
          <h3>Graph</h3>
 | 
						|
          <div class="border" id="cyto-graph" style="min-height: 320px;"></div>
 | 
						|
        </div>
 | 
						|
      </div>
 | 
						|
    </div>
 | 
						|
  </div>
 | 
						|
 | 
						|
  <!-- Offcanvas for Agent Details -->
 | 
						|
  <div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasRight" aria-labelledby="offcanvasRightLabel" data-bs-scroll="true">
 | 
						|
    <div class="offcanvas-header">
 | 
						|
      <h5 class="offcanvas-title" id="offcanvasRightLabel">Agent Details</h5>
 | 
						|
      <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
 | 
						|
    </div>
 | 
						|
    <div id="offcanvas-body" class="offcanvas-body">
 | 
						|
      ...
 | 
						|
    </div>
 | 
						|
  </div>
 | 
						|
 | 
						|
  <!-- Modal -->
 | 
						|
  <div class="modal fade modal-dialog-scrollable modal-xl" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
 | 
						|
    <div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
 | 
						|
      <div class="modal-content">
 | 
						|
        <div class="modal-header">
 | 
						|
          <h1 class="modal-title" id="exampleModalLabel">Modal title</h1>
 | 
						|
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
 | 
						|
        </div>
 | 
						|
        <div class="modal-body">
 | 
						|
          <pre id="commandOutput">...</pre>
 | 
						|
        </div>
 | 
						|
        <div class="modal-footer d-flex justify-content-between align-items-center">
 | 
						|
          <form id="modalAgentCommands"
 | 
						|
                hx-post="http://localhost:5555/executeCommand"
 | 
						|
                hx-target="#commandOutput"
 | 
						|
                hx-encoding="application/x-www-form-urlencoded"
 | 
						|
                hx-swap="innerHTML"
 | 
						|
                onsubmit="prepareAgentNames(event)"
 | 
						|
                class="d-flex flex-grow-1 me-3">
 | 
						|
            <input type="text" class="form-control me-2" id="modalCommand" name="command" placeholder="Enter command" required>
 | 
						|
            <input type="hidden" name="agentNames" id="modalAgentNamesInput">
 | 
						|
            <select id="modalAgentName"
 | 
						|
                    class="form-select d-none"
 | 
						|
                    name="agentName"
 | 
						|
                    hx-on="htmx:afterSwap:updateAgentDropdown">
 | 
						|
              <option value="" disabled selected>Select an Agent</option>
 | 
						|
            </select>
 | 
						|
            <button type="submit" class="btn btn-primary">Execute</button>
 | 
						|
          </form>
 | 
						|
          <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
 | 
						|
        </div>
 | 
						|
      </div>
 | 
						|
    </div>
 | 
						|
  </div>
 | 
						|
 | 
						|
  <!-- Sticky Footer Navbar -->
 | 
						|
  <nav class="navbar bg-body-tertiary fixed-bottom">
 | 
						|
    <div class="px-4 container-fluid navbar text-primary-emphasis bg-primary-subtle border-top border-primary-subtle">
 | 
						|
      <form id="agentCommands"
 | 
						|
            hx-post="http://localhost:5555/executeCommand"
 | 
						|
            hx-target="#commandOutput"
 | 
						|
            hx-encoding="application/x-www-form-urlencoded"
 | 
						|
            hx-swap="innerHTML"
 | 
						|
            onsubmit="prepareAgentNames(event)"
 | 
						|
            class="d-flex w-100">
 | 
						|
        <button type="submit" class="btn btn-primary me-2" data-bs-toggle="modal" data-bs-target="#exampleModal">Execute</button>
 | 
						|
        <input type="text" class="form-control" id="command" name="command" placeholder="Enter command" required>
 | 
						|
        <input type="hidden" name="agentNames" id="agentNamesInput">
 | 
						|
        <select id="agentName"
 | 
						|
                class="form-select d-none"
 | 
						|
                name="agentName"
 | 
						|
                hx-on="htmx:afterSwap:updateAgentDropdown">
 | 
						|
          <option value="" disabled selected>Select an Agent</option>
 | 
						|
        </select>
 | 
						|
      </form>
 | 
						|
    </div>
 | 
						|
  </nav>
 | 
						|
</body>
 | 
						|
</html>
 |