Merge remote-tracking branch 'upstream/develop' into feat/notification-modal
This commit is contained in:
commit
e76c3853f3
10 files changed
+44
-13
No files matched your search
@@ -18,6 +18,7 @@ import "./index.css";
|
|||||||
* @param {string} props.items.name - The display name of each item.
|
* @param {string} props.items.name - The display name of each item.
|
||||||
* @param {function} props.onChange - The function to handle onChange event.
|
* @param {function} props.onChange - The function to handle onChange event.
|
||||||
* @param {object} props.sx - The custom styles object for MUI Select component.
|
* @param {object} props.sx - The custom styles object for MUI Select component.
|
||||||
|
* @param {number} props.maxWidth - Maximum width in pixels for the select component. Enables responsive text truncation.
|
||||||
* @returns {JSX.Element}
|
* @returns {JSX.Element}
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
@@ -50,6 +51,7 @@ const Select = ({
|
|||||||
sx,
|
sx,
|
||||||
name = "",
|
name = "",
|
||||||
labelControlSpacing = 2,
|
labelControlSpacing = 2,
|
||||||
|
maxWidth,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const itemStyles = {
|
const itemStyles = {
|
||||||
@@ -59,6 +61,13 @@ const Select = ({
|
|||||||
margin: theme.spacing(2),
|
margin: theme.spacing(2),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const responsiveMaxWidth = {
|
||||||
|
xs: `${maxWidth * 0.5}px`,
|
||||||
|
sm: `${maxWidth * 0.75}px`,
|
||||||
|
md: `${maxWidth * 0.9}px`,
|
||||||
|
lg: `${maxWidth}px`,
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
gap={theme.spacing(labelControlSpacing)}
|
gap={theme.spacing(labelControlSpacing)}
|
||||||
@@ -87,6 +96,7 @@ const Select = ({
|
|||||||
sx={{
|
sx={{
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
minWidth: "125px",
|
minWidth: "125px",
|
||||||
|
...(maxWidth && { maxWidth: responsiveMaxWidth }),
|
||||||
"& fieldset": {
|
"& fieldset": {
|
||||||
borderRadius: theme.shape.borderRadius,
|
borderRadius: theme.shape.borderRadius,
|
||||||
borderColor: theme.palette.primary.lowContrast,
|
borderColor: theme.palette.primary.lowContrast,
|
||||||
@@ -99,6 +109,22 @@ const Select = ({
|
|||||||
},
|
},
|
||||||
...sx,
|
...sx,
|
||||||
}}
|
}}
|
||||||
|
renderValue={(selected) => {
|
||||||
|
const selectedItem = items.find((item) => item._id === selected);
|
||||||
|
const displayName = selectedItem ? selectedItem.name : placeholder;
|
||||||
|
return (
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
overflow: "hidden",
|
||||||
|
textOverflow: "ellipsis",
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
}}
|
||||||
|
title={displayName}
|
||||||
|
>
|
||||||
|
{displayName}
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{placeholder && (
|
{placeholder && (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
@@ -146,6 +172,11 @@ Select.propTypes = {
|
|||||||
onBlur: PropTypes.func,
|
onBlur: PropTypes.func,
|
||||||
sx: PropTypes.object,
|
sx: PropTypes.object,
|
||||||
labelControlSpacing: PropTypes.number,
|
labelControlSpacing: PropTypes.number,
|
||||||
|
/**
|
||||||
|
* Maximum width in pixels. Used to control text truncation and element width.
|
||||||
|
* Responsive breakpoints will be calculated as percentages of this value.
|
||||||
|
*/
|
||||||
|
maxWidth: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Select;
|
export default Select;
|
||||||
@@ -75,7 +75,7 @@ const DistributedUptimeMap = ({
|
|||||||
type: "Feature",
|
type: "Feature",
|
||||||
geometry: {
|
geometry: {
|
||||||
type: "Point",
|
type: "Point",
|
||||||
coordinates: [check.lng, check.lat],
|
coordinates: [check._id.lng, check._id.lat],
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
color: theme.palette.accent.main,
|
color: theme.palette.accent.main,
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ const DistributedUptimeResponseAreaChart = ({ checks }) => {
|
|||||||
</defs>
|
</defs>
|
||||||
<XAxis
|
<XAxis
|
||||||
stroke={theme.palette.primary.lowContrast}
|
stroke={theme.palette.primary.lowContrast}
|
||||||
dataKey="_id"
|
dataKey="_id.date"
|
||||||
tick={<CustomTick />}
|
tick={<CustomTick />}
|
||||||
minTickGap={0}
|
minTickGap={0}
|
||||||
axisLine={false}
|
axisLine={false}
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ const DistributedUptimeResponseBarChart = ({ checks }) => {
|
|||||||
/>
|
/>
|
||||||
<XAxis
|
<XAxis
|
||||||
stroke={theme.palette.primary.lowContrast}
|
stroke={theme.palette.primary.lowContrast}
|
||||||
dataKey="_id"
|
dataKey="_id.date"
|
||||||
tick={<CustomTick />}
|
tick={<CustomTick />}
|
||||||
minTickGap={0}
|
minTickGap={0}
|
||||||
axisLine={false}
|
axisLine={false}
|
||||||
|
|||||||
+1
-1
@@ -75,7 +75,7 @@ CustomToolTip.propTypes = {
|
|||||||
PropTypes.shape({
|
PropTypes.shape({
|
||||||
value: PropTypes.number,
|
value: PropTypes.number,
|
||||||
payload: PropTypes.shape({
|
payload: PropTypes.shape({
|
||||||
_id: PropTypes.string,
|
_id: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
||||||
avgResponseTime: PropTypes.number,
|
avgResponseTime: PropTypes.number,
|
||||||
originalAvgResponseTime: PropTypes.number,
|
originalAvgResponseTime: PropTypes.number,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ import PropTypes from "prop-types";
|
|||||||
|
|
||||||
const StatBoxes = ({ monitor, lastUpdateTrigger }) => {
|
const StatBoxes = ({ monitor, lastUpdateTrigger }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
let timeSinceLastCheck = 0;
|
||||||
|
|
||||||
|
if (monitor?.lastCheckTimestamp) {
|
||||||
|
timeSinceLastCheck = Date.now() - monitor?.lastCheckTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
@@ -32,7 +37,7 @@ const StatBoxes = ({ monitor, lastUpdateTrigger }) => {
|
|||||||
heading={"Last check"}
|
heading={"Last check"}
|
||||||
subHeading={
|
subHeading={
|
||||||
<LastUpdate
|
<LastUpdate
|
||||||
lastUpdateTime={monitor?.timeSinceLastCheck ?? 0}
|
lastUpdateTime={timeSinceLastCheck}
|
||||||
suffix={"seconds ago"}
|
suffix={"seconds ago"}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ const DistributedUptimeDetails = () => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
direction="column"
|
direction="column"
|
||||||
|
|||||||
@@ -25,11 +25,7 @@ const useSubscribeToMonitors = (page, rowsPerPage) => {
|
|||||||
const initialDataRes = await networkService.getDistributedUptimeMonitors({
|
const initialDataRes = await networkService.getDistributedUptimeMonitors({
|
||||||
teamId: user.teamId,
|
teamId: user.teamId,
|
||||||
limit: 25,
|
limit: 25,
|
||||||
types: [
|
types: ["distributed_http"],
|
||||||
typeof import.meta.env.VITE_DEPIN_TESTING === "undefined"
|
|
||||||
? "distributed_http"
|
|
||||||
: "distributed_test",
|
|
||||||
],
|
|
||||||
page,
|
page,
|
||||||
rowsPerPage,
|
rowsPerPage,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ const DistributedUptimeStatus = () => {
|
|||||||
/>
|
/>
|
||||||
<InfoBox
|
<InfoBox
|
||||||
heading={isSmallScreen ? "UPT" : "UPT Burned"}
|
heading={isSmallScreen ? "UPT" : "UPT Burned"}
|
||||||
subHeading={safelyParseFloat(monitor?.totalUptBurnt).toFixed(4)}
|
subHeading={safelyParseFloat(monitor?.uptBurnt).toFixed(4)}
|
||||||
img={UptLogo}
|
img={UptLogo}
|
||||||
alt="Upt Logo"
|
alt="Upt Logo"
|
||||||
sx={{ width: "50%" }}
|
sx={{ width: "50%" }}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const OptionsHeader = ({
|
|||||||
backgroundColor: theme.palette.primary.main,
|
backgroundColor: theme.palette.primary.main,
|
||||||
color: theme.palette.primary.contrastTextSecondary,
|
color: theme.palette.primary.contrastTextSecondary,
|
||||||
}}
|
}}
|
||||||
truncate={true}
|
maxWidth={250}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack {...stackStyles}>
|
<Stack {...stackStyles}>
|
||||||
|
|||||||
Reference in new issue
Block a user