Matthias Nott
2026-02-22 7d94ec0d18b46893e23680cf8438109a34cc2a10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>OPS Dashboard</title>
  <script src="https://cdn.tailwindcss.com"></script>
  <link rel="stylesheet" href="/static/css/style.css?v=10">
  <style>
    body { background: #0f172a; color: #e2e8f0; margin: 0; }
    #app { display: flex; min-height: 100vh; }
    #sidebar { width: 240px; background: #111827; border-right: 1px solid #1f2937; display: flex; flex-direction: column; flex-shrink: 0; }
    #main { flex: 1; display: flex; flex-direction: column; overflow-x: hidden; }
    #topbar { background: #111827; border-bottom: 1px solid #1f2937; padding: 0.75rem 1.5rem; display: flex; align-items: center; gap: 1rem; }
    #page-content { flex: 1; padding: 1.5rem; overflow-y: auto; }
    .breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: #9ca3af; flex-wrap: wrap; }
    .breadcrumb a { color: #60a5fa; cursor: pointer; text-decoration: none; }
    .breadcrumb a:hover { text-decoration: underline; }
    .breadcrumb .sep { color: #4b5563; }
    .breadcrumb .current { color: #e2e8f0; font-weight: 500; }
    .hamburger { display: none; background: none; border: none; color: #9ca3af; font-size: 1.5rem; cursor: pointer; padding: 0.25rem; }
    .sidebar-logo { padding: 1.25rem 1rem; font-size: 1.125rem; font-weight: 700; color: #f3f4f6; border-bottom: 1px solid #1f2937; display: flex; align-items: center; gap: 0.5rem; }
    .sidebar-nav { padding: 0.75rem 0.5rem; flex: 1; }
    .sidebar-footer { padding: 0.75rem 1rem; border-top: 1px solid #1f2937; font-size: 0.75rem; color: #6b7280; }
    .grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
    .grid-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; }
    .grid-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
    .card-clickable { cursor: pointer; transition: border-color 0.2s, transform 0.15s; }
    .card-clickable:hover { border-color: #60a5fa; transform: translateY(-1px); }
    .stat-tile { cursor: pointer; transition: border-color 0.2s, transform 0.1s; }
    .stat-tile:hover { border-color: #60a5fa; transform: translateY(-2px); }
    .filter-badge { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
    .filter-badge button { background: none; border: none; color: #60a5fa; cursor: pointer; font-size: 0.875rem; padding: 0; line-height: 1; }
    .filter-badge button:hover { color: #f87171; }
    .view-toggle { display: flex; background: #1f2937; border-radius: 0.375rem; overflow: hidden; border: 1px solid #374151; }
    .view-toggle button { background: none; border: none; color: #6b7280; padding: 0.25rem 0.5rem; font-size: 0.75rem; cursor: pointer; display: flex; align-items: center; gap: 0.25rem; }
    .view-toggle button.active { background: rgba(59,130,246,0.2); color: #60a5fa; }
    .view-toggle button:hover:not(.active) { color: #d1d5db; }
    .mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 40; }
    @media (max-width: 768px) {
      #sidebar { position: fixed; left: -240px; top: 0; bottom: 0; z-index: 50; transition: left 0.2s; }
      #sidebar.open { left: 0; }
      .mobile-overlay.open { display: block; }
      .hamburger { display: block; }
      .grid-auto { grid-template-columns: 1fr; }
      .grid-stats { grid-template-columns: repeat(2, 1fr); }
    }
  </style>
</head>
<body>
<!-- Login Overlay -->
<div id="login-overlay" style="position:fixed;inset:0;background:#0f172a;z-index:100;display:flex;align-items:center;justify-content:center;">
  <div class="card" style="width:100%;max-width:380px;text-align:center;">
    <div style="font-size:1.5rem;font-weight:700;margin-bottom:1.5rem;color:#f3f4f6;">OPS Dashboard</div>
    <input type="password" id="login-token" placeholder="Enter access token" class="form-input" style="margin-bottom:1rem;"
      onkeydown="if(event.key==='Enter')doLogin()">
    <button onclick="doLogin()" class="btn btn-primary" style="width:100%;">Login</button>
    <div id="login-error" style="color:#f87171;font-size:0.875rem;margin-top:0.75rem;display:none;"></div>
  </div>
</div>
<!-- App Shell -->
<div id="app" style="display:none;">
  <div id="mobile-overlay" class="mobile-overlay" onclick="toggleSidebar()"></div>
  <!-- Sidebar -->
  <aside id="sidebar">
    <div class="sidebar-logo">
      <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#60a5fa" stroke-width="2"><rect x="2" y="2" width="20" height="8" rx="2"/><rect x="2" y="14" width="20" height="8" rx="2"/><circle cx="6" cy="6" r="1" fill="#60a5fa"/><circle cx="6" cy="18" r="1" fill="#60a5fa"/></svg>
      OPS Dashboard
    </div>
    <nav class="sidebar-nav" id="sidebar-nav">
      <a class="sidebar-link active" data-page="dashboard" onclick="showPage('dashboard')">
        <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>
        Dashboard
      </a>
      <a class="sidebar-link" data-page="backups" onclick="showPage('backups')">
        <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
        Backups
      </a>
      <a class="sidebar-link" data-page="operations" onclick="showPage('operations')">
        <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg>
        Operations
      </a>
      <a class="sidebar-link" data-page="system" onclick="showPage('system')">
        <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z"/></svg>
        System
      </a>
    </nav>
    <div class="sidebar-footer" id="sidebar-footer">
      <a onclick="doLogout()" style="color:#9ca3af;cursor:pointer;">Logout</a><div id="app-version" style="margin-top:0.5rem;color:#4b5563;font-size:0.625rem;"></div>
    </div>
  </aside>
  <!-- Main Content -->
  <div id="main">
    <div id="topbar">
      <button class="hamburger" onclick="toggleSidebar()">&#9776;</button>
      <div id="breadcrumbs" class="breadcrumb" style="flex:1;"></div>
      <div id="view-toggle-wrap" style="display:none;">
        <div class="view-toggle">
          <button id="btn-view-cards" class="active" onclick="setViewMode('cards')" title="Card view">
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/></svg>
            Cards
          </button>
          <button id="btn-view-table" onclick="setViewMode('table')" title="Table view">
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
            Table
          </button>
        </div>
      </div>
      <div style="display:flex;align-items:center;gap:0.75rem;">
        <div id="refresh-indicator" class="refresh-ring paused" title="Auto-refresh"></div>
        <button class="btn btn-ghost btn-xs" onclick="refreshCurrentPage()" title="Refresh now">Refresh</button>
      </div>
    </div>
    <div id="page-content"></div>
  </div>
</div>
<!-- Toast Container -->
<div id="toast-container" class="toast-container"></div>
<!-- Log Modal -->
<div id="log-modal" class="modal-overlay" style="display:none;" onclick="if(event.target===this)closeLogModal()">
  <div class="modal-box" style="max-width:800px;">
    <div class="modal-header">
      <span id="log-modal-title" style="font-weight:600;color:#f3f4f6;">Container Logs</span>
      <button onclick="closeLogModal()" style="background:none;border:none;color:#9ca3af;font-size:1.25rem;cursor:pointer;">&times;</button>
    </div>
    <div class="modal-body" style="padding:0;">
      <div id="log-modal-content" class="terminal" style="max-height:60vh;border:none;border-radius:0;"></div>
    </div>
    <div class="modal-footer">
      <button class="btn btn-ghost btn-sm" onclick="closeLogModal()">Close</button>
      <button class="btn btn-primary btn-sm" onclick="refreshLogs()">Refresh</button>
    </div>
  </div>
</div>
<!-- Restore Modal -->
<div id="restore-modal" class="modal-overlay" style="display:none;" onclick="if(event.target===this)closeRestoreModal()">
  <div class="modal-box" style="max-width:640px;">
    <div class="modal-header">
      <span style="font-weight:600;color:#f3f4f6;">Restore Backup</span>
      <button onclick="closeRestoreModal()" style="background:none;border:none;color:#9ca3af;font-size:1.25rem;cursor:pointer;">&times;</button>
    </div>
    <div class="modal-body">
      <!-- Info rows -->
      <div class="restore-info-row">
        <span class="restore-info-label">Target</span>
        <span class="restore-info-value" id="restore-modal-project"></span>
      </div>
      <div class="restore-info-row" id="restore-source-row">
        <span class="restore-info-label">Source</span>
        <span class="restore-info-value" id="restore-modal-source"></span>
      </div>
      <div id="restore-source-selector" style="display:none;margin-bottom:0.625rem;">
        <div style="display:flex;align-items:baseline;gap:0.75rem;font-size:0.875rem;">
          <span class="restore-info-label">Source</span>
          <label style="display:flex;align-items:center;gap:0.375rem;color:#d1d5db;cursor:pointer;">
            <input type="radio" name="restore-source" value="local" checked style="accent-color:#3b82f6;"> Local
          </label>
          <label style="display:flex;align-items:center;gap:0.375rem;color:#d1d5db;cursor:pointer;">
            <input type="radio" name="restore-source" value="offsite" style="accent-color:#3b82f6;"> Offsite
          </label>
        </div>
      </div>
      <div class="restore-info-row" style="margin-bottom:1rem;">
        <span class="restore-info-label">Backup</span>
        <span class="restore-info-value mono" id="restore-modal-name" style="font-size:0.8125rem;word-break:break-all;"></span>
      </div>
<!-- Restore mode selector -->      <div style="margin-bottom:1rem;">        <div style="font-size:0.8125rem;font-weight:500;color:#9ca3af;margin-bottom:0.5rem;">Restore Mode</div>        <div style="display:flex;gap:1rem;">          <label style="display:flex;align-items:center;gap:0.375rem;font-size:0.875rem;color:#d1d5db;cursor:pointer;">            <input type="radio" name="restore-mode" value="full" checked style="accent-color:#3b82f6;"> Full          </label>          <label style="display:flex;align-items:center;gap:0.375rem;font-size:0.875rem;color:#d1d5db;cursor:pointer;">            <input type="radio" name="restore-mode" value="db" style="accent-color:#3b82f6;"> Database only          </label>          <label style="display:flex;align-items:center;gap:0.375rem;font-size:0.875rem;color:#d1d5db;cursor:pointer;">            <input type="radio" name="restore-mode" value="wp" style="accent-color:#3b82f6;"> WP-Content only          </label>        </div>      </div>      <!-- Dry run checkbox -->      <label style="display:flex;align-items:center;gap:0.5rem;font-size:0.875rem;color:#d1d5db;cursor:pointer;margin-bottom:1rem;">        <input type="checkbox" id="restore-dry-run" checked style="width:1rem;height:1rem;accent-color:#3b82f6;">        Dry run (preview only — no changes made)      </label>      <!-- Warning -->
      <div style="background:rgba(220,38,38,0.1);border:1px solid rgba(220,38,38,0.3);border-radius:0.5rem;padding:0.75rem 1rem;font-size:0.8125rem;color:#fca5a5;margin-bottom:1rem;">
        Warning: a real restore will stop services, replace data, and restart containers.
        Always run a dry run first.
      </div>
      <!-- SSE output (shown after start) -->
      <div id="restore-modal-output" style="display:none;">
        <div style="font-size:0.8125rem;font-weight:500;color:#9ca3af;margin-bottom:0.375rem;">Output</div>
        <div id="restore-modal-terminal" class="terminal" style="max-height:300px;"></div>
      </div>
    </div>
    <div class="modal-footer">
      <button class="btn btn-ghost btn-sm" onclick="closeRestoreModal()">Cancel</button>
      <button id="restore-start-btn" class="btn btn-danger btn-sm" onclick="startRestore()">Start Restore</button>
    </div>
  </div>
</div>
<!-- Operations Modal -->
<div id="ops-modal" class="modal-overlay" style="display:none;" onclick="if(event.target===this)closeOpsModal()">
  <div class="modal-box" style="max-width:700px;">
    <div class="modal-header">
      <span id="ops-modal-title" style="font-weight:600;color:#f3f4f6;">Operation</span>
      <button onclick="closeOpsModal()" style="background:none;border:none;color:#9ca3af;font-size:1.25rem;cursor:pointer;">&times;</button>
    </div>
    <div class="modal-body">
      <div id="ops-modal-info" style="margin-bottom:1rem;"></div>
      <label id="ops-dry-run-row" style="display:flex;align-items:center;gap:0.5rem;font-size:0.875rem;color:#d1d5db;cursor:pointer;margin-bottom:1rem;">
        <input type="checkbox" id="ops-dry-run" checked style="width:1rem;height:1rem;accent-color:#3b82f6;">
        Dry run (preview only)
      </label>
      <div id="ops-modal-output" style="display:none;">
        <div style="font-size:0.8125rem;font-weight:500;color:#9ca3af;margin-bottom:0.375rem;">Output</div>
        <div id="ops-modal-terminal" class="terminal" style="max-height:350px;"></div>
      </div>
    </div>
    <div class="modal-footer">
      <button class="btn btn-ghost btn-sm" onclick="closeOpsModal()">Cancel</button>
      <button id="ops-start-btn" class="btn btn-primary btn-sm" onclick="startOperation()">Start</button>
    </div>
  </div>
</div>
<script src="/static/js/app.js?v=12"></script>
</body>
</html>