aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/ServicesStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores/ServicesStore.js')
-rw-r--r--src/stores/ServicesStore.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index c38d0d9ee..f7d92b1ff 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -10,6 +10,8 @@ import CachedRequest from './lib/CachedRequest';
10import { matchRoute } from '../helpers/routing-helpers'; 10import { matchRoute } from '../helpers/routing-helpers';
11import { gaEvent } from '../lib/analytics'; 11import { gaEvent } from '../lib/analytics';
12 12
13const debug = require('debug')('ServiceStore');
14
13export default class ServicesStore extends Store { 15export default class ServicesStore extends Store {
14 @observable allServicesRequest = new CachedRequest(this.api.services, 'all'); 16 @observable allServicesRequest = new CachedRequest(this.api.services, 'all');
15 @observable createServiceRequest = new Request(this.api.services, 'create'); 17 @observable createServiceRequest = new Request(this.api.services, 'create');
@@ -87,6 +89,12 @@ export default class ServicesStore extends Store {
87 return this.stores.settings.all.showDisabledServices ? this.all : this.enabled; 89 return this.stores.settings.all.showDisabledServices ? this.all : this.enabled;
88 } 90 }
89 91
92 // This is just used to avoid unnecessary rerendering of resource-heavy webviews
93 @computed get allDisplayedUnordered() {
94 const services = this.allServicesRequest.execute().result || [];
95 return this.stores.settings.all.showDisabledServices ? services : services.filter(service => service.isEnabled);
96 }
97
90 @computed get filtered() { 98 @computed get filtered() {
91 return this.all.filter(service => service.name.toLowerCase().includes(this.filterNeedle.toLowerCase())); 99 return this.all.filter(service => service.name.toLowerCase().includes(this.filterNeedle.toLowerCase()));
92 } 100 }
@@ -103,7 +111,7 @@ export default class ServicesStore extends Store {
103 return activeService; 111 return activeService;
104 } 112 }
105 113
106 console.warn('Service not available'); 114 debug('Service not available');
107 } 115 }
108 116
109 return null; 117 return null;
@@ -117,10 +125,10 @@ export default class ServicesStore extends Store {
117 const recipesStore = this.stores.recipes; 125 const recipesStore = this.stores.recipes;
118 126
119 if (recipesStore.isInstalled(recipeId)) { 127 if (recipesStore.isInstalled(recipeId)) {
120 console.debug('Recipe is installed'); 128 debug(`Recipe ${recipeId} is installed`);
121 this._redirectToAddServiceRoute(recipeId); 129 this._redirectToAddServiceRoute(recipeId);
122 } else { 130 } else {
123 console.warn('Recipe is not installed'); 131 debug(`Recipe ${recipeId} is not installed`);
124 // We access the RecipeStore action directly 132 // We access the RecipeStore action directly
125 // returns Promise instead of action 133 // returns Promise instead of action
126 await this.stores.recipes._install({ recipeId }); 134 await this.stores.recipes._install({ recipeId });
@@ -487,7 +495,7 @@ export default class ServicesStore extends Store {
487 if (service) { 495 if (service) {
488 service.webview.openDevTools(); 496 service.webview.openDevTools();
489 } else { 497 } else {
490 console.warn('No service is active'); 498 debug('No service is active');
491 } 499 }
492 } 500 }
493 501