@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,271 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* ThresholdAlert Component
|
|
4
|
+
*
|
|
5
|
+
* Displays warning/critical alerts when resource usage exceeds thresholds.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface ThresholdWarning {
|
|
9
|
+
resource: string;
|
|
10
|
+
resourceName: string;
|
|
11
|
+
metric: string;
|
|
12
|
+
current: number;
|
|
13
|
+
limit: number;
|
|
14
|
+
percentage: number;
|
|
15
|
+
level: 'normal' | 'warning' | 'high' | 'critical';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface ThresholdAnalysis {
|
|
19
|
+
overallLevel: 'normal' | 'warning' | 'high' | 'critical';
|
|
20
|
+
warnings: ThresholdWarning[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface Props {
|
|
24
|
+
thresholds: ThresholdAnalysis;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { thresholds } = Astro.props;
|
|
28
|
+
|
|
29
|
+
// Filter to only show warning, high, and critical levels
|
|
30
|
+
const alertWarnings = thresholds.warnings.filter(
|
|
31
|
+
(w) => w.level === 'warning' || w.level === 'high' || w.level === 'critical'
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// If no alerts, don't render anything
|
|
35
|
+
if (alertWarnings.length === 0) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function getLevelStyles(level: string) {
|
|
40
|
+
switch (level) {
|
|
41
|
+
case 'critical':
|
|
42
|
+
return {
|
|
43
|
+
bg: 'bg-critical',
|
|
44
|
+
border: 'border-critical',
|
|
45
|
+
icon: '🚨',
|
|
46
|
+
label: 'CRITICAL',
|
|
47
|
+
};
|
|
48
|
+
case 'high':
|
|
49
|
+
return {
|
|
50
|
+
bg: 'bg-high',
|
|
51
|
+
border: 'border-high',
|
|
52
|
+
icon: '⚠️',
|
|
53
|
+
label: 'HIGH',
|
|
54
|
+
};
|
|
55
|
+
case 'warning':
|
|
56
|
+
return {
|
|
57
|
+
bg: 'bg-warning',
|
|
58
|
+
border: 'border-warning',
|
|
59
|
+
icon: '⚠',
|
|
60
|
+
label: 'WARNING',
|
|
61
|
+
};
|
|
62
|
+
default:
|
|
63
|
+
return {
|
|
64
|
+
bg: 'bg-normal',
|
|
65
|
+
border: 'border-normal',
|
|
66
|
+
icon: 'ℹ️',
|
|
67
|
+
label: 'INFO',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function formatNumber(num: number): string {
|
|
73
|
+
if (num >= 1_000_000_000) return `${(num / 1_000_000_000).toFixed(2)}B`;
|
|
74
|
+
if (num >= 1_000_000) return `${(num / 1_000_000).toFixed(2)}M`;
|
|
75
|
+
if (num >= 1_000) return `${(num / 1_000).toFixed(1)}K`;
|
|
76
|
+
return num.toLocaleString();
|
|
77
|
+
}
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
<div class="threshold-alerts">
|
|
81
|
+
{
|
|
82
|
+
alertWarnings.map((warning) => {
|
|
83
|
+
const styles = getLevelStyles(warning.level);
|
|
84
|
+
return (
|
|
85
|
+
<div class={`alert-banner ${styles.bg} ${styles.border}`} role="alert">
|
|
86
|
+
<span class="alert-icon" set:html={styles.icon} />
|
|
87
|
+
<div class="alert-content">
|
|
88
|
+
<div class="alert-header">
|
|
89
|
+
<span class={`alert-level level-${warning.level}`}>{styles.label}</span>
|
|
90
|
+
<span class="alert-resource">
|
|
91
|
+
{warning.resource}: {warning.resourceName}
|
|
92
|
+
</span>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="alert-details">
|
|
95
|
+
<span class="alert-metric">{warning.metric}</span>
|
|
96
|
+
<span class="alert-progress">
|
|
97
|
+
<span class="progress-bar">
|
|
98
|
+
<span
|
|
99
|
+
class={`progress-fill fill-${warning.level}`}
|
|
100
|
+
style={`width: ${Math.min(warning.percentage, 100)}%`}
|
|
101
|
+
/>
|
|
102
|
+
</span>
|
|
103
|
+
<span class="progress-text">
|
|
104
|
+
{formatNumber(warning.current)} / {formatNumber(warning.limit)}(
|
|
105
|
+
{warning.percentage.toFixed(0)}%)
|
|
106
|
+
</span>
|
|
107
|
+
</span>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<style>
|
|
117
|
+
.threshold-alerts {
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-direction: column;
|
|
120
|
+
gap: 0.75rem;
|
|
121
|
+
margin-bottom: 1.5rem;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.alert-banner {
|
|
125
|
+
display: flex;
|
|
126
|
+
gap: 0.75rem;
|
|
127
|
+
padding: 1rem;
|
|
128
|
+
border-radius: 0.5rem;
|
|
129
|
+
border-width: 1px;
|
|
130
|
+
border-style: solid;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.bg-critical {
|
|
134
|
+
background-color: #fef2f2;
|
|
135
|
+
}
|
|
136
|
+
.border-critical {
|
|
137
|
+
border-color: #fecaca;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.bg-high {
|
|
141
|
+
background-color: #fff7ed;
|
|
142
|
+
}
|
|
143
|
+
.border-high {
|
|
144
|
+
border-color: #fed7aa;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.bg-warning {
|
|
148
|
+
background-color: #fefce8;
|
|
149
|
+
}
|
|
150
|
+
.border-warning {
|
|
151
|
+
border-color: #fef08a;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.bg-normal {
|
|
155
|
+
background-color: #eff6ff;
|
|
156
|
+
}
|
|
157
|
+
.border-normal {
|
|
158
|
+
border-color: #bfdbfe;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.alert-icon {
|
|
162
|
+
font-size: 1.25rem;
|
|
163
|
+
flex-shrink: 0;
|
|
164
|
+
line-height: 1;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.alert-content {
|
|
168
|
+
flex: 1;
|
|
169
|
+
min-width: 0;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.alert-header {
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
gap: 0.75rem;
|
|
176
|
+
margin-bottom: 0.5rem;
|
|
177
|
+
flex-wrap: wrap;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.alert-level {
|
|
181
|
+
font-size: 0.625rem;
|
|
182
|
+
font-weight: 700;
|
|
183
|
+
padding: 0.125rem 0.5rem;
|
|
184
|
+
border-radius: 9999px;
|
|
185
|
+
letter-spacing: 0.1em;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.level-critical {
|
|
189
|
+
background-color: #dc2626;
|
|
190
|
+
color: white;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.level-high {
|
|
194
|
+
background-color: #ea580c;
|
|
195
|
+
color: white;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.level-warning {
|
|
199
|
+
background-color: #ca8a04;
|
|
200
|
+
color: white;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.alert-resource {
|
|
204
|
+
font-weight: 600;
|
|
205
|
+
color: #374151;
|
|
206
|
+
font-size: 0.875rem;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.alert-details {
|
|
210
|
+
display: flex;
|
|
211
|
+
flex-direction: column;
|
|
212
|
+
gap: 0.375rem;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.alert-metric {
|
|
216
|
+
font-size: 0.75rem;
|
|
217
|
+
color: #6b7280;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.alert-progress {
|
|
221
|
+
display: flex;
|
|
222
|
+
align-items: center;
|
|
223
|
+
gap: 0.75rem;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.progress-bar {
|
|
227
|
+
flex: 1;
|
|
228
|
+
max-width: 200px;
|
|
229
|
+
height: 0.375rem;
|
|
230
|
+
background-color: #e5e7eb;
|
|
231
|
+
border-radius: 9999px;
|
|
232
|
+
overflow: hidden;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.progress-fill {
|
|
236
|
+
height: 100%;
|
|
237
|
+
border-radius: 9999px;
|
|
238
|
+
transition: width 0.3s ease;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.fill-critical {
|
|
242
|
+
background-color: #dc2626;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.fill-high {
|
|
246
|
+
background-color: #ea580c;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.fill-warning {
|
|
250
|
+
background-color: #ca8a04;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.progress-text {
|
|
254
|
+
font-size: 0.75rem;
|
|
255
|
+
color: #374151;
|
|
256
|
+
font-family: monospace;
|
|
257
|
+
white-space: nowrap;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
@media (max-width: 640px) {
|
|
261
|
+
.alert-progress {
|
|
262
|
+
flex-direction: column;
|
|
263
|
+
align-items: flex-start;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.progress-bar {
|
|
267
|
+
width: 100%;
|
|
268
|
+
max-width: none;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
</style>
|