diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-09-24 08:14:30 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-09-24 08:14:30 -0400 |
commit | 54c7dba33dc707fa7013a87040c8a8e5d7b237e9 (patch) | |
tree | 6afeaf5fc7f7876f3e7677ed19a83d3e3dce3b44 /web/react/stores/admin_store.jsx | |
parent | 56f76502e3edcc95f7a0e9c8fe5b3d523b33ee29 (diff) | |
parent | 00112cae5123b02eee79e8b991618ed5069e07b1 (diff) | |
download | chat-54c7dba33dc707fa7013a87040c8a8e5d7b237e9.tar.gz chat-54c7dba33dc707fa7013a87040c8a8e5d7b237e9.tar.bz2 chat-54c7dba33dc707fa7013a87040c8a8e5d7b237e9.zip |
Merge pull request #765 from mattermost/PLT-349
PLT-349 adding team mgt to admin console
Diffstat (limited to 'web/react/stores/admin_store.jsx')
-rw-r--r-- | web/react/stores/admin_store.jsx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/web/react/stores/admin_store.jsx b/web/react/stores/admin_store.jsx index dd5b60a24..7b2aeb631 100644 --- a/web/react/stores/admin_store.jsx +++ b/web/react/stores/admin_store.jsx @@ -4,11 +4,14 @@ var AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); var EventEmitter = require('events').EventEmitter; +var BrowserStore = require('../stores/browser_store.jsx'); + var Constants = require('../utils/constants.jsx'); var ActionTypes = Constants.ActionTypes; var LOG_CHANGE_EVENT = 'log_change'; var CONFIG_CHANGE_EVENT = 'config_change'; +var ALL_TEAMS_EVENT = 'all_team_change'; class AdminStoreClass extends EventEmitter { constructor() { @@ -16,6 +19,7 @@ class AdminStoreClass extends EventEmitter { this.logs = null; this.config = null; + this.teams = null; this.emitLogChange = this.emitLogChange.bind(this); this.addLogChangeListener = this.addLogChangeListener.bind(this); @@ -24,6 +28,10 @@ class AdminStoreClass extends EventEmitter { this.emitConfigChange = this.emitConfigChange.bind(this); this.addConfigChangeListener = this.addConfigChangeListener.bind(this); this.removeConfigChangeListener = this.removeConfigChangeListener.bind(this); + + this.emitAllTeamsChange = this.emitAllTeamsChange.bind(this); + this.addAllTeamsChangeListener = this.addAllTeamsChangeListener.bind(this); + this.removeAllTeamsChangeListener = this.removeAllTeamsChangeListener.bind(this); } emitLogChange() { @@ -50,6 +58,18 @@ class AdminStoreClass extends EventEmitter { this.removeListener(CONFIG_CHANGE_EVENT, callback); } + emitAllTeamsChange() { + this.emit(ALL_TEAMS_EVENT); + } + + addAllTeamsChangeListener(callback) { + this.on(ALL_TEAMS_EVENT, callback); + } + + removeAllTeamsChangeListener(callback) { + this.removeListener(ALL_TEAMS_EVENT, callback); + } + getLogs() { return this.logs; } @@ -65,6 +85,22 @@ class AdminStoreClass extends EventEmitter { saveConfig(config) { this.config = config; } + + getAllTeams() { + return this.teams; + } + + saveAllTeams(teams) { + this.teams = teams; + } + + getSelectedTeams() { + return BrowserStore.getItem('seleted_teams'); + } + + saveSelectedTeams(teams) { + BrowserStore.setItem('seleted_teams', teams); + } } var AdminStore = new AdminStoreClass(); @@ -81,6 +117,10 @@ AdminStoreClass.dispatchToken = AppDispatcher.register((payload) => { AdminStore.saveConfig(action.config); AdminStore.emitConfigChange(); break; + case ActionTypes.RECIEVED_ALL_TEAMS: + AdminStore.saveAllTeams(action.teams); + AdminStore.emitAllTeamsChange(); + break; default: } }); |