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 {
|
.server-status-tile {
|
||||||
width: 230px;
|
width: 310px;
|
||||||
padding: var(--spacing-general-1);
|
padding: var(--spacing-general-1);
|
||||||
border: 1px solid var(--color-border-0);
|
border: 1px solid var(--color-border-0);
|
||||||
border-radius: var(--border-radius-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 "./index.css";
|
||||||
import Box from '@mui/material/Box';
|
import { useState } from "react";
|
||||||
import IconButton from '@mui/material/IconButton';
|
import Box from "@mui/material/Box";
|
||||||
import Menu from '@mui/material/Menu';
|
import IconButton from "@mui/material/IconButton";
|
||||||
import Tooltip from '@mui/material/Tooltip';
|
import Menu from "@mui/material/Menu";
|
||||||
import MenuItem from '@mui/material/MenuItem';
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
import Typography from '@mui/material/Typography';
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import SvgIcon from '@mui/material/SvgIcon';
|
import Typography from "@mui/material/Typography";
|
||||||
import SettingsIcon from '@mui/icons-material/Settings';
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
import { useTheme } from '@mui/material/styles';
|
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
|
* DashboardSettings component
|
||||||
@@ -54,20 +61,29 @@ function DashboardSettings() {
|
|||||||
id="menu-appbar"
|
id="menu-appbar"
|
||||||
anchorEl={anchorElUser}
|
anchorEl={anchorElUser}
|
||||||
anchorOrigin={{
|
anchorOrigin={{
|
||||||
vertical: 'top',
|
vertical: "top",
|
||||||
horizontal: 'right',
|
horizontal: "right",
|
||||||
}}
|
}}
|
||||||
keepMounted
|
keepMounted
|
||||||
transformOrigin={{
|
transformOrigin={{
|
||||||
vertical: 'top',
|
vertical: "top",
|
||||||
horizontal: 'right',
|
horizontal: "right",
|
||||||
}}
|
}}
|
||||||
open={Boolean(anchorElUser)}
|
open={Boolean(anchorElUser)}
|
||||||
onClose={handleCloseUserMenu}
|
onClose={handleCloseUserMenu}
|
||||||
>
|
>
|
||||||
{settings.map((setting) => (
|
{settings.map((setting) => (
|
||||||
<MenuItem key={setting} onClick={handleCloseUserMenu}>
|
<MenuItem
|
||||||
<Typography textAlign="center">{setting}</Typography>
|
className="dashboard-setting-menu-item"
|
||||||
|
key={setting}
|
||||||
|
onClick={handleCloseUserMenu}
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
style={{ fontSize: "var(--env-var-font-size-medium)" }}
|
||||||
|
textAlign="center"
|
||||||
|
>
|
||||||
|
{setting}
|
||||||
|
</Typography>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
))}
|
))}
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import OpenIt from "../../assets/Images/Icon-open-in-tab-gray.png";
|
import OpenIt from "../../assets/Images/Icon-open-in-tab-gray.png";
|
||||||
|
|
||||||
function Host(title, precentage, statusColor) {
|
function Host(title, precentage, statusColor, link) {
|
||||||
return (
|
return (
|
||||||
<div className="host-list-item">
|
<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-name">{title}</div>
|
||||||
<div className="host-list-item-precentage" style={{ color: statusColor }}>
|
<div className="host-list-item-precentage" style={{ color: statusColor }}>
|
||||||
{precentage}%
|
{precentage}%
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Actions from "../../assets/Images/Icon-setting-actions-gray.png";
|
import DashboardSettings from "../DashboardSettingsIcon";
|
||||||
|
|
||||||
function HostActions() {
|
function HostActions() {
|
||||||
return <img className="host-actions" src={Actions} alt="Actions" />;
|
return <DashboardSettings />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default HostActions;
|
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 Button from "../../Components/Button";
|
||||||
import ServerStatus from "../../Components/Charts/Servers/ServerStatus";
|
import ServerStatus from "../../Components/Charts/Servers/ServerStatus";
|
||||||
import CurrentMonitors from "../../Components/CurrentMonitors";
|
import CurrentMonitors from "../../Components/CurrentMonitors";
|
||||||
|
import MockData from "../../Mock/sample_data.json";
|
||||||
|
|
||||||
const hardCodedMonitors = [
|
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(
|
status: HostStatus(
|
||||||
"var(--env-var-color-20)",
|
"var(--env-var-color-20)",
|
||||||
"Up",
|
"Up",
|
||||||
@@ -19,7 +25,12 @@ const hardCodedMonitors = [
|
|||||||
actions: HostActions(),
|
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(
|
status: HostStatus(
|
||||||
"var(--env-var-color-20)",
|
"var(--env-var-color-20)",
|
||||||
"Up",
|
"Up",
|
||||||
@@ -29,7 +40,12 @@ const hardCodedMonitors = [
|
|||||||
actions: HostActions(),
|
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(
|
status: HostStatus(
|
||||||
"var(--env-var-color-20)",
|
"var(--env-var-color-20)",
|
||||||
"Up",
|
"Up",
|
||||||
@@ -39,7 +55,12 @@ const hardCodedMonitors = [
|
|||||||
actions: HostActions(),
|
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(
|
status: HostStatus(
|
||||||
"var(--env-var-color-21)",
|
"var(--env-var-color-21)",
|
||||||
"Down",
|
"Down",
|
||||||
@@ -49,7 +70,12 @@ const hardCodedMonitors = [
|
|||||||
actions: HostActions(),
|
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(
|
status: HostStatus(
|
||||||
"var(--env-var-color-15)",
|
"var(--env-var-color-15)",
|
||||||
"Cannot resolve",
|
"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.
|
// The hardcoded part is passed as default value for the purpose of demonstration.
|
||||||
// Pass an empty array, [], before fetching the data
|
// Pass an empty array, [], before fetching the data
|
||||||
const [monitors, setMonitors] = useState(hardCodedMonitors);
|
const [monitors, setMonitors] = useState(hardCodedMonitors);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch("API_URL")
|
if (mockdata) {
|
||||||
.then((response) => response.json())
|
console.log(MockData.data);
|
||||||
.then((data) => setMonitors(data))
|
setMonitors(
|
||||||
.catch((error) => console.error(error));
|
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 (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
.monitors-stats {
|
.monitors-stats {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
gap: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.monitors-gaps-medium {
|
.monitors-gaps-medium {
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
--env-var-color-23: #17b26a;
|
--env-var-color-23: #17b26a;
|
||||||
--env-var-color-24: #d92d20;
|
--env-var-color-24: #d92d20;
|
||||||
--env-var-color-25: #667085;
|
--env-var-color-25: #667085;
|
||||||
|
--env-var-color-26: #ff1818;
|
||||||
|
|
||||||
--env-var-radius-1: 4px;
|
--env-var-radius-1: 4px;
|
||||||
--env-var-radius-2: 8px;
|
--env-var-radius-2: 8px;
|
||||||
|
|||||||
Reference in new issue
Block a user