back to hosts table from new monitor
This commit is contained in:
1 parent
3e8f8bc5ee
commit
3f2fe8b084
13 files changed
+286
-112
No files matched your search
@@ -0,0 +1,85 @@
|
||||
import ConfigBox from "../../Components/ConfigBox";
|
||||
import FlexibileTextField from "../../Components/TextFields/Flexibile/FlexibileTextField";
|
||||
import "./index.css";
|
||||
import React from "react";
|
||||
|
||||
const CreateNewMonitor = () => {
|
||||
return (
|
||||
<div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="new-monitor-header">Create new monitor</div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<ConfigBox
|
||||
leftLayout={
|
||||
<div className="config-box-desc">
|
||||
<div className="config-box-desc-title">General settings</div>
|
||||
<div className="config-box-desc-text">
|
||||
Here you can select the URL of the host, together with the type of
|
||||
monitor.
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
rightLayout={
|
||||
<div className="config-box-inputs">
|
||||
<FlexibileTextField
|
||||
title="URL to monitor"
|
||||
type="url"
|
||||
placeholder="https://google.com"
|
||||
/>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<FlexibileTextField
|
||||
title="Friendly name (optional)"
|
||||
type="text"
|
||||
placeholder="Google"
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<ConfigBox
|
||||
leftLayout={
|
||||
<div className="config-box-desc">
|
||||
<div className="config-box-desc-title">Checks to perform</div>
|
||||
<div className="config-box-desc-text">
|
||||
You can always add or remove checks after adding your site.
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<ConfigBox
|
||||
leftLayout={
|
||||
<div className="config-box-desc">
|
||||
<div className="config-box-desc-title">Incident notifications</div>
|
||||
<div className="config-box-desc-text">
|
||||
When there is an incident, notify users.
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<ConfigBox
|
||||
leftLayout={
|
||||
<div className="config-box-desc">
|
||||
<div className="config-box-desc-title">Advanced settings</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<ConfigBox
|
||||
leftLayout={
|
||||
<div className="config-box-desc">
|
||||
<div className="config-box-desc-title">Proxy settings</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CreateNewMonitor;
|
||||
@@ -0,0 +1,99 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import Host from "../../Components/Host";
|
||||
import HostStatus from "../../Components/HostStatus";
|
||||
import HostActions from "../../Components/HostActions";
|
||||
import BarChart from "../../Components/Charts/BarChart/BarChart";
|
||||
import Button from "../../Components/Button";
|
||||
import ServerStatus from "../../Components/Charts/Servers/ServerStatus";
|
||||
import CurrentMonitors from "../../Components/CurrentMonitors";
|
||||
|
||||
const hardCodedMonitors = [
|
||||
{
|
||||
host: Host("Discord", 100, "var(--env-var-color-17)"),
|
||||
status: HostStatus(
|
||||
"var(--env-var-color-20)",
|
||||
"Up",
|
||||
"var(--env-var-color-17)"
|
||||
),
|
||||
team: <BarChart />,
|
||||
actions: HostActions(),
|
||||
},
|
||||
{
|
||||
host: Host("Google", 99.9, "var(--env-var-color-17)"),
|
||||
status: HostStatus(
|
||||
"var(--env-var-color-20)",
|
||||
"Up",
|
||||
"var(--env-var-color-17)"
|
||||
),
|
||||
team: <BarChart />,
|
||||
actions: HostActions(),
|
||||
},
|
||||
{
|
||||
host: Host("NBC", 98.1, "var(--env-var-color-18)"),
|
||||
status: HostStatus(
|
||||
"var(--env-var-color-20)",
|
||||
"Up",
|
||||
"var(--env-var-color-17)"
|
||||
),
|
||||
team: <BarChart />,
|
||||
actions: HostActions(),
|
||||
},
|
||||
{
|
||||
host: Host("Google", 95.1, "var(--env-var-color-19)"),
|
||||
status: HostStatus(
|
||||
"var(--env-var-color-21)",
|
||||
"Down",
|
||||
"var(--env-var-color-19)"
|
||||
),
|
||||
team: <BarChart />,
|
||||
actions: HostActions(),
|
||||
},
|
||||
{
|
||||
host: Host("NBC", 99.9, "var(--env-var-color-17)"),
|
||||
status: HostStatus(
|
||||
"var(--env-var-color-15)",
|
||||
"Cannot resolve",
|
||||
"var(--env-var-color-22)"
|
||||
),
|
||||
team: <BarChart />,
|
||||
actions: HostActions(),
|
||||
},
|
||||
];
|
||||
|
||||
const CurrentStats = () => {
|
||||
// The hardcoded part is passed as default value for the purpose of demonstration.
|
||||
// Pass an empty array, [], before fetching the data
|
||||
const [monitors, setMonitors] = useState(hardCodedMonitors);
|
||||
|
||||
useEffect(() => {
|
||||
fetch("API_URL")
|
||||
.then((response) => response.json())
|
||||
.then((data) => setMonitors(data))
|
||||
.catch((error) => console.error(error));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="monitors-bar">
|
||||
<div className="monitors-bar-title">Hello, Jackie</div>
|
||||
<Button
|
||||
level="primary"
|
||||
label="Create new monitor"
|
||||
sx={{ padding: "10px 20px", fontSize: "13px" }}
|
||||
/>
|
||||
</div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="monitors-stats">
|
||||
<ServerStatus title="Up" value="4" state="up" />
|
||||
<ServerStatus title="Down" value="0" state="down" />
|
||||
<ServerStatus title="Paused" value="0" state="pause" />
|
||||
</div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<CurrentMonitors monitors={monitors} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CurrentStats;
|
||||
@@ -1,4 +1,5 @@
|
||||
.monitors {
|
||||
.monitors,
|
||||
.new-monitor {
|
||||
width: 70vw;
|
||||
padding: 4vw;
|
||||
}
|
||||
@@ -22,3 +23,9 @@
|
||||
.monitors-gaps-medium {
|
||||
height: var(--env-var-spacing-2);
|
||||
}
|
||||
|
||||
.new-monitor-header {
|
||||
color: var(--env-var-color-1);
|
||||
font-size: var(--env-var-font-size-large-plus);
|
||||
font-weight: 600;
|
||||
}
|
||||
@@ -1,30 +1,11 @@
|
||||
import Button from "../../Components/Button";
|
||||
import ServerStatus from "../../Components/Charts/Servers/ServerStatus";
|
||||
import CurrentMonitors from "../../Components/CurrentMonitors";
|
||||
import CurrentStats from "./CurrentStats";
|
||||
import "./index.css";
|
||||
import React from "react";
|
||||
|
||||
const Monitors = () => {
|
||||
return (
|
||||
<div className="monitors">
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="monitors-bar">
|
||||
<div className="monitors-bar-title">Hello, Jackie</div>
|
||||
<Button
|
||||
level="primary"
|
||||
label="Create new monitor"
|
||||
sx={{ padding: "10px 20px", fontSize: "13px" }}
|
||||
/>
|
||||
</div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<div className="monitors-stats">
|
||||
<ServerStatus title="Up" value="4" state="up" />
|
||||
<ServerStatus title="Down" value="0" state="down" />
|
||||
<ServerStatus title="Paused" value="0" state="pause" />
|
||||
</div>
|
||||
<div className="monitors-gaps-medium"></div>
|
||||
<CurrentMonitors />
|
||||
<CurrentStats />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user