@gagandeep023/api-gateway 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +184 -0
- package/dist/backend/index.d.mts +55 -0
- package/dist/backend/index.d.ts +55 -0
- package/dist/backend/index.js +450 -0
- package/dist/backend/index.js.map +1 -0
- package/dist/backend/index.mjs +406 -0
- package/dist/backend/index.mjs.map +1 -0
- package/dist/frontend/GatewayDashboard.css +303 -0
- package/dist/frontend/index.d.mts +8 -0
- package/dist/frontend/index.d.ts +8 -0
- package/dist/frontend/index.js +270 -0
- package/dist/frontend/index.js.map +1 -0
- package/dist/frontend/index.mjs +243 -0
- package/dist/frontend/index.mjs.map +1 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +698 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +650 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/index.d.mts +78 -0
- package/dist/types/index.d.ts +78 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/index.mjs.map +1 -0
- package/package.json +100 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/* @gagandeep023/api-gateway - Dashboard Styles
|
|
2
|
+
Override --gw-* CSS custom properties to match your theme. */
|
|
3
|
+
|
|
4
|
+
.gw-dashboard {
|
|
5
|
+
--gw-bg-primary: #0a0a0a;
|
|
6
|
+
--gw-bg-card: #1a1a1a;
|
|
7
|
+
--gw-border: #2a2a2a;
|
|
8
|
+
--gw-border-light: #3a3a3a;
|
|
9
|
+
--gw-text-primary: #e0e0e0;
|
|
10
|
+
--gw-text-secondary: #b0b0b0;
|
|
11
|
+
--gw-text-muted: #888888;
|
|
12
|
+
--gw-accent: #64ffda;
|
|
13
|
+
--gw-danger: #cc4444;
|
|
14
|
+
--gw-warning: #ffd93d;
|
|
15
|
+
--gw-radius: 12px;
|
|
16
|
+
--gw-radius-sm: 8px;
|
|
17
|
+
--gw-font-mono: 'JetBrains Mono', 'Fira Code', monospace;
|
|
18
|
+
--gw-transition: 0.2s ease;
|
|
19
|
+
|
|
20
|
+
color: var(--gw-text-primary);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.gw-header {
|
|
24
|
+
margin-bottom: 40px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.gw-header h1 {
|
|
28
|
+
font-size: 2rem;
|
|
29
|
+
color: var(--gw-text-primary);
|
|
30
|
+
margin: 0 0 8px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.gw-header p {
|
|
34
|
+
color: var(--gw-text-secondary);
|
|
35
|
+
font-size: 0.95rem;
|
|
36
|
+
margin: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.gw-status-badge {
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 6px;
|
|
43
|
+
margin-top: 12px;
|
|
44
|
+
padding: 4px 12px;
|
|
45
|
+
border-radius: 20px;
|
|
46
|
+
font-size: 0.8rem;
|
|
47
|
+
font-family: var(--gw-font-mono);
|
|
48
|
+
background: rgba(100, 255, 218, 0.1);
|
|
49
|
+
color: var(--gw-accent);
|
|
50
|
+
border: 1px solid rgba(100, 255, 218, 0.2);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.gw-status-dot {
|
|
54
|
+
width: 6px;
|
|
55
|
+
height: 6px;
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
background: var(--gw-accent);
|
|
58
|
+
animation: gw-pulse 2s infinite;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@keyframes gw-pulse {
|
|
62
|
+
0%, 100% { opacity: 1; }
|
|
63
|
+
50% { opacity: 0.4; }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.gw-stats-grid {
|
|
67
|
+
display: grid;
|
|
68
|
+
grid-template-columns: repeat(4, 1fr);
|
|
69
|
+
gap: 16px;
|
|
70
|
+
margin-bottom: 32px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.gw-stat-card {
|
|
74
|
+
background: var(--gw-bg-card);
|
|
75
|
+
border: 1px solid var(--gw-border);
|
|
76
|
+
border-radius: var(--gw-radius-sm);
|
|
77
|
+
padding: 20px;
|
|
78
|
+
transition: border-color var(--gw-transition);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.gw-stat-card:hover {
|
|
82
|
+
border-color: var(--gw-border-light);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.gw-stat-label {
|
|
86
|
+
font-size: 0.8rem;
|
|
87
|
+
color: var(--gw-text-secondary);
|
|
88
|
+
text-transform: uppercase;
|
|
89
|
+
letter-spacing: 0.5px;
|
|
90
|
+
margin-bottom: 8px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.gw-stat-value {
|
|
94
|
+
font-size: 1.8rem;
|
|
95
|
+
font-weight: 700;
|
|
96
|
+
color: var(--gw-text-primary);
|
|
97
|
+
font-family: var(--gw-font-mono);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.gw-stat-value.gw-accent {
|
|
101
|
+
color: var(--gw-accent);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.gw-stat-value.gw-danger {
|
|
105
|
+
color: var(--gw-danger);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.gw-stat-value.gw-warning {
|
|
109
|
+
color: var(--gw-warning);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.gw-charts-row {
|
|
113
|
+
display: grid;
|
|
114
|
+
grid-template-columns: 2fr 1fr;
|
|
115
|
+
gap: 24px;
|
|
116
|
+
margin-bottom: 32px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.gw-chart-card {
|
|
120
|
+
background: var(--gw-bg-card);
|
|
121
|
+
border: 1px solid var(--gw-border);
|
|
122
|
+
border-radius: var(--gw-radius);
|
|
123
|
+
padding: 24px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.gw-chart-title {
|
|
127
|
+
font-size: 0.9rem;
|
|
128
|
+
color: var(--gw-text-secondary);
|
|
129
|
+
margin-bottom: 16px;
|
|
130
|
+
text-transform: uppercase;
|
|
131
|
+
letter-spacing: 0.5px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.gw-logs-section {
|
|
135
|
+
background: var(--gw-bg-card);
|
|
136
|
+
border: 1px solid var(--gw-border);
|
|
137
|
+
border-radius: var(--gw-radius);
|
|
138
|
+
padding: 24px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.gw-logs-title {
|
|
142
|
+
font-size: 0.9rem;
|
|
143
|
+
color: var(--gw-text-secondary);
|
|
144
|
+
margin-bottom: 16px;
|
|
145
|
+
text-transform: uppercase;
|
|
146
|
+
letter-spacing: 0.5px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.gw-logs-table {
|
|
150
|
+
width: 100%;
|
|
151
|
+
border-collapse: collapse;
|
|
152
|
+
font-family: var(--gw-font-mono);
|
|
153
|
+
font-size: 0.8rem;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.gw-logs-table th {
|
|
157
|
+
text-align: left;
|
|
158
|
+
padding: 8px 12px;
|
|
159
|
+
color: var(--gw-text-muted);
|
|
160
|
+
border-bottom: 1px solid var(--gw-border);
|
|
161
|
+
font-weight: 500;
|
|
162
|
+
text-transform: uppercase;
|
|
163
|
+
letter-spacing: 0.5px;
|
|
164
|
+
font-size: 0.7rem;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.gw-logs-table td {
|
|
168
|
+
padding: 8px 12px;
|
|
169
|
+
color: var(--gw-text-secondary);
|
|
170
|
+
border-bottom: 1px solid rgba(42, 42, 42, 0.5);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.gw-logs-table tr:hover td {
|
|
174
|
+
color: var(--gw-text-primary);
|
|
175
|
+
background: rgba(255, 255, 255, 0.02);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.gw-method-badge {
|
|
179
|
+
padding: 2px 8px;
|
|
180
|
+
border-radius: 4px;
|
|
181
|
+
font-size: 0.7rem;
|
|
182
|
+
font-weight: 600;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.gw-method-get {
|
|
186
|
+
background: rgba(100, 255, 218, 0.1);
|
|
187
|
+
color: var(--gw-accent);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.gw-method-post {
|
|
191
|
+
background: rgba(255, 217, 61, 0.1);
|
|
192
|
+
color: var(--gw-warning);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.gw-method-delete {
|
|
196
|
+
background: rgba(255, 107, 107, 0.1);
|
|
197
|
+
color: var(--gw-danger);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.gw-status-ok {
|
|
201
|
+
color: var(--gw-accent);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.gw-status-error {
|
|
205
|
+
color: var(--gw-danger);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.gw-status-rate-limit {
|
|
209
|
+
color: var(--gw-warning);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.gw-config-section {
|
|
213
|
+
margin-top: 32px;
|
|
214
|
+
display: grid;
|
|
215
|
+
grid-template-columns: repeat(3, 1fr);
|
|
216
|
+
gap: 24px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.gw-config-card {
|
|
220
|
+
background: var(--gw-bg-card);
|
|
221
|
+
border: 1px solid var(--gw-border);
|
|
222
|
+
border-radius: var(--gw-radius);
|
|
223
|
+
padding: 24px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.gw-config-card h3 {
|
|
227
|
+
font-size: 0.9rem;
|
|
228
|
+
color: var(--gw-text-secondary);
|
|
229
|
+
margin: 0 0 16px;
|
|
230
|
+
text-transform: uppercase;
|
|
231
|
+
letter-spacing: 0.5px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.gw-tier-item {
|
|
235
|
+
display: flex;
|
|
236
|
+
justify-content: space-between;
|
|
237
|
+
align-items: center;
|
|
238
|
+
padding: 8px 0;
|
|
239
|
+
border-bottom: 1px solid rgba(42, 42, 42, 0.5);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.gw-tier-name {
|
|
243
|
+
color: var(--gw-accent);
|
|
244
|
+
font-family: var(--gw-font-mono);
|
|
245
|
+
font-size: 0.85rem;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.gw-tier-detail {
|
|
249
|
+
color: var(--gw-text-muted);
|
|
250
|
+
font-size: 0.8rem;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@media (max-width: 900px) {
|
|
254
|
+
.gw-stats-grid {
|
|
255
|
+
grid-template-columns: repeat(2, 1fr);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.gw-charts-row {
|
|
259
|
+
grid-template-columns: 1fr;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.gw-config-section {
|
|
263
|
+
grid-template-columns: 1fr;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@media (max-width: 768px) {
|
|
268
|
+
.gw-logs-section {
|
|
269
|
+
overflow-x: auto;
|
|
270
|
+
-webkit-overflow-scrolling: touch;
|
|
271
|
+
padding: 16px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.gw-logs-table {
|
|
275
|
+
min-width: 600px;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.gw-header h1 {
|
|
279
|
+
font-size: 1.6rem;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
@media (max-width: 600px) {
|
|
284
|
+
.gw-stats-grid {
|
|
285
|
+
grid-template-columns: 1fr;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.gw-stat-card {
|
|
289
|
+
padding: 16px;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.gw-stat-value {
|
|
293
|
+
font-size: 1.5rem;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.gw-chart-card {
|
|
297
|
+
padding: 16px;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.gw-config-card {
|
|
301
|
+
padding: 16px;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface GatewayDashboardProps {
|
|
4
|
+
apiBaseUrl: string;
|
|
5
|
+
}
|
|
6
|
+
declare function GatewayDashboard({ apiBaseUrl }: GatewayDashboardProps): react_jsx_runtime.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { GatewayDashboard, type GatewayDashboardProps };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface GatewayDashboardProps {
|
|
4
|
+
apiBaseUrl: string;
|
|
5
|
+
}
|
|
6
|
+
declare function GatewayDashboard({ apiBaseUrl }: GatewayDashboardProps): react_jsx_runtime.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { GatewayDashboard, type GatewayDashboardProps };
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/frontend/index.ts
|
|
21
|
+
var frontend_exports = {};
|
|
22
|
+
__export(frontend_exports, {
|
|
23
|
+
GatewayDashboard: () => GatewayDashboard
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(frontend_exports);
|
|
26
|
+
|
|
27
|
+
// src/frontend/GatewayDashboard.tsx
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_recharts = require("recharts");
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
function useGatewayApi(apiBaseUrl, path) {
|
|
32
|
+
const [data, setData] = (0, import_react.useState)(null);
|
|
33
|
+
(0, import_react.useEffect)(() => {
|
|
34
|
+
fetch(`${apiBaseUrl}${path}`).then((r) => r.json()).then(setData).catch(() => {
|
|
35
|
+
});
|
|
36
|
+
}, [apiBaseUrl, path]);
|
|
37
|
+
return { data };
|
|
38
|
+
}
|
|
39
|
+
function GatewayDashboard({ apiBaseUrl }) {
|
|
40
|
+
const [analytics, setAnalytics] = (0, import_react.useState)(null);
|
|
41
|
+
const [rpmHistory, setRpmHistory] = (0, import_react.useState)([]);
|
|
42
|
+
const { data: config } = useGatewayApi(apiBaseUrl, "/gateway/config");
|
|
43
|
+
const { data: logsData } = useGatewayApi(apiBaseUrl, "/gateway/logs?limit=20");
|
|
44
|
+
const eventSourceRef = (0, import_react.useRef)(null);
|
|
45
|
+
(0, import_react.useEffect)(() => {
|
|
46
|
+
const es = new EventSource(`${apiBaseUrl}/gateway/analytics/live`);
|
|
47
|
+
eventSourceRef.current = es;
|
|
48
|
+
es.onmessage = (event) => {
|
|
49
|
+
const data = JSON.parse(event.data);
|
|
50
|
+
setAnalytics(data);
|
|
51
|
+
setRpmHistory((prev) => {
|
|
52
|
+
const next = [
|
|
53
|
+
...prev,
|
|
54
|
+
{ time: (/* @__PURE__ */ new Date()).toLocaleTimeString(), rpm: data.requestsPerMinute }
|
|
55
|
+
];
|
|
56
|
+
return next.slice(-20);
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
return () => {
|
|
60
|
+
es.close();
|
|
61
|
+
};
|
|
62
|
+
}, [apiBaseUrl]);
|
|
63
|
+
const getMethodClass = (method) => {
|
|
64
|
+
switch (method) {
|
|
65
|
+
case "GET":
|
|
66
|
+
return "gw-method-get";
|
|
67
|
+
case "POST":
|
|
68
|
+
return "gw-method-post";
|
|
69
|
+
case "DELETE":
|
|
70
|
+
return "gw-method-delete";
|
|
71
|
+
default:
|
|
72
|
+
return "gw-method-get";
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const getStatusClass = (code) => {
|
|
76
|
+
if (code === 429) return "gw-status-rate-limit";
|
|
77
|
+
if (code >= 400) return "gw-status-error";
|
|
78
|
+
return "gw-status-ok";
|
|
79
|
+
};
|
|
80
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-dashboard", children: [
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-header", children: [
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { children: "API Gateway Dashboard" }),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Real-time monitoring for the API gateway and rate limiter" }),
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-status-badge", children: [
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-status-dot" }),
|
|
86
|
+
"Live"
|
|
87
|
+
] })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-stats-grid", children: [
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-stat-card", children: [
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-label", children: "Total Requests" }),
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-value", children: analytics?.totalRequests ?? 0 })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-stat-card", children: [
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-label", children: "Requests / Min" }),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-value gw-accent", children: analytics?.requestsPerMinute ?? 0 })
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-stat-card", children: [
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-label", children: "Error Rate" }),
|
|
100
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `gw-stat-value ${analytics && analytics.errorRate > 5 ? "gw-danger" : ""}`, children: [
|
|
101
|
+
analytics?.errorRate ?? 0,
|
|
102
|
+
"%"
|
|
103
|
+
] })
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-stat-card", children: [
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-label", children: "Avg Response Time" }),
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-stat-value", children: [
|
|
108
|
+
analytics?.avgResponseTime ?? 0,
|
|
109
|
+
"ms"
|
|
110
|
+
] })
|
|
111
|
+
] })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-stats-grid", style: { marginBottom: 32 }, children: [
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-stat-card", children: [
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-label", children: "Rate Limit Hits" }),
|
|
116
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-value gw-warning", children: analytics?.rateLimitHits ?? 0 })
|
|
117
|
+
] }),
|
|
118
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-stat-card", children: [
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-label", children: "Active IPs" }),
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-value", children: analytics?.activeClients ?? 0 })
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-stat-card", children: [
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-label", children: "Active Key Sessions" }),
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-value", children: analytics?.activeKeyUses ?? 0 })
|
|
125
|
+
] }),
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-stat-card", children: [
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-label", children: "Rate Limit Tiers" }),
|
|
128
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-stat-value", children: config ? Object.keys(config.rateLimits.tiers).length : 0 })
|
|
129
|
+
] })
|
|
130
|
+
] }),
|
|
131
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-charts-row", children: [
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-chart-card", children: [
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-chart-title", children: "Requests Per Minute" }),
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height: 250, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_recharts.LineChart, { data: rpmHistory, children: [
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.CartesianGrid, { strokeDasharray: "3 3", stroke: "var(--gw-border, #2a2a2a)" }),
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.XAxis, { dataKey: "time", tick: { fill: "var(--gw-text-muted, #888)", fontSize: 11 } }),
|
|
137
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.YAxis, { tick: { fill: "var(--gw-text-muted, #888)", fontSize: 11 } }),
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
139
|
+
import_recharts.Tooltip,
|
|
140
|
+
{
|
|
141
|
+
contentStyle: { background: "var(--gw-bg-card, #1a1a1a)", border: "1px solid var(--gw-border, #2a2a2a)", borderRadius: 8 },
|
|
142
|
+
labelStyle: { color: "var(--gw-text-muted, #888)" }
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
146
|
+
import_recharts.Line,
|
|
147
|
+
{
|
|
148
|
+
type: "monotone",
|
|
149
|
+
dataKey: "rpm",
|
|
150
|
+
stroke: "var(--gw-accent, #64ffda)",
|
|
151
|
+
strokeWidth: 2,
|
|
152
|
+
dot: false,
|
|
153
|
+
activeDot: { r: 4, fill: "var(--gw-accent, #64ffda)" }
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
] }) })
|
|
157
|
+
] }),
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-chart-card", children: [
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-chart-title", children: "Top Endpoints" }),
|
|
160
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height: 250, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
161
|
+
import_recharts.BarChart,
|
|
162
|
+
{
|
|
163
|
+
data: analytics?.topEndpoints ?? [],
|
|
164
|
+
layout: "vertical",
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.CartesianGrid, { strokeDasharray: "3 3", stroke: "var(--gw-border, #2a2a2a)" }),
|
|
167
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.XAxis, { type: "number", tick: { fill: "var(--gw-text-muted, #888)", fontSize: 11 } }),
|
|
168
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
169
|
+
import_recharts.YAxis,
|
|
170
|
+
{
|
|
171
|
+
dataKey: "path",
|
|
172
|
+
type: "category",
|
|
173
|
+
tick: { fill: "var(--gw-text-muted, #888)", fontSize: 10 },
|
|
174
|
+
width: 120
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
178
|
+
import_recharts.Tooltip,
|
|
179
|
+
{
|
|
180
|
+
contentStyle: { background: "var(--gw-bg-card, #1a1a1a)", border: "1px solid var(--gw-border, #2a2a2a)", borderRadius: 8 }
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.Bar, { dataKey: "count", fill: "var(--gw-accent, #64ffda)", radius: [0, 4, 4, 0] })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
) })
|
|
187
|
+
] })
|
|
188
|
+
] }),
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-logs-section", children: [
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "gw-logs-title", children: "Recent Requests" }),
|
|
191
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: "gw-logs-table", children: [
|
|
192
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
193
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "Time" }),
|
|
194
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "Method" }),
|
|
195
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "Path" }),
|
|
196
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "Status" }),
|
|
197
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "Duration" }),
|
|
198
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "IP" })
|
|
199
|
+
] }) }),
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tbody", { children: [
|
|
201
|
+
(logsData?.logs ?? []).map((log, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
202
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: new Date(log.timestamp).toLocaleTimeString() }),
|
|
203
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `gw-method-badge ${getMethodClass(log.method)}`, children: log.method }) }),
|
|
204
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: log.path }),
|
|
205
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: getStatusClass(log.statusCode), children: log.statusCode }),
|
|
206
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
207
|
+
log.responseTime,
|
|
208
|
+
"ms"
|
|
209
|
+
] }),
|
|
210
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: log.ip })
|
|
211
|
+
] }, i)),
|
|
212
|
+
(!logsData?.logs || logsData.logs.length === 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { colSpan: 6, style: { textAlign: "center", color: "var(--gw-text-muted, #666)" }, children: "No requests logged yet. Make some API calls to see data here." }) })
|
|
213
|
+
] })
|
|
214
|
+
] })
|
|
215
|
+
] }),
|
|
216
|
+
config && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-config-section", children: [
|
|
217
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-config-card", children: [
|
|
218
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "Rate Limit Tiers" }),
|
|
219
|
+
Object.entries(config.rateLimits.tiers).map(([name, tier]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-tier-item", children: [
|
|
220
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-name", children: name }),
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-detail", children: tier.algorithm === "none" ? "unlimited" : `${tier.maxRequests} req / ${(tier.windowMs || 6e4) / 1e3}s` })
|
|
222
|
+
] }, name))
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-config-card", children: [
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "IP Rules" }),
|
|
226
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-tier-item", children: [
|
|
227
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-name", children: "Mode" }),
|
|
228
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-detail", children: config.ipRules.mode })
|
|
229
|
+
] }),
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-tier-item", children: [
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-name", children: "Allowlist" }),
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-detail", children: config.ipRules.allowlist.length === 0 ? "empty" : config.ipRules.allowlist.length + " IPs" })
|
|
233
|
+
] }),
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-tier-item", children: [
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-name", children: "Blocklist" }),
|
|
236
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-detail", children: config.ipRules.blocklist.length === 0 ? "empty" : config.ipRules.blocklist.length + " IPs" })
|
|
237
|
+
] })
|
|
238
|
+
] }),
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-config-card", children: [
|
|
240
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: "Global Limit" }),
|
|
241
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-tier-item", children: [
|
|
242
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-name", children: "Max Requests" }),
|
|
243
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "gw-tier-detail", children: [
|
|
244
|
+
config.rateLimits.globalLimit.maxRequests,
|
|
245
|
+
" / ",
|
|
246
|
+
config.rateLimits.globalLimit.windowMs / 1e3,
|
|
247
|
+
"s"
|
|
248
|
+
] })
|
|
249
|
+
] }),
|
|
250
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-tier-item", children: [
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-name", children: "Default Tier" }),
|
|
252
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-detail", children: config.rateLimits.defaultTier })
|
|
253
|
+
] }),
|
|
254
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-tier-item", children: [
|
|
255
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-name", children: "Active Keys" }),
|
|
256
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-detail", children: config.activeKeys })
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "gw-tier-item", children: [
|
|
259
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-name", children: "Active Key Sessions" }),
|
|
260
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "gw-tier-detail", children: config.activeKeyUses })
|
|
261
|
+
] })
|
|
262
|
+
] })
|
|
263
|
+
] })
|
|
264
|
+
] });
|
|
265
|
+
}
|
|
266
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
267
|
+
0 && (module.exports = {
|
|
268
|
+
GatewayDashboard
|
|
269
|
+
});
|
|
270
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/frontend/index.ts","../../src/frontend/GatewayDashboard.tsx"],"sourcesContent":["export { GatewayDashboard } from './GatewayDashboard';\nexport type { GatewayDashboardProps } from './GatewayDashboard';\n","import { useState, useEffect, useRef } from 'react';\nimport { LineChart, Line, BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';\nimport type { GatewayAnalytics, GatewayConfig, RequestLog } from '../types';\n\nexport interface GatewayDashboardProps {\n apiBaseUrl: string;\n}\n\ninterface LogsResponse {\n logs: RequestLog[];\n limit: number;\n offset: number;\n}\n\nfunction useGatewayApi<T>(apiBaseUrl: string, path: string): { data: T | null } {\n const [data, setData] = useState<T | null>(null);\n useEffect(() => {\n fetch(`${apiBaseUrl}${path}`)\n .then(r => r.json())\n .then(setData)\n .catch(() => {});\n }, [apiBaseUrl, path]);\n return { data };\n}\n\nexport function GatewayDashboard({ apiBaseUrl }: GatewayDashboardProps) {\n const [analytics, setAnalytics] = useState<GatewayAnalytics | null>(null);\n const [rpmHistory, setRpmHistory] = useState<{ time: string; rpm: number }[]>([]);\n const { data: config } = useGatewayApi<GatewayConfig>(apiBaseUrl, '/gateway/config');\n const { data: logsData } = useGatewayApi<LogsResponse>(apiBaseUrl, '/gateway/logs?limit=20');\n const eventSourceRef = useRef<EventSource | null>(null);\n\n useEffect(() => {\n const es = new EventSource(`${apiBaseUrl}/gateway/analytics/live`);\n eventSourceRef.current = es;\n\n es.onmessage = (event) => {\n const data: GatewayAnalytics = JSON.parse(event.data);\n setAnalytics(data);\n setRpmHistory(prev => {\n const next = [\n ...prev,\n { time: new Date().toLocaleTimeString(), rpm: data.requestsPerMinute },\n ];\n return next.slice(-20);\n });\n };\n\n return () => {\n es.close();\n };\n }, [apiBaseUrl]);\n\n const getMethodClass = (method: string) => {\n switch (method) {\n case 'GET': return 'gw-method-get';\n case 'POST': return 'gw-method-post';\n case 'DELETE': return 'gw-method-delete';\n default: return 'gw-method-get';\n }\n };\n\n const getStatusClass = (code: number) => {\n if (code === 429) return 'gw-status-rate-limit';\n if (code >= 400) return 'gw-status-error';\n return 'gw-status-ok';\n };\n\n return (\n <div className=\"gw-dashboard\">\n <div className=\"gw-header\">\n <h1>API Gateway Dashboard</h1>\n <p>Real-time monitoring for the API gateway and rate limiter</p>\n <div className=\"gw-status-badge\">\n <span className=\"gw-status-dot\" />\n Live\n </div>\n </div>\n\n {/* Stats Grid */}\n <div className=\"gw-stats-grid\">\n <div className=\"gw-stat-card\">\n <div className=\"gw-stat-label\">Total Requests</div>\n <div className=\"gw-stat-value\">{analytics?.totalRequests ?? 0}</div>\n </div>\n <div className=\"gw-stat-card\">\n <div className=\"gw-stat-label\">Requests / Min</div>\n <div className=\"gw-stat-value gw-accent\">\n {analytics?.requestsPerMinute ?? 0}\n </div>\n </div>\n <div className=\"gw-stat-card\">\n <div className=\"gw-stat-label\">Error Rate</div>\n <div className={`gw-stat-value ${analytics && analytics.errorRate > 5 ? 'gw-danger' : ''}`}>\n {analytics?.errorRate ?? 0}%\n </div>\n </div>\n <div className=\"gw-stat-card\">\n <div className=\"gw-stat-label\">Avg Response Time</div>\n <div className=\"gw-stat-value\">{analytics?.avgResponseTime ?? 0}ms</div>\n </div>\n </div>\n\n {/* Second Row Stats */}\n <div className=\"gw-stats-grid\" style={{ marginBottom: 32 }}>\n <div className=\"gw-stat-card\">\n <div className=\"gw-stat-label\">Rate Limit Hits</div>\n <div className=\"gw-stat-value gw-warning\">\n {analytics?.rateLimitHits ?? 0}\n </div>\n </div>\n <div className=\"gw-stat-card\">\n <div className=\"gw-stat-label\">Active IPs</div>\n <div className=\"gw-stat-value\">{analytics?.activeClients ?? 0}</div>\n </div>\n <div className=\"gw-stat-card\">\n <div className=\"gw-stat-label\">Active Key Sessions</div>\n <div className=\"gw-stat-value\">{analytics?.activeKeyUses ?? 0}</div>\n </div>\n <div className=\"gw-stat-card\">\n <div className=\"gw-stat-label\">Rate Limit Tiers</div>\n <div className=\"gw-stat-value\">\n {config ? Object.keys(config.rateLimits.tiers).length : 0}\n </div>\n </div>\n </div>\n\n {/* Charts Row */}\n <div className=\"gw-charts-row\">\n <div className=\"gw-chart-card\">\n <div className=\"gw-chart-title\">Requests Per Minute</div>\n <ResponsiveContainer width=\"100%\" height={250}>\n <LineChart data={rpmHistory}>\n <CartesianGrid strokeDasharray=\"3 3\" stroke=\"var(--gw-border, #2a2a2a)\" />\n <XAxis dataKey=\"time\" tick={{ fill: 'var(--gw-text-muted, #888)', fontSize: 11 }} />\n <YAxis tick={{ fill: 'var(--gw-text-muted, #888)', fontSize: 11 }} />\n <Tooltip\n contentStyle={{ background: 'var(--gw-bg-card, #1a1a1a)', border: '1px solid var(--gw-border, #2a2a2a)', borderRadius: 8 }}\n labelStyle={{ color: 'var(--gw-text-muted, #888)' }}\n />\n <Line\n type=\"monotone\"\n dataKey=\"rpm\"\n stroke=\"var(--gw-accent, #64ffda)\"\n strokeWidth={2}\n dot={false}\n activeDot={{ r: 4, fill: 'var(--gw-accent, #64ffda)' }}\n />\n </LineChart>\n </ResponsiveContainer>\n </div>\n\n <div className=\"gw-chart-card\">\n <div className=\"gw-chart-title\">Top Endpoints</div>\n <ResponsiveContainer width=\"100%\" height={250}>\n <BarChart\n data={analytics?.topEndpoints ?? []}\n layout=\"vertical\"\n >\n <CartesianGrid strokeDasharray=\"3 3\" stroke=\"var(--gw-border, #2a2a2a)\" />\n <XAxis type=\"number\" tick={{ fill: 'var(--gw-text-muted, #888)', fontSize: 11 }} />\n <YAxis\n dataKey=\"path\"\n type=\"category\"\n tick={{ fill: 'var(--gw-text-muted, #888)', fontSize: 10 }}\n width={120}\n />\n <Tooltip\n contentStyle={{ background: 'var(--gw-bg-card, #1a1a1a)', border: '1px solid var(--gw-border, #2a2a2a)', borderRadius: 8 }}\n />\n <Bar dataKey=\"count\" fill=\"var(--gw-accent, #64ffda)\" radius={[0, 4, 4, 0]} />\n </BarChart>\n </ResponsiveContainer>\n </div>\n </div>\n\n {/* Recent Logs */}\n <div className=\"gw-logs-section\">\n <div className=\"gw-logs-title\">Recent Requests</div>\n <table className=\"gw-logs-table\">\n <thead>\n <tr>\n <th>Time</th>\n <th>Method</th>\n <th>Path</th>\n <th>Status</th>\n <th>Duration</th>\n <th>IP</th>\n </tr>\n </thead>\n <tbody>\n {(logsData?.logs ?? []).map((log, i) => (\n <tr key={i}>\n <td>{new Date(log.timestamp).toLocaleTimeString()}</td>\n <td>\n <span className={`gw-method-badge ${getMethodClass(log.method)}`}>\n {log.method}\n </span>\n </td>\n <td>{log.path}</td>\n <td className={getStatusClass(log.statusCode)}>{log.statusCode}</td>\n <td>{log.responseTime}ms</td>\n <td>{log.ip}</td>\n </tr>\n ))}\n {(!logsData?.logs || logsData.logs.length === 0) && (\n <tr>\n <td colSpan={6} style={{ textAlign: 'center', color: 'var(--gw-text-muted, #666)' }}>\n No requests logged yet. Make some API calls to see data here.\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </div>\n\n {/* Config Section */}\n {config && (\n <div className=\"gw-config-section\">\n <div className=\"gw-config-card\">\n <h3>Rate Limit Tiers</h3>\n {Object.entries(config.rateLimits.tiers).map(([name, tier]) => (\n <div key={name} className=\"gw-tier-item\">\n <span className=\"gw-tier-name\">{name}</span>\n <span className=\"gw-tier-detail\">\n {tier.algorithm === 'none'\n ? 'unlimited'\n : `${tier.maxRequests} req / ${(tier.windowMs || 60000) / 1000}s`}\n </span>\n </div>\n ))}\n </div>\n\n <div className=\"gw-config-card\">\n <h3>IP Rules</h3>\n <div className=\"gw-tier-item\">\n <span className=\"gw-tier-name\">Mode</span>\n <span className=\"gw-tier-detail\">{config.ipRules.mode}</span>\n </div>\n <div className=\"gw-tier-item\">\n <span className=\"gw-tier-name\">Allowlist</span>\n <span className=\"gw-tier-detail\">\n {config.ipRules.allowlist.length === 0 ? 'empty' : config.ipRules.allowlist.length + ' IPs'}\n </span>\n </div>\n <div className=\"gw-tier-item\">\n <span className=\"gw-tier-name\">Blocklist</span>\n <span className=\"gw-tier-detail\">\n {config.ipRules.blocklist.length === 0 ? 'empty' : config.ipRules.blocklist.length + ' IPs'}\n </span>\n </div>\n </div>\n\n <div className=\"gw-config-card\">\n <h3>Global Limit</h3>\n <div className=\"gw-tier-item\">\n <span className=\"gw-tier-name\">Max Requests</span>\n <span className=\"gw-tier-detail\">\n {config.rateLimits.globalLimit.maxRequests} / {config.rateLimits.globalLimit.windowMs / 1000}s\n </span>\n </div>\n <div className=\"gw-tier-item\">\n <span className=\"gw-tier-name\">Default Tier</span>\n <span className=\"gw-tier-detail\">{config.rateLimits.defaultTier}</span>\n </div>\n <div className=\"gw-tier-item\">\n <span className=\"gw-tier-name\">Active Keys</span>\n <span className=\"gw-tier-detail\">{config.activeKeys}</span>\n </div>\n <div className=\"gw-tier-item\">\n <span className=\"gw-tier-name\">Active Key Sessions</span>\n <span className=\"gw-tier-detail\">{config.activeKeyUses}</span>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA4C;AAC5C,sBAA0G;AAsElG;AAzDR,SAAS,cAAiB,YAAoB,MAAkC;AAC9E,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAmB,IAAI;AAC/C,8BAAU,MAAM;AACd,UAAM,GAAG,UAAU,GAAG,IAAI,EAAE,EACzB,KAAK,OAAK,EAAE,KAAK,CAAC,EAClB,KAAK,OAAO,EACZ,MAAM,MAAM;AAAA,IAAC,CAAC;AAAA,EACnB,GAAG,CAAC,YAAY,IAAI,CAAC;AACrB,SAAO,EAAE,KAAK;AAChB;AAEO,SAAS,iBAAiB,EAAE,WAAW,GAA0B;AACtE,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAkC,IAAI;AACxE,QAAM,CAAC,YAAY,aAAa,QAAI,uBAA0C,CAAC,CAAC;AAChF,QAAM,EAAE,MAAM,OAAO,IAAI,cAA6B,YAAY,iBAAiB;AACnF,QAAM,EAAE,MAAM,SAAS,IAAI,cAA4B,YAAY,wBAAwB;AAC3F,QAAM,qBAAiB,qBAA2B,IAAI;AAEtD,8BAAU,MAAM;AACd,UAAM,KAAK,IAAI,YAAY,GAAG,UAAU,yBAAyB;AACjE,mBAAe,UAAU;AAEzB,OAAG,YAAY,CAAC,UAAU;AACxB,YAAM,OAAyB,KAAK,MAAM,MAAM,IAAI;AACpD,mBAAa,IAAI;AACjB,oBAAc,UAAQ;AACpB,cAAM,OAAO;AAAA,UACX,GAAG;AAAA,UACH,EAAE,OAAM,oBAAI,K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