diff options
author | Dominik Guzei <dominik.guzei@gmail.com> | 2019-03-01 14:25:44 +0100 |
---|---|---|
committer | Dominik Guzei <dominik.guzei@gmail.com> | 2019-03-01 14:25:44 +0100 |
commit | 739ef2e8a2dec94c3e10c3d26d797fe759fac7aa (patch) | |
tree | 4a2e066bf8627249f803eee16ba8e73268127fbd /src/stores/ServicesStore.js | |
parent | fixes merge conflicts with latest develop (diff) | |
download | ferdium-app-739ef2e8a2dec94c3e10c3d26d797fe759fac7aa.tar.gz ferdium-app-739ef2e8a2dec94c3e10c3d26d797fe759fac7aa.tar.zst ferdium-app-739ef2e8a2dec94c3e10c3d26d797fe759fac7aa.zip |
finish workspaces mvp
Diffstat (limited to 'src/stores/ServicesStore.js')
-rw-r--r-- | src/stores/ServicesStore.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index c63bef196..a86db8103 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -2,7 +2,7 @@ import { | |||
2 | action, | 2 | action, |
3 | reaction, | 3 | reaction, |
4 | computed, | 4 | computed, |
5 | observable, | 5 | observable, runInAction, |
6 | } from 'mobx'; | 6 | } from 'mobx'; |
7 | import { debounce, remove } from 'lodash'; | 7 | import { debounce, remove } from 'lodash'; |
8 | import ms from 'ms'; | 8 | import ms from 'ms'; |
@@ -12,6 +12,8 @@ import Request from './lib/Request'; | |||
12 | import CachedRequest from './lib/CachedRequest'; | 12 | import CachedRequest from './lib/CachedRequest'; |
13 | import { matchRoute } from '../helpers/routing-helpers'; | 13 | import { matchRoute } from '../helpers/routing-helpers'; |
14 | import { gaEvent } from '../lib/analytics'; | 14 | import { gaEvent } from '../lib/analytics'; |
15 | import { workspacesState } from '../features/workspaces/state'; | ||
16 | import { filterServicesByActiveWorkspace, getActiveWorkspaceServices } from '../features/workspaces'; | ||
15 | 17 | ||
16 | const debug = require('debug')('Franz:ServiceStore'); | 18 | const debug = require('debug')('Franz:ServiceStore'); |
17 | 19 | ||
@@ -98,7 +100,6 @@ export default class ServicesStore extends Store { | |||
98 | return observable(services.slice().slice().sort((a, b) => a.order - b.order)); | 100 | return observable(services.slice().slice().sort((a, b) => a.order - b.order)); |
99 | } | 101 | } |
100 | } | 102 | } |
101 | |||
102 | return []; | 103 | return []; |
103 | } | 104 | } |
104 | 105 | ||
@@ -107,13 +108,16 @@ export default class ServicesStore extends Store { | |||
107 | } | 108 | } |
108 | 109 | ||
109 | @computed get allDisplayed() { | 110 | @computed get allDisplayed() { |
110 | return this.stores.settings.all.app.showDisabledServices ? this.all : this.enabled; | 111 | const services = this.stores.settings.all.app.showDisabledServices ? this.all : this.enabled; |
112 | return filterServicesByActiveWorkspace(services); | ||
111 | } | 113 | } |
112 | 114 | ||
113 | // This is just used to avoid unnecessary rerendering of resource-heavy webviews | 115 | // This is just used to avoid unnecessary rerendering of resource-heavy webviews |
114 | @computed get allDisplayedUnordered() { | 116 | @computed get allDisplayedUnordered() { |
117 | const { showDisabledServices } = this.stores.settings.all.app; | ||
115 | const services = this.allServicesRequest.execute().result || []; | 118 | const services = this.allServicesRequest.execute().result || []; |
116 | return this.stores.settings.all.app.showDisabledServices ? services : services.filter(service => service.isEnabled); | 119 | const filteredServices = showDisabledServices ? services : services.filter(service => service.isEnabled); |
120 | return getActiveWorkspaceServices(filteredServices); | ||
117 | } | 121 | } |
118 | 122 | ||
119 | @computed get filtered() { | 123 | @computed get filtered() { |