Skip to content

Commit 7fd1df0

Browse files
committed
update
1 parent 3490fe5 commit 7fd1df0

File tree

6 files changed

+20
-205
lines changed

6 files changed

+20
-205
lines changed

apps/web/src/components/tools/shared/metric-card.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ interface MetricCardProps {
44
title: string
55
value: string | number
66
description?: string
7+
isLoading?: boolean
78
}
89

9-
export default function MetricCard({ title, value, description }: MetricCardProps) {
10+
export default function MetricCard({ title, value, description, isLoading }: MetricCardProps) {
1011
return (
1112
<Card>
1213
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
1314
<CardTitle className="text-sm font-medium">{title}</CardTitle>
1415
</CardHeader>
1516
<CardContent>
16-
<div className="text-2xl font-bold">{value}</div>
17+
<div className="text-2xl font-bold">
18+
{isLoading ? 'Loading...' : value}
19+
</div>
1720
{description && (
1821
<p className="text-xs text-muted-foreground">{description}</p>
1922
)}

apps/web/src/components/tools/vercel/dashboard.tsx

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ import { DeploymentsChart } from './deployments-chart'
1212
import { DurationChart } from './duration-chart'
1313
import { ProjectsChart } from './projects-chart'
1414
import { GitAnalyticsChart } from './git-analytics-chart'
15-
import { InfrastructureChart } from './infrastructure-chart'
1615

1716
interface GitData {
17+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1818
analytics: any[]
19+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1920
distribution: any[]
21+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2022
branches: any[]
2123
}
2224

@@ -29,16 +31,19 @@ export default function VercelDashboard() {
2931
})
3032

3133
const [isLoading, setIsLoading] = useState(true)
34+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3235
const [metrics, setMetrics] = useState<any>()
36+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3337
const [deploymentsData, setDeploymentsData] = useState<any[]>([])
38+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3439
const [durationData, setDurationData] = useState<any[]>([])
40+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3541
const [projectsData, setProjectsData] = useState<any[]>([])
3642
const [gitData, setGitData] = useState<GitData>({
3743
analytics: [],
3844
distribution: [],
3945
branches: []
4046
})
41-
const [infraData, setInfraData] = useState<any[]>([])
4247

4348
useEffect(() => {
4449
async function fetchData() {
@@ -60,7 +65,6 @@ export default function VercelDashboard() {
6065
gitAnalyticsResult,
6166
gitDistributionResult,
6267
branchResult,
63-
infraResult
6468
] = await Promise.all([
6569
pipe(token, 'vercel_deployment_metrics', params),
6670
pipe(token, 'vercel_deployments_over_time', params),
@@ -69,7 +73,6 @@ export default function VercelDashboard() {
6973
pipe(token, 'vercel_git_analytics', params),
7074
pipe(token, 'vercel_git_distribution', params),
7175
pipe(token, 'vercel_branch_distribution', params),
72-
pipe(token, 'vercel_infrastructure_stats', params)
7376
])
7477

7578
setMetrics(metricsResult?.data?.[0])
@@ -81,7 +84,6 @@ export default function VercelDashboard() {
8184
distribution: gitDistributionResult?.data ?? [],
8285
branches: branchResult?.data ?? []
8386
})
84-
setInfraData(infraResult?.data ?? [])
8587
} catch (error) {
8688
console.error('Failed to fetch data:', error)
8789
} finally {
@@ -171,18 +173,6 @@ export default function VercelDashboard() {
171173
/>
172174
</CardContent>
173175
</Card>
174-
175-
{/* <Card>
176-
<CardHeader>
177-
<CardTitle>Infrastructure</CardTitle>
178-
</CardHeader>
179-
<CardContent>
180-
<InfrastructureChart
181-
data={infraData}
182-
isLoading={isLoading}
183-
/>
184-
</CardContent>
185-
</Card> */}
186176
</div>
187177
</div>
188178
)

apps/web/src/components/tools/vercel/deployments-chart.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { format } from 'date-fns'
44

55
interface DeploymentsData {
66
period: string
7-
'deployment.succeeded': number
8-
'deployment.error': number
7+
event_type: string
8+
count: number
99
}
1010

1111
const chartConfig = {
@@ -27,7 +27,8 @@ export function DeploymentsChart({ data, isLoading, className }: {
2727
if (isLoading) return <div className={`flex items-center justify-center ${className}`}>Loading...</div>
2828
if (!data.length) return <div className={`flex items-center justify-center ${className}`}>No data available</div>
2929

30-
const chartData = data.reduce((acc: any[], curr) => {
30+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
31+
const chartData = data.reduce((acc: any[], curr: DeploymentsData) => {
3132
const existing = acc.find(d => d.period === curr.period)
3233
if (existing) {
3334
existing[curr.event_type] = curr.count
@@ -65,7 +66,9 @@ export function DeploymentsChart({ data, isLoading, className }: {
6566
<div className="text-xs text-muted-foreground">
6667
{format(new Date(data.period), 'd HH:mm')}
6768
</div>
68-
{payload.map((p: any) => (
69+
{
70+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
71+
payload.map((p: any) => (
6972
<div key={p.dataKey} className="font-bold">
7073
{chartConfig[p.dataKey as keyof typeof chartConfig].label}: {p.value}
7174
</div>

apps/web/src/components/tools/vercel/duration-chart.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'rec
33
import { Card } from '@/components/ui/card'
44

55
interface DurationChartProps {
6+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
67
data: any[]
78
}
89

apps/web/src/components/tools/vercel/infrastructure-chart.tsx

Lines changed: 0 additions & 165 deletions
This file was deleted.

tinybird/pipes/vercel_infrastructure_stats.pipe

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)