Skip to content

Commit b3fa410

Browse files
committed
chore: fix linter issues
1 parent 8752206 commit b3fa410

15 files changed

+46
-64
lines changed

ui/src/app/login/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ export default function LoginPage() {
5757
<Link href="/forgot-password">Forgot Password?</Link>
5858
</div>
5959
)
60-
};
60+
}

ui/src/app/projects/index.tsx

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
Box,
3-
Button,
4-
Container,
5-
Flex,
6-
Heading,
7-
VStack,
8-
} from "@chakra-ui/react";
1+
import { Box, Button, Flex, Heading, VStack } from "@chakra-ui/react";
92
import { IconPlus, IconTrash } from "@tabler/icons-react";
103
import { useQuery } from "@tanstack/react-query";
114
import { Link } from "react-router-dom";

ui/src/app/projects/list-project-test-plans.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { Box, Button, Container, Flex, Heading } from "@chakra-ui/react";
1+
import { Button, Container, Flex, Heading } from "@chakra-ui/react";
22
import { useEffect, useState } from "react";
33
import { useParams } from "react-router";
44
import TestPlanService from "../../services/TestPlanService";
5-
import ProjectService from "../../services/ProjectService";
65
import { Link } from "react-router-dom";
76
import { IconRefreshDot, IconTrash } from "@tabler/icons-react";
7+
import { TestPlan } from "../../common/models";
88

