mirror of
https://github.com/postmannen/ctrl.git
synced 2025-04-08 01:44:14 +00:00
- Added network graph - Updated doc - Specify key to use in settings - Other minor changes
364 lines
10 KiB
HTML
364 lines
10 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Command Dashboard</title>
|
|
<link rel="stylesheet" href="styles.css" />
|
|
<style>
|
|
.popup {
|
|
display: none;
|
|
position: fixed;
|
|
z-index: 1000;
|
|
left: 0;
|
|
top: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
}
|
|
|
|
.popup-content {
|
|
background-color: #fefefe;
|
|
margin: 15% auto;
|
|
padding: 20px;
|
|
border: 1px solid #888;
|
|
width: 80%;
|
|
max-width: 600px;
|
|
position: relative;
|
|
}
|
|
|
|
.close-popup {
|
|
color: #aaa;
|
|
float: right;
|
|
font-size: 28px;
|
|
font-weight: bold;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.close-popup:hover,
|
|
.close-popup:focus {
|
|
color: black;
|
|
text-decoration: none;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.extras-toggle {
|
|
cursor: pointer;
|
|
padding: 10px;
|
|
background-color: #f5f5f5;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
margin: 10px 0;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.extras-toggle:hover {
|
|
background-color: #e9e9e9;
|
|
}
|
|
|
|
.extras-content {
|
|
max-height: 1000px;
|
|
overflow: hidden;
|
|
transition: max-height 0.3s ease-out;
|
|
}
|
|
|
|
.extras-content.collapsed {
|
|
max-height: 0;
|
|
}
|
|
|
|
.arrow {
|
|
margin-left: 10px;
|
|
}
|
|
|
|
.form-divider {
|
|
margin: 20px 0;
|
|
border-top: 2px solid #ddd;
|
|
}
|
|
|
|
#networkGraphForm h3 {
|
|
margin: 0 0 15px 0;
|
|
color: #333;
|
|
}
|
|
|
|
#networkGraphForm {
|
|
padding-top: 10px;
|
|
}
|
|
|
|
#graphContainer,
|
|
#graphContainer2 {
|
|
width: 100%;
|
|
height: 300px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
margin-top: 10px;
|
|
}
|
|
|
|
.menu-section {
|
|
border-top: 1px solid #444;
|
|
margin-top: 20px;
|
|
padding-top: 10px;
|
|
}
|
|
|
|
.menu-section-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 10px 15px;
|
|
color: #fff;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.menu-section-header:hover {
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
.menu-section-content {
|
|
max-height: 1000px;
|
|
overflow: hidden;
|
|
transition: max-height 0.3s ease-out;
|
|
}
|
|
|
|
.menu-section-content.collapsed {
|
|
max-height: 0;
|
|
}
|
|
|
|
.menu-section-content a {
|
|
padding-left: 30px;
|
|
}
|
|
|
|
.collapsed + .arrow {
|
|
transform: rotate(-90deg);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="hamburger-menu">
|
|
<div class="hamburger-icon">
|
|
<span></span>
|
|
<span></span>
|
|
<span></span>
|
|
</div>
|
|
</div>
|
|
|
|
<nav class="side-menu">
|
|
<a href="index.html" class="active">Command</a>
|
|
<a href="#" id="fileTemplatesLink">File Templates</a>
|
|
<a href="#" id="graphLink">Graph</a>
|
|
<a href="settings.html">Settings</a>
|
|
|
|
<!-- Add the foldable Development section -->
|
|
<div class="menu-section">
|
|
<div class="menu-section-header">
|
|
<span>Development</span>
|
|
<span class="arrow">▼</span>
|
|
</div>
|
|
<div class="menu-section-content collapsed">
|
|
<a href="#" id="flameGraphLink">Flame Graph</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="split-container">
|
|
<div class="left-panel">
|
|
<form id="commandForm">
|
|
<div class="form-group">
|
|
<label for="toNodes">To Nodes (comma-separated):</label>
|
|
<input
|
|
type="text"
|
|
id="toNodes"
|
|
placeholder="btdev1, btdev2..."
|
|
value="btdev1"
|
|
/>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="method">Method:</label>
|
|
<input type="text" id="method" value="cliCommand" />
|
|
</div>
|
|
|
|
<div class="form-group method-args">
|
|
<label>Method Arguments:</label>
|
|
<input
|
|
type="text"
|
|
class="method-arg"
|
|
placeholder="/bin/bash"
|
|
value="/bin/bash"
|
|
/>
|
|
<input type="text" class="method-arg" placeholder="-c" value="-c" />
|
|
<textarea
|
|
class="method-arg"
|
|
placeholder="Enter command here..."
|
|
value="ls -l"
|
|
></textarea>
|
|
</div>
|
|
|
|
<div class="extras-toggle">
|
|
<span>Advanced Options</span>
|
|
<span class="arrow">▼</span>
|
|
</div>
|
|
<div class="extras-content collapsed">
|
|
<div class="form-group">
|
|
<label for="jetstreamToNode">Jetstream To Node:</label>
|
|
<input type="text" id="jetstreamToNode" placeholder="btdev1" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="useDetectedShell">Use Detected Shell:</label>
|
|
<select id="useDetectedShell">
|
|
<option value="false">false</option>
|
|
<option value="true">true</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="methodTimeout">Method Timeout (seconds):</label>
|
|
<input type="number" id="methodTimeout" value="3" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="replyMethod">Reply Method:</label>
|
|
<input type="text" id="replyMethod" value="webUI" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="ackTimeout">ACK Timeout:</label>
|
|
<input type="number" id="ackTimeout" value="0" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="button-group">
|
|
<button type="submit" id="sendBtn">Send</button>
|
|
<button type="submit" id="writeFileBtn">Write File</button>
|
|
<button type="button" id="generateBtn">Generate Command</button>
|
|
</div>
|
|
</form>
|
|
|
|
<!-- Add new horizontal divider and form -->
|
|
<div class="form-divider"></div>
|
|
|
|
<form id="networkGraphForm">
|
|
<h3>Network Graph</h3>
|
|
<div id="graphContainer2"></div>
|
|
</form>
|
|
</div>
|
|
<div class="right-panel">
|
|
<textarea
|
|
id="outputArea"
|
|
readonly
|
|
placeholder="Command output will appear here..."
|
|
></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="fileTemplatesPopup" class="popup">
|
|
<div class="popup-content">
|
|
<span class="close-popup">×</span>
|
|
<!-- Content will go here later -->
|
|
</div>
|
|
</div>
|
|
|
|
<div id="flameGraphPopup" class="popup">
|
|
<div class="popup-content">
|
|
<!-- Content will be dynamically added here -->
|
|
</div>
|
|
</div>
|
|
|
|
<script
|
|
src="https://cdn.jsdelivr.net/npm/nats@2.29.1/index.min.js"
|
|
type="module"
|
|
></script>
|
|
<script type="module" src="script.js"></script>
|
|
<script src="https://d3js.org/d3.v7.min.js"></script>
|
|
<script>
|
|
// Function to close menu
|
|
function closeMenu() {
|
|
document.body.classList.remove("menu-open");
|
|
}
|
|
|
|
// Toggle menu on hamburger click
|
|
document
|
|
.querySelector(".hamburger-menu")
|
|
.addEventListener("click", function (e) {
|
|
e.stopPropagation(); // Prevent click from immediately bubbling to document
|
|
document.body.classList.toggle("menu-open");
|
|
});
|
|
|
|
// Close menu when clicking outside
|
|
document.addEventListener("click", function (e) {
|
|
// If menu is open and click is outside the side-menu and hamburger-menu
|
|
if (
|
|
document.body.classList.contains("menu-open") &&
|
|
!e.target.closest(".side-menu") &&
|
|
!e.target.closest(".hamburger-menu")
|
|
) {
|
|
closeMenu();
|
|
}
|
|
});
|
|
|
|
// Close menu on Escape key
|
|
document.addEventListener("keydown", function (e) {
|
|
if (
|
|
e.key === "Escape" &&
|
|
document.body.classList.contains("menu-open")
|
|
) {
|
|
closeMenu();
|
|
}
|
|
});
|
|
|
|
// Prevent clicks on the menu itself from closing it
|
|
document
|
|
.querySelector(".side-menu")
|
|
.addEventListener("click", function (e) {
|
|
e.stopPropagation();
|
|
});
|
|
|
|
// File Templates popup functionality
|
|
const fileTemplatesLink = document.getElementById("fileTemplatesLink");
|
|
const fileTemplatesPopup = document.getElementById("fileTemplatesPopup");
|
|
const closePopup = document.querySelector(".close-popup");
|
|
|
|
fileTemplatesLink.addEventListener("click", function (e) {
|
|
e.preventDefault();
|
|
fileTemplatesPopup.style.display = "block";
|
|
closeMenu(); // Close the side menu when opening popup
|
|
});
|
|
|
|
closePopup.addEventListener("click", function () {
|
|
fileTemplatesPopup.style.display = "none";
|
|
});
|
|
|
|
// Close popup when clicking outside
|
|
window.addEventListener("click", function (e) {
|
|
if (e.target == fileTemplatesPopup) {
|
|
fileTemplatesPopup.style.display = "none";
|
|
}
|
|
});
|
|
|
|
// Add Escape key handler for popup
|
|
document.addEventListener("keydown", function (e) {
|
|
if (e.key === "Escape") {
|
|
if (fileTemplatesPopup.style.display === "block") {
|
|
fileTemplatesPopup.style.display = "none";
|
|
} else if (document.body.classList.contains("menu-open")) {
|
|
closeMenu();
|
|
}
|
|
}
|
|
});
|
|
|
|
// Add this to your existing script section
|
|
document
|
|
.querySelector(".menu-section-header")
|
|
.addEventListener("click", function () {
|
|
const content = this.nextElementSibling;
|
|
content.classList.toggle("collapsed");
|
|
const arrow = this.querySelector(".arrow");
|
|
arrow.style.transform = content.classList.contains("collapsed")
|
|
? "rotate(-90deg)"
|
|
: "rotate(0)";
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|