commit to discuss
This commit is contained in:
1 parent
bc48a28296
commit
3ece902d57
9 files changed
+277
-34
No files matched your search
@@ -12,7 +12,7 @@
|
||||
}
|
||||
|
||||
.server-status-tile {
|
||||
width: 230px;
|
||||
width: 310px;
|
||||
padding: var(--spacing-general-1);
|
||||
border: 1px solid var(--color-border-0);
|
||||
border-radius: var(--border-radius-0);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
.dashboard-setting-menu-item {
|
||||
width: 135px;
|
||||
padding: 6px;
|
||||
margin: 5px 12px;
|
||||
}
|
||||
|
||||
.dashboard-setting-menu-item:hover {
|
||||
color: var(--env-var-color-26);
|
||||
}
|
||||
|
||||
#menu-appbar {
|
||||
padding: var(--env-var-spacing-1);
|
||||
}
|
||||
@@ -1,15 +1,22 @@
|
||||
import { useState } from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import Menu from '@mui/material/Menu';
|
||||
import Tooltip from '@mui/material/Tooltip';
|
||||
import MenuItem from '@mui/material/MenuItem';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import SvgIcon from '@mui/material/SvgIcon';
|
||||
import SettingsIcon from '@mui/icons-material/Settings';
|
||||
import { useTheme } from '@mui/material/styles';
|
||||
import "./index.css";
|
||||
import { useState } from "react";
|
||||
import Box from "@mui/material/Box";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Menu from "@mui/material/Menu";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
import SettingsIcon from "@mui/icons-material/Settings";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
|
||||
const settings = ['Open Site', 'Detailed View', 'Incidents', 'Configure', 'Remove'];
|
||||
const settings = [
|
||||
"Open Site",
|
||||
"Detailed View",
|
||||
"Incidents",
|
||||
"Configure",
|
||||
"Remove",
|
||||
];
|
||||
|
||||
/**
|
||||
* DashboardSettings component
|
||||
@@ -54,20 +61,29 @@ function DashboardSettings() {
|
||||
id="menu-appbar"
|
||||
anchorEl={anchorElUser}
|
||||
anchorOrigin={{
|
||||
vertical: 'top',
|
||||
horizontal: 'right',
|
||||
vertical: "top",
|
||||
horizontal: "right",
|
||||
}}
|
||||
keepMounted
|
||||
transformOrigin={{
|
||||
vertical: 'top',
|
||||
horizontal: 'right',
|
||||
vertical: "top",
|
||||
horizontal: "right",
|
||||
}}
|
||||
open={Boolean(anchorElUser)}
|
||||
onClose={handleCloseUserMenu}
|
||||
>
|
||||
{settings.map((setting) => (
|
||||
<MenuItem key={setting} onClick={handleCloseUserMenu}>
|
||||
<Typography textAlign="center">{setting}</Typography>
|
||||
<MenuItem
|
||||
className="dashboard-setting-menu-item"
|
||||
key={setting}
|
||||
onClick={handleCloseUserMenu}
|
||||
>
|
||||
<Typography
|
||||
style={{ fontSize: "var(--env-var-font-size-medium)" }}
|
||||
textAlign="center"
|
||||
>
|
||||
{setting}
|
||||
</Typography>
|
||||
</MenuItem>
|
||||
))}
|
||||
</Menu>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import React from "react";
|
||||
import OpenIt from "../../assets/Images/Icon-open-in-tab-gray.png";
|
||||
|
||||
function Host(title, precentage, statusColor) {
|
||||
function Host(title, precentage, statusColor, link) {
|
||||
return (
|
||||
<div className="host-list-item">
|
||||
<img className="host-list-item-open" src={OpenIt} alt="OpenIt" />
|
||||
<a href={link} target="_blank">
|
||||
<img className="host-list-item-open" src={OpenIt} alt="OpenIt" />
|
||||
</a>
|
||||
<div className="host-list-item-name">{title}</div>
|
||||
<div className="host-list-item-precentage" style={{ color: statusColor }}>
|
||||
{precentage}%
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from "react";
|
||||
import Actions from "../../assets/Images/Icon-setting-actions-gray.png";
|
||||
import DashboardSettings from "../DashboardSettingsIcon";
|
||||
|
||||
function HostActions() {
|
||||
return <img className="host-actions" src={Actions} alt="Actions" />;
|
||||
return <DashboardSettings />;
|
||||
}
|
||||
|
||||
export default HostActions;
|
||||
@@ -0,0 +1,163 @@
|
||||
{
|
||||
"success": true,
|
||||
"msg": "Got monitor for 666c9146c9bfa20db790b1df successfully\"",
|
||||
"data": [
|
||||
{
|
||||
"_id": "6671d8469ba14f9f260eed23",
|
||||
"userId": "666c9146c9bfa20db790b1df",
|
||||
"name": "Google Monitor",
|
||||
"description": "Google",
|
||||
"type": "ping",
|
||||
"url": "127.0.0.1",
|
||||
"isActive": true,
|
||||
"interval": 10000,
|
||||
"createdAt": "2024-06-18T18:56:06.212Z",
|
||||
"updatedAt": "2024-06-18T18:56:06.212Z",
|
||||
"__v": 0,
|
||||
"checks": [
|
||||
{
|
||||
"_id": "6671d84a9ba14f9f260eed27",
|
||||
"monitorId": "6671d8469ba14f9f260eed23",
|
||||
"status": true,
|
||||
"responseTime": 2,
|
||||
"createdAt": "2024-06-18T18:56:10.082Z",
|
||||
"updatedAt": "2024-06-18T18:56:10.082Z",
|
||||
"__v": 0
|
||||
},
|
||||
{
|
||||
"_id": "6671d8549ba14f9f260eed2d",
|
||||
"monitorId": "6671d8469ba14f9f260eed23",
|
||||
"status": true,
|
||||
"responseTime": 2,
|
||||
"createdAt": "2024-06-18T18:56:20.016Z",
|
||||
"updatedAt": "2024-06-18T18:56:20.016Z",
|
||||
"__v": 0
|
||||
},
|
||||
{
|
||||
"_id": "6671d85e9ba14f9f260eed3c",
|
||||
"monitorId": "6671d8469ba14f9f260eed23",
|
||||
"status": true,
|
||||
"responseTime": 2,
|
||||
"createdAt": "2024-06-18T18:56:30.050Z",
|
||||
"updatedAt": "2024-06-18T18:56:30.050Z",
|
||||
"__v": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "6671d8529ba14f9f260eed2b",
|
||||
"userId": "666c9146c9bfa20db790b1df",
|
||||
"name": "Google Monitor",
|
||||
"description": "Google",
|
||||
"type": "http",
|
||||
"url": "https://www.google.com/404",
|
||||
"isActive": true,
|
||||
"interval": 10000,
|
||||
"createdAt": "2024-06-18T18:56:18.555Z",
|
||||
"updatedAt": "2024-06-18T18:56:18.555Z",
|
||||
"__v": 0,
|
||||
"checks": [
|
||||
{
|
||||
"_id": "6671d8549ba14f9f260eed31",
|
||||
"monitorId": "6671d8529ba14f9f260eed2b",
|
||||
"status": false,
|
||||
"responseTime": 167,
|
||||
"statusCode": 404,
|
||||
"createdAt": "2024-06-18T18:56:20.190Z",
|
||||
"updatedAt": "2024-06-18T18:56:20.190Z",
|
||||
"__v": 0
|
||||
},
|
||||
{
|
||||
"_id": "6671d85e9ba14f9f260eed3e",
|
||||
"monitorId": "6671d8529ba14f9f260eed2b",
|
||||
"status": false,
|
||||
"responseTime": 228,
|
||||
"statusCode": 404,
|
||||
"createdAt": "2024-06-18T18:56:30.279Z",
|
||||
"updatedAt": "2024-06-18T18:56:30.279Z",
|
||||
"__v": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "6671d8619ba14f9f260eed4c",
|
||||
"userId": "666c9146c9bfa20db790b1df",
|
||||
"name": "Amazon Monitor",
|
||||
"description": "Amazon website",
|
||||
"type": "http",
|
||||
"url": "https://www.amazon.com",
|
||||
"isActive": true,
|
||||
"interval": 15000,
|
||||
"createdAt": "2024-06-18T18:56:49.419Z",
|
||||
"updatedAt": "2024-06-18T18:56:49.419Z",
|
||||
"__v": 0,
|
||||
"checks": [
|
||||
{
|
||||
"_id": "6671d8649ba14f9f260eed50",
|
||||
"monitorId": "6671d8619ba14f9f260eed4c",
|
||||
"status": true,
|
||||
"responseTime": 158,
|
||||
"statusCode": 200,
|
||||
"createdAt": "2024-06-18T18:56:52.302Z",
|
||||
"updatedAt": "2024-06-18T18:56:52.302Z",
|
||||
"__v": 0
|
||||
},
|
||||
{
|
||||
"_id": "6671d86e9ba14f9f260eed5a",
|
||||
"monitorId": "6671d8619ba14f9f260eed4c",
|
||||
"status": true,
|
||||
"responseTime": 162,
|
||||
"statusCode": 200,
|
||||
"createdAt": "2024-06-18T18:57:02.331Z",
|
||||
"updatedAt": "2024-06-18T18:57:02.331Z",
|
||||
"__v": 0
|
||||
},
|
||||
{
|
||||
"_id": "6671d8779ba14f9f260eed64",
|
||||
"monitorId": "6671d8619ba14f9f260eed4c",
|
||||
"status": true,
|
||||
"responseTime": 145,
|
||||
"statusCode": 200,
|
||||
"createdAt": "2024-06-18T18:57:12.378Z",
|
||||
"updatedAt": "2024-06-18T18:57:12.378Z",
|
||||
"__v": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "6671d8789ba14f9f260eed66",
|
||||
"userId": "666c9146c9bfa20db790b1df",
|
||||
"name": "Facebook Monitor",
|
||||
"description": "Facebook website",
|
||||
"type": "http",
|
||||
"url": "https://www.facebook.com",
|
||||
"isActive": true,
|
||||
"interval": 20000,
|
||||
"createdAt": "2024-06-18T18:57:12.798Z",
|
||||
"updatedAt": "2024-06-18T18:57:12.798Z",
|
||||
"__v": 0,
|
||||
"checks": [
|
||||
{
|
||||
"_id": "6671d87b9ba14f9f260eed6a",
|
||||
"monitorId": "6671d8789ba14f9f260eed66",
|
||||
"status": true,
|
||||
"responseTime": 221,
|
||||
"statusCode": 200,
|
||||
"createdAt": "2024-06-18T18:57:15.613Z",
|
||||
"updatedAt": "2024-06-18T18:57:15.613Z",
|
||||
"__v": 0
|
||||
},
|
||||
{
|
||||
"_id": "6671d8859ba14f9f260eed74",
|
||||
"monitorId": "6671d8789ba14f9f260eed66",
|
||||
"status": true,
|
||||
"responseTime": 234,
|
||||
"statusCode": 200,
|
||||
"createdAt": "2024-06-18T18:57:25.655Z",
|
||||
"updatedAt": "2024-06-18T18:57:25.655Z",
|
||||
"__v": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,10 +6,16 @@ import BarChart from "../../Components/Charts/BarChart/BarChart";
|
||||
import Button from "../../Components/Button";
|
||||
import ServerStatus from "../../Components/Charts/Servers/ServerStatus";
|
||||
import CurrentMonitors from "../../Components/CurrentMonitors";
|
||||
import MockData from "../../Mock/sample_data.json";
|
||||
|
||||
const hardCodedMonitors = [
|
||||
{
|
||||
host: Host("Discord", 100, "var(--env-var-color-17)"),
|
||||
host: Host(
|
||||
"Discord",
|
||||
100,
|
||||
"var(--env-var-color-17)",
|
||||
"https://www.google.com"
|
||||
),
|
||||
status: HostStatus(
|
||||
"var(--env-var-color-20)",
|
||||
"Up",
|
||||
@@ -19,7 +25,12 @@ const hardCodedMonitors = [
|
||||
actions: HostActions(),
|
||||
},
|
||||
{
|
||||
host: Host("Google", 99.9, "var(--env-var-color-17)"),
|
||||
host: Host(
|
||||
"Google",
|
||||
99.9,
|
||||
"var(--env-var-color-17)",
|
||||
"https://www.google.com"
|
||||
),
|
||||
status: HostStatus(
|
||||
"var(--env-var-color-20)",
|
||||
"Up",
|
||||
@@ -29,7 +40,12 @@ const hardCodedMonitors = [
|
||||
actions: HostActions(),
|
||||
},
|
||||
{
|
||||
host: Host("NBC", 98.1, "var(--env-var-color-18)"),
|
||||
host: Host(
|
||||
"NBC",
|
||||
98.1,
|
||||
"var(--env-var-color-18)",
|
||||
"https://www.google.com"
|
||||
),
|
||||
status: HostStatus(
|
||||
"var(--env-var-color-20)",
|
||||
"Up",
|
||||
@@ -39,7 +55,12 @@ const hardCodedMonitors = [
|
||||
actions: HostActions(),
|
||||
},
|
||||
{
|
||||
host: Host("Google", 95.1, "var(--env-var-color-19)"),
|
||||
host: Host(
|
||||
"Google",
|
||||
95.1,
|
||||
"var(--env-var-color-19)",
|
||||
"https://www.google.com"
|
||||
),
|
||||
status: HostStatus(
|
||||
"var(--env-var-color-21)",
|
||||
"Down",
|
||||
@@ -49,7 +70,12 @@ const hardCodedMonitors = [
|
||||
actions: HostActions(),
|
||||
},
|
||||
{
|
||||
host: Host("NBC", 99.9, "var(--env-var-color-17)"),
|
||||
host: Host(
|
||||
"NBC",
|
||||
99.9,
|
||||
"var(--env-var-color-17)",
|
||||
"https://www.google.com"
|
||||
),
|
||||
status: HostStatus(
|
||||
"var(--env-var-color-15)",
|
||||
"Cannot resolve",
|
||||
@@ -60,17 +86,39 @@ const hardCodedMonitors = [
|
||||
},
|
||||
];
|
||||
|
||||
const CurrentStats = () => {
|
||||
const CurrentStats = (mockdata = true) => {
|
||||
// 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));
|
||||
}, []);
|
||||
if (mockdata) {
|
||||
console.log(MockData.data);
|
||||
setMonitors(
|
||||
MockData.data.map((item) => ({
|
||||
host: Host(item.name, 100, "var(--env-var-color-17)", item.url),
|
||||
status: HostStatus(
|
||||
item.isActive
|
||||
? "var(--env-var-color-20)"
|
||||
: "var(--env-var-color-21)",
|
||||
item.isActive ? "Up" : "Down",
|
||||
item.isActive
|
||||
? "var(--env-var-color-17)"
|
||||
: "var(--env-var-color-19)"
|
||||
),
|
||||
team: <BarChart />,
|
||||
actions: HostActions(),
|
||||
}))
|
||||
);
|
||||
}
|
||||
}, [mockdata]);
|
||||
|
||||
// useEffect(() => {
|
||||
// fetch("API_URL")
|
||||
// .then((response) => response.json())
|
||||
// .then((data) => setMonitors(data))
|
||||
// .catch((error) => console.error(error));
|
||||
// }, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
.monitors-stats {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.monitors-gaps-medium {
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
--env-var-color-23: #17b26a;
|
||||
--env-var-color-24: #d92d20;
|
||||
--env-var-color-25: #667085;
|
||||
--env-var-color-26: #ff1818;
|
||||
|
||||
--env-var-radius-1: 4px;
|
||||
--env-var-radius-2: 8px;
|
||||
|
||||
Reference in new issue
Block a user