@littlebearapps/platform-admin-sdk 2.1.0 → 2.3.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/README.md +2 -5
- package/dist/check-upgrade.d.ts +29 -0
- package/dist/check-upgrade.js +97 -0
- package/dist/index.js +59 -4
- package/dist/manifest.d.ts +2 -0
- package/dist/scaffold.js +5 -1
- package/dist/templates.d.ts +6 -1
- package/dist/templates.js +141 -3
- package/dist/upgrade.d.ts +1 -0
- package/dist/upgrade.js +21 -2
- package/package.json +1 -1
- package/templates/full/dashboard/src/components/notifications/NotificationDropdown.tsx +130 -0
- package/templates/full/dashboard/src/components/notifications/NotificationItem.tsx +264 -0
- package/templates/full/dashboard/src/components/patterns/PatternInfoButton.tsx +60 -0
- package/templates/full/dashboard/src/components/reports/FeatureUsageReport.tsx +339 -0
- package/templates/full/dashboard/src/components/search/SearchResultGroup.tsx +46 -0
- package/templates/full/dashboard/src/components/search/SearchResultItem.tsx +212 -0
- package/templates/full/dashboard/src/pages/api/patterns/[id]/approve.ts +49 -0
- package/templates/full/dashboard/src/pages/api/patterns/[id]/reject.ts +50 -0
- package/templates/full/dashboard/src/pages/api/reports/digests/stats.ts +38 -0
- package/templates/full/dashboard/src/pages/api/reports/digests.ts +39 -0
- package/templates/full/dashboard/src/pages/api/search/reindex/[type].ts +56 -0
- package/templates/full/dashboard/src/pages/api/test-reports/[id].ts +102 -0
- package/templates/full/dashboard/src/pages/feedback.astro +365 -0
- package/templates/full/dashboard/src/pages/kiosk.astro +206 -0
- package/templates/full/dashboard/src/pages/map.astro +561 -0
- package/templates/full/dashboard/src/pages/revenue.astro +72 -0
- package/templates/full/dashboard/src/pages/tests.astro +431 -0
- package/templates/full/scripts/ops/audit-cost-anomaly.ts +430 -0
- package/templates/full/scripts/ops/verify-account-total.ts +256 -0
- package/templates/full/tests/integration/feedback-schema.test.ts +361 -0
- package/templates/full/tests/integration/r2-archive.test.ts +108 -0
- package/templates/shared/.github/workflows/dependabot-automerge.yml +41 -0
- package/templates/shared/.github/workflows/validate-controls.yml +27 -0
- package/templates/shared/dashboard/src/components/Breadcrumbs.astro +101 -0
- package/templates/shared/dashboard/src/components/EmptyState.astro +46 -0
- package/templates/shared/dashboard/src/components/ErrorBoundary.astro +79 -0
- package/templates/shared/dashboard/src/components/LoadingSkeleton.astro +105 -0
- package/templates/shared/dashboard/src/components/PageShell.astro +72 -0
- package/templates/shared/dashboard/src/components/SkipLinks.astro +22 -0
- package/templates/shared/dashboard/src/components/Toast.astro +170 -0
- package/templates/shared/dashboard/src/components/ToastContainer.astro +156 -0
- package/templates/shared/dashboard/src/components/costs/ProviderCostsGrid.tsx +401 -0
- package/templates/shared/dashboard/src/components/costs/index.ts +4 -0
- package/templates/shared/dashboard/src/components/overview/AlertBanner.tsx +94 -0
- package/templates/shared/dashboard/src/components/overview/index.ts +9 -0
- package/templates/shared/dashboard/src/components/resources/CostChart.tsx +170 -0
- package/templates/shared/dashboard/src/components/resources/ProviderCard.tsx +272 -0
- package/templates/shared/dashboard/src/components/resources/ProviderDetail.tsx +293 -0
- package/templates/shared/dashboard/src/components/settings/SettingsCard.astro +102 -0
- package/templates/shared/dashboard/src/components/usage/AllowanceGauge.astro +170 -0
- package/templates/shared/dashboard/src/components/usage/AnomalyAlerts.astro +633 -0
- package/templates/shared/dashboard/src/components/usage/BillingCycleCountdown.astro +192 -0
- package/templates/shared/dashboard/src/components/usage/BurnRateHero.astro +539 -0
- package/templates/shared/dashboard/src/components/usage/CircuitBreakerEventLog.astro +542 -0
- package/templates/shared/dashboard/src/components/usage/CircuitBreakerPanel.tsx +292 -0
- package/templates/shared/dashboard/src/components/usage/CircuitBreakerStatus.astro +669 -0
- package/templates/shared/dashboard/src/components/usage/CompactThresholdBanner.astro +531 -0
- package/templates/shared/dashboard/src/components/usage/ComparisonModeSelector.astro +651 -0
- package/templates/shared/dashboard/src/components/usage/CostBreakdownChart.astro +381 -0
- package/templates/shared/dashboard/src/components/usage/CostBreakdownTable.astro +210 -0
- package/templates/shared/dashboard/src/components/usage/CostDataTable.astro +0 -0
- package/templates/shared/dashboard/src/components/usage/CostDonutChart.astro +311 -0
- package/templates/shared/dashboard/src/components/usage/DailyCostChart.astro +632 -0
- package/templates/shared/dashboard/src/components/usage/ExportButton.astro +114 -0
- package/templates/shared/dashboard/src/components/usage/FeatureBudgetsTable.astro +872 -0
- package/templates/shared/dashboard/src/components/usage/FilterBar.astro +190 -0
- package/templates/shared/dashboard/src/components/usage/FilterToggles.astro +175 -0
- package/templates/shared/dashboard/src/components/usage/GitHubUsageCard.astro +537 -0
- package/templates/shared/dashboard/src/components/usage/OverageCostCard.astro +212 -0
- package/templates/shared/dashboard/src/components/usage/PlanUtilizationCard.astro +193 -0
- package/templates/shared/dashboard/src/components/usage/ProjectCard.astro +640 -0
- package/templates/shared/dashboard/src/components/usage/ProjectCardsGrid.astro +272 -0
- package/templates/shared/dashboard/src/components/usage/ResourceSearch.astro +279 -0
- package/templates/shared/dashboard/src/components/usage/ServiceUtilizationList.astro +604 -0
- package/templates/shared/dashboard/src/components/usage/SparklineCard.astro +399 -0
- package/templates/shared/dashboard/src/components/usage/StatsHero.astro +600 -0
- package/templates/shared/dashboard/src/components/usage/TableFilters.astro +1033 -0
- package/templates/shared/dashboard/src/components/usage/ThresholdAlert.astro +271 -0
- package/templates/shared/dashboard/src/components/usage/ThresholdSettings.astro +618 -0
- package/templates/shared/dashboard/src/components/usage/TopSpenderCard.astro +170 -0
- package/templates/shared/dashboard/src/components/usage/UnifiedResourceTable.astro +1737 -0
- package/templates/shared/dashboard/src/components/usage/UsageCard.astro +135 -0
- package/templates/shared/dashboard/src/components/usage/UsageHealthBanner.astro +387 -0
- package/templates/shared/dashboard/src/components/usage/UtilizationBar.astro +159 -0
- package/templates/shared/dashboard/src/components/usage/WorkersBreakdownTable.astro +659 -0
- package/templates/shared/dashboard/src/components/usage/daily/CostChart.astro +461 -0
- package/templates/shared/dashboard/src/components/usage/daily/CostTable.astro +946 -0
- package/templates/shared/dashboard/src/components/usage/daily/DailyOverview.astro +1079 -0
- package/templates/shared/dashboard/src/components/usage/design-tokens.ts +187 -0
- package/templates/shared/dashboard/src/components/usage/filters/InlineDateRange.astro +285 -0
- package/templates/shared/dashboard/src/components/usage/filters/PeriodButtons.astro +157 -0
- package/templates/shared/dashboard/src/components/usage/filters/ProjectSelect.astro +284 -0
- package/templates/shared/dashboard/src/components/usage/scripts/ai-tab-controller.ts +419 -0
- package/templates/shared/dashboard/src/components/usage/scripts/constants.ts +60 -0
- package/templates/shared/dashboard/src/components/usage/scripts/formatters.ts +62 -0
- package/templates/shared/dashboard/src/components/usage/scripts/overview-controller.ts +1633 -0
- package/templates/shared/dashboard/src/components/usage/scripts/resource-table-builder.ts +294 -0
- package/templates/shared/dashboard/src/components/usage/scripts/tabs-filters-controller.ts +464 -0
- package/templates/shared/dashboard/src/components/usage/state/index.ts +55 -0
- package/templates/shared/dashboard/src/components/usage/state/usageActions.ts +439 -0
- package/templates/shared/dashboard/src/components/usage/state/usageStore.ts +376 -0
- package/templates/shared/dashboard/src/components/usage/types.ts +283 -0
- package/templates/shared/dashboard/src/components/usage/usage-colors.ts +292 -0
- package/templates/shared/dashboard/src/pages/api/usage/ai-models.ts +235 -0
- package/templates/shared/dashboard/src/pages/api/usage/billing-context.ts +296 -0
- package/templates/shared/scripts/test-telemetry-flow.ts +464 -0
- package/templates/shared/tests/e2e/usage-export.test.ts +784 -0
- package/templates/shared/tests/e2e/usage-mobile.test.ts +531 -0
- package/templates/standard/dashboard/src/components/errors/PriorityBadge.astro +27 -0
- package/templates/standard/dashboard/src/components/infrastructure/HealthchecksStatus.tsx +293 -0
- package/templates/standard/dashboard/src/components/infrastructure/InfrastructureTabs.tsx +268 -0
- package/templates/standard/dashboard/src/pages/analytics.astro +64 -0
- package/templates/standard/dashboard/src/pages/api/infrastructure/alerts.ts +85 -0
- package/templates/standard/dashboard/src/pages/api/infrastructure/healthchecks/[id]/flips.ts +110 -0
- package/templates/standard/dashboard/src/pages/api/infrastructure/healthchecks.ts +101 -0
- package/templates/standard/dashboard/src/pages/api/infrastructure/uptime/[id]/response-times.ts +121 -0
- package/templates/standard/dashboard/src/pages/api/infrastructure/uptime.ts +89 -0
- package/templates/standard/dashboard/src/pages/api/test/service-auth.ts +178 -0
- package/templates/standard/tests/integration/connectors.test.ts +241 -0
- package/templates/standard/tests/integration/github-monitor.test.ts +143 -0
- package/templates/standard/tests/integration/ingestion.test.ts +211 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
const runtime = (Astro.locals as App.Locals | undefined)?.runtime;
|
|
3
|
+
const db = runtime?.env?.PLATFORM_DB;
|
|
4
|
+
|
|
5
|
+
let errors24h = 0;
|
|
6
|
+
let mrr = 0;
|
|
7
|
+
let activeUsers = 0;
|
|
8
|
+
let alerts = 0;
|
|
9
|
+
|
|
10
|
+
if (db) {
|
|
11
|
+
// Wrap each query in try/catch - tables may not exist yet
|
|
12
|
+
try {
|
|
13
|
+
const errorRow = await db
|
|
14
|
+
.prepare(
|
|
15
|
+
`SELECT COUNT(*) AS count FROM error_reports
|
|
16
|
+
WHERE timestamp > unixepoch() - 86400`
|
|
17
|
+
)
|
|
18
|
+
.first<{ count: number }>();
|
|
19
|
+
errors24h = errorRow?.count ?? 0;
|
|
20
|
+
} catch {
|
|
21
|
+
// Table doesn't exist yet
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const mrrRow = await db
|
|
26
|
+
.prepare(
|
|
27
|
+
`SELECT value FROM revenue_metrics
|
|
28
|
+
WHERE metric_type = 'mrr'
|
|
29
|
+
ORDER BY timestamp DESC
|
|
30
|
+
LIMIT 1`
|
|
31
|
+
)
|
|
32
|
+
.first<{ value: number }>();
|
|
33
|
+
mrr = mrrRow?.value ?? 0;
|
|
34
|
+
} catch {
|
|
35
|
+
// Table doesn't exist yet
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const activeUsersRow = await db
|
|
40
|
+
.prepare(
|
|
41
|
+
`SELECT value FROM product_metrics
|
|
42
|
+
WHERE metric_type = 'active_users'
|
|
43
|
+
ORDER BY timestamp DESC
|
|
44
|
+
LIMIT 1`
|
|
45
|
+
)
|
|
46
|
+
.first<{ value: number }>();
|
|
47
|
+
activeUsers = activeUsersRow?.value ?? 0;
|
|
48
|
+
} catch {
|
|
49
|
+
// Table doesn't exist yet
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
const alertsRow = await db
|
|
54
|
+
.prepare(
|
|
55
|
+
`SELECT COUNT(*) AS count FROM alerts
|
|
56
|
+
WHERE resolved = 0 AND severity IN ('critical', 'high')`
|
|
57
|
+
)
|
|
58
|
+
.first<{ count: number }>();
|
|
59
|
+
alerts = alertsRow?.count ?? 0;
|
|
60
|
+
} catch {
|
|
61
|
+
// Table doesn't exist yet
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
<!doctype html>
|
|
67
|
+
<html lang="en">
|
|
68
|
+
<head>
|
|
69
|
+
<meta charset="UTF-8" />
|
|
70
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
71
|
+
<title>Platform Kiosk</title>
|
|
72
|
+
<style>
|
|
73
|
+
body {
|
|
74
|
+
margin: 0;
|
|
75
|
+
padding: 2rem;
|
|
76
|
+
background: #111;
|
|
77
|
+
color: #fff;
|
|
78
|
+
font-family:
|
|
79
|
+
'Inter',
|
|
80
|
+
system-ui,
|
|
81
|
+
-apple-system,
|
|
82
|
+
BlinkMacSystemFont,
|
|
83
|
+
'Segoe UI',
|
|
84
|
+
sans-serif;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.kiosk-grid {
|
|
88
|
+
display: grid;
|
|
89
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
90
|
+
gap: 2rem;
|
|
91
|
+
min-height: calc(100vh - 4rem);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.kiosk-tile {
|
|
95
|
+
background: #222;
|
|
96
|
+
border-radius: 1.25rem;
|
|
97
|
+
padding: 3rem;
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
align-items: center;
|
|
102
|
+
text-align: center;
|
|
103
|
+
box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.35);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.kiosk-label {
|
|
107
|
+
font-size: 2rem;
|
|
108
|
+
text-transform: uppercase;
|
|
109
|
+
letter-spacing: 0.08em;
|
|
110
|
+
opacity: 0.7;
|
|
111
|
+
margin-bottom: 1.5rem;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.kiosk-value {
|
|
115
|
+
font-size: clamp(4rem, 8vw, 7rem);
|
|
116
|
+
font-weight: 700;
|
|
117
|
+
line-height: 1;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.kiosk-unit {
|
|
121
|
+
font-size: 2rem;
|
|
122
|
+
opacity: 0.6;
|
|
123
|
+
margin-top: 1rem;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.status-ok {
|
|
127
|
+
color: #10b981;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.status-warning {
|
|
131
|
+
color: #f59e0b;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.status-error {
|
|
135
|
+
color: #ef4444;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.refresh-indicator {
|
|
139
|
+
position: fixed;
|
|
140
|
+
bottom: 2rem;
|
|
141
|
+
right: 2rem;
|
|
142
|
+
opacity: 0.5;
|
|
143
|
+
font-size: 1rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@media (max-width: 900px) {
|
|
147
|
+
body {
|
|
148
|
+
padding: 1.5rem;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.kiosk-grid {
|
|
152
|
+
grid-template-columns: 1fr;
|
|
153
|
+
gap: 1.5rem;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.kiosk-tile {
|
|
157
|
+
padding: 2rem;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.kiosk-label {
|
|
161
|
+
font-size: 1.5rem;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
</style>
|
|
165
|
+
</head>
|
|
166
|
+
<body>
|
|
167
|
+
<div class="kiosk-grid">
|
|
168
|
+
<div class="kiosk-tile">
|
|
169
|
+
<div class="kiosk-label">Errors (24h)</div>
|
|
170
|
+
<div class={`kiosk-value ${errors24h > 10 ? 'status-error' : 'status-ok'}`}>
|
|
171
|
+
{errors24h}
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div class="kiosk-tile">
|
|
176
|
+
<div class="kiosk-label">MRR</div>
|
|
177
|
+
<div class="kiosk-value status-ok">
|
|
178
|
+
${mrr.toFixed(0)}
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<div class="kiosk-tile">
|
|
183
|
+
<div class="kiosk-label">Active Users</div>
|
|
184
|
+
<div class="kiosk-value status-ok">
|
|
185
|
+
{activeUsers.toLocaleString()}
|
|
186
|
+
</div>
|
|
187
|
+
<div class="kiosk-unit">Last 30 Days</div>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div class="kiosk-tile">
|
|
191
|
+
<div class="kiosk-label">Active Alerts</div>
|
|
192
|
+
<div class={`kiosk-value ${alerts > 0 ? 'status-error' : 'status-ok'}`}>
|
|
193
|
+
{alerts}
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
|
|
198
|
+
<div class="refresh-indicator">Auto-refresh: 60s</div>
|
|
199
|
+
|
|
200
|
+
<script>
|
|
201
|
+
setTimeout(() => {
|
|
202
|
+
window.location.reload();
|
|
203
|
+
}, 60000);
|
|
204
|
+
</script>
|
|
205
|
+
</body>
|
|
206
|
+
</html>
|