aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/AppStore.js5
-rw-r--r--src/stores/FeaturesStore.js2
-rw-r--r--src/stores/ServicesStore.js6
-rw-r--r--src/stores/UserStore.js1
-rw-r--r--src/stores/index.js4
-rw-r--r--src/stores/lib/Reaction.js19
6 files changed, 29 insertions, 8 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index 351ad6422..e68e797ef 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -67,6 +67,8 @@ export default class AppStore extends Store {
67 67
68 @observable isFocused = true; 68 @observable isFocused = true;
69 69
70 @observable nextAppReleaseVersion = null;
71
70 dictionaries = []; 72 dictionaries = [];
71 73
72 constructor(...args) { 74 constructor(...args) {
@@ -123,7 +125,7 @@ export default class AppStore extends Store {
123 ipcRenderer.on('autoUpdate', (event, data) => { 125 ipcRenderer.on('autoUpdate', (event, data) => {
124 if (data.available) { 126 if (data.available) {
125 this.updateStatus = this.updateStatusTypes.AVAILABLE; 127 this.updateStatus = this.updateStatusTypes.AVAILABLE;
126 128 this.nextAppReleaseVersion = data.version;
127 if (isMac) { 129 if (isMac) {
128 app.dock.bounce(); 130 app.dock.bounce();
129 } 131 }
@@ -172,7 +174,6 @@ export default class AppStore extends Store {
172 reaction(() => this.stores.router.location.pathname, (pathname) => { 174 reaction(() => this.stores.router.location.pathname, (pathname) => {
173 gaPage(pathname); 175 gaPage(pathname);
174 }); 176 });
175 console.log('router location', this.stores.router.location);
176 } 177 }
177 178
178 @computed get cacheSize() { 179 @computed get cacheSize() {
diff --git a/src/stores/FeaturesStore.js b/src/stores/FeaturesStore.js
index 6200c9a16..e7832088b 100644
--- a/src/stores/FeaturesStore.js
+++ b/src/stores/FeaturesStore.js
@@ -14,6 +14,7 @@ import serviceProxy from '../features/serviceProxy';
14import basicAuth from '../features/basicAuth'; 14import basicAuth from '../features/basicAuth';
15import workspaces from '../features/workspaces'; 15import workspaces from '../features/workspaces';
16import shareFranz from '../features/shareFranz'; 16import shareFranz from '../features/shareFranz';
17import announcements from '../features/announcements';
17import settingsWS from '../features/settingsWS'; 18import settingsWS from '../features/settingsWS';
18 19
19import { DEFAULT_FEATURES_CONFIG } from '../config'; 20import { DEFAULT_FEATURES_CONFIG } from '../config';
@@ -72,6 +73,7 @@ export default class FeaturesStore extends Store {
72 basicAuth(this.stores, this.actions); 73 basicAuth(this.stores, this.actions);
73 workspaces(this.stores, this.actions); 74 workspaces(this.stores, this.actions);
74 shareFranz(this.stores, this.actions); 75 shareFranz(this.stores, this.actions);
76 announcements(this.stores, this.actions);
75 settingsWS(this.stores, this.actions); 77 settingsWS(this.stores, this.actions);
76 } 78 }
77} 79}
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index 0ec6bf550..d04fdd0c5 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -36,6 +36,7 @@ export default class ServicesStore extends Store {
36 36
37 // Register action handlers 37 // Register action handlers
38 this.actions.service.setActive.listen(this._setActive.bind(this)); 38 this.actions.service.setActive.listen(this._setActive.bind(this));
39 this.actions.service.blurActive.listen(this._blurActive.bind(this));
39 this.actions.service.setActiveNext.listen(this._setActiveNext.bind(this)); 40 this.actions.service.setActiveNext.listen(this._setActiveNext.bind(this));
40 this.actions.service.setActivePrev.listen(this._setActivePrev.bind(this)); 41 this.actions.service.setActivePrev.listen(this._setActivePrev.bind(this));
41 this.actions.service.showAddServiceInterface.listen(this._showAddServiceInterface.bind(this)); 42 this.actions.service.showAddServiceInterface.listen(this._showAddServiceInterface.bind(this));
@@ -301,6 +302,11 @@ export default class ServicesStore extends Store {
301 this._focusActiveService(); 302 this._focusActiveService();
302 } 303 }
303 304
305 @action _blurActive() {
306 if (!this.active) return;
307 this.active.isActive = false;
308 }
309
304 @action _setActiveNext() { 310 @action _setActiveNext() {
305 const nextIndex = this._wrapIndex(this.allDisplayed.findIndex(service => service.isActive), 1, this.allDisplayed.length); 311 const nextIndex = this._wrapIndex(this.allDisplayed.findIndex(service => service.isActive), 1, this.allDisplayed.length);
306 312
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js
index 534690fbb..31555dd5c 100644
--- a/src/stores/UserStore.js
+++ b/src/stores/UserStore.js
@@ -178,6 +178,7 @@ export default class UserStore extends Store {
178 password, 178 password,
179 accountType, 179 accountType,
180 company, 180 company,
181 locale: this.stores.app.locale,
181 }); 182 });
182 183
183 this.hasCompletedSignup = false; 184 this.hasCompletedSignup = false;
diff --git a/src/stores/index.js b/src/stores/index.js
index 96b844c95..1912418a2 100644
--- a/src/stores/index.js
+++ b/src/stores/index.js
@@ -10,6 +10,8 @@ import PaymentStore from './PaymentStore';
10import NewsStore from './NewsStore'; 10import NewsStore from './NewsStore';
11import RequestStore from './RequestStore'; 11import RequestStore from './RequestStore';
12import GlobalErrorStore from './GlobalErrorStore'; 12import GlobalErrorStore from './GlobalErrorStore';
13import { workspaceStore } from '../features/workspaces';
14import { announcementsStore } from '../features/announcements';
13 15
14export default (api, actions, router) => { 16export default (api, actions, router) => {
15 const stores = {}; 17 const stores = {};
@@ -27,6 +29,8 @@ export default (api, actions, router) => {
27 news: new NewsStore(stores, api, actions), 29 news: new NewsStore(stores, api, actions),
28 requests: new RequestStore(stores, api, actions), 30 requests: new RequestStore(stores, api, actions),
29 globalError: new GlobalErrorStore(stores, api, actions), 31 globalError: new GlobalErrorStore(stores, api, actions),
32 workspaces: workspaceStore,
33 announcements: announcementsStore,
30 }); 34 });
31 // Initialize all stores 35 // Initialize all stores
32 Object.keys(stores).forEach((name) => { 36 Object.keys(stores).forEach((name) => {
diff --git a/src/stores/lib/Reaction.js b/src/stores/lib/Reaction.js
index 46aa4dae6..f2642908f 100644
--- a/src/stores/lib/Reaction.js
+++ b/src/stores/lib/Reaction.js
@@ -1,24 +1,31 @@
1// @flow
2import { autorun } from 'mobx'; 1import { autorun } from 'mobx';
3 2
4export default class Reaction { 3export default class Reaction {
5 reaction; 4 reaction;
6 5
7 hasBeenStarted; 6 isRunning = false;
8 7
9 dispose; 8 dispose;
10 9
11 constructor(reaction) { 10 constructor(reaction) {
12 this.reaction = reaction; 11 this.reaction = reaction;
13 this.hasBeenStarted = false;
14 } 12 }
15 13
16 start() { 14 start() {
17 this.dispose = autorun(() => this.reaction()); 15 if (!this.isRunning) {
18 this.hasBeenStarted = true; 16 this.dispose = autorun(() => this.reaction());
17 this.isActive = true;
18 }
19 } 19 }
20 20
21 stop() { 21 stop() {
22 if (this.hasBeenStarted) this.dispose(); 22 if (this.isRunning) {
23 this.dispose();
24 this.isActive = false;
25 }
23 } 26 }
24} 27}
28
29export const createReactions = reactions => (
30 reactions.map(r => new Reaction(r))
31);