From 15ecdef7b9c786400740863a2546f6d21e2c7bd1 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 16 Nov 2024 02:20:17 +0000 Subject: [PATCH 1/4] Enhanced statistics table rendering --- frontend/src/TestStatisticsPanel.tsx | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/frontend/src/TestStatisticsPanel.tsx b/frontend/src/TestStatisticsPanel.tsx index 8f79234..09d55ee 100644 --- a/frontend/src/TestStatisticsPanel.tsx +++ b/frontend/src/TestStatisticsPanel.tsx @@ -1,4 +1,4 @@ -import { Box, LoadingOverlay, MantineProvider, Paper} from '@mantine/core'; +import { Box, Group, LoadingOverlay, MantineProvider, Paper, Text} from '@mantine/core'; import { useMemo } from 'react'; import { createRoot } from 'react-dom/client'; import { QueryClient, useQuery } from '@tanstack/react-query'; @@ -57,10 +57,32 @@ function TestStatisticsPanel({context}: {context: any}) { { accessor: 'pass_count', title: 'Pass', + render: (record: any) => { + let total = record.pass_count + record.fail_count; + let pass_pct = total > 0 ? (record.pass_count / total) * 100 : 0; + + return ( + + {record.pass_count} + {total > 0 && ({pass_pct.toFixed(2)}%)} + + ) + } }, { accessor: 'fail_count', title: 'Fail', + render: (record: any) => { + let total = record.pass_count + record.fail_count; + let fail_pct = total > 0 ? (record.fail_count / total) * 100 : 0; + + return ( + + {record.fail_count} + {total > 0 && ({fail_pct.toFixed(2)}%)} + + ) + } }, { accessor: 'total', @@ -78,6 +100,10 @@ function TestStatisticsPanel({context}: {context: any}) { From d742c9c049daed0bd47162e16797e166b4272eee Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 16 Nov 2024 02:41:56 +0000 Subject: [PATCH 2/4] Adjust column headers --- frontend/src/TestStatisticsPanel.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/TestStatisticsPanel.tsx b/frontend/src/TestStatisticsPanel.tsx index 09d55ee..03d82fd 100644 --- a/frontend/src/TestStatisticsPanel.tsx +++ b/frontend/src/TestStatisticsPanel.tsx @@ -56,7 +56,7 @@ function TestStatisticsPanel({context}: {context: any}) { }, { accessor: 'pass_count', - title: 'Pass', + title: 'Passed', render: (record: any) => { let total = record.pass_count + record.fail_count; let pass_pct = total > 0 ? (record.pass_count / total) * 100 : 0; @@ -71,7 +71,7 @@ function TestStatisticsPanel({context}: {context: any}) { }, { accessor: 'fail_count', - title: 'Fail', + title: 'Failed', render: (record: any) => { let total = record.pass_count + record.fail_count; let fail_pct = total > 0 ? (record.fail_count / total) * 100 : 0; From ca6bb9ce4dd1ac8e965be088e3d06236c7877ea7 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 16 Nov 2024 02:58:22 +0000 Subject: [PATCH 3/4] Specify icon type --- test_statistics/core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test_statistics/core.py b/test_statistics/core.py index 3a280ef..53e856d 100644 --- a/test_statistics/core.py +++ b/test_statistics/core.py @@ -80,6 +80,7 @@ def get_ui_panels(self, request, context=None, **kwargs): 'title': 'Test Statistics', 'template': 'test_statistics/panel.html', 'source': self.plugin_static_file('TestStatisticsPanel.js:renderPanel'), + 'icon': 'ti:test-report-analytics:outline', 'context': { 'settings': self.plugin_settings, 'filters': stat_filters, From bff57ce10b0145722170a9f273eea4891e5b6b30 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 16 Nov 2024 03:32:25 +0000 Subject: [PATCH 4/4] Fix icon --- test_statistics/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_statistics/core.py b/test_statistics/core.py index 53e856d..5cf864d 100644 --- a/test_statistics/core.py +++ b/test_statistics/core.py @@ -80,7 +80,7 @@ def get_ui_panels(self, request, context=None, **kwargs): 'title': 'Test Statistics', 'template': 'test_statistics/panel.html', 'source': self.plugin_static_file('TestStatisticsPanel.js:renderPanel'), - 'icon': 'ti:test-report-analytics:outline', + 'icon': 'ti:report-analytics:outline', 'context': { 'settings': self.plugin_settings, 'filters': stat_filters,