From d153d661db7d4349d69824d318aa9ad571970606 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Tue, 2 Feb 2016 16:49:27 -0500 Subject: Add basic server audit tab to system console for EE --- web/react/utils/async_client.jsx | 26 ++++++++++++++++++++++++++ web/react/utils/client.jsx | 14 ++++++++++++++ web/react/utils/constants.jsx | 1 + 3 files changed, 41 insertions(+) (limited to 'web/react/utils') diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index 0ee89b9fa..d615e02c7 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -312,6 +312,32 @@ export function getLogs() { ); } +export function getServerAudits() { + if (isCallInProgress('getServerAudits')) { + return; + } + + callTracker.getServerAudits = utils.getTimestamp(); + client.getServerAudits( + (data, textStatus, xhr) => { + callTracker.getServerAudits = 0; + + if (xhr.status === 304 || !data) { + return; + } + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECIEVED_SERVER_AUDITS, + audits: data + }); + }, + (err) => { + callTracker.getServerAudits = 0; + dispatchError(err, 'getServerAudits'); + } + ); +} + export function getConfig() { if (isCallInProgress('getConfig')) { return; diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 09cd4162a..473087308 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -385,6 +385,20 @@ export function getLogs(success, error) { }); } +export function getServerAudits(success, error) { + $.ajax({ + url: '/api/v1/admin/audits', + dataType: 'json', + contentType: 'application/json', + type: 'GET', + success, + error: function onError(xhr, status, err) { + var e = handleError('getServerAudits', xhr, status, err); + error(e); + } + }); +} + export function getConfig(success, error) { $.ajax({ url: '/api/v1/admin/config', diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index e1a4b8a8a..fec9b27d7 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -45,6 +45,7 @@ export default { RECIEVED_CONFIG: null, RECIEVED_LOGS: null, + RECIEVED_SERVER_AUDITS: null, RECIEVED_ALL_TEAMS: null, SHOW_SEARCH: null, -- cgit v1.2.3-1-g7c22