diff --git a/frontend/components/TestCasePriority.tsx b/frontend/components/TestCasePriority.tsx new file mode 100644 index 0000000..bf0e642 --- /dev/null +++ b/frontend/components/TestCasePriority.tsx @@ -0,0 +1,17 @@ +import { Circle } from 'lucide-react'; +import { priorities } from '@/config/selection'; +import { PriorityMessages } from '@/types/priority'; + +type Props = { + priorityValue: number; + priorityMessages: PriorityMessages; +}; + +export default function TestCasePriority({ priorityValue, priorityMessages }: Props) { + return ( +
+ +
{priorityMessages[priorities[priorityValue].uid]}
+
+ ); +} diff --git a/frontend/messages/en.json b/frontend/messages/en.json index dcdadb9..0f4ddfa 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -1,4 +1,10 @@ { + "Priority": { + "critical": "Critical", + "high": "High", + "medium": "Medium", + "low": "Low" + }, "Index": { "get_started": "Get Started", "demo": "Demo", diff --git a/frontend/messages/ja.json b/frontend/messages/ja.json index e56f4e0..559f8ff 100644 --- a/frontend/messages/ja.json +++ b/frontend/messages/ja.json @@ -1,4 +1,11 @@ { + "Priority": { + "priority": "優先度", + "critical": "致", + "high": "高", + "medium": "中", + "low": "低" + }, "Index": { "get_started": "テスト管理を始める", "demo": "デモ", 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 731319f..6a59045 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx @@ -37,6 +37,7 @@ import { fetchFolders } from '../../folders/foldersControl'; import { TokenContext } from '@/utils/TokenProvider'; import { useTheme } from 'next-themes'; import { useFormGuard } from '@/utils/formGuard'; +import { PriorityMessages } from '@/types/priority'; const defaultTestRun = { id: 0, @@ -53,10 +54,11 @@ type Props = { projectId: string; runId: string; messages: RunMessages; + priorityMessages: PriorityMessages; locale: string; }; -export default function RunEditor({ projectId, runId, messages, locale }: Props) { +export default function RunEditor({ projectId, runId, messages, priorityMessages, locale }: Props) { const context = useContext(TokenContext); const { theme, setTheme } = useTheme(); const [testRun, setTestRun] = useState(defaultTestRun); @@ -314,6 +316,7 @@ export default function RunEditor({ projectId, runId, messages, locale }: Props) onIncludeCase={(includeTestId) => handleIncludeExcludeCase(true, includeTestId)} onExcludeCase={(excludeCaseId) => handleIncludeExcludeCase(false, excludeCaseId)} messages={messages} + priorityMessages={priorityMessages} /> diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseDetailDialog.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseDetailDialog.tsx index 90ca322..9d1c939 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseDetailDialog.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseDetailDialog.tsx @@ -1,8 +1,9 @@ -import { Button, Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Chip, Divider } from '@nextui-org/react'; +import { Button, Modal, ModalContent, ModalHeader, ModalBody, ModalFooter } from '@nextui-org/react'; +import { testTypes, templates } from '@/config/selection'; +import TestCasePriority from '@/components/TestCasePriority'; import { RunMessages } from '@/types/run'; import { CaseType } from '@/types/case'; -import { Circle } from 'lucide-react'; -import { priorities, testTypes, templates } from '@/config/selection'; +import { PriorityMessages } from '@/types/priority'; type Props = { isOpen: boolean; @@ -10,9 +11,17 @@ type Props = { onCancel: () => void; onChangeStatus: (changeCaseId: number, status: number) => {}; messages: RunMessages; + priorityMessages: PriorityMessages; }; -export default function showTestCaseDetailDialog({ isOpen, testCase, onCancel, onChangeStatus, messages }: Props) { +export default function showTestCaseDetailDialog({ + isOpen, + testCase, + onCancel, + onChangeStatus, + messages, + priorityMessages, +}: Props) { return (

{messages.priority}

- - } - variant="light" - > - {messages[priorities[testCase.priority].uid]} - +
diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseSelector.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseSelector.tsx index a1deb0c..4202fda 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseSelector.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/TestCaseSelector.tsx @@ -30,6 +30,7 @@ import { priorities, testRunCaseStatus } from '@/config/selection'; import { CaseType } from '@/types/case'; import { RunMessages } from '@/types/run'; import TestCaseDetailDialog from './TestCaseDetailDialog'; +import { PriorityMessages } from '@/types/priority'; type Props = { cases: CaseType[]; @@ -40,6 +41,7 @@ type Props = { onIncludeCase: (includeCaseId: number) => {}; onExcludeCase: (excludeCaseId: number) => {}; messages: RunMessages; + priorityMessages: PriorityMessages; }; export default function TestCaseSelector({ @@ -51,6 +53,7 @@ export default function TestCaseSelector({ onIncludeCase, onExcludeCase, messages, + priorityMessages, }: Props) { const headerColumns = [ { name: messages.id, uid: 'id', sortable: true }, @@ -303,6 +306,7 @@ export default function TestCaseSelector({ onCancel={hideTestCaseDetailDialog} onChangeStatus={(showingCaseId, newStatus) => onChangeStatus(showingCaseId, newStatus)} messages={messages} + priorityMessages={priorityMessages} /> ); 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 b86c688..bc8db9b 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/page.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/page.tsx @@ -1,9 +1,11 @@ import RunEditor from './RunEditor'; import { useTranslations } from 'next-intl'; +import { RunMessages } from '@/types/run'; +import { PriorityMessages } from '@/types/priority'; export default function Page({ params }: { params: { projectId: string; runId: string; locale: string } }) { const t = useTranslations('Run'); - const messages = { + const messages: RunMessages = { backToRuns: t('back_to_runs'), updating: t('updating'), update: t('update'), @@ -22,10 +24,6 @@ export default function Page({ params }: { params: { projectId: string; runId: s priority: t('priority'), actions: t('actions'), status: t('status'), - critical: t('critical'), - high: t('high'), - medium: t('medium'), - low: t('low'), untested: t('untested'), passed: t('passed'), failed: t('failed'), @@ -57,5 +55,21 @@ export default function Page({ params }: { params: { projectId: string; runId: s close: t('close'), }; - return ; + const priorityTranslation = useTranslations('Priority'); + const priorityMessages: PriorityMessages = { + critical: priorityTranslation('critical'), + high: priorityTranslation('high'), + medium: priorityTranslation('medium'), + low: priorityTranslation('low'), + }; + + return ( + + ); } diff --git a/frontend/types/case.ts b/frontend/types/case.ts index ff945b6..09da508 100644 --- a/frontend/types/case.ts +++ b/frontend/types/case.ts @@ -101,11 +101,6 @@ type CaseMessages = { pleaseEnterTitle: string; description: string; testCaseDescription: string; - priority: string; - critical: string; - high: string; - medium: string; - low: string; type: string; other: string; security: string; diff --git a/frontend/types/priority.ts b/frontend/types/priority.ts new file mode 100644 index 0000000..b3779e0 --- /dev/null +++ b/frontend/types/priority.ts @@ -0,0 +1,7 @@ +type PriorityMessages = { + critical: string; + high: string; + medium: string; + low: string; +}; +export type { PriorityMessages };