Skip to content

Commit 7802527

Browse files
committed
add more panels
1 parent d214793 commit 7802527

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

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

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ interface Responder {
3333
type: string;
3434
}
3535

36+
interface InterruptionData {
37+
day: string
38+
interruptions: number
39+
day_type: 'business' | 'off'
40+
}
41+
3642
export default function PagerDutyDashboard() {
3743
const [token] = useQueryState('token')
3844
const [dateRange, setDateRange] = useState<DateRange>({
@@ -77,11 +83,7 @@ export default function PagerDutyDashboard() {
7783
const pageSize = 10
7884
const [incidentTypes, setIncidentTypes] = useState<IncidentType[]>([])
7985
const [selectedService, setSelectedService] = useState<string>()
80-
const [interruptions, setInterruptions] = useState<Array<{
81-
day: string
82-
interruptions: number
83-
day_type: 'business' | 'off'
84-
}>>([])
86+
const [interruptions, setInterruptions] = useState<InterruptionData[]>([])
8587
const [responseEffort, setResponseEffort] = useState<Array<{
8688
responder: Array<{
8789
html_url: string
@@ -211,9 +213,28 @@ export default function PagerDutyDashboard() {
211213
high_urgency_rate: number
212214
}>)
213215
setIncidentTypes(incidentTypesData.data as IncidentType[])
214-
setInterruptions(interruptionsData.data)
215-
setResponseEffort(responseEffortData.data)
216-
setSleepInterruptions(sleepInterruptionsData.data)
216+
setInterruptions(interruptionsData.data as InterruptionData[])
217+
setResponseEffort(responseEffortData.data as Array<{
218+
responder: Array<{
219+
html_url: string
220+
id: string
221+
self: string
222+
summary: string
223+
type: string
224+
}>
225+
hours: number
226+
}>)
227+
setSleepInterruptions(sleepInterruptionsData.data as Array<{
228+
responder: Array<{
229+
html_url: string
230+
id: string
231+
self: string
232+
summary: string
233+
type: string
234+
}>
235+
interruptions: number
236+
avg_response_time: number
237+
}>)
217238

218239
} catch (error) {
219240
console.error('Failed to fetch metrics:', error)

apps/web/src/components/tools/pagerduty/interruptions-chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function InterruptionsChart({ data }: InterruptionsChartProps) {
4141
/>
4242
<Tooltip
4343
labelFormatter={(value) => new Date(value).toLocaleString()}
44-
formatter={(value, name) => [value, name.split('_').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')]}
44+
formatter={(value, name: string) => [value, name.split('_').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')]}
4545
/>
4646
<Legend />
4747
<Bar dataKey="business_hours" stackId="a" fill="hsl(var(--primary))" name="Business Hours" />

0 commit comments

Comments
 (0)