From 88020e920722570277380e4785f887f9feec3168 Mon Sep 17 00:00:00 2001 From: Caio Cabral Date: Fri, 29 Nov 2024 10:17:09 -0500 Subject: [PATCH] refactor: changing friendly to display name --- .../Components/Charts/CustomGauge/index.jsx | 4 +-- Client/src/Components/Charts/Gauge/index.jsx | 2 ++ .../Infrastructure/CreateMonitor/index.jsx | 3 +- Client/src/Pages/Infrastructure/index.jsx | 36 +++++++++---------- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/Client/src/Components/Charts/CustomGauge/index.jsx b/Client/src/Components/Charts/CustomGauge/index.jsx index cb74caf9e..44512aa60 100644 --- a/Client/src/Components/Charts/CustomGauge/index.jsx +++ b/Client/src/Components/Charts/CustomGauge/index.jsx @@ -54,8 +54,8 @@ const CustomGauge = ({ progress = 0, radius = 70, strokeWidth = 15, threshold = const fillColor = progressWithinRange > threshold - ? theme.palette.primary.main - : theme.palette.percentage.uptimePoor; + ? theme.palette.percentage.uptimePoor + : theme.palette.primary.main; return ( { mockedData); - const columns = [ { label: "Host" }, { label: "Status" }, @@ -41,6 +38,8 @@ const columns = [ { label: "Actions" }, ]; +const BREADCRUMBS = [{ name: `infrastructure`, path: "/infrastructure" }]; + /* TODO Create reusable table component. It should receive as a parameter the following object: @@ -122,21 +121,28 @@ function Infrastructure(/* {isAdmin} */) { const { determineState } = useUtils(); const { monitors, total: totalMonitors } = monitorState; + console.log({ monitors }); + console.log(monitors[0]?.checks[0]?.memory.usage_percent); const monitorsAsRows = monitors.map((monitor) => ({ ip: monitor.name, status: determineState(monitor), - processor: "2Ghz" /* How to retrieve that? */, - cpu: 80 /* How to retrieve that? */, - mem: 50 /* How to retrieve that? */, - disk: 70 /* How to retrieve that? */, + processor: (monitor?.checks[0]?.cpu.frequency / 1000).toFixed(2) + " GHz", + cpu: monitor?.checks[0]?.cpu.usage_percent * 100, + mem: monitor?.checks[0]?.memory.usage_percent * 100, + disk: monitor?.checks[0]?.disk[0]?.usage_percent * 100, })); + /* TODO when friendyly name i added, it shoul display frindly name + url */ + /* TODO remove table scrollbar */ + /* Fix search in monitors page */ + /* Adding actions to the table */ + /* Adding click on row action */ return ( - + - {/* */} - + - + {/* Get ActionsMenu from Monitor Table and create a component */}