Merge branch 'develop' into feat/create-monitor-display-name-v2
This commit is contained in:
commit
0adc8fd037
39 files changed
+345
-744
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { Box, Stack, Typography } from "@mui/material";
|
||||
import Field from "../../Components/Inputs/Field";
|
||||
import TextInput from "../../Components/Inputs/TextInput";
|
||||
import Link from "../../Components/Link";
|
||||
import "./index.css";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
@@ -160,13 +160,14 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
</Typography>
|
||||
</Box>
|
||||
<Stack gap={theme.spacing(20)}>
|
||||
<Field
|
||||
<TextInput
|
||||
id="apiBaseUrl"
|
||||
label="API URL Host"
|
||||
value={localSettings.apiBaseUrl}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
error={errors.apiBaseUrl}
|
||||
error={errors.apiBaseUrl ? true : false}
|
||||
helperText={errors.apiBaseUrl}
|
||||
/>
|
||||
<Select
|
||||
id="logLevel"
|
||||
@@ -189,7 +190,7 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
</Typography>
|
||||
</Box>
|
||||
<Stack gap={theme.spacing(20)}>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="systemEmailHost"
|
||||
label="System email host"
|
||||
@@ -197,9 +198,10 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
value={localSettings.systemEmailHost}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
error={errors.systemEmailHost}
|
||||
error={errors.systemEmailHost ? true : false}
|
||||
helperText={errors.systemEmailHost}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="number"
|
||||
id="systemEmailPort"
|
||||
label="System email port"
|
||||
@@ -207,18 +209,21 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
value={localSettings.systemEmailPort?.toString()}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
error={errors.systemEmailPort}
|
||||
error={errors.systemEmailPort ? true : false}
|
||||
helperText={errors.systemEmailPort}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="email"
|
||||
id="systemEmailAddress"
|
||||
label="System email address"
|
||||
name="systemEmailAddress"
|
||||
value={localSettings.systemEmailAddress}
|
||||
onChange={handleChange}
|
||||
error={errors.systemEmailAddress}
|
||||
onBlur={handleBlur}
|
||||
error={errors.systemEmailAddress ? true : false}
|
||||
helperText={errors.systemEmailAddress}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="systemEmailPassword"
|
||||
label="System email password"
|
||||
@@ -226,7 +231,8 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
value={localSettings.systemEmailPassword}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
error={errors.systemEmailPassword}
|
||||
error={errors.systemEmailPassword ? true : false}
|
||||
helperText={errors.systemEmailPassword}
|
||||
/>
|
||||
</Stack>
|
||||
</ConfigBox>
|
||||
@@ -242,7 +248,7 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
direction="row"
|
||||
gap={theme.spacing(10)}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
type="number"
|
||||
id="jwtTTLNum"
|
||||
label="JWT time to live"
|
||||
@@ -250,7 +256,8 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
value={localSettings.jwtTTLNum.toString()}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
error={errors.jwtTTLNum}
|
||||
error={errors.jwtTTLNum ? true : false}
|
||||
helperText={errors.jwtTTLNum}
|
||||
/>
|
||||
<Select
|
||||
id="jwtTTLUnits"
|
||||
@@ -265,7 +272,7 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
error={errors.jwtTTLUnits}
|
||||
/>
|
||||
</Stack>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="dbType"
|
||||
label="Database type"
|
||||
@@ -273,9 +280,10 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
value={localSettings.dbType}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
error={errors.dbType}
|
||||
error={errors.dbType ? true : false}
|
||||
helperText={errors.dbType}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="redisHost"
|
||||
label="Redis host"
|
||||
@@ -283,9 +291,10 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
value={localSettings.redisHost}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
error={errors.redisHost}
|
||||
error={errors.redisHost ? true : false}
|
||||
helperText={errors.redisHost}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="number"
|
||||
id="redisPort"
|
||||
label="Redis port"
|
||||
@@ -293,9 +302,10 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
value={localSettings.redisPort?.toString()}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
error={errors.redisPort}
|
||||
error={errors.redisPort ? true : false}
|
||||
helperText={errors.redisPort}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="pagespeedApiKey"
|
||||
label="PageSpeed API key"
|
||||
@@ -303,7 +313,8 @@ const AdvancedSettings = ({ isAdmin }) => {
|
||||
value={localSettings.pagespeedApiKey}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
error={errors.pagespeedApiKey}
|
||||
error={errors.pagespeedApiKey ? true : false}
|
||||
helperText={errors.pagespeedApiKey}
|
||||
/>
|
||||
</Stack>
|
||||
</ConfigBox>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useEffect, useState } from "react";
|
||||
import { credentials } from "../../Validation/validation";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { IconBox } from "./styled";
|
||||
import Field from "../../Components/Inputs/Field";
|
||||
import TextInput from "../../Components/Inputs/TextInput";
|
||||
import Logo from "../../assets/icons/bwu-icon.svg?react";
|
||||
import Key from "../../assets/icons/key.svg?react";
|
||||
import Background from "../../assets/Images/background-grid.svg?react";
|
||||
@@ -160,7 +160,7 @@ const ForgotPassword = () => {
|
||||
spellCheck={false}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
type="email"
|
||||
id="forgot-password-email-input"
|
||||
label="Email"
|
||||
@@ -168,7 +168,8 @@ const ForgotPassword = () => {
|
||||
placeholder="Enter your email"
|
||||
value={form.email}
|
||||
onChange={handleChange}
|
||||
error={errors.email}
|
||||
error={errors.email ? true : false}
|
||||
helperText={errors.email}
|
||||
/>
|
||||
<LoadingButton
|
||||
variant="contained"
|
||||
|
||||
@@ -7,7 +7,8 @@ import { login } from "../../Features/Auth/authSlice";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { createToast } from "../../Utils/toastUtils";
|
||||
import { networkService } from "../../main";
|
||||
import Field from "../../Components/Inputs/Field";
|
||||
import TextInput from "../../Components/Inputs/TextInput";
|
||||
import { PasswordEndAdornment } from "../../Components/Inputs/TextInput/Adornments";
|
||||
import Background from "../../assets/Images/background-grid.svg?react";
|
||||
import Logo from "../../assets/icons/bwu-icon.svg?react";
|
||||
import Mail from "../../assets/icons/mail.svg?react";
|
||||
@@ -150,7 +151,7 @@ const StepOne = ({ form, errors, onSubmit, onChange, onBack }) => {
|
||||
display="grid"
|
||||
gap={{ xs: theme.spacing(12), sm: theme.spacing(16) }}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
type="email"
|
||||
id="login-email-input"
|
||||
label="Email"
|
||||
@@ -160,7 +161,8 @@ const StepOne = ({ form, errors, onSubmit, onChange, onBack }) => {
|
||||
value={form.email}
|
||||
onInput={(e) => (e.target.value = e.target.value.toLowerCase())}
|
||||
onChange={onChange}
|
||||
error={errors.email}
|
||||
error={errors.email ? true : false}
|
||||
helperText={errors.email}
|
||||
ref={inputRef}
|
||||
/>
|
||||
<Stack
|
||||
@@ -268,7 +270,7 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
|
||||
gap: { xs: theme.spacing(12), sm: theme.spacing(16) },
|
||||
}}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
type="password"
|
||||
id="login-password-input"
|
||||
label="Password"
|
||||
@@ -277,8 +279,10 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
|
||||
autoComplete="current-password"
|
||||
value={form.password}
|
||||
onChange={onChange}
|
||||
error={errors.password}
|
||||
error={errors.password ? true : false}
|
||||
helperText={errors.password}
|
||||
ref={inputRef}
|
||||
endAdornment={<PasswordEndAdornment />}
|
||||
/>
|
||||
<Stack
|
||||
direction="row"
|
||||
|
||||
@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { Box, Button, Stack, Typography } from "@mui/material";
|
||||
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
||||
import Field from "../../../../Components/Inputs/Field";
|
||||
import TextInput from "../../../../Components/Inputs/TextInput";
|
||||
|
||||
StepOne.propTypes = {
|
||||
form: PropTypes.object,
|
||||
@@ -60,7 +60,7 @@ function StepOne({ form, errors, onSubmit, onChange, onBack }) {
|
||||
display="grid"
|
||||
gap={{ xs: theme.spacing(8), sm: theme.spacing(12) }}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
id="register-firstname-input"
|
||||
label="Name"
|
||||
isRequired={true}
|
||||
@@ -68,10 +68,11 @@ function StepOne({ form, errors, onSubmit, onChange, onBack }) {
|
||||
autoComplete="given-name"
|
||||
value={form.firstName}
|
||||
onChange={onChange}
|
||||
error={errors.firstName}
|
||||
error={errors.firstName ? true : false}
|
||||
helperText={errors.firstName}
|
||||
ref={inputRef}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
id="register-lastname-input"
|
||||
label="Surname"
|
||||
isRequired={true}
|
||||
@@ -79,7 +80,9 @@ function StepOne({ form, errors, onSubmit, onChange, onBack }) {
|
||||
autoComplete="family-name"
|
||||
value={form.lastName}
|
||||
onChange={onChange}
|
||||
error={errors.lastName}
|
||||
error={errors.lastName ? true : false}
|
||||
helperText={errors.lastName}
|
||||
ref={inputRef}
|
||||
/>
|
||||
</Box>
|
||||
<Stack
|
||||
|
||||
@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { Box, Button, Stack, Typography } from "@mui/material";
|
||||
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
||||
import Field from "../../../../Components/Inputs/Field";
|
||||
import TextInput from "../../../../Components/Inputs/TextInput";
|
||||
import Check from "../../../../Components/Check/Check";
|
||||
import { useValidatePassword } from "../../hooks/useValidatePassword";
|
||||
|
||||
@@ -31,6 +31,7 @@ function StepThree({ onSubmit, onBack }) {
|
||||
}, []);
|
||||
|
||||
const { handleChange, feedbacks, form, errors } = useValidatePassword();
|
||||
console.log(errors);
|
||||
return (
|
||||
<>
|
||||
<Stack
|
||||
@@ -59,7 +60,7 @@ function StepThree({ onSubmit, onBack }) {
|
||||
display="grid"
|
||||
gap={{ xs: theme.spacing(8), sm: theme.spacing(12) }}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
type="password"
|
||||
id="register-password-input"
|
||||
name="password"
|
||||
@@ -69,10 +70,10 @@ function StepThree({ onSubmit, onBack }) {
|
||||
autoComplete="current-password"
|
||||
value={form.password}
|
||||
onChange={handleChange}
|
||||
error={errors.password && errors.password[0]}
|
||||
error={errors.password && errors.password[0] ? true : false}
|
||||
ref={inputRef}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="password"
|
||||
id="register-confirm-input"
|
||||
name="confirm"
|
||||
@@ -82,7 +83,7 @@ function StepThree({ onSubmit, onBack }) {
|
||||
autoComplete="current-password"
|
||||
value={form.confirm}
|
||||
onChange={handleChange}
|
||||
error={errors.confirm && errors.confirm[0]}
|
||||
error={errors.confirm && errors.confirm[0] ? true : false}
|
||||
/>
|
||||
</Box>
|
||||
<Stack
|
||||
|
||||
@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { Box, Button, Stack, Typography } from "@mui/material";
|
||||
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
||||
import Field from "../../../../Components/Inputs/Field";
|
||||
import TextInput from "../../../../Components/Inputs/TextInput";
|
||||
|
||||
StepTwo.propTypes = {
|
||||
form: PropTypes.object,
|
||||
@@ -55,7 +55,7 @@ function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
|
||||
display="grid"
|
||||
gap={{ xs: theme.spacing(12), sm: theme.spacing(16) }}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
type="email"
|
||||
id="register-email-input"
|
||||
label="Email"
|
||||
@@ -65,7 +65,8 @@ function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
|
||||
value={form.email}
|
||||
onInput={(e) => (e.target.value = e.target.value.toLowerCase())}
|
||||
onChange={onChange}
|
||||
error={errors.email}
|
||||
error={errors.email ? true : false}
|
||||
helperText={errors.email}
|
||||
ref={inputRef}
|
||||
/>
|
||||
<Stack
|
||||
|
||||
@@ -9,7 +9,9 @@ import { setNewPassword } from "../../Features/Auth/authSlice";
|
||||
import { createToast } from "../../Utils/toastUtils";
|
||||
import { credentials } from "../../Validation/validation";
|
||||
import Check from "../../Components/Check/Check";
|
||||
import Field from "../../Components/Inputs/Field";
|
||||
import TextInput from "../../Components/Inputs/TextInput";
|
||||
import { PasswordEndAdornment } from "../../Components/Inputs/TextInput/Adornments";
|
||||
|
||||
import { IconBox } from "./styled";
|
||||
import LockIcon from "../../assets/icons/lock.svg?react";
|
||||
import Logo from "../../assets/icons/bwu-icon.svg?react";
|
||||
@@ -147,7 +149,7 @@ const SetNewPassword = () => {
|
||||
spellCheck={false}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
id={passwordId}
|
||||
type="password"
|
||||
name="password"
|
||||
@@ -156,7 +158,9 @@ const SetNewPassword = () => {
|
||||
placeholder="••••••••"
|
||||
value={form.password}
|
||||
onChange={handleChange}
|
||||
error={errors.password}
|
||||
error={errors.password ? true : false}
|
||||
helperText={errors.password}
|
||||
endAdornment={<PasswordEndAdornment />}
|
||||
/>
|
||||
</Box>
|
||||
<Box
|
||||
@@ -165,7 +169,7 @@ const SetNewPassword = () => {
|
||||
spellCheck={false}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
id={confirmPasswordId}
|
||||
type="password"
|
||||
name="confirm"
|
||||
@@ -174,7 +178,9 @@ const SetNewPassword = () => {
|
||||
placeholder="••••••••"
|
||||
value={form.confirm}
|
||||
onChange={handleChange}
|
||||
error={errors.confirm}
|
||||
error={errors.confirm ? true : false}
|
||||
helperText={errors.confirm}
|
||||
endAdornment={<PasswordEndAdornment />}
|
||||
/>
|
||||
</Box>
|
||||
<Stack
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Box, Stack, Typography } from "@mui/material";
|
||||
import Field from "../../../../Components/Inputs/Field";
|
||||
import TextInput from "../../../../Components/Inputs/TextInput";
|
||||
import Checkbox from "../../../../Components/Inputs/Checkbox";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import PropTypes from "prop-types";
|
||||
@@ -57,17 +57,17 @@ export const CustomThreshold = ({
|
||||
justifyContent: "flex-end",
|
||||
}}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
maxWidth="var(--env-var-width-4)"
|
||||
type="number"
|
||||
className="field-infrastructure-alert"
|
||||
id={fieldId}
|
||||
value={infrastructureMonitor[fieldId]}
|
||||
onBlur={onFieldBlur}
|
||||
onChange={onFieldChange}
|
||||
error={errors[fieldId]}
|
||||
error={errors[fieldId] ? true : false}
|
||||
disabled={!infrastructureMonitor[checkboxId]}
|
||||
hideErrorText={true}
|
||||
></Field>
|
||||
/>
|
||||
|
||||
<Typography
|
||||
component="p"
|
||||
m={theme.spacing(3)}
|
||||
|
||||
@@ -12,9 +12,8 @@ import { useNavigate } from "react-router-dom";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { createToast } from "../../../Utils/toastUtils";
|
||||
import Link from "../../../Components/Link";
|
||||
|
||||
import { ConfigBox } from "../../Monitors/styled";
|
||||
import Field from "../../../Components/Inputs/Field";
|
||||
import TextInput from "../../../Components/Inputs/TextInput";
|
||||
import Select from "../../../Components/Inputs/Select";
|
||||
import Checkbox from "../../../Components/Inputs/Checkbox";
|
||||
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||
@@ -106,7 +105,6 @@ const CreateInfrastructureMonitor = () => {
|
||||
event.preventDefault();
|
||||
const { value, id } = event.target;
|
||||
let name = appendedId ?? idMap[id] ?? id;
|
||||
|
||||
if (name.includes("notification-")) {
|
||||
name = name.replace("notification-", "");
|
||||
let hasNotif = infrastructureMonitor.notifications.some(
|
||||
@@ -263,7 +261,7 @@ const CreateInfrastructureMonitor = () => {
|
||||
</Stack>
|
||||
</Box>
|
||||
<Stack gap={theme.spacing(15)}>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="url"
|
||||
label="Server URL"
|
||||
@@ -271,9 +269,10 @@ const CreateInfrastructureMonitor = () => {
|
||||
value={infrastructureMonitor.url}
|
||||
onBlur={handleBlur}
|
||||
onChange={handleChange}
|
||||
error={errors["url"]}
|
||||
error={errors["url"] ? true : false}
|
||||
helperText={errors["url"]}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="name"
|
||||
label="Friendly name"
|
||||
@@ -283,14 +282,15 @@ const CreateInfrastructureMonitor = () => {
|
||||
onChange={handleChange}
|
||||
error={errors["name"]}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="secret"
|
||||
label="Authorization secret"
|
||||
value={infrastructureMonitor.secret}
|
||||
onBlur={handleBlur}
|
||||
onChange={handleChange}
|
||||
error={errors["secret"]}
|
||||
error={errors["secret"] ? true : false}
|
||||
helperText={errors["secret"]}
|
||||
/>
|
||||
</Stack>
|
||||
</ConfigBox>
|
||||
@@ -378,15 +378,6 @@ const CreateInfrastructureMonitor = () => {
|
||||
onBlur={(e) => handleBlur(e, "interval")}
|
||||
items={frequencies}
|
||||
/>
|
||||
{/* <Field
|
||||
type={"number"}
|
||||
id="monitor-retries"
|
||||
label="Maximum retries before the service is marked as down"
|
||||
value={infrastructureMonitor.url}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
error={errors["url"]}
|
||||
/> */}
|
||||
</Stack>
|
||||
</ConfigBox>
|
||||
<Stack
|
||||
|
||||
@@ -312,7 +312,7 @@ const InfrastructureDetails = () => {
|
||||
};
|
||||
|
||||
const buildTemps = (checks) => {
|
||||
let numCores = 0;
|
||||
let numCores = 1;
|
||||
if (checks === null) return { temps: [], tempKeys: [] };
|
||||
|
||||
for (const check of checks) {
|
||||
@@ -321,19 +321,16 @@ const InfrastructureDetails = () => {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (numCores === 0) return { temps: [], tempKeys: [] };
|
||||
|
||||
const temps = checks.map((check) => {
|
||||
if (check.cpu.temperature.length > numCores) {
|
||||
numCores = check.cpu.temperature.length;
|
||||
}
|
||||
|
||||
// If there's no data, set the temperature to 0
|
||||
if (check.cpu.temperature.length === 0) {
|
||||
if (
|
||||
check?.cpu?.temperature?.length === 0 ||
|
||||
check?.cpu?.temperature === undefined ||
|
||||
check?.cpu?.temperature === null
|
||||
) {
|
||||
check.cpu.temperature = Array(numCores).fill(0);
|
||||
}
|
||||
|
||||
return check.cpu.temperature.reduce(
|
||||
const res = check?.cpu?.temperature?.reduce(
|
||||
(acc, cur, idx) => {
|
||||
acc[`core${idx + 1}`] = cur;
|
||||
return acc;
|
||||
@@ -342,9 +339,16 @@ const InfrastructureDetails = () => {
|
||||
createdAt: check.createdAt,
|
||||
}
|
||||
);
|
||||
return res;
|
||||
});
|
||||
// Slice to remove `createdAt` key
|
||||
return { tempKeys: Object.keys(temps[0]).slice(1), temps };
|
||||
if (temps.length === 0 || !temps[0]) {
|
||||
return { temps: [], tempKeys: [] };
|
||||
}
|
||||
|
||||
return {
|
||||
tempKeys: Object.keys(temps[0] || {}).filter((key) => key !== "createdAt"),
|
||||
temps,
|
||||
};
|
||||
};
|
||||
|
||||
const buildAreaChartConfigs = (checks) => {
|
||||
@@ -401,10 +405,13 @@ const InfrastructureDetails = () => {
|
||||
yLabel: "Temperature",
|
||||
xTick: <TzTick />,
|
||||
yDomain: [
|
||||
Math.min(...tempData.temps.flatMap((t) => tempData.tempKeys.map((k) => t[k]))) *
|
||||
0.9,
|
||||
Math.max(...tempData.temps.flatMap((t) => tempData.tempKeys.map((k) => t[k]))) *
|
||||
1.1,
|
||||
0,
|
||||
Math.max(
|
||||
Math.max(
|
||||
...tempData.temps.flatMap((t) => tempData.tempKeys.map((k) => t[k]))
|
||||
) * 1.1,
|
||||
200
|
||||
),
|
||||
],
|
||||
toolTip: (
|
||||
<TemperatureTooltip
|
||||
@@ -537,10 +544,6 @@ const InfrastructureDetails = () => {
|
||||
}}
|
||||
>
|
||||
{areaChartConfigs.map((config) => {
|
||||
if (config?.data?.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<BaseBox key={`${config.type}-${config.diskIndex ?? ""}`}>
|
||||
<Typography
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Box, Button, duration, Stack, Typography } from "@mui/material";
|
||||
import { Box, Button, Stack, Typography } from "@mui/material";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { useEffect, useState } from "react";
|
||||
@@ -13,7 +13,7 @@ import LoadingButton from "@mui/lab/LoadingButton";
|
||||
|
||||
import dayjs from "dayjs";
|
||||
import Select from "../../../Components/Inputs/Select";
|
||||
import Field from "../../../Components/Inputs/Field";
|
||||
import TextInput from "../../../Components/Inputs/TextInput";
|
||||
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||
import CalendarIcon from "../../../assets/icons/calendar.svg?react";
|
||||
import "./index.css";
|
||||
@@ -215,8 +215,7 @@ const CreateMaintenance = () => {
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (hasValidationErrors(form, maintenanceWindowValidation, setErrors))
|
||||
return;
|
||||
if (hasValidationErrors(form, maintenanceWindowValidation, setErrors)) return;
|
||||
// Build timestamp for maintenance window from startDate and startTime
|
||||
const start = dayjs(form.startDate)
|
||||
.set("hour", form.startTime.hour())
|
||||
@@ -467,14 +466,15 @@ const CreateMaintenance = () => {
|
||||
direction="row"
|
||||
spacing={theme.spacing(8)}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
type="number"
|
||||
id="duration"
|
||||
value={form.duration}
|
||||
onChange={(event) => {
|
||||
handleFormChange("duration", event.target.value);
|
||||
}}
|
||||
error={errors["duration"]}
|
||||
error={errors["duration"] ? true : false}
|
||||
helperText={errors["duration"]}
|
||||
/>
|
||||
<Select
|
||||
id="durationUnit"
|
||||
@@ -511,14 +511,15 @@ const CreateMaintenance = () => {
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box>
|
||||
<Field
|
||||
<TextInput
|
||||
id="name"
|
||||
placeholder="Maintenance at __ : __ for ___ minutes"
|
||||
value={form.name}
|
||||
onChange={(event) => {
|
||||
handleFormChange("name", event.target.value);
|
||||
}}
|
||||
error={errors["name"]}
|
||||
error={errors["name"] ? true : false}
|
||||
helperText={errors["name"]}
|
||||
/>
|
||||
</Box>
|
||||
</Stack>
|
||||
|
||||
@@ -14,7 +14,8 @@ import {
|
||||
getUptimeMonitorsByTeamId,
|
||||
deleteUptimeMonitor,
|
||||
} from "../../../Features/UptimeMonitors/uptimeMonitorsSlice";
|
||||
import Field from "../../../Components/Inputs/Field";
|
||||
import TextInput from "../../../Components/Inputs/TextInput";
|
||||
import { HttpAdornment } from "../../../Components/Inputs/TextInput/Adornments";
|
||||
import PauseIcon from "../../../assets/icons/pause-icon.svg?react";
|
||||
import ResumeIcon from "../../../assets/icons/resume-icon.svg?react";
|
||||
import Select from "../../../Components/Inputs/Select";
|
||||
@@ -343,17 +344,17 @@ const Configure = () => {
|
||||
</Typography>
|
||||
</Box>
|
||||
<Stack gap={theme.spacing(20)}>
|
||||
<Field
|
||||
<TextInput
|
||||
type={monitor?.type === "http" ? "url" : "text"}
|
||||
https={protocol === "https"}
|
||||
startAdornment={<HttpAdornment https={protocol === "https"} />}
|
||||
id="monitor-url"
|
||||
label="URL to monitor"
|
||||
placeholder="google.com"
|
||||
value={parsedUrl?.host || monitor?.url || ""}
|
||||
disabled={true}
|
||||
error={errors["url"]}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="monitor-name"
|
||||
label="Display name"
|
||||
@@ -361,7 +362,8 @@ const Configure = () => {
|
||||
placeholder="Google"
|
||||
value={monitor?.name || ""}
|
||||
onChange={handleChange}
|
||||
error={errors["name"]}
|
||||
error={errors["name"] ? true : false}
|
||||
helperText={errors["name"]}
|
||||
/>
|
||||
</Stack>
|
||||
</ConfigBox>
|
||||
@@ -405,7 +407,7 @@ const Configure = () => {
|
||||
(notification) => notification.type === "emails"
|
||||
) ? (
|
||||
<Box mx={theme.spacing(16)}>
|
||||
<Field
|
||||
<TextInput
|
||||
id="notify-email-list"
|
||||
type="text"
|
||||
placeholder="name@gmail.com"
|
||||
|
||||
@@ -11,7 +11,8 @@ import { createToast } from "../../../Utils/toastUtils";
|
||||
import { logger } from "../../../Utils/Logger";
|
||||
import { ConfigBox } from "../styled";
|
||||
import Radio from "../../../Components/Inputs/Radio";
|
||||
import Field from "../../../Components/Inputs/Field";
|
||||
import TextInput from "../../../Components/Inputs/TextInput";
|
||||
import { HttpAdornment } from "../../../Components/Inputs/TextInput/Adornments";
|
||||
import Select from "../../../Components/Inputs/Select";
|
||||
import Checkbox from "../../../Components/Inputs/Checkbox";
|
||||
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||
@@ -258,18 +259,20 @@ const CreateMonitor = () => {
|
||||
</Typography>
|
||||
</Box>
|
||||
<Stack gap={theme.spacing(15)}>
|
||||
<Field
|
||||
<TextInput
|
||||
type={monitor.type === "http" ? "url" : "text"}
|
||||
id="monitor-url"
|
||||
startAdornment={<HttpAdornment https={https} />}
|
||||
label={monitorTypeMaps[monitor.type].label || "URL to monitor"}
|
||||
https={https}
|
||||
placeholder={monitorTypeMaps[monitor.type].placeholder || ""}
|
||||
value={monitor.url}
|
||||
onChange={handleChange}
|
||||
onBlur={onUrlBlur}
|
||||
error={errors["url"]}
|
||||
error={errors["url"] ? true : false}
|
||||
helperText={errors["url"]}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="monitor-name"
|
||||
label="Display name"
|
||||
@@ -277,7 +280,8 @@ const CreateMonitor = () => {
|
||||
placeholder={monitorTypeMaps[monitor.type].namePlaceholder || ""}
|
||||
value={monitor.name}
|
||||
onChange={handleChange}
|
||||
error={errors["name"]}
|
||||
error={errors["name"] ? true : false}
|
||||
helperText={errors["name"]}
|
||||
/>
|
||||
</Stack>
|
||||
</ConfigBox>
|
||||
@@ -391,7 +395,7 @@ const CreateMonitor = () => {
|
||||
(notification) => notification.type === "emails"
|
||||
) ? (
|
||||
<Box mx={theme.spacing(16)}>
|
||||
<Field
|
||||
<TextInput
|
||||
id="notify-email-list"
|
||||
type="text"
|
||||
placeholder="name@gmail.com"
|
||||
|
||||
@@ -14,7 +14,7 @@ import { monitorValidation } from "../../../Validation/validation";
|
||||
import { createToast } from "../../../Utils/toastUtils";
|
||||
import { logger } from "../../../Utils/Logger";
|
||||
import { ConfigBox } from "../../Monitors/styled";
|
||||
import Field from "../../../Components/Inputs/Field";
|
||||
import TextInput from "../../../Components/Inputs/TextInput";
|
||||
import Select from "../../../Components/Inputs/Select";
|
||||
import Checkbox from "../../../Components/Inputs/Checkbox";
|
||||
import PauseCircleOutlineIcon from "@mui/icons-material/PauseCircleOutline";
|
||||
@@ -321,17 +321,18 @@ const PageSpeedConfigure = () => {
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Field
|
||||
<TextInput
|
||||
type="url"
|
||||
id="monitor-url"
|
||||
label="URL"
|
||||
placeholder="random.website.com"
|
||||
value={monitor?.url?.replace("http://", "") || ""}
|
||||
value={monitor?.url || ""}
|
||||
onChange={handleChange}
|
||||
error={errors.url}
|
||||
error={errors.url ? true : false}
|
||||
helperText={errors.url}
|
||||
disabled={true}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="monitor-name"
|
||||
label="Monitor display name"
|
||||
@@ -339,7 +340,8 @@ const PageSpeedConfigure = () => {
|
||||
isOptional={true}
|
||||
value={monitor?.name || ""}
|
||||
onChange={handleChange}
|
||||
error={errors.name}
|
||||
error={errors.name ? true : false}
|
||||
helperText={errors.name}
|
||||
/>
|
||||
</Stack>
|
||||
</ConfigBox>
|
||||
@@ -383,7 +385,7 @@ const PageSpeedConfigure = () => {
|
||||
(notification) => notification.type === "emails"
|
||||
) ? (
|
||||
<Box mx={theme.spacing(16)}>
|
||||
<Field
|
||||
<TextInput
|
||||
id="notify-email-list"
|
||||
type="text"
|
||||
placeholder="name@gmail.com"
|
||||
|
||||
@@ -13,7 +13,8 @@ import { createToast } from "../../../Utils/toastUtils";
|
||||
import { logger } from "../../../Utils/Logger";
|
||||
import { ConfigBox } from "../../Monitors/styled";
|
||||
import Radio from "../../../Components/Inputs/Radio";
|
||||
import Field from "../../../Components/Inputs/Field";
|
||||
import TextInput from "../../../Components/Inputs/TextInput";
|
||||
import { HttpAdornment } from "../../../Components/Inputs/TextInput/Adornments";
|
||||
import Select from "../../../Components/Inputs/Select";
|
||||
import Checkbox from "../../../Components/Inputs/Checkbox";
|
||||
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||
@@ -216,18 +217,19 @@ const CreatePageSpeed = () => {
|
||||
</Typography>
|
||||
</Box>
|
||||
<Stack gap={theme.spacing(15)}>
|
||||
<Field
|
||||
<TextInput
|
||||
type={"url"}
|
||||
id="monitor-url"
|
||||
label="URL to monitor"
|
||||
https={https}
|
||||
startAdornment={<HttpAdornment https={https} />}
|
||||
placeholder="google.com"
|
||||
value={monitor.url}
|
||||
onChange={handleChange}
|
||||
onBlur={onUrlBlur}
|
||||
error={errors["url"]}
|
||||
error={errors["url"] ? true : false}
|
||||
helperText={errors["url"]}
|
||||
/>
|
||||
<Field
|
||||
<TextInput
|
||||
type="text"
|
||||
id="monitor-name"
|
||||
label="Display name"
|
||||
@@ -235,7 +237,8 @@ const CreatePageSpeed = () => {
|
||||
placeholder="Google"
|
||||
value={monitor.name}
|
||||
onChange={handleChange}
|
||||
error={errors["name"]}
|
||||
error={errors["name"] ? true : false}
|
||||
helperText={errors["name"]}
|
||||
/>
|
||||
</Stack>
|
||||
</ConfigBox>
|
||||
@@ -327,7 +330,7 @@ const CreatePageSpeed = () => {
|
||||
(notification) => notification.type === "emails"
|
||||
) ? (
|
||||
<Box mx={theme.spacing(16)}>
|
||||
<Field
|
||||
<TextInput
|
||||
id="notify-email-list"
|
||||
type="text"
|
||||
placeholder="name@gmail.com"
|
||||
|
||||
@@ -8,7 +8,6 @@ import "./index.css";
|
||||
import { useNavigate } from "react-router";
|
||||
import PropTypes from "prop-types";
|
||||
import Breadcrumbs from "../../Components/Breadcrumbs";
|
||||
import Greeting from "../../Utils/greeting";
|
||||
import SkeletonLayout from "./skeleton";
|
||||
import Card from "./card";
|
||||
import { networkService } from "../../main";
|
||||
@@ -82,11 +81,10 @@ const PageSpeed = ({ isAdmin }) => {
|
||||
<Breadcrumbs list={[{ name: `pagespeed`, path: "/pagespeed" }]} />
|
||||
<Stack
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
justifyContent="end"
|
||||
alignItems="center"
|
||||
mt={theme.spacing(5)}
|
||||
>
|
||||
<Greeting type="pagespeed" />
|
||||
{isAdmin && (
|
||||
<Button
|
||||
variant="contained"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { Box, Stack, Typography, Button } from "@mui/material";
|
||||
import Field from "../../Components/Inputs/Field";
|
||||
import TextInput from "../../Components/Inputs/TextInput";
|
||||
import Link from "../../Components/Link";
|
||||
import Select from "../../Components/Inputs/Select";
|
||||
import { logger } from "../../Utils/Logger";
|
||||
@@ -240,13 +240,14 @@ const Settings = ({ isAdmin }) => {
|
||||
</Typography>
|
||||
</Box>
|
||||
<Stack gap={theme.spacing(20)}>
|
||||
<Field
|
||||
<TextInput
|
||||
id="ttl"
|
||||
label="The days you want to keep monitoring history."
|
||||
optionalLabel="0 for infinite"
|
||||
value={form.ttl}
|
||||
onChange={handleChange}
|
||||
error={errors.ttl}
|
||||
error={errors.ttl ? true : false}
|
||||
helperText={errors.ttl}
|
||||
/>
|
||||
<Box>
|
||||
<Typography>Clear all stats. This is irreversible.</Typography>
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
import { Stack, Typography } from "@mui/material";
|
||||
import Field from "../Components/Inputs/Field";
|
||||
import TextInput from "../Components/Inputs/TextInput";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { HttpAdornment } from "../Components/Inputs/TextInput/Adornments";
|
||||
import { PasswordEndAdornment } from "../Components/Inputs/TextInput/Adornments";
|
||||
const Test = () => {
|
||||
const [originalValue, setOriginalValue] = useState("");
|
||||
const [originalError, setOriginalError] = useState("");
|
||||
|
||||
const [newValue, setNewValue] = useState("");
|
||||
const [newError, setNewError] = useState("");
|
||||
|
||||
const [thresholdValue, setThresholdValue] = useState(20);
|
||||
const [thresholdError, setThresholdError] = useState("");
|
||||
|
||||
const [thresholdValue2, setThresholdValue2] = useState(20);
|
||||
const [thresholdError2, setThresholdError2] = useState("");
|
||||
|
||||
const inputRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (inputRef.current) {
|
||||
inputRef.current.focus();
|
||||
}
|
||||
}, []);
|
||||
|
||||
const checkError = (value) => {
|
||||
if (value !== "clear") {
|
||||
return "This is an error";
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
const checkThresholdError = (value) => {
|
||||
if (value !== 99) {
|
||||
return "This is a threshold error";
|
||||
}
|
||||
return "";
|
||||
};
|
||||
const checkThresholdError2 = (value) => {
|
||||
if (value !== 99) {
|
||||
return "This is a threshold error 2";
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
const handleOriginalValue = (e) => {
|
||||
setOriginalError(checkError(e.target.value));
|
||||
setOriginalValue(e.target.value);
|
||||
};
|
||||
|
||||
const handleNewValue = (e) => {
|
||||
setNewError(checkError(e.target.value));
|
||||
setNewValue(e.target.value);
|
||||
};
|
||||
|
||||
const handleThresholdValue = (e) => {
|
||||
const parsedVal = parseInt(e.target.value);
|
||||
setThresholdError(checkThresholdError(parsedVal));
|
||||
setThresholdValue(parsedVal);
|
||||
};
|
||||
|
||||
const handleThresholdValue2 = (e) => {
|
||||
const parsedVal = parseInt(e.target.value);
|
||||
setThresholdError2(checkThresholdError2(parsedVal));
|
||||
setThresholdValue2(parsedVal);
|
||||
};
|
||||
|
||||
return (
|
||||
<Stack
|
||||
gap={8}
|
||||
direction="column"
|
||||
border="1px dashed blue"
|
||||
padding="1rem"
|
||||
>
|
||||
<Typography>
|
||||
This is a test page for the TextInput component. It is a rationalized Input
|
||||
component.
|
||||
</Typography>
|
||||
<Typography>Type anything for an error.</Typography>
|
||||
<Typography>Typing "clear" will clear the error for text based input</Typography>
|
||||
<Typography>Typing "99" will clear the error for threshold based input</Typography>
|
||||
<Field
|
||||
id="original-field"
|
||||
onChange={handleOriginalValue}
|
||||
type="text"
|
||||
value={originalValue}
|
||||
error={originalError}
|
||||
/>
|
||||
<TextInput
|
||||
value={newValue}
|
||||
onChange={handleNewValue}
|
||||
error={newError !== ""}
|
||||
helperText={newError}
|
||||
/>
|
||||
|
||||
<Field
|
||||
type={"url"}
|
||||
id="monitor-url"
|
||||
label={"URL to monitor"}
|
||||
https={true}
|
||||
placeholder={""}
|
||||
value={originalValue}
|
||||
onChange={handleOriginalValue}
|
||||
error={originalError}
|
||||
/>
|
||||
<TextInput
|
||||
type={"url"}
|
||||
id="monitor-url"
|
||||
label={"URL to monitor"}
|
||||
placeholder={""}
|
||||
value={newValue}
|
||||
startAdornment={<HttpAdornment https={true} />}
|
||||
onChange={handleNewValue}
|
||||
error={newError !== ""}
|
||||
helperText={newError}
|
||||
/>
|
||||
|
||||
<Field
|
||||
type="password"
|
||||
id="login-password-input"
|
||||
label="Password"
|
||||
isRequired={true}
|
||||
placeholder="••••••••••"
|
||||
autoComplete="current-password"
|
||||
value={originalValue}
|
||||
onChange={handleOriginalValue}
|
||||
error={originalError}
|
||||
ref={inputRef}
|
||||
/>
|
||||
<TextInput
|
||||
type="password"
|
||||
id="login-password-input"
|
||||
label="Password"
|
||||
isRequired={true}
|
||||
placeholder="••••••••••"
|
||||
autoComplete="current-password"
|
||||
value={newValue}
|
||||
endAdornment={<PasswordEndAdornment />}
|
||||
onChange={handleNewValue}
|
||||
error={newError !== ""}
|
||||
helperText={newError}
|
||||
ref={inputRef}
|
||||
/>
|
||||
|
||||
<Field
|
||||
id="ttl"
|
||||
label="The days you want to keep monitoring history."
|
||||
isOptional={true}
|
||||
optionalLabel="0 for infinite"
|
||||
value={originalValue}
|
||||
onChange={handleOriginalValue}
|
||||
error={originalError}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
id="ttl"
|
||||
label="The days you want to keep monitoring history."
|
||||
isOptional={true}
|
||||
optionalLabel="0 for infinite"
|
||||
value={newValue}
|
||||
onChange={handleNewValue}
|
||||
error={newError !== ""}
|
||||
helperText={newError}
|
||||
/>
|
||||
|
||||
<Typography>Short field for threshold. Easily show/hide error text</Typography>
|
||||
<TextInput
|
||||
maxWidth="var(--env-var-width-4)"
|
||||
id="threshold"
|
||||
type="number"
|
||||
value={thresholdValue.toString()}
|
||||
onChange={handleThresholdValue}
|
||||
error={thresholdError !== ""}
|
||||
/>
|
||||
<TextInput
|
||||
maxWidth="var(--env-var-width-4)"
|
||||
id="threshold"
|
||||
type="number"
|
||||
value={thresholdValue2.toString()}
|
||||
onChange={handleThresholdValue2}
|
||||
error={thresholdError2 !== ""}
|
||||
/>
|
||||
<Typography sx={{ color: "red" }}>
|
||||
{thresholdError} {thresholdError2}
|
||||
</Typography>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
export default Test;
|
||||
Reference in new issue
Block a user