mirror of
https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
synced 2025-11-02 03:07:46 +00:00
Merge pull request #52 from stephb9959/feature/32-statistics
Feature/32 statistics
This commit is contained in:
@@ -3,7 +3,7 @@ import { CFooter } from '@coreui/react';
|
|||||||
|
|
||||||
const TheFooter = () => (
|
const TheFooter = () => (
|
||||||
<CFooter fixed={false}>
|
<CFooter fixed={false}>
|
||||||
<div>Version 0.0.6</div>
|
<div>Version 0.0.7</div>
|
||||||
<div className="mfs-auto">
|
<div className="mfs-auto">
|
||||||
<span className="mr-1">Powered by</span>
|
<span className="mr-1">Powered by</span>
|
||||||
<a href="https://coreui.io/react" target="_blank" rel="noopener noreferrer">
|
<a href="https://coreui.io/react" target="_blank" rel="noopener noreferrer">
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import PropTypes from 'prop-types';
|
|||||||
import Chart from 'react-apexcharts'
|
import Chart from 'react-apexcharts'
|
||||||
|
|
||||||
const DeviceStatisticsChart = ({ data, options }) => (
|
const DeviceStatisticsChart = ({ data, options }) => (
|
||||||
<div>
|
<div style={{height: '360px'}}>
|
||||||
<Chart
|
<Chart
|
||||||
series={data}
|
series={data}
|
||||||
options={options}
|
options={options}
|
||||||
type='line'
|
type='line'
|
||||||
height={360}
|
height='100%'
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -97,28 +97,29 @@ const StatisticsChartList = ({ selectedDeviceId, lastRefresh }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getStatistics = () => {
|
const getStatistics = () => {
|
||||||
if (loading) return;
|
if (!loading){
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
Authorization: `Bearer ${getToken()}`,
|
Authorization: `Bearer ${getToken()}`,
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
serialNumber: "24f5a207a130"
|
serialNumber: "24f5a207a130"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
axiosInstance
|
axiosInstance
|
||||||
.get(`/device/${selectedDeviceId}/statistics?newest=true&limit=50`, options)
|
.get(`/device/${selectedDeviceId}/statistics?newest=true&limit=50`, options)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
transformIntoDataset(response.data.data);
|
transformIntoDataset(response.data.data);
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user