99
export default function ListProjectTestPlans() {
1010
const { projectId } = useParams();
11-
const [testPlans, setTestPlans] = useState([]);
11+
const [testPlans, setTestPlans] = useState<TestPlan[]>([]);
1212
const testPlanService = new TestPlanService();
1313
// const projectService = new ProjectService();
1414
useEffect(() => {

ui/src/app/projects/list-test-cases.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ export default function ListProjectTestCases() {
5353
const [testCases, setTestCases] = useState<TestCase[]>([]);
5454

5555
const fetchTestCases = async () => {
56-
const testCaseData = await testCaseService.findByProjectId(projectId!);
56+
const testCaseData = await testCaseService.findByProjectId(
57+
parseInt(projectId!),
58+
);
5759
setTestCases(testCaseData);
5860
};
5961

ui/src/app/projects/view-project.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { Outlet, useParams } from "react-router";
33
import ProjectService from "../../services/ProjectService";
44
import { Box, Flex, Heading } from "@chakra-ui/react";
55
import { Link } from "react-router-dom";
6+
import { Project } from "../../common/models";
67

78
export default function ViewProject() {
89
const { projectId } = useParams();
9-
const [project, setProject] = useState(null);
10+
const [project, setProject] = useState<Project | null>(null);
1011

1112
const projectService = new ProjectService();
1213
useEffect(() => {

ui/src/app/testcase/inbox-item.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ import { IconChevronDown } from "@tabler/icons-react";
1313
import { useParams } from "react-router";
1414
import TestCaseService from "../../services/TestCaseService";
1515
import { useEffect, useState } from "react";
16+
import { TestCase } from "../../common/models";
1617

1718
export default function TestCaseInboxItem() {
1819
const { testCaseId } = useParams();
19-
const [testCase, setTestCase] = useState(null);
20+
const [testCase, setTestCase] = useState<TestCase | null>(null);
2021
const testCaseService = new TestCaseService();
2122
useEffect(() => {
2223
testCaseService.findById(testCaseId!).then((data) => {

ui/src/app/testcase/inbox.tsx

-21
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,14 @@
11
"use client";
22
import {
3-
Avatar,
4-
AvatarGroup,
53
Box,
64
Button,
75
Flex,
86
Input,
9-
Menu,
10-
MenuButton,
117
Container,
12-
MenuItem,
13-
MenuList,
14-
Tab,
15-
Table,
16-
TableCaption,
17-
TableContainer,
18-
TabList,
19-
TabPanel,
20-
TabPanels,
21-
Tabs,
22-
Tbody,
23-
Td,
24-
Tfoot,
25-
Th,
26-
Thead,
27-
Tr,
288
Heading,
299
Stack,
3010
Badge,
3111
} from "@chakra-ui/react";
32-
import { IconChevronDown } from "@tabler/icons-react";
3312
import { useQuery } from "@tanstack/react-query";
3413
import { Link, Outlet } from "react-router-dom";
3514
import TestCaseService from "../../services/TestCaseService";

ui/src/app/testplans/CreateNewTestPlan.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,22 @@ export default function CreateNewTestPlan() {
9191
));
9292

9393
const testCaseList = testCases.map((t) => (
94-
<Box key={t.ID}>
94+
<Box key={t.id}>
9595
<Flex>
9696
<Box>
9797
<Checkbox
98-
name={`testCase-${t.ID}`}
98+
name={`testCase-${t.id}`}
9999
onChange={(e) => {
100100
if (e.target.checked) {
101101
const newSelected = {
102-
test_case_id: t.ID,
102+
test_case_id: t.id,
103103
user_ids: [],
104104
};
105105
setSelectedTestCases([...selectedTestCases, newSelected]);
106106
}
107107
}}
108108
/>{" "}
109-
{t.Code} - {t.Title} (Tags: {t.Tags?.join(", ")})
109+
{t.code} - {t.title} (Tags: {t.tags?.join(", ")})
110110
</Box>
111111
<Box>
112112
<Button onClick={onOpen}>Assign Testers</Button>

ui/src/app/testplans/ListTestPlans.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function ListTestPlans() {
2121
if (error) {
2222
return <div className="error">Error: error fetching</div>;
2323
}
24-
const testPlanList = testPlans.map((t) => <p>{t.Description.String}</p>);
24+
const testPlanList = testPlans.map((t) => <p>{t.description}</p>);
2525
return (
2626
<Box>
2727
<Heading>List Test Plans</Heading>

ui/src/common/models.ts

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1+
export interface Project {
2+
id: number;
3+
title?: string;
4+
description?: string;
5+
version?: string;
6+
tags?: string[];
7+
}
18
export interface TestCase {
2-
ID: number;
3-
Title?: string;
4-
Code?: string;
5-
Description?: string;
6-
Tags?: string[];
9+
id: string;
10+
title?: string;
11+
code?: string;
12+
description?: string;
13+
tags?: string[];
714
}
815

916
export interface TestPlan {
10-
ID: number;
11-
Title?: string;
12-
Code?: string;
13-
Description?: string;
14-
Tags?: string[];
17+
id: number;
18+
title?: string;
19+
code?: string;
20+
description?: string;
21+
tags?: string[];
1522
}
1623

1724
export interface SelectAssignedTestCase {
18-
test_case_id: number;
25+
test_case_id: string;
1926
user_ids: number[];
2027
}
2128

ui/src/components/Sidebar.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ import {
88
IconPlayerPlay,
99
IconReport,
1010
IconSettings,
11-
IconTestPipe,
1211
IconUser,
1312
IconUsersGroup,
1413
} from "@tabler/icons-react";
1514
import { Link } from "react-router-dom";
1615
export default function Sidebar() {
17-
var items = [
16+
const items = [
1817
{ icon: <IconDashboard />, href: "/dashboard", text: "Dashboard" },
1918
{ icon: <IconInbox />, href: "/test-cases/inbox", text: "Inbox" },
2019
{ icon: <IconList />, href: "/projects", text: "Projects" },

ui/src/components/TestCaseGrid.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function TestCaseGrid() {
4343

4444
const getRows = (people: TestCaseTest[]): Row[] => [
4545
headerRow,
46-
...people.map<Row>((tc, idx) => ({
46+
...people.map<Row>((_, idx) => ({
4747
rowId: idx,
4848
cells: [
4949
{ type: "text", text: "Name" },

ui/src/services/TestCaseService.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ export default class TestCaseService {
99
}
1010

1111
async findAll() {
12-
var res = await axios.get(`${this.apiEndpoint}/v1/test-cases`, useAuthHeaders())
12+
const res = await axios.get(`${this.apiEndpoint}/v1/test-cases`, useAuthHeaders())
1313
if (res.status == 200) {
1414
return res.data.test_cases || [];
1515
}
1616
throw new Error(res.data);
1717
}
1818

1919

20-
async findById(id: String) {
21-
var res = await axios.get(`${this.apiEndpoint}/v1/test-cases/${id}`, useAuthHeaders())
20+
async findById(id: string) {
21+
const res = await axios.get(`${this.apiEndpoint}/v1/test-cases/${id}`, useAuthHeaders())
2222
if (res.status === 200) {
2323
return res.data.test_case;
2424
}
@@ -27,15 +27,15 @@ export default class TestCaseService {
2727

2828

2929
async findByProjectId(projectID: number) {
30-
var res = await axios.get(`${this.apiEndpoint}/v1/projects/${projectID}/test-cases`, useAuthHeaders())
30+
const res = await axios.get(`${this.apiEndpoint}/v1/projects/${projectID}/test-cases`, useAuthHeaders())
3131
if (res.status === 200) {
3232
return res.data.test_cases || [];
3333
}
3434
throw new Error(res.data);
3535
}
3636

3737
async create(data: any) {
38-
var res = await axios.post(`${this.apiEndpoint}/v1/test-cases`, data, useAuthHeaders())
38+
const res = await axios.post(`${this.apiEndpoint}/v1/test-cases`, data, useAuthHeaders())
3939
if (res.status === 200) {
4040
// TODO: return a specific shape of the response, not the whole response
4141
// return res.data.test_case;

ui/src/services/TesterService.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ export default class TesterService {
1010
}
1111

1212
async findAll() {
13-
var res = await axios.get(`${this.apiEndpoint}/v1/testers`, useAuthHeaders());
13+
const res = await axios.get(`${this.apiEndpoint}/v1/testers`, useAuthHeaders());
1414
if (res.status === 200) {
1515
return res.data.testers;
1616
}
1717
throw new Error(res.data);
1818
}
1919

2020
async findById(id: string) {
21-
var res = await axios.get(`${this.apiEndpoint}/v1/testers/${id}`, useAuthHeaders());
21+
const res = await axios.get(`${this.apiEndpoint}/v1/testers/${id}`, useAuthHeaders());
2222
if (res.status === 200) {
2323
return res.data.tester;
2424
}
2525
throw new Error(res.data);
2626
}
2727

2828
async deleteTester(id: string) {
29-
var res = await axios.delete(`${this.apiEndpoint}/v1/testers/${id}`, useAuthHeaders());
29+
const res = await axios.delete(`${this.apiEndpoint}/v1/testers/${id}`, useAuthHeaders());
3030
if (res.status === 200) {
3131
return res.data.testers;
3232
}

ui/src/services/UserService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default class UserService {
1010
}
1111

1212
async create(data: any) {
13-
var res = await axios.post(`${this.apiEndpoint}/v1/users`, data, useAuthHeaders());
13+
const res = await axios.post(`${this.apiEndpoint}/v1/users`, data, useAuthHeaders());
1414
if (res.status === 200) {
1515
return res;
1616
}

0 commit comments

Comments
 (0)