Skip to content

Commit 1b2112a

Browse files
Add "Clear Terminal" button to Web UI
- Added "Clear Terminal" button to the controls in `index.html`. - Implemented `clearTerminalBtn.onclick` handler in `terminal.js`. - The handler clears the terminal content but preserves the `robot-art` ASCII art element. - Verified functionality using a Playwright script. - Updated README.md roadmap to mark the task as complete.
1 parent 103e046 commit 1b2112a

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ This section outlines the major feature enhancements and maintenance tasks plann
368368
- **Monitoring and Observability:** Deploy a monitoring stack like Prometheus and Grafana to collect and visualize metrics from Nomad, Consul, and the application itself.
369369
- **Web UI/UX Improvements:**
370370
- Replace ASCII art with a more dynamic animated character.
371-
- Add a "Clear Terminal" button to the UI.
371+
- [x] Add a "Clear Terminal" button to the UI.
372372
- Improve the status display to be more readable than a raw JSON dump.
373373
- **Bolster Automated Testing:**
374374
- Implement Ansible Molecule tests for critical roles.

ansible/roles/pipecatapp/files/static/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ <h1>Mission Control <span id="status-light"></span></h1>
106106
<input type="text" id="save-name-input" placeholder="Enter state name...">
107107
<button id="save-state-btn">Save State</button>
108108
<button id="load-state-btn">Load State</button>
109+
<button id="clear-terminal-btn">Clear Terminal</button>
109110
</div>
110111
<div id="terminal">
111112
<pre id="robot-art" style="text-align: center; font-family: 'Courier New', Courier, monospace;"></pre>

ansible/roles/pipecatapp/files/static/terminal.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ document.addEventListener("DOMContentLoaded", function() {
1515
const saveNameInput = document.getElementById("save-name-input");
1616
const saveStateBtn = document.getElementById("save-state-btn");
1717
const loadStateBtn = document.getElementById("load-state-btn");
18+
const clearTerminalBtn = document.getElementById("clear-terminal-btn");
1819
const statusLight = document.getElementById("status-light");
1920
const testAndEvaluationBtn = document.getElementById("test-and-evaluation-btn");
2021
const statusDisplay = document.getElementById("status-display");
@@ -155,6 +156,19 @@ document.addEventListener("DOMContentLoaded", function() {
155156
.catch(error => logToTerminal(`Error loading state: ${error}`, "error"));
156157
};
157158

159+
clearTerminalBtn.onclick = function() {
160+
// Find the robot art element within the terminal
161+
const robotArt = document.getElementById("robot-art");
162+
163+
// Clear all content of the terminal
164+
terminal.innerHTML = '';
165+
166+
// Re-append the robot art if it was found
167+
if (robotArt) {
168+
terminal.appendChild(robotArt);
169+
}
170+
};
171+
158172
ws.onmessage = function(event) {
159173
try {
160174
const msg = JSON.parse(event.data);

0 commit comments

Comments
 (0)