- client: convert average processing time to milliseconds
This commit is contained in:
parent
63049e0521
commit
17a26155cd
|
@ -2,7 +2,7 @@ import { createAction } from 'redux-actions';
|
||||||
|
|
||||||
import Api from '../api/Api';
|
import Api from '../api/Api';
|
||||||
import { addErrorToast, addSuccessToast } from './index';
|
import { addErrorToast, addSuccessToast } from './index';
|
||||||
import { normalizeTopStats } from '../helpers/helpers';
|
import { normalizeTopStats, secondsToMilliseconds } from '../helpers/helpers';
|
||||||
|
|
||||||
const apiClient = new Api();
|
const apiClient = new Api();
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ export const getStats = () => async (dispatch) => {
|
||||||
top_blocked_domains: normalizeTopStats(stats.top_blocked_domains),
|
top_blocked_domains: normalizeTopStats(stats.top_blocked_domains),
|
||||||
top_clients: normalizeTopStats(stats.top_clients),
|
top_clients: normalizeTopStats(stats.top_clients),
|
||||||
top_queried_domains: normalizeTopStats(stats.top_queried_domains),
|
top_queried_domains: normalizeTopStats(stats.top_queried_domains),
|
||||||
|
avg_processing_time: secondsToMilliseconds(stats.avg_processing_time),
|
||||||
};
|
};
|
||||||
|
|
||||||
dispatch(getStatsSuccess(normalizedStats));
|
dispatch(getStatsSuccess(normalizedStats));
|
||||||
|
|
|
@ -102,7 +102,7 @@ const Counters = (props) => {
|
||||||
</td>
|
</td>
|
||||||
<td className="text-right">
|
<td className="text-right">
|
||||||
<span className="text-muted">
|
<span className="text-muted">
|
||||||
{avgProcessingTime ? `${round(avgProcessingTime, 2)} ms` : 0}
|
{avgProcessingTime ? `${round(avgProcessingTime)} ms` : 0}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -233,3 +233,11 @@ export const sortClients = (clients) => {
|
||||||
export const toggleAllServices = (services, change, isSelected) => {
|
export const toggleAllServices = (services, change, isSelected) => {
|
||||||
services.forEach(service => change(`blocked_services.${service.id}`, isSelected));
|
services.forEach(service => change(`blocked_services.${service.id}`, isSelected));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const secondsToMilliseconds = (seconds) => {
|
||||||
|
if (seconds) {
|
||||||
|
return seconds * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
return seconds;
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue