Skip to content

Commit

Permalink
Update based on meeting
Browse files Browse the repository at this point in the history
- Query only uptime monitors without checks
- Change log validation from 640Kb  to 3Mb, fixed validation error text contrast issue
- Word/syntax updates, suburl is disabled and provided via env
  • Loading branch information
jennifer-gan committed Jan 10, 2025
1 parent e8d9f31 commit a1d4ec4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 34 deletions.
5 changes: 1 addition & 4 deletions Client/src/Components/ConfigBox/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ const ConfigBox = styled(Stack)(({ theme }) => ({
},
"& h1, & h2": {
color: theme.palette.text.secondary,
},
"& p": {
color: theme.palette.text.tertiary,
},
}
}));

export default ConfigBox;
4 changes: 2 additions & 2 deletions Client/src/Components/TabPanels/Status/ContentPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const ContentPanel = () => {
const response = await networkService.getMonitorsByTeamId({
authToken: authToken,
teamId: user.teamId,
limit: 50,
types: ["http", "ping", "pagespeed", "hardware"],
limit: null, // donot return any checks for the monitors
types: ["http"], // status page is available only for the uptime type
});
if(response.data.data.monitors.length==0){
setErrors({monitors: "Please config monitors to setup status page"})
Expand Down
40 changes: 16 additions & 24 deletions Client/src/Components/TabPanels/Status/GeneralSettingsPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const GeneralSettingsPanel = () => {
const intervalRef = useRef(null);
const SUBDOAMIN_PREFIX =
import.meta.env.VITE_STATUS_PAGE_SUBDOMAIN_PREFIX ?? "http://localhost/";
const STATUS_PAGE = import.meta.env.VITE_STATU_PAGE_URL?? "status-page";

// Clears specific error from errors state
const clearError = (err) => {
Expand Down Expand Up @@ -91,19 +92,15 @@ const GeneralSettingsPanel = () => {
let error = validateField({ type: pic?.type, size: pic?.size }, logoImageValidation);
if (error) return;

setProgress((prev) => ({ ...prev, isLoading: true }));
setLogo({
const newLogo = {
src: URL.createObjectURL(pic),
name: pic.name,
type: pic.type,
size: pic.size,
});
setForm({...form, logo: {
src: URL.createObjectURL(pic),
name: pic.name,
type: pic.type,
size: pic.size,
}})
}
setProgress((prev) => ({ ...prev, isLoading: true }));
setLogo(newLogo);
setForm({ ...form, logo: newLogo });
intervalRef.current = setInterval(() => {
const buffer = 12;
setProgress((prev) => {
Expand All @@ -118,12 +115,7 @@ const GeneralSettingsPanel = () => {

return (
<TabPanel
value="General Settings"
sx={{
"& h1, & p, & input": {
color: theme.palette.text.tertiary,
},
}}
value="General settings"
>
<Stack
component="form"
Expand Down Expand Up @@ -176,14 +168,15 @@ const GeneralSettingsPanel = () => {
<TextInput
id="url"
type="url"
label="SubURL"
value={form.url}
startAdornment={
<HttpAdornment
prefix={SUBDOAMIN_PREFIX}
https={false}
/>
}
label="Your status page address"
disabled
value={SUBDOAMIN_PREFIX+ STATUS_PAGE}
// startAdornment={
// <HttpAdornment
// prefix={SUBDOAMIN_PREFIX}
// https={false}
// />
// }
onChange={handleChange}
onBlur={handleBlur}
helperText={errors["url"]}
Expand Down Expand Up @@ -217,7 +210,6 @@ const GeneralSettingsPanel = () => {
loading={progress.isLoading && progress.value !== 100}
onChange={handleLogo}
isRound={false}
maxSize="640KB"
/>
{progress.isLoading || progress.value !== 0 || errors["logo"] ? (
<ProgressUpload
Expand Down
4 changes: 2 additions & 2 deletions Client/src/Pages/Status/CreateStatus/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { networkService } from "../../../main";
["companyName", "url", "timezone", "color", "publish", "logo"],
["monitors", "showUptimePercentage", "showBarcode"],
];
const tabList = ["General Settings", "Contents"];
const tabList = ["General settings", "Contents"];
const hasInitForm = initForm && Object.keys(initForm).length > 0;
const [form, setForm] = useState(
hasInitForm
Expand Down Expand Up @@ -143,7 +143,7 @@ import { networkService } from "../../../main";
/>
))}
</TabList>
</Box>
</Box>
<StatusFormProvider
form={form}
setForm={setForm}
Expand Down
4 changes: 2 additions & 2 deletions Client/src/Validation/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ const logoImageValidation = joi.object({
}),
size: joi
.number()
.max(800*800)
.max(3000000)
.messages({
"number.base": "File size must be a number.",
"number.max": "File size must be less than 640KB.",
"number.max": "File size must be less than 3MB.",
"number.empty": "File size required.",
}),
});
Expand Down

0 comments on commit a1d4ec4

Please sign in to comment.