Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add types for requests #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/api/experimentApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {api} from "./config";

export const getAllModelsFn = async () => {
const data = await api.get<string, number, boolean>('get/models').then((res) => {}).catch((res) => {})
const data = await api.get<string, number, boolean>('get/models').then((res) => {
}).catch((res) => {
})
}
5 changes: 3 additions & 2 deletions src/components/global/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import classes from './Layout.module.scss'
import {Aside} from "../../ui/Aside/Aside";
import {Header} from "../../ui/Header/Header";
import {Filters} from "../../ui/Filters/Filters";
import {Outlet} from "@tanstack/react-router";
import {ExperimentPopup} from "../../popups/ExperimentPopup/ExperimentPopup";
// import {ExperimentPopup} from "../../popups/ExperimentPopup/ExperimentPopup";

interface LayoutProps {
Expand All @@ -27,7 +27,8 @@ export const Layout: FC<PropsWithChildren<LayoutProps>> = () => {
{!path.current.includes('/experiment') && (
<Filters />
)}
<Outlet />
<ExperimentPopup />
{/*<Outlet />*/}
</div>
</main>
</div>
Expand Down
1 change: 0 additions & 1 deletion src/components/icons/LogOutIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import classes from './LogOutIcon.module.scss'
import {FC, PropsWithChildren} from "react"

interface LogOutIconProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/Experiment/Experiment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface ExperimentProps {

}

export const Experiment: FC<PropsWithChildren<ExperimentProps>> = ({}) => {
export const Experiment: FC<PropsWithChildren<ExperimentProps>> = () => {


return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/popups/ExperimentPopup/ExperimentPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {ColumnType} from "../../../types/DNDTypes";
import {v4} from 'uuid'

interface ExperimentPopupProps {
className?: string
}

export const ExperimentPopup: FC<PropsWithChildren<ExperimentPopupProps>> = () => {
Expand Down Expand Up @@ -80,6 +79,7 @@ export const ExperimentPopup: FC<PropsWithChildren<ExperimentPopupProps>> = () =
const root = document.documentElement
root.style.setProperty('--right-width', (wrapperRef.current.offsetWidth / 4) + 'px')
setRightColWidth(wrapperRef.current.offsetWidth / 4)
// eslint-disable-next-line
}, [wrapperRef.current]);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/Charts/BarChart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ChartJS.register(
BarElement
)

export const BarChart: FC<PropsWithChildren<BarChartProps>> = ({}) => {
export const BarChart: FC<PropsWithChildren<BarChartProps>> = () => {

const data = {
labels: ["red", "blue", "yellow", "green", "purple", "orange"],
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/Charts/LineChart/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ChartJS.register(
)


export const LineChart: FC<PropsWithChildren<LineChartProps>> = ({}) => {
export const LineChart: FC<PropsWithChildren<LineChartProps>> = () => {

const data = {
labels: ["red", "blue", "yellow", "green", "purple", "orange"],
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/Charts/PieChart/PieChart.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FC, PropsWithChildren} from "react"
import {Bar, Doughnut} from "react-chartjs-2";
import {Doughnut} from "react-chartjs-2";
import {Chart as ChartJS, ArcElement, Tooltip, Legend} from "chart.js";

interface PieChartProps {
Expand All @@ -11,7 +11,7 @@ ChartJS.register(
ArcElement
)

export const PieChart: FC<PropsWithChildren<PieChartProps>> = ({}) => {
export const PieChart: FC<PropsWithChildren<PieChartProps>> = () => {

const data = {
labels: ["red", "blue", "yellow", "green", "purple", "orange"],
Expand Down
3 changes: 3 additions & 0 deletions src/components/ui/Filters/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const Filters: FC<PropsWithChildren<FiltersProps>> = () => {
return prev
})
}
// eslint-disable-next-line
}, [filtersData.period]);

useEffect(() => {
Expand All @@ -87,12 +88,14 @@ export const Filters: FC<PropsWithChildren<FiltersProps>> = () => {
})

fillRangeSelect(period.value)
// eslint-disable-next-line
}, []);

useEffect(() => {
const period = filtersData.period.value

fillRangeSelect(period)
// eslint-disable-next-line
}, [filtersData.period])

return (
Expand Down
1 change: 0 additions & 1 deletion src/components/ui/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {FC, PropsWithChildren, useLayoutEffect, useState} from "react"
import classes from './Header.module.scss'
import {CalendarIcon} from "../../icons/CalendarIcon";
import {LogOutIcon} from "../../icons/LogOutIcon";
import {DateHelper} from "../../../utils/dateHelper";

interface HeaderProps {
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useClickOutside.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export const useClickOutside = <T extends HTMLElement>(ref: RefObject<T>, cb: ()
return () => {
document.removeEventListener("mousedown", handleClickOutside);
};
// eslint-disable-next-line
}, [ref]);
}
33 changes: 33 additions & 0 deletions src/types/metaModelTypes/FirstFileTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {ModelNameType} from "./GeneralTypes";
import {AlgNameType} from "./ThirdFileTypes";

export type FirstFileTypes = {
type: MetaModelType[]
}

type MetaModelType = {
name: string,
description: string,
inputParameters: inputParametersType,
outputParameters?: outputParametersType,
}

type inputParametersType = {
modelName: ModelNameType,
featuresHeader?: ModelNameType,
hyperparameters?: ModelNameType,
providerName: ModelNameType,
algName: AlgNameType,

outputParameters: outputParametersType,

features?: null,
labels?: null,
encoderFeatures?: null,
encoderLabels?: null,
scalers?: null,
}

type outputParametersType = {
modelId: ModelNameType
}
53 changes: 53 additions & 0 deletions src/types/metaModelTypes/GeneralTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import {AlgNameType} from "./ThirdFileTypes";

export type OptionsType = {
hasDynamicData: boolean,
dependsOn: null | string[] | [],
data: string[] | null | DataType[],
}

type DataType = {
name: string,
value: string,
}

export type TypesT = {
typeName: string | null,
minValue?: number | null,
maxValue?: number | null,
includeMin?: boolean,
includeMax?: boolean,
options?: OptionsType
itemTypes?: ItemTypes,
dependsOn?: null | string[],
// ???
itemType?: {} | ItemType,
data?: DataType[],
}

export type ItemTypes = {
name: ModelNameType,
type?: ModelNameType,
value: ModelNameType,
}

export type ModelNameType = {
name: string,
description: string,
required?: boolean,
type: TypesT,
providerName?: providerNameType,
algName: AlgNameType,
}

type providerNameType = {
name: string,
description: string,
required?: boolean,
type: TypesT,
}

type ItemType = {
typeName: string,
ItemTypes: ItemTypes
}
7 changes: 7 additions & 0 deletions src/types/metaModelTypes/SecondFileTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {TypesT} from "./GeneralTypes";

export type ModelTypes = ModelTypesInside[];

type ModelTypesInside = {
type: TypesT
}
10 changes: 10 additions & 0 deletions src/types/metaModelTypes/ThirdFileTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {TypesT} from "./GeneralTypes";

export type AlgNameType = {
algName: {
name: string,
description: string,
required: boolean,
type: TypesT,
}
}
Loading