Implemented select component and added styling
This commit is contained in:
1 parent
2147f14ff7
commit
dd4d5faf33
3 files changed
+96
-18
No files matched your search
@@ -1,12 +1,6 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import {
|
||||
Select,
|
||||
MenuItem,
|
||||
Typography,
|
||||
ButtonGroup,
|
||||
Stack,
|
||||
} from "@mui/material";
|
||||
import { Typography, ButtonGroup, Stack } from "@mui/material";
|
||||
|
||||
import Button from "../../Components/Button";
|
||||
import axiosInstance from "../../Utils/axiosConfig";
|
||||
@@ -15,6 +9,7 @@ import { StatusLabel } from "../../Components/Label";
|
||||
import { useTheme } from "@emotion/react";
|
||||
|
||||
import "./index.css";
|
||||
import Select from "../../Components/Inputs/Select";
|
||||
|
||||
const Incidents = () => {
|
||||
const theme = useTheme();
|
||||
@@ -59,6 +54,7 @@ const Incidents = () => {
|
||||
fetchIncidents();
|
||||
}, [authState]);
|
||||
|
||||
console.log(monitors);
|
||||
const handleSelect = (event) => {
|
||||
setSelectedMonitor(event.target.value);
|
||||
};
|
||||
@@ -118,16 +114,14 @@ const Incidents = () => {
|
||||
>
|
||||
<Stack direction="row" alignItems="center" gap={theme.gap.medium}>
|
||||
<Typography component="h1">Incident history for: </Typography>
|
||||
<Select value={selectedMonitor} onChange={handleSelect}>
|
||||
<MenuItem value={"0"}>All servers</MenuItem>
|
||||
{Object.values(monitors).map((monitor) => {
|
||||
return (
|
||||
<MenuItem key={monitor._id} value={monitor._id}>
|
||||
{monitor.name}
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</Select>
|
||||
<Select
|
||||
id="incidents-select-monitor"
|
||||
placeholder="All servers"
|
||||
value={selectedMonitor}
|
||||
onChange={handleSelect}
|
||||
items={Object.values(monitors)}
|
||||
field="name"
|
||||
/>
|
||||
<ButtonGroup sx={{ ml: "auto" }}>
|
||||
<Button
|
||||
level="secondary"
|
||||
@@ -158,7 +152,7 @@ const Incidents = () => {
|
||||
/>
|
||||
</ButtonGroup>
|
||||
</Stack>
|
||||
<BasicTable data={data} paginated={true} rowsPerPage={12}/>
|
||||
<BasicTable data={data} paginated={true} rowsPerPage={12} />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user