Skip to content

Commit

Permalink
fix: submitter frontend forms
Browse files Browse the repository at this point in the history
  • Loading branch information
domysh committed Aug 27, 2024
1 parent ece3484 commit 220481f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions frontend/src/components/charts/LineChartAttackView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { hashedColor } from "@/utils"
import { clientsQuery, exploitsQuery, statsQuery, statusQuery } from "@/utils/queries"
import { getDateSmallFormatted } from "@/utils/time"
import { AttackStatuses } from "@/utils/types"
import { AreaChart, ChartData, LineChart } from "@mantine/charts"
import { AreaChart, ChartData } from "@mantine/charts"
import { Box, Divider, Space } from "@mantine/core"
import { useMemo } from "react"
import { AttackTypeControl, SeriesTypeChartControl, TypeLineChartControl } from "@/components/inputs/Controllers"
Expand Down Expand Up @@ -78,20 +78,18 @@ export const LineChartAttackView = ({ seriesType, attackType, chartType, withCon
return res?.filter((tick) => Object.keys(tick).length > 1)??[]
}, [stats.isFetching, finalSeries, finalAttackStatus, finalChartType, exploits.isFetching])

const ChartComponent = finalChartType == "area" ? AreaChart : LineChart

return <Box style={{width:"100%", minHeight:300}}>
<b>Attacks chart</b>
<Space h="md" />
<Divider />
<Space h="lg" />
<Space h="md" />
<ChartComponent
<AreaChart
h={300}
w="100%"
data={data as ChartData}
type={finalChartType == "area" ? "stacked": undefined}
dataKey="date"
type="stacked"
withLegend
legendProps={{ verticalAlign: 'bottom', height: 50 }}
series={series}
Expand Down
8 changes: 3 additions & 5 deletions frontend/src/components/charts/LineChartFlagView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { hashedColor } from "@/utils"
import { clientsQuery, exploitsQuery, statsQuery, statusQuery } from "@/utils/queries"
import { getDateSmallFormatted } from "@/utils/time"
import { FlagStatuses } from "@/utils/types"
import { AreaChart, ChartData, LineChart } from "@mantine/charts"
import { AreaChart, ChartData } from "@mantine/charts"
import { Box, Divider, Space } from "@mantine/core"
import { useMemo } from "react"
import { FlagTypeControl, SeriesTypeChartControl, TypeLineChartControl } from "@/components/inputs/Controllers"
Expand Down Expand Up @@ -78,21 +78,19 @@ export const LineChartFlagView = ({ seriesType, flagType, chartType, withControl
return res?.filter((item) => Object.keys(item).length > 1)??[]
}, [stats.isFetching, finalSeries, finalFlagStatus, finalChartType, exploits.isFetching])

const ChartComponent = finalChartType == "area" ? AreaChart : LineChart

return <Box style={{width:"100%", minHeight:300}}>
<b>Flag chart</b>
<Space h="md" />
<Divider />
<Space h="lg" />
<Space h="md" />
<ChartComponent
<AreaChart
h={300}
mih={300}
miw={100}
data={data as ChartData}
dataKey="date"
type="stacked"
type={finalChartType == "area" ? "stacked": undefined}
withLegend
legendProps={{ verticalAlign: 'bottom', height: 50 }}
series={series}
Expand Down

0 comments on commit 220481f

Please sign in to comment.