This repository has been archived on 2026-10-25. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Arvex 866b301d28 feat: ClawDash - service control dashboard APK
Android app for starting/stopping services via Termux:
- Service cards for OpenClaw Gateway, SmallClawViewer, Watchdog
- Status dots (green=running, red=stopped, grey=unknown)
- Termux:API intent integration to run shortcut scripts
- Auto-refresh every 15 seconds
- Open button for SmallClawViewer WebView
- Dark theme, Material3
2026-04-04 14:51:33 -06:00

241 lines
6.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>ClawDash</title>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #0d0d0d;
--surface: #1a1a1a;
--surface2: #2a2a2a;
--text: #e8e8e8;
--text-muted: #888;
--accent: #4dabf7;
--green: #22c55e;
--red: #ef4444;
--border: #2a2a2a;
}
html, body {
min-height: 100%;
font-family: system-ui, -apple-system, sans-serif;
background: var(--bg);
color: var(--text);
}
header {
background: var(--surface);
border-bottom: 1px solid var(--border);
padding: 1rem;
text-align: center;
position: sticky;
top: 0;
z-index: 10;
}
header h1 { font-size: 1.2rem; font-weight: 700; }
header p { font-size: 0.8rem; color: var(--text-muted); }
main {
padding: 1rem;
max-width: 640px;
margin: 0 auto;
}
.service-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 10px;
padding: 1rem;
margin-bottom: 0.75rem;
display: flex;
align-items: center;
gap: 0.75rem;
}
.status-dot {
width: 12px;
height: 12px;
border-radius: 50%;
flex-shrink: 0;
}
.status-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.offline { background: var(--red); box-shadow: none; }
.service-info {
flex: 1;
min-width: 0;
}
.service-info h3 { font-size: 0.95rem; font-weight: 600; }
.service-info p { font-size: 0.8rem; color: var(--text-muted); }
.service-actions {
display: flex;
gap: 0.5rem;
flex-shrink: 0;
}
.btn {
padding: 0.5rem 0.75rem;
border: none;
border-radius: 8px;
font-size: 0.8rem;
font-weight: 500;
cursor: pointer;
background: var(--surface2);
color: var(--text);
transition: background 0.15s;
}
.btn:hover { background: #333; }
.btn:active { background: #444; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-start {
background: rgba(34, 197, 94, 0.15);
color: var(--green);
}
.btn-start:hover:not(:disabled) { background: rgba(34, 197, 94, 0.25); }
.btn-stop {
background: rgba(239, 68, 68, 0.15);
color: var(--red);
}
.btn-stop:hover:not(:disabled) { background: rgba(239, 68, 68, 0.25); }
.hint {
color: var(--text-muted);
font-size: 0.85rem;
text-align: center;
padding: 2rem 0;
}
.last-check {
text-align: center;
padding: 0.75rem 0 0;
font-size: 0.75rem;
color: var(--text-muted);
}
.toast {
position: fixed;
bottom: 1rem;
left: 50%;
transform: translateX(-50%);
background: var(--surface2);
color: var(--text);
padding: 0.5rem 1rem;
border-radius: 8px;
font-size: 0.85rem;
z-index: 100;
border: 1px solid var(--border);
animation: toast-in 0.2s ease;
}
@keyframes toast-in {
from { opacity: 0; transform: translateX(-50%) translateY(10px); }
to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
</style>
</head>
<body x-data="dash()">
<header>
<h1>
ClawDash
</h1>
<p>Service control panel</p>
</header>
<main>
<template x-if="services.length === 0 && loading">
<p class="hint">Loading services...</p>
</template>
<template x-for="svc in services" :key="svc.id">
<div class="service-card">
<div class="status-dot" :class="svc.running ? 'online' : 'offline'"></div>
<div class="service-info">
<h3 x-text="svc.name"></h3>
<p x-text="svc.description"></p>
</div>
<div class="service-actions">
<button class="btn btn-start" x-show="!svc.running" @click="startSvc(svc)" :disabled="svc.busy">Start</button>
<button class="btn btn-stop" x-show="svc.running" @click="stopSvc(svc)" :disabled="svc.busy" x-text="svc.busy ? '...' : 'Restart'"></button>
</div>
</div>
</template>
<p class="last-check" x-text="lastCheck"></p>
</main>
<script>
async function sleep(ms) { return new Promise(r => setTimeout(r, ms)) }
function dash() {
return {
services: [],
loading: true,
lastCheck: '',
toast: null,
async init() {
await this.refresh()
// Auto-refresh every 15 seconds
setInterval(() => this.refresh(), 15000)
},
async refresh() {
try {
const res = await fetch('/api/status')
this.services = await res.json()
this.loading = false
this.lastCheck = 'Last checked: ' + new Date().toLocaleTimeString()
} catch (e) {
this.loading = false
}
},
async startSvc(svc) {
svc.busy = true
try {
const res = await fetch('/api/start/' + svc.id)
const result = await res.json()
if (result.ok) {
this.showToast(svc.name + ' started')
await sleep(2000)
await this.refresh()
} else {
this.showToast(svc.name + ' failed: ' + (result.error || 'unknown'))
}
} catch (e) {
this.showToast(svc.name + ' error: ' + e.message)
}
svc.busy = false
},
async stopSvc(svc) {
// Restart = we can't cleanly stop from here without sudo, so we just refresh
this.showToast(svc.name + ' — restart via stop not implemented yet')
await this.refresh()
svc.busy = false
},
showToast(msg) {
this.toast = msg
setTimeout(() => this.toast = null, 3000)
}
}
}
</script>
<template x-if="toast">
<div class="toast" x-text="toast"></div>
</template>
</body>
</html>