FIX-1930 have made initial changes in order to proceed with rebuidling.

This commit is contained in:
Owaise Imdad
2025-03-15 01:44:00 +05:30
parent 228b080730
commit 5466d38496
2 changed files with 83 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import { Box, Stack, Typography } from "@mui/material";
import PropTypes from "prop-types";
import { useTheme } from "@emotion/react";
import ConfigBox from "../../../../../Components/ConfigBox";
const ConfigRow = ({ title, description, children }) => {
const theme = useTheme();
return (
<ConfigBox>
<Box>
<Typography component="h2" variant="h2">
{title}
</Typography>
{description && (
<Typography variant="body2" mt={theme.spacing(2)}>
{description}
</Typography>
)}
</Box>
<Stack gap={theme.spacing(15)} mt={theme.spacing(4)}>
{children}
</Stack>
</ConfigBox>
);
};
ConfigRow.propTypes = {
title: PropTypes.string.isRequired,
description: PropTypes.string,
children: PropTypes.node
};
export default ConfigRow;

View File

@@ -0,0 +1,49 @@
import PropTypes from "prop-types";
import ConfigRow from "../ConfigRow";
import Search from "../../../../../Components/Inputs/Search";
import { useState } from "react";
const MonitorsConfig = ({
monitors,
selectedMonitors,
error,
isEditMode,
onSelectMonitors,
secondaryLabelText,
}) => {
const [search, setSearch] = useState("");
const handleSearch = (value) => {
setSearch(value);
};
return (
<ConfigRow title="Monitors to apply maintenance window to">
<Search
id={"monitors"}
label="Add monitors"
multiple={true}
isAdorned={false}
options={monitors || []}
filteredBy="name"
secondaryLabel={secondaryLabelText}
inputValue={search}
value={selectedMonitors}
handleInputChange={handleSearch}
handleChange={onSelectMonitors}
error={error}
disabled={isEditMode}
/>
</ConfigRow>
);
};
MonitorsConfig.propTypes = {
monitors: PropTypes.array.isRequired,
selectedMonitors: PropTypes.array.isRequired,
error: PropTypes.string,
isEditMode: PropTypes.bool.isRequired,
onSelectMonitors: PropTypes.func.isRequired,
secondaryLabelText: PropTypes.string,
};
export default MonitorsConfig;