File size: 7,179 Bytes
f3220aa
 
 
 
 
 
 
 
a47c2e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6339a53
 
 
 
 
 
a47c2e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3220aa
 
 
 
a47c2e0
 
 
 
 
 
 
f3220aa
 
 
a47c2e0
 
f3220aa
a47c2e0
 
 
 
 
 
 
 
 
6339a53
a47c2e0
 
 
 
 
 
 
 
 
 
 
 
 
 
6339a53
a47c2e0
 
 
 
f3220aa
a47c2e0
f3220aa
 
 
a47c2e0
 
f3220aa
a47c2e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f3220aa
a47c2e0
f3220aa
 
 
a47c2e0
 
 
f3220aa
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="refresh" content="10">
    <title>Claude Code Proxy - Admin Dashboard</title>
    <style>
        * { box-sizing: border-box; }
        body {
            background-color: #0d1117;
            color: #c9d1d9;
            font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
            font-size: 13px;
            line-height: 1.5;
            margin: 0;
            padding: 20px;
        }
        .container { max-width: 1200px; margin: 0 auto; }
        .header {
            color: #58a6ff;
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 20px;
        }
        .summary {
            background: #161b22;
            border: 1px solid #30363d;
            border-radius: 6px;
            padding: 12px 16px;
            margin-bottom: 20px;
            font-size: 14px;
        }
        .summary-line {
            color: #8b949e;
        }
        .summary-line span {
            color: #58a6ff;
            font-weight: bold;
        }
        .section {
            background: #161b22;
            border: 1px solid #30363d;
            border-radius: 6px;
            padding: 12px 16px;
            margin-bottom: 20px;
        }
        .section-title {
            color: #58a6ff;
            font-weight: bold;
            margin-bottom: 12px;
            font-size: 14px;
        }
        .divider {
            color: #30363d;
            margin: 8px 0;
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        th {
            text-align: left;
            color: #8b949e;
            font-weight: normal;
            padding: 6px 8px;
            border-bottom: 1px solid #30363d;
            font-size: 12px;
        }
        td {
            padding: 6px 8px;
            border-bottom: 1px solid #21262d;
        }
        tr:last-child td {
            border-bottom: none;
        }
        .session-id {
            color: #f0883e;
            font-family: monospace;
        }
        .provider-badge {
            display: inline-block;
            background: #1f6feb;
            color: #ffffff;
            padding: 2px 6px;
            border-radius: 3px;
            font-size: 11px;
            margin-right: 4px;
        }
        .status-healthy {
            color: #3fb950;
        }
        .status-limited {
            color: #f85149;
        }
        .status-active {
            color: #3fb950;
        }
        .status-idle {
            color: #8b949e;
        }
        .empty {
            color: #8b949e;
            font-style: italic;
        }
        .footer {
            color: #8b949e;
            font-size: 11px;
            text-align: center;
            margin-top: 20px;
        }
        .footer a {
            color: #58a6ff;
            text-decoration: none;
        }
        .footer a:hover {
            text-decoration: underline;
        }
        .number {
            color: #79c0ff;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">Claude Code Proxy - Admin Dashboard</div>

        <div class="summary">
            <div class="summary-line">
                Active Sessions: <span>{{ summary.active_sessions }}</span> &nbsp;|&nbsp;
                Total Requests: <span>{{ summary.total_requests }}</span> &nbsp;|&nbsp;
                Providers: <span>{{ summary.providers }}</span>
            </div>
        </div>

        <div class="section">
            <div class="section-title">Sessions</div>
            {% if sessions %}
            <div class="divider">─────────────────────────────────────────────────────────────</div>
            <table>
                <thead>
                    <tr>
                        <th>Session ID</th>
                        <th>Requests</th>
                        <th>Providers</th>
                        <th>Last Active</th>
                        <th>Req/Min</th>
                        <th>Status</th>
                    </tr>
                </thead>
                <tbody>
                    {% for session in sessions %}
                    <tr>
                        <td class="session-id">{{ session.session_id[:12] }}...</td>
                        <td class="number">{{ session.total_requests }}</td>
                        <td>
                            {% for provider in session.providers %}
                            <span class="provider-badge">{{ provider }}</span>
                            {% endfor %}
                        </td>
                        <td>{{ session.last_activity_display }}</td>
                        <td class="number">{{ session.requests_per_minute }}</td>
                        <td class="{{ session.status_class }}">{{ session.status }}</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            {% else %}
            <p class="empty">No active sessions</p>
            {% endif %}
        </div>

        <div class="section">
            <div class="section-title">Provider Load</div>
            {% if providers %}
            <div class="divider">─────────────────────────────────────────────────────────────</div>
            <table>
                <thead>
                    <tr>
                        <th>Provider</th>
                        <th>Active</th>
                        <th>Sessions</th>
                        <th>Req/Min</th>
                        <th>Status</th>
                    </tr>
                </thead>
                <tbody>
                    {% for provider in providers %}
                    <tr>
                        <td class="session-id">{{ provider.provider_id }}</td>
                        <td class="number">{{ provider.active_requests }}</td>
                        <td class="number">{{ provider.sessions_count }}</td>
                        <td class="number">{{ provider.requests_per_minute }}</td>
                        <td>
                            {% if provider.is_healthy %}
                            <span class="status-healthy">&#10003; {{ provider.status }}</span>
                            {% else %}
                            <span class="status-limited">&#9888; {{ provider.status }}</span>
                            {% endif %}
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            {% else %}
            <p class="empty">No provider data</p>
            {% endif %}
        </div>

        <div class="footer">
            Auto-refreshes every 10 seconds &bull; <a href="/api/admin/sessions">JSON API</a>
        </div>
    </div>
</body>
</html>