From 761f595c337fbb291a48ecbd59bf70a8a61a6d5f Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 11 May 2023 11:58:09 -0400 Subject: [PATCH] cleaner metrics component design (#324) --- ui/src/console/detail/share/MetricsTab.js | 2 +- ui/src/console/metrics/MetricsView.js | 92 +++++++++-------------- 2 files changed, 37 insertions(+), 57 deletions(-) diff --git a/ui/src/console/detail/share/MetricsTab.js b/ui/src/console/detail/share/MetricsTab.js index e152ffbf..bf6f2454 100644 --- a/ui/src/console/detail/share/MetricsTab.js +++ b/ui/src/console/detail/share/MetricsTab.js @@ -1,5 +1,5 @@ import React, {useEffect, useState} from "react"; -import {buildMetrics, bytesToSize} from "../../metrics"; +import {buildMetrics} from "../../metrics"; import * as metadata from "../../../api/metadata"; import MetricsView from "../../metrics/MetricsView"; diff --git a/ui/src/console/metrics/MetricsView.js b/ui/src/console/metrics/MetricsView.js index 6454e3c1..9b71b5ac 100644 --- a/ui/src/console/metrics/MetricsView.js +++ b/ui/src/console/metrics/MetricsView.js @@ -4,7 +4,7 @@ import {Bar, BarChart, CartesianGrid, ResponsiveContainer, XAxis, YAxis} from "r import moment from "moment/moment"; import React from "react"; -const MetricsView = (props) => { +const MetricsViews = (props) => { return ( @@ -12,72 +12,52 @@ const MetricsView = (props) => {

Last 30 Days:

- -

Received: {bytesToSize(props.metrics30.rx)}

-

Sent: {bytesToSize(props.metrics30.tx)}

-
- - - - - - v.timestamp} scale={"time"} tickFormatter={(v) => moment(v).format("MMM DD") } style={{ fontSize: '75%'}}/> - bytesToSize(v)} style={{ fontSize: '75%' }}/> - - - - - - - + +

Last 7 Days:

- -

Received: {bytesToSize(props.metrics7.rx)}

-

Sent: {bytesToSize(props.metrics7.tx)}

-
- - - - - - v.timestamp} scale={"time"} tickFormatter={(v) => moment(v).format("MMM DD") } style={{ fontSize: '75%'}}/> - bytesToSize(v)} style={{ fontSize: '75%' }}/> - - - - - - - + +

Last 24 Hours:

- -

Received: {bytesToSize(props.metrics1.rx)}

-

Sent: {bytesToSize(props.metrics1.tx)}

-
- - - - - - v.timestamp} scale={"time"} tickFormatter={(v) => moment(v).format("MMM DD") } style={{ fontSize: '75%'}}/> - bytesToSize(v)} style={{ fontSize: '75%' }}/> - - - - - - - + +
); } -export default MetricsView; \ No newline at end of file +const MetricsSummary = (props) => { + return ( + +

Received: {bytesToSize(props.metrics.rx)}

+

Sent: {bytesToSize(props.metrics.tx)}

+
+ ); +} + +const MetricsGraph = (props) => { + return ( + + + + + + v.timestamp} scale={"time"} tickFormatter={(v) => moment(v).format("MMM DD") } style={{ fontSize: '75%'}}/> + bytesToSize(v)} style={{ fontSize: '75%' }}/> + + + + + + + + ); +} + +export default MetricsViews; \ No newline at end of file