diff options
Diffstat (limited to 'src/features/quickSwitch/Component.js')
-rw-r--r-- | src/features/quickSwitch/Component.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/features/quickSwitch/Component.js b/src/features/quickSwitch/Component.js index 7b76553b2..583c7184c 100644 --- a/src/features/quickSwitch/Component.js +++ b/src/features/quickSwitch/Component.js | |||
@@ -119,10 +119,27 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
119 | 119 | ||
120 | // Get currently shown services | 120 | // Get currently shown services |
121 | services() { | 121 | services() { |
122 | let services = this.props.stores.services.allDisplayed; | 122 | let services = []; |
123 | if (this.state.search) { | 123 | if (this.state.search) { |
124 | // Apply simple search algorythm | 124 | // Apply simple search algorythm to list of all services |
125 | services = this.props.stores.services.allDisplayed; | ||
125 | services = services.filter(service => service.name.toLowerCase().includes(this.state.search.toLowerCase())); | 126 | services = services.filter(service => service.name.toLowerCase().includes(this.state.search.toLowerCase())); |
127 | } else { | ||
128 | // Add last used services to services array | ||
129 | for (const service of this.props.stores.services.lastUsedServices) { | ||
130 | if (this.props.stores.services.one(service)) { | ||
131 | services.push( | ||
132 | this.props.stores.services.one(service), | ||
133 | ); | ||
134 | } | ||
135 | } | ||
136 | |||
137 | // Add all other services in the default order | ||
138 | for (const service of this.props.stores.services.allDisplayed) { | ||
139 | if (!services.includes(service)) { | ||
140 | services.push(service); | ||
141 | } | ||
142 | } | ||
126 | } | 143 | } |
127 | 144 | ||
128 | return services; | 145 | return services; |