refactor: test run case status messages duplication

This commit is contained in:
Takeshi Kimata
2024-07-21 15:16:40 +09:00
parent 1751dd69a2
commit f797ae2581
11 changed files with 92 additions and 76 deletions

View File

@@ -2,16 +2,17 @@ import React from 'react';
import { useState, useEffect } from 'react';
import dynamic from 'next/dynamic';
import { testRunCaseStatus } from '@/config/selection';
import { RunStatusCountType, RunMessages } from '@/types/run';
import { RunStatusCountType } from '@/types/run';
import { TestStatusMessages } from '@/types/testStatus';
const Chart = dynamic(() => import('react-apexcharts'), { ssr: false });
type Props = {
statusCounts: RunStatusCountType[];
messages: RunMessages;
statusMessages: TestStatusMessages;
theme: string | undefined;
};
export default function RunProgressDounut({ statusCounts, messages, theme }: Props) {
export default function RunProgressDounut({ statusCounts, statusMessages, theme }: Props) {
const [chartData, setChartData] = useState({
series: [],
options: {
@@ -28,7 +29,7 @@ export default function RunProgressDounut({ statusCounts, messages, theme }: Pro
return found ? found.count : 0;
});
const labels = testRunCaseStatus.map((entry) => messages[entry.uid]);
const labels = testRunCaseStatus.map((entry) => statusMessages[entry.uid]);
const colors = testRunCaseStatus.map((entry) => entry.chartColor);
const legend = {
labels: {