From 331a1f39043dd7899080f4c25540d95e67f776d9 Mon Sep 17 00:00:00 2001 From: Mohammad Khalilzadeh Date: Mon, 5 Aug 2024 14:17:41 +0330 Subject: [PATCH 1/8] completing create new maintenance window (no-repeat) UI --- .../CreateMaintenanceWindow/index.css | 40 ++++++-- .../CreateMaintenanceWindow/index.jsx | 98 ++++++++++++++++++- 2 files changed, 128 insertions(+), 10 deletions(-) diff --git a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.css b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.css index a799bf0af..04960d08b 100644 --- a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.css +++ b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.css @@ -1,11 +1,18 @@ -.maintenance-options > .MuiStack-root > .MuiStack-root.select-wrapper { - width: 380px; +.maintenance-options { + > .MuiStack-root { + > .MuiStack-root.select-wrapper, + .field { + width: 380px; + } + } } -.date-picker .MuiOutlinedInput-root, -.time-picker .MuiOutlinedInput-root { - height: 34px; - font-size: var(--env-var-font-size-medium); +.date-picker, +.time-picker { + .MuiOutlinedInput-root { + height: 34px; + font-size: var(--env-var-font-size-medium); + } } .date-picker .MuiOutlinedInput-root { @@ -19,3 +26,24 @@ .MuiInputAdornment-outlined .MuiIconButton-root svg { width: 20px; } + +.duration-config { + .field-text .MuiTextField-root, + .field { + width: 70px; + min-width: 70px; + max-width: 70px; + } + + > .MuiStack-root.select-wrapper { + width: 100px; + + > .MuiInputBase-root:has(> .MuiSelect-select) { + min-width: 100px; + } + } + + .select-wrapper .select-component > .MuiSelect-select { + text-transform: none; + } +} diff --git a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx index aea012e2c..b60b263a6 100644 --- a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx +++ b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx @@ -9,6 +9,7 @@ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; import dayjs from "dayjs"; import { DatePicker } from "@mui/x-date-pickers/DatePicker"; import { MobileTimePicker } from "@mui/x-date-pickers/MobileTimePicker"; +import Field from "../../../Components/Inputs/Field"; const directory = { title: "Create a maintenance window", @@ -45,9 +46,29 @@ const configOptionTitle = (title, description) => { ); }; +const timeFrames = [ + { _id: "seconds", name: "seconds" }, + { _id: "minutes", name: "minutes" }, + { _id: "hours", name: "hours" }, + { _id: "days", name: "days" }, +]; + +const sxButtons = { + width: 110, + height: 34, +}; + const CreateNewMaintenanceWindow = () => { const [values, setValues] = useState({ repeat: 1, + date: dayjs(), + startTime: dayjs(), + duration: { + value: "60", + unit: "minutes", + }, + friendlyName: "", + AddMonitors: "", }); const handleChange = (event, name) => { @@ -77,7 +98,13 @@ const CreateNewMaintenanceWindow = () => { className="date-localization-provider" dateAdapter={AdapterDayjs} > - + + handleChange({ target: { value: date } }, "date") + } + /> ), }, @@ -89,10 +116,68 @@ const CreateNewMaintenanceWindow = () => { className="time-localization-provider" dateAdapter={AdapterDayjs} > - + + handleChange({ target: { value: time } }, "startTime") + } + /> ), }, + { + title: "Duration", + component: ( + + handleChange(e, "duration")} + value={values.duration.value} + /> + handleChange(e, "duration.unit")} @@ -159,7 +159,11 @@ const CreateNewMaintenanceWindow = () => { { title: "Add monitors", component: ( - + Date: Tue, 6 Aug 2024 18:41:00 +0330 Subject: [PATCH 5/8] fixes --- .../Maintenance/CreateMaintenanceWindow/index.jsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx index 286d7798f..a31fc3385 100644 --- a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx +++ b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx @@ -63,10 +63,8 @@ const CreateNewMaintenanceWindow = () => { repeat: 1, date: dayjs(), startTime: dayjs(), - duration: { - magnitude: "", - unit: 1, - }, + duration: "60", + unit: "minutes", friendlyName: "", AddMonitors: "", }); @@ -133,14 +131,14 @@ const CreateNewMaintenanceWindow = () => { handleChange(e, "duration.magnitude")} - value={values["duration.unit"]} + onChange={(e) => handleChange(e, "duration")} + value={values.duration} /> handleChange(e, "unit")} From 0ae29e13a5823f889da50ed65d02e44c116e7add Mon Sep 17 00:00:00 2001 From: Mohammad Khalilzadeh Date: Thu, 8 Aug 2024 09:13:46 +0330 Subject: [PATCH 7/8] fixes --- .../Maintenance/CreateMaintenanceWindow/index.jsx | 12 ++++++------ Client/src/index.css | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx index 3eda3e4af..e4e244b6c 100644 --- a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx +++ b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.jsx @@ -46,7 +46,7 @@ const configOptionTitle = (title, description) => { ); }; -const timeFrames = [ +const durationOptions = [ { _id: "minutes", name: "minutes" }, { _id: "hours", name: "hours" }, { _id: "days", name: "days" }, @@ -62,7 +62,7 @@ const CreateNewMaintenanceWindow = () => { repeat: 1, date: dayjs(), startTime: dayjs(), - durationOptions: "60", + duration: "60", unit: "minutes", friendlyName: "", AddMonitors: "", @@ -107,7 +107,6 @@ const CreateNewMaintenanceWindow = () => { }, { title: "Start time", - description: "Your pings won’t be sent in this time frame.", component: ( { handleChange(e, "durationOptions")} - value={values.durationOptions} + onChange={(e) => handleChange(e, "duration")} + value={values.duration} />