diff --git a/client/src/components/Tree/ObjectTree.tsx b/client/src/components/Tree/ObjectTree.tsx index 4df4d38..d93c33c 100644 --- a/client/src/components/Tree/ObjectTree.tsx +++ b/client/src/components/Tree/ObjectTree.tsx @@ -114,7 +114,7 @@ const ObjectList = ({ return ( { setSelectedObjectType(id) - }} rightSection={} p={0} label={`${id} ${label} ${count ? `(${count})` : ''}`}> + }} rightSection={} p={0} label={`${label} ${count ? `(${count})` : ''}`}> {Array.isArray(data) && data.map((type) => ( setCurrentObjectId(type.object_id)} /> ))} diff --git a/client/src/interfaces/fuel.ts b/client/src/interfaces/fuel.ts index 2ccadee..5e33465 100644 --- a/client/src/interfaces/fuel.ts +++ b/client/src/interfaces/fuel.ts @@ -9,7 +9,6 @@ export interface ICity { } export interface IBoiler { - id: string; id_object: string; boiler_name: string; boiler_code: string; diff --git a/client/src/pages/Boilers.tsx b/client/src/pages/Boilers.tsx index ef1de0e..0782d57 100644 --- a/client/src/pages/Boilers.tsx +++ b/client/src/pages/Boilers.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from 'react' import { useBoilers } from '../hooks/swrHooks' import { Badge, ScrollAreaAutosize, Table, Text } from '@mantine/core' +import { IBoiler } from '../interfaces/fuel' function Boilers() { const [boilersPage, setBoilersPage] = useState(1) @@ -47,7 +48,7 @@ function Boilers() { - {boilers.map((boiler: {id_object: string, activity: boolean}) => ( + {boilers.map((boiler: IBoiler) => ( {boilersColumns.map(column => { if (column.field === 'activity') { @@ -69,7 +70,7 @@ function Boilers() { ) } else return ( - {boiler[column.field]} + {boiler[column.field as keyof IBoiler]} ) })} diff --git a/client/src/pages/MonitorPage.tsx b/client/src/pages/MonitorPage.tsx index 32f2cc9..a949a84 100644 --- a/client/src/pages/MonitorPage.tsx +++ b/client/src/pages/MonitorPage.tsx @@ -4,7 +4,7 @@ import { Card, Flex } from '@mantine/core'; function CardComponent({ url, is_alive -}: { url: any, is_alive: any }) { +}: { url: string, is_alive: boolean }) { return ( @@ -16,7 +16,7 @@ function CardComponent({ } export default function MonitorPage() { - const [servers, setServers] = useState([]) + const [servers, setServers] = useState([]) useEffect(() => { const eventSource = new EventSource(`${import.meta.env.VITE_API_MONITOR_URL}/watch`); @@ -39,7 +39,7 @@ export default function MonitorPage() { return (
- {servers.length > 0 && servers.map((server: any) => ( + {servers.length > 0 && servers.map((server: { name: string, status: boolean }) => ( ))} diff --git a/client/src/pages/Reports.tsx b/client/src/pages/Reports.tsx index 4baffdd..1254cf8 100644 --- a/client/src/pages/Reports.tsx +++ b/client/src/pages/Reports.tsx @@ -65,32 +65,6 @@ export default function Reports() { } value={search} /> - {/* setSearch(value)} - onChange={(_, value) => setSelectedOption(value)} - isOptionEqualToValue={(option: ICity, value: ICity) => option.id === value.id} - getOptionLabel={(option: ICity) => option.name ? option.name : ""} - options={cities || []} - loading={isLoading} - value={selectedOption} - renderInput={(params) => ( - - {isLoading ? : null} - {params.InputProps.endAdornment} - - ) - }} - /> - )} - /> */} refreshReport()}> @@ -159,48 +133,6 @@ export default function Reports() { } - - - {/* Object.keys(report[key])))].map(id => { - const row: any = { id: Number(id) }; - Object.keys(report).forEach(key => { - row[key] = report[key][id]; - }); - return row; - }) - : - [] - } - columns={[ - { field: 'id', headerName: '№', width: 70 }, - ...Object.keys(report).map(key => ({ - field: key, - headerName: key.charAt(0).toUpperCase() + key.slice(1), - width: 150 - })) - ]} - initialState={{ - pagination: { - paginationModel: { page: 0, pageSize: 10 }, - }, - }} - pageSizeOptions={[10, 20, 50, 100]} - checkboxSelection={false} - disableRowSelectionOnClick - - processRowUpdate={(updatedRow) => { - return updatedRow - }} - - onProcessRowUpdateError={() => { - }} - /> */} ) } \ No newline at end of file diff --git a/client/src/pages/Users.tsx b/client/src/pages/Users.tsx index 52b2ff2..6a39356 100644 --- a/client/src/pages/Users.tsx +++ b/client/src/pages/Users.tsx @@ -6,13 +6,14 @@ import UserService from "../services/UserService" import FormFields from "../components/FormFields" import { Badge, Button, Flex, Loader, Modal, Pagination, ScrollAreaAutosize, Select, Table } from "@mantine/core" import { useDisclosure } from "@mantine/hooks" +import { IUser } from "../interfaces/user" export default function Users() { const { users, isError, isLoading } = useUsers() const { roles } = useRoles() - const [roleOptions, setRoleOptions] = useState() + const [roleOptions, setRoleOptions] = useState<{ label: string, value: string }[]>() useEffect(() => { if (Array.isArray(roles)) { @@ -54,7 +55,7 @@ export default function Users() { Произошла ошибка при получении данных.
) - + if (isLoading) { return ( @@ -86,7 +87,7 @@ export default function Users() { - {users.map((user: any) => ( + {users.map((user: IUser) => ( - ) : ( @@ -123,7 +123,7 @@ export default function Users() { ) } else return ( - {user[column.field]} + {user[column.field as keyof IUser]} ) })} diff --git a/client/src/types/tools.ts b/client/src/types/tools.ts index 1c825a0..fd6d478 100644 --- a/client/src/types/tools.ts +++ b/client/src/types/tools.ts @@ -10,4 +10,5 @@ export type ToolType = "Circle" | "Measure" | "Mover" | + "Edit" | null \ No newline at end of file