Skip to content
Snippets Groups Projects
Commit 25e8a3e8 authored by Imre Toth's avatar Imre Toth
Browse files

CE-2131: Statistics improvement

parent 096545c2
No related branches found
No related tags found
2 merge requests!407CE-2141: 3.0.0,!362CE-2131: Statistics improvement
import React from "react"; import React from "react";
import { useCurrentlyActiveIOCs } from "../../../api/SwaggerApi"; import { useCurrentlyActiveIOCs } from "../../../api/SwaggerApi";
import { useEffect } from "react"; import { useEffect } from "react";
import { LinearProgress, useTheme } from "@mui/material"; import { LinearProgress, useTheme, Typography } from "@mui/material";
import { circularPalette } from "../../common/Helper"; import { circularPalette } from "../../common/Helper";
import { import {
BarChart, BarChart,
...@@ -60,9 +60,7 @@ export default function ActiveIOCChart({ title }) { ...@@ -60,9 +60,7 @@ export default function ActiveIOCChart({ title }) {
return activeIocs ? ( return activeIocs ? (
<> <>
<div style={{ textAlign: "center" }}> <Typography variant="h2">{title}</Typography>
<h3>{title}</h3>
</div>
<ResponsiveContainer <ResponsiveContainer
width="100%" width="100%"
aspect={2} aspect={2}
......
...@@ -2,7 +2,7 @@ import React from "react"; ...@@ -2,7 +2,7 @@ import React from "react";
import { useEffect } from "react"; import { useEffect } from "react";
import { formatDateOnly } from "../../common/Helper"; import { formatDateOnly } from "../../common/Helper";
import { circularPalette } from "../../common/Helper"; import { circularPalette } from "../../common/Helper";
import { LinearProgress, useTheme } from "@mui/material"; import { LinearProgress, useTheme, Typography } from "@mui/material";
import { import {
AreaChart, AreaChart,
Area, Area,
...@@ -25,9 +25,7 @@ export default function DeploymentLineChart({ title, chartLabel, hook }) { ...@@ -25,9 +25,7 @@ export default function DeploymentLineChart({ title, chartLabel, hook }) {
return iocDeployments ? ( return iocDeployments ? (
<> <>
<div style={{ textAlign: "center" }}> <Typography variant="h2">{title}</Typography>
<h3>{title}</h3>
</div>
<ResponsiveContainer <ResponsiveContainer
width="100%" width="100%"
aspect={3} aspect={3}
......
...@@ -24,29 +24,17 @@ export function HostStatistics() { ...@@ -24,29 +24,17 @@ export function HostStatistics() {
fcn: client.apis.Statistics.calculateStatistics, fcn: client.apis.Statistics.calculateStatistics,
call: false call: false
}); });
const { value: hostsWithoutIssues, wrapper: getHostsWithoutIssues } =
useAPIMethod({
fcn: client.apis.Statistics.calculateStatistics,
call: false
});
useEffect(() => { useEffect(() => {
getHostsRegistered({ statistics_type: "HOSTS_REGISTERED" }); getHostsRegistered({ statistics_type: "HOSTS_REGISTERED" });
getHostsWithIocs({ statistics_type: "HOSTS_WITH_IOCS" }); getHostsWithIocs({ statistics_type: "HOSTS_WITH_IOCS" });
getHostsReachable({ statistics_type: "HOSTS_REACHABLE" }); getHostsReachable({ statistics_type: "HOSTS_REACHABLE" });
getHostsWithoutIssues({ statistics_type: "HOSTS_WITHOUT_ISSUE" }); }, [getHostsRegistered, getHostsWithIocs, getHostsReachable]);
}, [
getHostsRegistered,
getHostsWithIocs,
getHostsReachable,
getHostsWithoutIssues
]);
const hostStats = { const hostStats = {
"Registered IOC-hosts": renderValue(hostsRegistered?.value), "Registered IOC-hosts": renderValue(hostsRegistered?.value),
"IOC-hosts with IOCs": renderValue(hostsWithIocs?.value), "IOC-hosts with IOCs": renderValue(hostsWithIocs?.value),
"Reachable IOC-hosts with IOCs": renderValue(hostsReachable?.value), "Reachable IOC-hosts with IOCs": renderValue(hostsReachable?.value)
"Issue free IOC-hosts with IOCs": renderValue(hostsWithoutIssues?.value)
}; };
return ( return (
......
...@@ -25,29 +25,17 @@ export function IOCStatistics() { ...@@ -25,29 +25,17 @@ export function IOCStatistics() {
fcn: client.apis.Statistics.calculateStatistics, fcn: client.apis.Statistics.calculateStatistics,
call: false call: false
}); });
const { value: iocsWithoutIssues, wrapper: getIocsWithoutIssues } =
useAPIMethod({
fcn: client.apis.Statistics.calculateStatistics,
call: false
});
useEffect(() => { useEffect(() => {
getIocsRegistered({ statistics_type: "IOCS_REGISTERED" }); getIocsRegistered({ statistics_type: "IOCS_REGISTERED" });
getIocsDeployed({ statistics_type: "IOCS_DEPLOYED" }); getIocsDeployed({ statistics_type: "IOCS_DEPLOYED" });
getIocsReachable({ statistics_type: "IOCS_RUNNING" }); getIocsReachable({ statistics_type: "IOCS_RUNNING" });
getIocsWithoutIssues({ statistics_type: "IOCS_RUNNING_WITHOUT_ISSUE" }); }, [getIocsDeployed, getIocsReachable, getIocsRegistered]);
}, [
getIocsDeployed,
getIocsReachable,
getIocsRegistered,
getIocsWithoutIssues
]);
const iocStats = { const iocStats = {
"Registered IOCs": renderValue(iocsRegistered?.value), "Registered IOCs": renderValue(iocsRegistered?.value),
"Deployed IOCs": renderValue(iocsDeployed?.value), "Deployed IOCs": renderValue(iocsDeployed?.value),
"Running IOCs": renderValue(iocsReachable?.value), "Running IOCs": renderValue(iocsReachable?.value)
"Issue-free and running IOCs": renderValue(iocsWithoutIssues?.value)
}; };
return ( return (
......
...@@ -2,7 +2,7 @@ import React from "react"; ...@@ -2,7 +2,7 @@ import React from "react";
import { useEffect } from "react"; import { useEffect } from "react";
import { formatDateOnly } from "../../common/Helper"; import { formatDateOnly } from "../../common/Helper";
import { circularPalette } from "../../common/Helper"; import { circularPalette } from "../../common/Helper";
import { LinearProgress, useTheme } from "@mui/material"; import { LinearProgress, useTheme, Typography } from "@mui/material";
import { import {
AreaChart, AreaChart,
Area, Area,
...@@ -24,9 +24,7 @@ export default function OperationChart({ title, hook }) { ...@@ -24,9 +24,7 @@ export default function OperationChart({ title, hook }) {
return iocDeployments ? ( return iocDeployments ? (
<> <>
<div style={{ textAlign: "center" }}> <Typography variant="h2">{title}</Typography>
<h3>{title}</h3>
</div>
<ResponsiveContainer <ResponsiveContainer
width="100%" width="100%"
aspect={3} aspect={3}
......
import React, { useContext, useEffect } from "react"; import React, { useContext, useEffect } from "react";
import { styled } from "@mui/material/styles"; import { styled } from "@mui/material/styles";
import { Paper, Grid, useTheme, Typography } from "@mui/material"; import { Paper, Grid, useTheme } from "@mui/material";
import { GlobalAppBarContext } from "@ess-ics/ce-ui-common"; import { GlobalAppBarContext } from "@ess-ics/ce-ui-common";
import { RootContainer } from "../../components/common/Container/RootContainer"; import { RootContainer } from "../../components/common/Container/RootContainer";
import ActiveIOCChart from "../../components/statistics/ActiveIOCChart"; import ActiveIOCChart from "../../components/statistics/ActiveIOCChart";
...@@ -38,13 +38,6 @@ export function StatisticsView() { ...@@ -38,13 +38,6 @@ export function StatisticsView() {
container container
spacing={theme.spacing(0.5)} spacing={theme.spacing(0.5)}
> >
<Grid
item
xs={12}
>
<Typography variant="h2">Statistics</Typography>
</Grid>
<Grid <Grid
item item
xs={6} xs={6}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment