diff --git a/frontend/config/selection.ts b/frontend/config/selection.ts index 98bb76e..06c2b64 100644 --- a/frontend/config/selection.ts +++ b/frontend/config/selection.ts @@ -1,6 +1,6 @@ +import { RunStatusType, TestRunCaseStatusType } from '@/types/status'; import { TestTypeType } from '@/types/testType'; import { PriorityType } from '@/types/priority'; -import { TestRunCaseStatusType } from '@/types/testRunCaseStatus'; const roles = [{ uid: 'administrator' }, { uid: 'user' }]; @@ -14,7 +14,7 @@ const locales = [ ]; // The status of each test run -const testRunStatus = [ +const testRunStatus: RunStatusType[] = [ { uid: 'new' }, { uid: 'inProgress' }, { uid: 'underReview' }, diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 4aebf1f..dcb0910 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -1,4 +1,12 @@ { + "RunStatus": { + "new": "New", + "inProgress": "In progress", + "underReview": "Under review", + "rejected": "Rejected", + "done": "Done", + "closed": "Closed" + }, "RunCaseStatus": { "untested": "Untested", "passed": "Passed", @@ -234,12 +242,6 @@ "title": "Title", "please_enter": "Please enter run name", "description": "Description", - "new": "New", - "inProgress": "In progress", - "underReview": "Under review", - "rejected": "Rejected", - "done": "Done", - "closed": "Closed", "priority": "Priority", "status": "Status", "actions": "Actions", diff --git a/frontend/messages/ja.json b/frontend/messages/ja.json index 37e11d2..a5c419a 100644 --- a/frontend/messages/ja.json +++ b/frontend/messages/ja.json @@ -1,4 +1,12 @@ { + "RunStatus": { + "new": "新規", + "inProgress": "進行中", + "underReview": "レビュー中", + "rejected": "却下", + "done": "完了", + "closed": "クローズ" + }, "RunCaseStatus": { "untested": "未実行", "passed": "成功", @@ -234,12 +242,6 @@ "id": "ID", "title": "タイトル", "description": "詳細", - "new": "新規", - "inProgress": "進行中", - "underReview": "レビュー中", - "rejected": "却下", - "done": "完了", - "closed": "クローズ", "please_enter": "タイトルを入力してください", "priority": "優先度", "status": "ステータス", diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/ProjectHome.tsx b/frontend/src/app/[locale]/projects/[projectId]/home/ProjectHome.tsx index 102b568..4f98ff6 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/ProjectHome.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/home/ProjectHome.tsx @@ -13,7 +13,7 @@ import { useTheme } from 'next-themes'; import TestTypesChart from './TestTypesDonutChart'; import TestPriorityChart from './TestPriorityDonutChart'; import TestProgressBarChart from './TestProgressColumnChart'; -import { TestRunCaseStatusMessages } from '@/types/testRunCaseStatus'; +import { TestRunCaseStatusMessages } from '@/types/status'; import { TestTypeMessages } from '@/types/testType'; import { PriorityMessages } from '@/types/priority'; diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/aggregate.ts b/frontend/src/app/[locale]/projects/[projectId]/home/aggregate.ts index 474c168..41c7ffc 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/aggregate.ts +++ b/frontend/src/app/[locale]/projects/[projectId]/home/aggregate.ts @@ -1,6 +1,6 @@ import { ProjectType } from '@/types/project'; import { testTypes, priorities, testRunCaseStatus } from '@/config/selection'; -import { TestRunCaseStatusMessages } from '@/types/testRunCaseStatus'; +import { TestRunCaseStatusMessages } from '@/types/status'; // aggregate folder, case, run mum function aggregateBasicInfo(project: ProjectType) { diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx b/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx index 895d758..dc862f8 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx @@ -2,7 +2,7 @@ import { ProjectHome } from './ProjectHome'; import { useTranslations } from 'next-intl'; import { PriorityMessages } from '@/types/priority'; import { TestTypeMessages } from '@/types/testType'; -import { TestRunCaseStatusMessages } from '@/types/testRunCaseStatus'; +import { TestRunCaseStatusMessages } from '@/types/status'; export type HomeMessages = { folders: string; diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx index 320108c..7acdab7 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx @@ -38,7 +38,7 @@ import { TokenContext } from '@/utils/TokenProvider'; import { useTheme } from 'next-themes'; import { useFormGuard } from '@/utils/formGuard'; import { PriorityMessages } from '@/types/priority'; -import { TestRunCaseStatusMessages } from '@/types/testRunCaseStatus'; +import { RunStatusMessages, TestRunCaseStatusMessages } from '@/types/status'; const defaultTestRun = { id: 0, @@ -55,6 +55,7 @@ type Props = { projectId: string; runId: string; messages: RunMessages; + runStatusMessages: RunStatusMessages; testRunCaseStatusMessages: TestRunCaseStatusMessages; priorityMessages: PriorityMessages; locale: string; @@ -64,6 +65,7 @@ export default function RunEditor({ projectId, runId, messages, + runStatusMessages, testRunCaseStatusMessages, priorityMessages, locale, @@ -261,7 +263,7 @@ export default function RunEditor({ > {testRunStatus.map((status, index) => ( - {messages[status.uid]} + {runStatusMessages[status.uid]} ))} diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx index 6c3f0a2..46109c8 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx @@ -3,7 +3,7 @@ import { useState, useEffect } from 'react'; import dynamic from 'next/dynamic'; import { testRunCaseStatus } from '@/config/selection'; import { RunStatusCountType } from '@/types/run'; -import { TestRunCaseStatusMessages } from '@/types/testRunCaseStatus'; +import { TestRunCaseStatusMessages } from '@/types/status'; const Chart = dynamic(() => import('react-apexcharts'), { ssr: false }); type Props = { diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/page.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/page.tsx index c53f855..408b68f 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/page.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/page.tsx @@ -2,7 +2,7 @@ import RunEditor from './RunEditor'; import { useTranslations } from 'next-intl'; import { RunMessages } from '@/types/run'; import { PriorityMessages } from '@/types/priority'; -import { TestRunCaseStatusMessages } from '@/types/testRunCaseStatus'; +import { RunStatusMessages, TestRunCaseStatusMessages } from '@/types/status'; export default function Page({ params }: { params: { projectId: string; runId: string; locale: string } }) { const t = useTranslations('Run'); @@ -16,12 +16,6 @@ export default function Page({ params }: { params: { projectId: string; runId: s title: t('title'), pleaseEnter: t('please_enter'), description: t('description'), - new: t('new'), - inProgress: t('inProgress'), - underReview: t('underReview'), - rejected: t('rejected'), - done: t('done'), - closed: t('closed'), priority: t('priority'), actions: t('actions'), status: t('status'), @@ -38,6 +32,16 @@ export default function Page({ params }: { params: { projectId: string; runId: s close: t('close'), }; + const rst = useTranslations('RunStatus'); + const runStatusMessages: RunStatusMessages = { + new: rst('new'), + inProgress: rst('inProgress'), + underReview: rst('underReview'), + rejected: rst('rejected'), + done: rst('done'), + closed: rst('closed'), + }; + const rcst = useTranslations('RunCaseStatus'); const testRunCaseStatusMessages: TestRunCaseStatusMessages = { untested: rcst('untested'), @@ -60,6 +64,7 @@ export default function Page({ params }: { params: { projectId: string; runId: s projectId={params.projectId} runId={params.runId} messages={messages} + runStatusMessages={runStatusMessages} testRunCaseStatusMessages={testRunCaseStatusMessages} priorityMessages={priorityMessages} locale={params.locale} diff --git a/frontend/types/status.ts b/frontend/types/status.ts new file mode 100644 index 0000000..e498b10 --- /dev/null +++ b/frontend/types/status.ts @@ -0,0 +1,41 @@ +// The status of each test run +type RunStatusUidType = 'new' | 'inProgress' | 'underReview' | 'rejected' | 'done' | 'closed'; + +type RunStatusType = { + uid: RunStatusUidType; +}; + +type RunStatusMessages = { + new: string; + inProgress: string; + underReview: string; + rejected: string; + done: string; + closed: string; +}; + +// The status of each test case in test run +type TestRunCaseStatusUidType = 'untested' | 'passed' | 'failed' | 'retest' | 'skipped'; + +type TestRunCaseStatusType = { + uid: TestRunCaseStatusUidType; + color: string; + chartColor: string; +}; + +type TestRunCaseStatusMessages = { + untested: string; + passed: string; + failed: string; + retest: string; + skipped: string; +}; + +export type { + RunStatusUidType, + RunStatusType, + RunStatusMessages, + TestRunCaseStatusUidType, + TestRunCaseStatusType, + TestRunCaseStatusMessages, +}; diff --git a/frontend/types/testRunCaseStatus.ts b/frontend/types/testRunCaseStatus.ts deleted file mode 100644 index f370963..0000000 --- a/frontend/types/testRunCaseStatus.ts +++ /dev/null @@ -1,18 +0,0 @@ -// The status of each test case in test run -type TestRunCaseStatusUidType = 'untested' | 'passed' | 'failed' | 'retest' | 'skipped'; - -type TestRunCaseStatusType = { - uid: TestRunCaseStatusUidType; - color: string; - chartColor: string; -}; - -type TestRunCaseStatusMessages = { - untested: string; - passed: string; - failed: string; - retest: string; - skipped: string; -}; - -export type { TestRunCaseStatusUidType, TestRunCaseStatusType, TestRunCaseStatusMessages };