Skip to content

Commit a39e6aa

Browse files
committed
Refactor: Complete rewrite of api-metrics widget with beautiful Chart.js charts
- Replaced makeDataset with custom createTimeSeriesData for hourly grouping - Added vibrant colors with smooth curved lines (tension: 0.4) - Implemented proper Chart.js time series format { x, y } - Fixed status_code string to number conversion - API Error Distribution now only shows POST, PUT, DELETE (no GET) - Added beautiful hover effects and animations - Improved chart styling with better colors and fills - Removed unnecessary chartLabels (not needed for time series) - Better responsive layout with fixed height charts - Cleaner, more maintainable code structure
1 parent e21be30 commit a39e6aa

2 files changed

Lines changed: 299 additions & 206 deletions

File tree

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,39 @@
11
<ContentPanel @title={{t "developers.component.widget.api-metrics.title"}} @open={{or @open true}} @wrapperClass="bordered-classic">
2-
<div class="grid grid-cols-1 md:grid-cols-2">
3-
<div class="w-full border-b border-r border-gray-200 dark:border-gray-900">
4-
<h4 class="my-3 text-sm font-semibold mx-5">{{t "developers.component.widget.api-metrics.api-requests"}}</h4>
5-
<Chart @type="line" @labels={{this.chartLabels}} @datasets={{this.apiRequestData}} @options={{this.chartOptions}} />
2+
<div class="grid grid-cols-1 md:grid-cols-2 gap-px bg-gray-200 dark:bg-gray-800">
3+
<div class="bg-white dark:bg-gray-900 p-5">
4+
<h4 class="mb-4 text-sm font-semibold text-gray-700 dark:text-gray-200">
5+
{{t "developers.component.widget.api-metrics.api-requests"}}
6+
</h4>
7+
<div class="h-64">
8+
<Chart @type="line" @datasets={{this.apiRequestData}} @options={{this.chartOptions}} />
9+
</div>
610
</div>
7-
<div class="w-full border-b border-gray-200 dark:border-gray-900">
8-
<h4 class="my-3 text-sm font-semibold mx-5">{{t "developers.component.widget.api-metrics.api-error"}}</h4>
9-
<Chart @type="line" @labels={{this.chartLabels}} @datasets={{this.apiErrorDistributionData}} @options={{this.chartOptions}} />
11+
12+
<div class="bg-white dark:bg-gray-900 p-5">
13+
<h4 class="mb-4 text-sm font-semibold text-gray-700 dark:text-gray-200">
14+
{{t "developers.component.widget.api-metrics.api-error"}}
15+
</h4>
16+
<div class="h-64">
17+
<Chart @type="line" @datasets={{this.apiErrorDistributionData}} @options={{this.chartOptions}} />
18+
</div>
1019
</div>
11-
<div class="w-full border-b border-r border-gray-200 dark:border-gray-900">
12-
<h4 class="my-3 text-sm font-semibold mx-5">{{t "developers.component.widget.api-metrics.webhooks"}}</h4>
13-
<Chart @type="line" @labels={{this.chartLabels}} @datasets={{this.webhookRequestData}} @options={{this.chartOptions}} />
20+
21+
<div class="bg-white dark:bg-gray-900 p-5">
22+
<h4 class="mb-4 text-sm font-semibold text-gray-700 dark:text-gray-200">
23+
{{t "developers.component.widget.api-metrics.webhooks"}}
24+
</h4>
25+
<div class="h-64">
26+
<Chart @type="line" @datasets={{this.webhookRequestData}} @options={{this.chartOptions}} />
27+
</div>
1428
</div>
15-
<div class="w-full border-b border-gray-200 dark:border-gray-900">
16-
<h4 class="my-3 text-sm font-semibold mx-5">{{t "developers.component.widget.api-metrics.webhooks-response"}}</h4>
17-
<Chart @type="line" @labels={{this.chartLabels}} @datasets={{this.webhookRequestTimingData}} @options={{this.chartOptions}} />
29+
30+
<div class="bg-white dark:bg-gray-900 p-5">
31+
<h4 class="mb-4 text-sm font-semibold text-gray-700 dark:text-gray-200">
32+
{{t "developers.component.widget.api-metrics.webhooks-response"}}
33+
</h4>
34+
<div class="h-64">
35+
<Chart @type="line" @datasets={{this.webhookRequestTimingData}} @options={{this.chartOptions}} />
36+
</div>
1837
</div>
1938
</div>
20-
</ContentPanel>
39+
</ContentPanel>

0 commit comments

Comments
 (0)