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/stores/admin_store.jsx | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'web/react/stores/admin_store.jsx') diff --git a/web/react/stores/admin_store.jsx b/web/react/stores/admin_store.jsx index 704e2ced4..8f43091a7 100644 --- a/web/react/stores/admin_store.jsx +++ b/web/react/stores/admin_store.jsx @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; @@ -10,6 +10,7 @@ import Constants from '../utils/constants.jsx'; const ActionTypes = Constants.ActionTypes; const LOG_CHANGE_EVENT = 'log_change'; +const SERVER_AUDIT_CHANGE_EVENT = 'server_audit_change'; const CONFIG_CHANGE_EVENT = 'config_change'; const ALL_TEAMS_EVENT = 'all_team_change'; @@ -18,6 +19,7 @@ class AdminStoreClass extends EventEmitter { super(); this.logs = null; + this.audits = null; this.config = null; this.teams = null; @@ -25,6 +27,10 @@ class AdminStoreClass extends EventEmitter { this.addLogChangeListener = this.addLogChangeListener.bind(this); this.removeLogChangeListener = this.removeLogChangeListener.bind(this); + this.emitAuditChange = this.emitAuditChange.bind(this); + this.addAuditChangeListener = this.addAuditChangeListener.bind(this); + this.removeAuditChangeListener = this.removeAuditChangeListener.bind(this); + this.emitConfigChange = this.emitConfigChange.bind(this); this.addConfigChangeListener = this.addConfigChangeListener.bind(this); this.removeConfigChangeListener = this.removeConfigChangeListener.bind(this); @@ -46,6 +52,18 @@ class AdminStoreClass extends EventEmitter { this.removeListener(LOG_CHANGE_EVENT, callback); } + emitAuditChange() { + this.emit(SERVER_AUDIT_CHANGE_EVENT); + } + + addAuditChangeListener(callback) { + this.on(SERVER_AUDIT_CHANGE_EVENT, callback); + } + + removeAuditChangeListener(callback) { + this.removeListener(SERVER_AUDIT_CHANGE_EVENT, callback); + } + emitConfigChange() { this.emit(CONFIG_CHANGE_EVENT); } @@ -78,6 +96,14 @@ class AdminStoreClass extends EventEmitter { this.logs = logs; } + getAudits() { + return this.audits; + } + + saveAudits(audits) { + this.audits = audits; + } + getConfig() { return this.config; } @@ -113,6 +139,10 @@ AdminStoreClass.dispatchToken = AppDispatcher.register((payload) => { AdminStore.saveLogs(action.logs); AdminStore.emitLogChange(); break; + case ActionTypes.RECIEVED_SERVER_AUDITS: + AdminStore.saveAudits(action.audits); + AdminStore.emitAuditChange(); + break; case ActionTypes.RECIEVED_CONFIG: AdminStore.saveConfig(action.config); AdminStore.emitConfigChange(); -- cgit v1.2.3-1-g7c22