parent
6c70d8ca37
commit
9258fada47
|
@ -152,10 +152,10 @@ export const getTopStatsSuccess = createAction('GET_TOP_STATS_SUCCESS');
|
||||||
|
|
||||||
export const getTopStats = () => async (dispatch, getState) => {
|
export const getTopStats = () => async (dispatch, getState) => {
|
||||||
dispatch(getTopStatsRequest());
|
dispatch(getTopStatsRequest());
|
||||||
try {
|
|
||||||
const state = getState();
|
|
||||||
const timer = setInterval(async () => {
|
const timer = setInterval(async () => {
|
||||||
|
const state = getState();
|
||||||
if (state.dashboard.isCoreRunning) {
|
if (state.dashboard.isCoreRunning) {
|
||||||
|
clearInterval(timer);
|
||||||
try {
|
try {
|
||||||
const stats = await apiClient.getGlobalStatsTop();
|
const stats = await apiClient.getGlobalStatsTop();
|
||||||
dispatch(getTopStatsSuccess(stats));
|
dispatch(getTopStatsSuccess(stats));
|
||||||
|
@ -163,13 +163,8 @@ export const getTopStats = () => async (dispatch, getState) => {
|
||||||
alertify.error(`Failed to load statistics with status code ${error.response.status}`);
|
alertify.error(`Failed to load statistics with status code ${error.response.status}`);
|
||||||
dispatch(getTopStatsFailure());
|
dispatch(getTopStatsFailure());
|
||||||
}
|
}
|
||||||
clearInterval(timer);
|
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
dispatch(getTopStatsFailure());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getLogsRequest = createAction('GET_LOGS_REQUEST');
|
export const getLogsRequest = createAction('GET_LOGS_REQUEST');
|
||||||
|
@ -178,10 +173,10 @@ export const getLogsSuccess = createAction('GET_LOGS_SUCCESS');
|
||||||
|
|
||||||
export const getLogs = () => async (dispatch, getState) => {
|
export const getLogs = () => async (dispatch, getState) => {
|
||||||
dispatch(getLogsRequest());
|
dispatch(getLogsRequest());
|
||||||
try {
|
|
||||||
const state = getState();
|
|
||||||
const timer = setInterval(async () => {
|
const timer = setInterval(async () => {
|
||||||
|
const state = getState();
|
||||||
if (state.dashboard.isCoreRunning) {
|
if (state.dashboard.isCoreRunning) {
|
||||||
|
clearInterval(timer);
|
||||||
try {
|
try {
|
||||||
const logs = normalizeLogs(await apiClient.getQueryLog());
|
const logs = normalizeLogs(await apiClient.getQueryLog());
|
||||||
dispatch(getLogsSuccess(logs));
|
dispatch(getLogsSuccess(logs));
|
||||||
|
@ -189,13 +184,8 @@ export const getLogs = () => async (dispatch, getState) => {
|
||||||
alertify.error(`Failed to load query log with status code ${error.response.status}`);
|
alertify.error(`Failed to load query log with status code ${error.response.status}`);
|
||||||
dispatch(getLogsFailure());
|
dispatch(getLogsFailure());
|
||||||
}
|
}
|
||||||
clearInterval(timer);
|
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
dispatch(getLogsFailure());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const toggleLogStatusRequest = createAction('TOGGLE_LOGS_REQUEST');
|
export const toggleLogStatusRequest = createAction('TOGGLE_LOGS_REQUEST');
|
||||||
|
|
Loading…
Reference in New Issue