From 8d4d90197d9065e7b435a741a9d8caee3f5b8647 Mon Sep 17 00:00:00 2001 From: bourquecharles Date: Mon, 21 Jun 2021 15:28:47 -0400 Subject: [PATCH 1/5] Changed version number --- package-lock.json | 2 +- package.json | 2 +- src/layout/Footer/index.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 63a2898..f02aca9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ucentral-client", - "version": "0.9.0", + "version": "0.9.1", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 1677bc4..735c7c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ucentral-client", - "version": "0.9.0", + "version": "0.9.1", "private": true, "dependencies": { "@coreui/coreui": "^3.4.0", diff --git a/src/layout/Footer/index.js b/src/layout/Footer/index.js index 8a006c3..c90adef 100644 --- a/src/layout/Footer/index.js +++ b/src/layout/Footer/index.js @@ -6,7 +6,7 @@ const TheFooter = () => ( {(t) => ( -
{t('footer.version')} 0.9.0
+
{t('footer.version')} 0.9.1
{t('footer.powered_by')} From dcc37a113f4eafdbe3a0395b1c48dffb090a36c2 Mon Sep 17 00:00:00 2001 From: bourquecharles Date: Mon, 21 Jun 2021 15:34:10 -0400 Subject: [PATCH 2/5] Added back sass package --- package-lock.json | 18 ++++-------------- package.json | 1 + 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index f02aca9..e9921e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,8 @@ "requires": true, "packages": { "": { - "version": "0.9.0", + "name": "ucentral-client", + "version": "0.9.1", "dependencies": { "@coreui/coreui": "^3.4.0", "@coreui/icons": "^2.0.1", @@ -37,6 +38,7 @@ "react-select": "^4.3.1", "react-widgets": "^5.1.1", "redux": "^4.1.0", + "sass": "^1.35.1", "uuid": "^8.3.2" }, "devDependencies": { @@ -5248,7 +5250,6 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "optional": true, "engines": { "node": ">=8" } @@ -5737,7 +5738,6 @@ "version": "3.5.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", - "optional": true, "dependencies": { "anymatch": "~3.1.1", "braces": "~3.0.2", @@ -10569,7 +10569,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "optional": true, "dependencies": { "binary-extensions": "^2.0.0" }, @@ -17453,7 +17452,6 @@ "version": "3.5.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", - "optional": true, "dependencies": { "picomatch": "^2.2.1" }, @@ -18343,8 +18341,6 @@ "version": "1.35.1", "resolved": "https://registry.npmjs.org/sass/-/sass-1.35.1.tgz", "integrity": "sha512-oCisuQJstxMcacOPmxLNiLlj4cUyN2+8xJnG7VanRoh2GOLr9RqkvI4AxA4a6LHVg/rsu+PmxXeGhrdSF9jCiQ==", - "optional": true, - "peer": true, "dependencies": { "chokidar": ">=3.0.0 <4.0.0" }, @@ -26490,8 +26486,7 @@ "binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "optional": true + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" }, "bindings": { "version": "1.5.0", @@ -26896,7 +26891,6 @@ "version": "3.5.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", - "optional": true, "requires": { "anymatch": "~3.1.1", "braces": "~3.0.2", @@ -30706,7 +30700,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "optional": true, "requires": { "binary-extensions": "^2.0.0" } @@ -36047,7 +36040,6 @@ "version": "3.5.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", - "optional": true, "requires": { "picomatch": "^2.2.1" } @@ -36756,8 +36748,6 @@ "version": "1.35.1", "resolved": "https://registry.npmjs.org/sass/-/sass-1.35.1.tgz", "integrity": "sha512-oCisuQJstxMcacOPmxLNiLlj4cUyN2+8xJnG7VanRoh2GOLr9RqkvI4AxA4a6LHVg/rsu+PmxXeGhrdSF9jCiQ==", - "optional": true, - "peer": true, "requires": { "chokidar": ">=3.0.0 <4.0.0" } diff --git a/package.json b/package.json index 735c7c9..801bb5e 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "react-select": "^4.3.1", "react-widgets": "^5.1.1", "redux": "^4.1.0", + "sass": "^1.35.1", "uuid": "^8.3.2" }, "scripts": { From 1bdb30ef01e3946d3d1f34b89d0050e6fd7da148 Mon Sep 17 00:00:00 2001 From: bourquecharles Date: Mon, 21 Jun 2021 15:47:15 -0400 Subject: [PATCH 3/5] The rx_bytes were not converted to KB --- .../InterfaceStatistics/containers/StatisticsChartList/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js b/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js index 5e8f395..7967ca2 100644 --- a/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js +++ b/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js @@ -60,7 +60,7 @@ const StatisticsChartList = ({ selectedDeviceId, lastRefresh }) => { interfaceList[interfaceTypes[inter.name]][0].data.push( Math.floor(inter.counters.tx_bytes / 1024), ); - interfaceList[interfaceTypes[inter.name]][1].data.push(Math.floor(inter.counters.rx_bytes)); + interfaceList[interfaceTypes[inter.name]][1].data.push(Math.floor(inter.counters.rx_bytes / 1024)); } } From 0f1d251c3afcee74b1e4e28e9bfd9159c7e8f07c Mon Sep 17 00:00:00 2001 From: bourquecharles Date: Mon, 21 Jun 2021 16:32:50 -0400 Subject: [PATCH 4/5] Fixed double rendering of the statistics charts --- package-lock.json | 2 +- package.json | 2 +- .../containers/DeviceStatisticsChart/index.js | 3 +-- .../DeviceStatisticsChart/index.module.scss | 3 --- .../containers/StatisticsChartList/index.js | 24 +++++++++++++------ src/components/InterfaceStatistics/index.js | 2 +- src/layout/Footer/index.js | 2 +- 7 files changed, 22 insertions(+), 16 deletions(-) delete mode 100644 src/components/InterfaceStatistics/containers/DeviceStatisticsChart/index.module.scss diff --git a/package-lock.json b/package-lock.json index e9921e2..4f04f59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "ucentral-client", - "version": "0.9.1", + "version": "0.9.2", "dependencies": { "@coreui/coreui": "^3.4.0", "@coreui/icons": "^2.0.1", diff --git a/package.json b/package.json index 801bb5e..3dad34a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ucentral-client", - "version": "0.9.1", + "version": "0.9.2", "private": true, "dependencies": { "@coreui/coreui": "^3.4.0", diff --git a/src/components/InterfaceStatistics/containers/DeviceStatisticsChart/index.js b/src/components/InterfaceStatistics/containers/DeviceStatisticsChart/index.js index 02e6c93..1694d00 100644 --- a/src/components/InterfaceStatistics/containers/DeviceStatisticsChart/index.js +++ b/src/components/InterfaceStatistics/containers/DeviceStatisticsChart/index.js @@ -1,10 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import Chart from 'react-apexcharts'; -import styles from './index.module.scss'; const DeviceStatisticsChart = ({ data, options }) => ( -
+
); diff --git a/src/components/InterfaceStatistics/containers/DeviceStatisticsChart/index.module.scss b/src/components/InterfaceStatistics/containers/DeviceStatisticsChart/index.module.scss deleted file mode 100644 index 68c7968..0000000 --- a/src/components/InterfaceStatistics/containers/DeviceStatisticsChart/index.module.scss +++ /dev/null @@ -1,3 +0,0 @@ -.chart { - height: 360px; -} diff --git a/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js b/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js index 7967ca2..d223d64 100644 --- a/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js +++ b/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js @@ -10,8 +10,10 @@ import DeviceStatisticsChart from '../DeviceStatisticsChart'; const StatisticsChartList = ({ selectedDeviceId, lastRefresh }) => { const { t } = useTranslation(); const [loading, setLoading] = useState(false); - const [deviceStats, setStats] = useState([]); - const [statOptions, setStatOptions] = useState({}); + const [statOptions, setStatOptions] = useState({ + interfaceList: [], + settings: {} + }); const transformIntoDataset = (data) => { const sortedData = data.sort((a, b) => { @@ -97,8 +99,16 @@ const StatisticsChartList = ({ selectedDeviceId, lastRefresh }) => { }, }; - setStatOptions(options); - setStats(interfaceList); + console.log('loading stats'); + + const newOptions = { + interfaceList, + settings: options + }; + + if(statOptions !== newOptions){ + setStatOptions(newOptions); + } }; const getStatistics = () => { @@ -134,20 +144,20 @@ const StatisticsChartList = ({ selectedDeviceId, lastRefresh }) => { }, [selectedDeviceId]); useEffect(() => { - if (lastRefresh !== '' && selectedDeviceId) { + if (!loading && lastRefresh !== '' && selectedDeviceId) { getStatistics(); } }, [lastRefresh]); return (
- {deviceStats.map((data) => ( + {statOptions.interfaceList.map((data) => (
{ const { t } = useTranslation(); - const [lastRefresh, setLastRefresh] = useState(''); + const [lastRefresh, setLastRefresh] = useState(new Date().toString()); const refresh = () => { setLastRefresh(new Date().toString()); diff --git a/src/layout/Footer/index.js b/src/layout/Footer/index.js index c90adef..badf9fc 100644 --- a/src/layout/Footer/index.js +++ b/src/layout/Footer/index.js @@ -6,7 +6,7 @@ const TheFooter = () => ( {(t) => ( -
{t('footer.version')} 0.9.1
+
{t('footer.version')} 0.9.2
{t('footer.powered_by')} From ad2be40718202e37ea39fb92b48c91334f41ba55 Mon Sep 17 00:00:00 2001 From: bourquecharles Date: Mon, 21 Jun 2021 16:46:52 -0400 Subject: [PATCH 5/5] Deleting console.log --- .../InterfaceStatistics/containers/StatisticsChartList/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js b/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js index d223d64..6f5b398 100644 --- a/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js +++ b/src/components/InterfaceStatistics/containers/StatisticsChartList/index.js @@ -99,8 +99,6 @@ const StatisticsChartList = ({ selectedDeviceId, lastRefresh }) => { }, }; - console.log('loading stats'); - const newOptions = { interfaceList, settings: options