Merge remote-tracking branch 'upstream/master' into feat/image-upload
This commit is contained in:
commit
7f7226d6e5
42 files changed
+1776
-549
No files matched your search
@@ -0,0 +1,9 @@
|
||||
.alert {
|
||||
margin: 0;
|
||||
width: fit-content;
|
||||
padding: var(--env-var-spacing-1-plus);
|
||||
font-size: var(--env-var-font-size-medium);
|
||||
}
|
||||
.alert .MuiStack-root {
|
||||
max-width: 85%;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import PropTypes from "prop-types";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { Box, Stack } from "@mui/material";
|
||||
import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
|
||||
import ErrorOutlineOutlinedIcon from "@mui/icons-material/ErrorOutlineOutlined";
|
||||
import WarningAmberOutlinedIcon from "@mui/icons-material/WarningAmberOutlined";
|
||||
import "./index.css";
|
||||
|
||||
/**
|
||||
* Icons mapping for different alert variants.
|
||||
* @type {Object<string, JSX.Element>}
|
||||
*/
|
||||
|
||||
const icons = {
|
||||
info: <InfoOutlinedIcon />,
|
||||
error: <ErrorOutlineOutlinedIcon />,
|
||||
warning: <WarningAmberOutlinedIcon />,
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Object} props
|
||||
* @param {'info' | 'error' | 'warning'} props.variant - The type of alert.
|
||||
* @param {string} [props.title] - The title of the alert.
|
||||
* @param {string} [props.body] - The body text of the alert.
|
||||
* @returns {JSX.Element}
|
||||
*/
|
||||
|
||||
const Alert = ({ variant, title, body }) => {
|
||||
const theme = useTheme();
|
||||
const { bg, border, color } = theme.alert[variant];
|
||||
const icon = icons[variant];
|
||||
|
||||
return (
|
||||
<Stack
|
||||
direction="row"
|
||||
justifyContent="flex-start"
|
||||
className="alert row-stack"
|
||||
gap={theme.gap.ml}
|
||||
sx={{
|
||||
backgroundColor: bg,
|
||||
border: `solid 1px ${border}`,
|
||||
borderRadius: `${theme.shape.borderRadius}px`,
|
||||
}}
|
||||
>
|
||||
{icon && <Box sx={{ color: color }}>{icon}</Box>}
|
||||
<Stack direction="column" gap="2px" sx={{ flex: 1, color: color }}>
|
||||
{title && <Box sx={{ fontWeight: "700" }}>{title}</Box>}
|
||||
{body && <Box sx={{ fontWeight: "400" }}>{body}</Box>}
|
||||
</Stack>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
Alert.propTypes = {
|
||||
variant: PropTypes.oneOf(["info", "error", "warning"]).isRequired,
|
||||
title: PropTypes.string,
|
||||
body: PropTypes.string,
|
||||
};
|
||||
|
||||
export default Alert;
|
||||
@@ -12,7 +12,7 @@
|
||||
}
|
||||
|
||||
.server-status-tile {
|
||||
min-width: 310px;
|
||||
min-width: 250px;
|
||||
width: calc(100% - 310px);
|
||||
padding: var(--spacing-general-1);
|
||||
border: 1px solid var(--color-border-0);
|
||||
|
||||
@@ -5,6 +5,7 @@ import Monitors from "../../assets/Images/Icon-monitor-gray.png";
|
||||
import Incidents from "../../assets/Images/Icon-warning-gray.png";
|
||||
import SensorsIcon from "../../assets/Images/Icon-signal-gray.png";
|
||||
import AllInclusiveIcon from "../../assets/Images/Icon-link-gray.png";
|
||||
import MaintenanceIcon from "../../assets/Images/Icon-maintenance-gray.png";
|
||||
import SettingsIcon from "../../assets/Images/Icon-setting-gray.png";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useNavigate, useLocation } from "react-router-dom";
|
||||
@@ -62,6 +63,13 @@ function DashboardMenu() {
|
||||
activeButton === "/integrations",
|
||||
() => handleClick(pathMap["/integrations"], "/integrations")
|
||||
)}
|
||||
{DashboardMenuButton(
|
||||
MaintenanceIcon,
|
||||
"Maintenance",
|
||||
"/maintenance",
|
||||
activeButton === "/maintenance",
|
||||
() => handleClick(pathMap["/maintenance"], "/maintenance")
|
||||
)}
|
||||
{DashboardMenuButton(
|
||||
SettingsIcon,
|
||||
"Settings",
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
.host-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.host-row a {
|
||||
width: var(--env-var-img-width-2);
|
||||
height: var(--env-var-img-width-2);
|
||||
color: var(--env-var-color-5);
|
||||
margin-right: 10px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.host-row a svg {
|
||||
width: var(--env-var-font-size-large);
|
||||
height: var(--env-var-font-size-large);
|
||||
}
|
||||
.host-row .host-percentage {
|
||||
font-size: var(--env-var-font-size-small);
|
||||
}
|
||||
|
||||
.host-name {
|
||||
width: fit-content;
|
||||
margin-right: 10px;
|
||||
font-weight: 700;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.host-status {
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.host-status-details {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border: 1px solid var(--env-var-color-4);
|
||||
border-radius: var(--env-var-radius-2);
|
||||
padding: calc(var(--env-var-spacing-1) / 2);
|
||||
}
|
||||
|
||||
.host-status-text {
|
||||
font-size: var(--env-var-font-size-medium);
|
||||
line-height: var(--env-var-font-size-medium);
|
||||
}
|
||||
.host-status-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
margin-right: calc(var(--env-var-spacing-1) / 2);
|
||||
}
|
||||
|
||||
.monitors .MuiPaper-root:has(table.MuiTable-root) {
|
||||
box-shadow: none;
|
||||
border: solid 1px var(--env-var-color-16);
|
||||
border-radius: var(--env-var-radius-1);
|
||||
}
|
||||
.monitors .MuiTableFooter-root .MuiTableCell-root {
|
||||
border: none;
|
||||
}
|
||||
.monitors .MuiTableHead-root,
|
||||
.monitors .MuiTableRow-root:hover {
|
||||
background-color: var(--env-var-color-13);
|
||||
}
|
||||
.monitors .MuiTableHead-root .MuiTableCell-root,
|
||||
.monitors .MuiTableBody-root .MuiTableCell-root {
|
||||
font-size: var(--env-var-font-size-medium);
|
||||
}
|
||||
.monitors .MuiTableHead-root .MuiTableCell-root {
|
||||
padding: var(--env-var-spacing-1) var(--env-var-spacing-2);
|
||||
font-weight: 500;
|
||||
color: var(--env-var-color-2);
|
||||
}
|
||||
.monitors .MuiTableHead-root span {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
height: 14px;
|
||||
width: 20px;
|
||||
overflow: hidden;
|
||||
margin-bottom: -3px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
.monitors .MuiTableHead-root span svg {
|
||||
position: absolute;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
bottom: 0;
|
||||
}
|
||||
.monitors .MuiTableBody-root .MuiTableCell-root {
|
||||
color: var(--env-var-color-5);
|
||||
padding: 6px var(--env-var-spacing-2);
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
import "./index.css";
|
||||
import { useState } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import OpenIt from "../../assets/Images/Icon-open-in-tab-gray.png";
|
||||
import ResponseTimeChart from "../Charts/ResponseTimeChart";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableContainer,
|
||||
TableHead,
|
||||
TableRow,
|
||||
TableFooter,
|
||||
TablePagination,
|
||||
Paper,
|
||||
} from "@mui/material";
|
||||
import SouthRoundedIcon from "@mui/icons-material/SouthRounded";
|
||||
import OpenInNewPage from "../../assets/icons/open-in-new-page.svg?react"
|
||||
|
||||
/**
|
||||
* Host component.
|
||||
* This subcomponent receives a params object and displays the host details.
|
||||
*
|
||||
* @component
|
||||
* @param {Object} params - An object containing the following properties:
|
||||
* @param {string} params.url - The URL of the host.
|
||||
* @param {string} params.title - The name of the host.
|
||||
* @param {string} params.percentageColor - The color of the percentage text.
|
||||
* @param {number} params.precentage - The percentage to display.
|
||||
* @returns {React.ElementType} Returns a div element with the host details.
|
||||
*/
|
||||
const Host = ({ params }) => {
|
||||
return (
|
||||
<div className="host-row">
|
||||
<a href={params.url} target="_blank">
|
||||
<OpenInNewPage />
|
||||
</a>
|
||||
<div className="host-name">{params.title}</div>
|
||||
<div
|
||||
className="host-percentage"
|
||||
style={{ color: params.percentageColor }}
|
||||
>
|
||||
{params.precentage}%
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Status component.
|
||||
* This subcomponent receives a params object and displays the status details of a monitor.
|
||||
*
|
||||
* @component
|
||||
* @param {Object} params - An object containing the following properties:
|
||||
* @param {string} params.backgroundColor - The background color of the status box.
|
||||
* @param {string} params.statusDotColor - The color of the status dot.
|
||||
* @param {string} params.status - The status text to display.
|
||||
* @returns {React.ElementType} Returns a div element with the host status.
|
||||
*/
|
||||
const Status = ({ params }) => {
|
||||
return (
|
||||
<div className="host-status">
|
||||
<div
|
||||
className="host-status-details"
|
||||
style={{ backgroundColor: params.backgroundColor }}
|
||||
>
|
||||
<div
|
||||
className="host-status-dot"
|
||||
style={{ backgroundColor: params.statusDotColor }}
|
||||
/>
|
||||
<span
|
||||
className="host-status-text"
|
||||
style={{ textTransform: "capitalize" }}
|
||||
>
|
||||
{params.status}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* MonitorTable component.
|
||||
* Takes an array of monitor objects and displays them in a table.
|
||||
* Each row in the table represents a monitor and includes the host, status, response time, and action.
|
||||
*
|
||||
* @component
|
||||
* @param {Object[]} monitors - An array of monitor objects. Each object should have the following properties:
|
||||
* @param {string} monitors[].url - The URL of the monitor.
|
||||
* @param {string} monitors[].name - The name of the monitor.
|
||||
* @param {boolean} monitors[].status - The status of the monitor. True if the monitor is up, false otherwise.
|
||||
* @param {Object[]} monitors[].checks - An array of check objects for the response time chart.
|
||||
* @returns {React.Component} Returns a table with the monitor data.
|
||||
*/
|
||||
const MonitorTable = ({ monitors = [] }) => {
|
||||
const [page, setPage] = useState(0);
|
||||
const [rowsPerPage, setRowsPerPage] = useState(5);
|
||||
|
||||
const handleChangePage = (event, newPage) => {
|
||||
setPage(newPage);
|
||||
};
|
||||
|
||||
const handleChangeRowsPerPage = (event) => {
|
||||
setRowsPerPage(parseInt(event.target.value, 10));
|
||||
setPage(0);
|
||||
};
|
||||
|
||||
const mappedRows = monitors
|
||||
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
||||
.map((monitor) => {
|
||||
const params = {
|
||||
url: monitor.url,
|
||||
title: monitor.name,
|
||||
precentage: 100,
|
||||
percentageColor:
|
||||
monitor.status === true
|
||||
? "var(--env-var-color-17)"
|
||||
: "var(--env-var-color-19)",
|
||||
status: monitor.status === true ? "up" : "down",
|
||||
backgroundColor:
|
||||
monitor.status === true
|
||||
? "var(--env-var-color-20)"
|
||||
: "var(--env-var-color-21)",
|
||||
statusDotColor:
|
||||
monitor.status === true
|
||||
? "var(--env-var-color-17)"
|
||||
: "var(--env-var-color-19)",
|
||||
};
|
||||
|
||||
return (
|
||||
<TableRow key={monitor._id}>
|
||||
<TableCell>
|
||||
<Host params={params} />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Status params={params} />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<ResponseTimeChart checks={monitor.checks} />
|
||||
</TableCell>
|
||||
<TableCell>TODO Add Actions</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<TableContainer component={Paper}>
|
||||
<Table>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell>Host</TableCell>
|
||||
<TableCell>
|
||||
Status
|
||||
<span>
|
||||
<SouthRoundedIcon />
|
||||
</span>
|
||||
</TableCell>
|
||||
<TableCell>Response Time</TableCell>
|
||||
<TableCell>Actions</TableCell>
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>{mappedRows}</TableBody>
|
||||
<TableFooter>
|
||||
<TableRow>
|
||||
<TablePagination
|
||||
rowsPerPageOptions={[5, 10, 25]}
|
||||
count={monitors.length}
|
||||
rowsPerPage={rowsPerPage}
|
||||
page={page}
|
||||
onPageChange={handleChangePage}
|
||||
onRowsPerPageChange={handleChangeRowsPerPage}
|
||||
/>
|
||||
</TableRow>
|
||||
</TableFooter>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
);
|
||||
};
|
||||
|
||||
MonitorTable.propTypes = {
|
||||
monitors: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
};
|
||||
|
||||
Status.propTypes = { params: PropTypes.object.isRequired };
|
||||
Host.propTypes = { params: PropTypes.object.isRequired };
|
||||
|
||||
export default MonitorTable;
|
||||
@@ -24,3 +24,9 @@
|
||||
box-shadow: none;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#menu-appbar svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
color: var(--env-var-color-25);
|
||||
}
|
||||
@@ -18,8 +18,18 @@ import { clearMonitorState } from "../../Features/Monitors/monitorsSlice";
|
||||
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import LockSvg from "../../assets/icons/lock.svg?react";
|
||||
import UserSvg from "../../assets/icons/user.svg?react";
|
||||
import TeamSvg from "../../assets/icons/user-two.svg?react";
|
||||
import LogoutSvg from "../../assets/icons/logout.svg?react";
|
||||
|
||||
const settings = ["Profile", "Team", "Invite Colleagues", "Logout"];
|
||||
const settings = ["Profile", "Password", "Team", "Logout"];
|
||||
const icons = {
|
||||
Profile: <UserSvg />,
|
||||
Team: <TeamSvg />,
|
||||
Password: <LockSvg />,
|
||||
Logout: <LogoutSvg />,
|
||||
};
|
||||
|
||||
/**
|
||||
* NavBar component
|
||||
@@ -71,8 +81,8 @@ function NavBar() {
|
||||
case "Team":
|
||||
navigate("/account/team");
|
||||
break;
|
||||
case "Invite Colleagues":
|
||||
console.log("Invite Colleagues");
|
||||
case "Password":
|
||||
navigate("/account/password");
|
||||
break;
|
||||
case "Logout":
|
||||
logout();
|
||||
@@ -184,10 +194,13 @@ function NavBar() {
|
||||
id="menu-item"
|
||||
key={setting}
|
||||
onClick={() => handleCloseUserMenu(setting)}
|
||||
sx={{ width: "150px" }}
|
||||
>
|
||||
{icons[setting]}
|
||||
<Typography
|
||||
fontSize="var(--env-var-font-size-medium)"
|
||||
textAlign="center"
|
||||
marginLeft="8px"
|
||||
>
|
||||
{setting}
|
||||
</Typography>
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import TabPanel from "@mui/lab/TabPanel";
|
||||
import React, { useState } from "react";
|
||||
// import AnnouncementsDualButtonWithIcon from "../../Announcements/AnnouncementsDualButtonWithIcon/AnnouncementsDualButtonWithIcon";
|
||||
import AnnouncementsDualButtonWithIcon from "../../Toast/AnnouncementsDualButtonWithIcon/AnnouncementsDualButtonWithIcon";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { Box, Divider, Stack, Typography } from "@mui/material";
|
||||
import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
|
||||
import WarningAmberOutlinedIcon from "@mui/icons-material/WarningAmberOutlined";
|
||||
import ButtonSpinner from "../../ButtonSpinner";
|
||||
import PasswordTextField from "../../TextFields/Password/PasswordTextField";
|
||||
import { editPasswordValidation } from "../../../Validation/validation";
|
||||
import Alert from "../../Alert";
|
||||
|
||||
/**
|
||||
* PasswordPanel component manages the form for editing password.
|
||||
@@ -96,13 +93,9 @@ const PasswordPanel = () => {
|
||||
spellCheck="false"
|
||||
>
|
||||
<div className="edit-password-form__wrapper">
|
||||
<AnnouncementsDualButtonWithIcon
|
||||
icon={
|
||||
<InfoOutlinedIcon
|
||||
style={{ fill: theme.palette.secondary.main }}
|
||||
/>
|
||||
}
|
||||
subject="SSO login"
|
||||
<Alert
|
||||
variant="info"
|
||||
title="SSO login"
|
||||
body="Since you logged in via SSO, you cannot reset or modify your password."
|
||||
/>
|
||||
</div>
|
||||
@@ -181,8 +174,8 @@ const PasswordPanel = () => {
|
||||
<div className="edit-password-form__wrapper">
|
||||
<Stack></Stack>
|
||||
<Box sx={{ flex: 1 }}>
|
||||
<AnnouncementsDualButtonWithIcon
|
||||
icon={<WarningAmberOutlinedIcon style={{ fill: "#f79009" }} />}
|
||||
<Alert
|
||||
variant="warning"
|
||||
body="New password must contain at least 8 characters and must have at least one uppercase letter, one number and one symbol."
|
||||
/>
|
||||
</Box>
|
||||
|
||||
Reference in new issue
Block a user