diff --git a/Client/src/App.jsx b/Client/src/App.jsx index 56c279e78..cc9de1304 100644 --- a/Client/src/App.jsx +++ b/Client/src/App.jsx @@ -20,13 +20,13 @@ import NewPasswordConfirmed from "./Pages/Auth/NewPasswordConfirmed"; import ProtectedRoute from "./Components/ProtectedRoute"; import Details from "./Pages/Monitors/Details"; import AdvancedSettings from "./Pages/AdvancedSettings"; -// import Maintenance from "./Pages/Maintenance"; +import Maintenance from "./Pages/Maintenance"; import withAdminCheck from "./HOC/withAdminCheck"; import withAdminProp from "./HOC/withAdminProp"; import Configure from "./Pages/Monitors/Configure"; import PageSpeed from "./Pages/PageSpeed"; import CreatePageSpeed from "./Pages/PageSpeed/CreatePageSpeed"; -// import CreateNewMaintenanceWindow from "./Pages/Maintenance/CreateMaintenanceWindow"; +import CreateNewMaintenanceWindow from "./Pages/Maintenance/CreateMaintenance"; import PageSpeedDetails from "./Pages/PageSpeed/Details"; import PageSpeedConfigure from "./Pages/PageSpeed/Configure"; import { ThemeProvider } from "@emotion/react"; @@ -45,7 +45,7 @@ function App() { const MonitorDetailsWithAdminProp = withAdminProp(Details); const PageSpeedWithAdminProp = withAdminProp(PageSpeed); const PageSpeedDetailsWithAdminProp = withAdminProp(PageSpeedDetails); - // const MaintenanceWithAdminProp = withAdminProp(Maintenance); + const MaintenanceWithAdminProp = withAdminProp(Maintenance); const SettingsWithAdminProp = withAdminProp(Settings); const AdvancedSettingsWithAdminProp = withAdminProp(AdvancedSettings); const mode = useSelector((state) => state.ui.mode); @@ -105,14 +105,14 @@ function App() { path="integrations" element={} /> - {/* } - /> */} - {/* + } - /> */} + /> } diff --git a/Client/src/Components/Inputs/Search/index.jsx b/Client/src/Components/Inputs/Search/index.jsx index f4d931fd1..b1e5d74ae 100644 --- a/Client/src/Components/Inputs/Search/index.jsx +++ b/Client/src/Components/Inputs/Search/index.jsx @@ -1,5 +1,12 @@ import PropTypes from "prop-types"; -import { Box, ListItem, Autocomplete, TextField } from "@mui/material"; +import { + Box, + ListItem, + Autocomplete, + TextField, + Stack, + Typography, +} from "@mui/material"; import { useTheme } from "@emotion/react"; import SearchIcon from "../../../assets/icons/search.svg?react"; @@ -15,21 +22,52 @@ import SearchIcon from "../../../assets/icons/search.svg?react"; * @param {Object} props.sx - Additional styles to apply to the component * @returns {JSX.Element} The rendered Search component */ + +const SearchAdornment = () => { + const theme = useTheme(); + return ( + + + + ); +}; + const Search = ({ id, options, filteredBy, + secondaryLabel, value, + inputValue, handleInputChange, handleChange, sx, + multiple = false, + isAdorned = true, + error, + disabled, }) => { const theme = useTheme(); return ( { handleInputChange(newValue); }} @@ -38,45 +76,45 @@ const Search = ({ }} fullWidth freeSolo + disabled={disabled} disableClearable options={options} getOptionLabel={(option) => option[filteredBy]} renderInput={(params) => ( - - - - ), - }} - sx={{ - "& fieldset": { - borderColor: theme.palette.border.light, - borderRadius: theme.shape.borderRadius, - }, - "& .MuiOutlinedInput-root:hover:not(:has(input:focus)):not(:has(textarea:focus)) fieldset": - { + + }), + }} + sx={{ + "& fieldset": { borderColor: theme.palette.border.light, + borderRadius: theme.shape.borderRadius, }, - }} - /> + "& .MuiOutlinedInput-root:hover:not(:has(input:focus)):not(:has(textarea:focus)) fieldset": + { + borderColor: theme.palette.border.light, + }, + }} + /> + {error && ( + + {error} + + )} + )} filterOptions={(options, { inputValue }) => { const filtered = options.filter((option) => @@ -103,7 +141,8 @@ const Search = ({ : {} } > - {option[filteredBy]} + {option[filteredBy] + + (secondaryLabel ? ` (${option[secondaryLabel]})` : "")} ); }} @@ -139,12 +178,18 @@ const Search = ({ Search.propTypes = { id: PropTypes.string, + multiple: PropTypes.bool, options: PropTypes.array.isRequired, filteredBy: PropTypes.string.isRequired, - value: PropTypes.string.isRequired, + secondaryLabel: PropTypes.string, + value: PropTypes.array, + inputValue: PropTypes.string.isRequired, handleInputChange: PropTypes.func.isRequired, handleChange: PropTypes.func, + isAdorned: PropTypes.bool, sx: PropTypes.object, + error: PropTypes.string, + disabled: PropTypes.bool, }; export default Search; diff --git a/Client/src/Components/Inputs/Select/index.jsx b/Client/src/Components/Inputs/Select/index.jsx index 3d34fcca5..00cceaa29 100644 --- a/Client/src/Components/Inputs/Select/index.jsx +++ b/Client/src/Components/Inputs/Select/index.jsx @@ -34,6 +34,7 @@ import "./index.css"; * * { + handleFormChange( + "repeat", + getValueById(repeatConfig, event.target.value) + ); + }} + items={repeatConfig} + /> + + Date + + .MuiOutlinedInput-root": { + flexDirection: "row-reverse", + }, + "& input": { + height: 34, + p: 0, + pr: theme.spacing(5), + }, + "& fieldset": { + borderColor: theme.palette.border.dark, + borderRadius: theme.shape.borderRadius, + }, + "&:not(:has(.Mui-disabled)):not(:has(.Mui-error)) .MuiOutlinedInput-root:not(:has(input:focus)):hover fieldset": + { + borderColor: theme.palette.border.dark, + }, + }, + }, + inputAdornment: { sx: { ml: 0, px: 3 } }, + openPickerButton: { + sx: { + py: 0, + mr: 0, + "& path": { + stroke: theme.palette.other.icon, + strokeWidth: 1.1, + }, + "&:hover": { backgroundColor: "transparent" }, + }, + }, + }} + sx={{}} + onChange={(newDate) => { + handleTimeChange("startDate", newDate); + }} + error={errors["startDate"]} + /> + + + + + + + + + Start time + + + All dates and times are in GMT+0 time zone. + + + + + { + handleTimeChange("startTime", newTime); + }} + slotProps={{ + nextIconButton: { sx: { ml: theme.spacing(2) } }, + field: { + sx: { + width: "fit-content", + "& > .MuiOutlinedInput-root": { + flexDirection: "row-reverse", + }, + "& input": { + height: 34, + p: 0, + pl: theme.spacing(5), + }, + "& fieldset": { + borderColor: theme.palette.border.dark, + borderRadius: theme.shape.borderRadius, + }, + "&:not(:has(.Mui-disabled)):not(:has(.Mui-error)) .MuiOutlinedInput-root:not(:has(input:focus)):hover fieldset": + { + borderColor: theme.palette.border.dark, + }, + }, + }, + }} + error={errors["startTime"]} + /> + + + + + + + Duration + + + + { + handleFormChange("duration", event.target.value); + }} + error={errors["duration"]} + /> + handleChange(e, "repeat")} - id="repeat-mode" - items={repeatOptions} - value={values.repeat} - /> - ), - }, - { - title: "Date", - component: ( - - - handleChange({ target: { value: date } }, "date") - } - /> - - ), - }, - { - title: "Start time", - component: ( - - - handleChange({ target: { value: time } }, "startTime") - } - /> - - ), - }, - { - title: "Duration", - component: ( - - handleChange(e, "duration")} - value={values.duration} - error={errors.duration} - type="number" - /> -