diff options
Diffstat (limited to 'webapp/stores/analytics_store.jsx')
-rw-r--r-- | webapp/stores/analytics_store.jsx | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/webapp/stores/analytics_store.jsx b/webapp/stores/analytics_store.jsx deleted file mode 100644 index 63c8a5bee..000000000 --- a/webapp/stores/analytics_store.jsx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import EventEmitter from 'events'; - -const CHANGE_EVENT = 'change'; - -import store from 'stores/redux_store.jsx'; - -class AnalyticsStoreClass extends EventEmitter { - constructor() { - super(); - - this.entities = {}; - - store.subscribe(() => { - const newEntities = store.getState().entities.admin; - - if (newEntities.analytics !== this.entities.analytics) { - this.emitChange(); - } - - if (newEntities.teamAnalytics !== this.entities.teamAnalytics) { - this.emitChange(); - } - - this.entities = newEntities; - }); - } - - emitChange() { - this.emit(CHANGE_EVENT); - } - - addChangeListener(callback) { - this.on(CHANGE_EVENT, callback); - } - - removeChangeListener(callback) { - this.removeListener(CHANGE_EVENT, callback); - } - - getAllSystem() { - return JSON.parse(JSON.stringify(store.getState().entities.admin.analytics)); - } - - getAllTeam(id) { - const teamStats = store.getState().entities.admin.teamAnalytics[id]; - if (teamStats) { - return JSON.parse(JSON.stringify(teamStats)); - } - - return {}; - } -} - -var AnalyticsStore = new AnalyticsStoreClass(); -export default AnalyticsStore; |