diff options
author | Stefan Malzner <stefan@adlk.io> | 2018-03-18 21:06:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-18 21:06:30 +0100 |
commit | adc67db3a46b5d5de411c4b73f92464fbe64a03c (patch) | |
tree | 85e10e35f8867e3e747c92e0eddc0a75bdb94516 | |
parent | Merge pull request #798 from meetfranz/fix/order-performance (diff) | |
parent | Add debug flags to render process (diff) | |
download | ferdium-app-adc67db3a46b5d5de411c4b73f92464fbe64a03c.tar.gz ferdium-app-adc67db3a46b5d5de411c4b73f92464fbe64a03c.tar.zst ferdium-app-adc67db3a46b5d5de411c4b73f92464fbe64a03c.zip |
Merge pull request #805 from meetfranz/chore/add-debugger
Replace console logs with debugger
-rw-r--r-- | .vscode/launch.json | 12 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/api/server/LocalApi.js | 8 | ||||
-rw-r--r-- | src/api/server/ServerApi.js | 60 | ||||
-rw-r--r-- | src/index.html | 11 | ||||
-rw-r--r-- | src/lib/analytics.js | 6 | ||||
-rw-r--r-- | src/stores/RecipesStore.js | 8 | ||||
-rw-r--r-- | src/stores/RequestStore.js | 4 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 10 | ||||
-rw-r--r-- | yarn.lock | 12 |
10 files changed, 83 insertions, 49 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json index fc5cf094e..17d506895 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json | |||
@@ -10,6 +10,7 @@ | |||
10 | "protocol": "inspector", | 10 | "protocol": "inspector", |
11 | "env": { | 11 | "env": { |
12 | "NODE_ENV": "development", | 12 | "NODE_ENV": "development", |
13 | "DEBUG": "*,-engine.io*,-socket.io*" | ||
13 | } | 14 | } |
14 | }, | 15 | }, |
15 | { | 16 | { |
@@ -21,6 +22,7 @@ | |||
21 | "protocol": "inspector", | 22 | "protocol": "inspector", |
22 | "env": { | 23 | "env": { |
23 | "LIVE_API": "1", | 24 | "LIVE_API": "1", |
25 | "DEBUG": "*,-engine.io*,-socket.io*" | ||
24 | } | 26 | } |
25 | }, | 27 | }, |
26 | { | 28 | { |
@@ -32,6 +34,7 @@ | |||
32 | "protocol": "inspector", | 34 | "protocol": "inspector", |
33 | "env": { | 35 | "env": { |
34 | "LOCAL_API": "1", | 36 | "LOCAL_API": "1", |
37 | "DEBUG": "*,-engine.io*,-socket.io*" | ||
35 | } | 38 | } |
36 | }, | 39 | }, |
37 | { | 40 | { |
@@ -43,7 +46,8 @@ | |||
43 | "protocol": "inspector", | 46 | "protocol": "inspector", |
44 | "env": { | 47 | "env": { |
45 | "NODE_ENV": "development", | 48 | "NODE_ENV": "development", |
46 | "OS_PLATFORM": "win32" | 49 | "OS_PLATFORM": "win32", |
50 | "DEBUG": "*,-engine.io*,-socket.io*" | ||
47 | } | 51 | } |
48 | }, | 52 | }, |
49 | { | 53 | { |
@@ -55,7 +59,8 @@ | |||
55 | "protocol": "inspector", | 59 | "protocol": "inspector", |
56 | "env": { | 60 | "env": { |
57 | "LIVE_API": "1", | 61 | "LIVE_API": "1", |
58 | "OS_PLATFORM": "win32" | 62 | "OS_PLATFORM": "win32", |
63 | "DEBUG": "*,-engine.io*,-socket.io*" | ||
59 | } | 64 | } |
60 | }, | 65 | }, |
61 | { | 66 | { |
@@ -67,7 +72,8 @@ | |||
67 | "protocol": "inspector", | 72 | "protocol": "inspector", |
68 | "env": { | 73 | "env": { |
69 | "LOCAL_API": "1", | 74 | "LOCAL_API": "1", |
70 | "OS_PLATFORM": "win32" | 75 | "OS_PLATFORM": "win32", |
76 | "DEBUG": "*,-engine.io*,-socket.io*" | ||
71 | } | 77 | } |
72 | } | 78 | } |
73 | ] | 79 | ] |
diff --git a/package.json b/package.json index f35da9880..31013baad 100644 --- a/package.json +++ b/package.json | |||
@@ -33,6 +33,7 @@ | |||
33 | "babel-polyfill": "^6.23.0", | 33 | "babel-polyfill": "^6.23.0", |
34 | "babel-runtime": "^6.23.0", | 34 | "babel-runtime": "^6.23.0", |
35 | "classnames": "^2.2.5", | 35 | "classnames": "^2.2.5", |
36 | "debug-electron": "^0.0.4", | ||
36 | "du": "^0.1.0", | 37 | "du": "^0.1.0", |
37 | "electron-fetch": "^1.1.0", | 38 | "electron-fetch": "^1.1.0", |
38 | "electron-react-titlebar": "^0.7.1", | 39 | "electron-react-titlebar": "^0.7.1", |
diff --git a/src/api/server/LocalApi.js b/src/api/server/LocalApi.js index aa3a7d655..4d2497c61 100644 --- a/src/api/server/LocalApi.js +++ b/src/api/server/LocalApi.js | |||
@@ -3,6 +3,8 @@ import du from 'du'; | |||
3 | 3 | ||
4 | import { getServicePartitionsDirectory } from '../../helpers/service-helpers.js'; | 4 | import { getServicePartitionsDirectory } from '../../helpers/service-helpers.js'; |
5 | 5 | ||
6 | const debug = require('debug')('LocalApi'); | ||
7 | |||
6 | const { session } = remote; | 8 | const { session } = remote; |
7 | 9 | ||
8 | export default class LocalApi { | 10 | export default class LocalApi { |
@@ -13,7 +15,7 @@ export default class LocalApi { | |||
13 | du(partitionsDir, (err, size) => { | 15 | du(partitionsDir, (err, size) => { |
14 | if (err) reject(err); | 16 | if (err) reject(err); |
15 | 17 | ||
16 | console.debug('LocalApi::getAppCacheSize resolves', size); | 18 | debug('LocalApi::getAppCacheSize resolves', size); |
17 | resolve(size); | 19 | resolve(size); |
18 | }); | 20 | }); |
19 | }); | 21 | }); |
@@ -22,14 +24,14 @@ export default class LocalApi { | |||
22 | async clearCache(serviceId) { | 24 | async clearCache(serviceId) { |
23 | const s = session.fromPartition(`persist:service-${serviceId}`); | 25 | const s = session.fromPartition(`persist:service-${serviceId}`); |
24 | 26 | ||
25 | console.debug('LocalApi::clearCache resolves', serviceId); | 27 | debug('LocalApi::clearCache resolves', serviceId); |
26 | return new Promise(resolve => s.clearCache(resolve)); | 28 | return new Promise(resolve => s.clearCache(resolve)); |
27 | } | 29 | } |
28 | 30 | ||
29 | async clearAppCache() { | 31 | async clearAppCache() { |
30 | const s = session.defaultSession; | 32 | const s = session.defaultSession; |
31 | 33 | ||
32 | console.debug('LocalApi::clearCache clearAppCache'); | 34 | debug('LocalApi::clearCache clearAppCache'); |
33 | return new Promise(resolve => s.clearCache(resolve)); | 35 | return new Promise(resolve => s.clearCache(resolve)); |
34 | } | 36 | } |
35 | } | 37 | } |
diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js index 8f3297d13..353faa7f4 100644 --- a/src/api/server/ServerApi.js +++ b/src/api/server/ServerApi.js | |||
@@ -27,6 +27,8 @@ import { | |||
27 | removeServicePartitionDirectory, | 27 | removeServicePartitionDirectory, |
28 | } from '../../helpers/service-helpers.js'; | 28 | } from '../../helpers/service-helpers.js'; |
29 | 29 | ||
30 | const debug = require('debug')('ServerApi'); | ||
31 | |||
30 | module.paths.unshift( | 32 | module.paths.unshift( |
31 | getDevRecipeDirectory(), | 33 | getDevRecipeDirectory(), |
32 | getRecipeDirectory(), | 34 | getRecipeDirectory(), |
@@ -55,7 +57,7 @@ export default class ServerApi { | |||
55 | } | 57 | } |
56 | const u = await request.json(); | 58 | const u = await request.json(); |
57 | 59 | ||
58 | console.debug('ServerApi::login resolves', u); | 60 | debug('ServerApi::login resolves', u); |
59 | return u.token; | 61 | return u.token; |
60 | } | 62 | } |
61 | 63 | ||
@@ -69,7 +71,7 @@ export default class ServerApi { | |||
69 | } | 71 | } |
70 | const u = await request.json(); | 72 | const u = await request.json(); |
71 | 73 | ||
72 | console.debug('ServerApi::signup resolves', u); | 74 | debug('ServerApi::signup resolves', u); |
73 | return u.token; | 75 | return u.token; |
74 | } | 76 | } |
75 | 77 | ||
@@ -82,7 +84,7 @@ export default class ServerApi { | |||
82 | throw request; | 84 | throw request; |
83 | } | 85 | } |
84 | 86 | ||
85 | console.debug('ServerApi::inviteUser'); | 87 | debug('ServerApi::inviteUser'); |
86 | return true; | 88 | return true; |
87 | } | 89 | } |
88 | 90 | ||
@@ -98,7 +100,7 @@ export default class ServerApi { | |||
98 | } | 100 | } |
99 | const r = await request.json(); | 101 | const r = await request.json(); |
100 | 102 | ||
101 | console.debug('ServerApi::retrievePassword'); | 103 | debug('ServerApi::retrievePassword'); |
102 | return r; | 104 | return r; |
103 | } | 105 | } |
104 | 106 | ||
@@ -112,7 +114,7 @@ export default class ServerApi { | |||
112 | const data = await request.json(); | 114 | const data = await request.json(); |
113 | 115 | ||
114 | const user = new UserModel(data); | 116 | const user = new UserModel(data); |
115 | console.debug('ServerApi::userInfo resolves', user); | 117 | debug('ServerApi::userInfo resolves', user); |
116 | 118 | ||
117 | return user; | 119 | return user; |
118 | } | 120 | } |
@@ -128,7 +130,7 @@ export default class ServerApi { | |||
128 | const updatedData = await request.json(); | 130 | const updatedData = await request.json(); |
129 | 131 | ||
130 | const user = Object.assign(updatedData, { data: new UserModel(updatedData.data) }); | 132 | const user = Object.assign(updatedData, { data: new UserModel(updatedData.data) }); |
131 | console.debug('ServerApi::updateUserInfo resolves', user); | 133 | debug('ServerApi::updateUserInfo resolves', user); |
132 | return user; | 134 | return user; |
133 | } | 135 | } |
134 | 136 | ||
@@ -141,7 +143,7 @@ export default class ServerApi { | |||
141 | } | 143 | } |
142 | const data = await request.json(); | 144 | const data = await request.json(); |
143 | 145 | ||
144 | console.debug('ServerApi::deleteAccount resolves', data); | 146 | debug('ServerApi::deleteAccount resolves', data); |
145 | return data; | 147 | return data; |
146 | } | 148 | } |
147 | 149 | ||
@@ -157,7 +159,7 @@ export default class ServerApi { | |||
157 | 159 | ||
158 | let services = await this._mapServiceModels(data); | 160 | let services = await this._mapServiceModels(data); |
159 | services = services.filter(service => service !== null); | 161 | services = services.filter(service => service !== null); |
160 | console.debug('ServerApi::getServices resolves', services); | 162 | debug('ServerApi::getServices resolves', services); |
161 | return services; | 163 | return services; |
162 | } | 164 | } |
163 | 165 | ||
@@ -181,7 +183,7 @@ export default class ServerApi { | |||
181 | 183 | ||
182 | const service = Object.assign(serviceData, { data: await this._prepareServiceModel(serviceData.data) }); | 184 | const service = Object.assign(serviceData, { data: await this._prepareServiceModel(serviceData.data) }); |
183 | 185 | ||
184 | console.debug('ServerApi::createService resolves', service); | 186 | debug('ServerApi::createService resolves', service); |
185 | return service; | 187 | return service; |
186 | } | 188 | } |
187 | 189 | ||
@@ -205,7 +207,7 @@ export default class ServerApi { | |||
205 | 207 | ||
206 | const service = Object.assign(serviceData, { data: await this._prepareServiceModel(serviceData.data) }); | 208 | const service = Object.assign(serviceData, { data: await this._prepareServiceModel(serviceData.data) }); |
207 | 209 | ||
208 | console.debug('ServerApi::updateService resolves', service); | 210 | debug('ServerApi::updateService resolves', service); |
209 | return service; | 211 | return service; |
210 | } | 212 | } |
211 | 213 | ||
@@ -240,7 +242,7 @@ export default class ServerApi { | |||
240 | throw request; | 242 | throw request; |
241 | } | 243 | } |
242 | const serviceData = await request.json(); | 244 | const serviceData = await request.json(); |
243 | console.debug('ServerApi::reorderService resolves', serviceData); | 245 | debug('ServerApi::reorderService resolves', serviceData); |
244 | return serviceData; | 246 | return serviceData; |
245 | } | 247 | } |
246 | 248 | ||
@@ -255,7 +257,7 @@ export default class ServerApi { | |||
255 | 257 | ||
256 | removeServicePartitionDirectory(id, true); | 258 | removeServicePartitionDirectory(id, true); |
257 | 259 | ||
258 | console.debug('ServerApi::deleteService resolves', data); | 260 | debug('ServerApi::deleteService resolves', data); |
259 | return data; | 261 | return data; |
260 | } | 262 | } |
261 | 263 | ||
@@ -277,7 +279,7 @@ export default class ServerApi { | |||
277 | 279 | ||
278 | this.recipes = this.recipes.concat(this._getDevRecipes()); | 280 | this.recipes = this.recipes.concat(this._getDevRecipes()); |
279 | 281 | ||
280 | console.debug('StubServerApi::getInstalledRecipes resolves', this.recipes); | 282 | debug('StubServerApi::getInstalledRecipes resolves', this.recipes); |
281 | return this.recipes; | 283 | return this.recipes; |
282 | } | 284 | } |
283 | 285 | ||
@@ -290,7 +292,7 @@ export default class ServerApi { | |||
290 | throw request; | 292 | throw request; |
291 | } | 293 | } |
292 | const recipes = await request.json(); | 294 | const recipes = await request.json(); |
293 | console.debug('ServerApi::getRecipeUpdates resolves', recipes); | 295 | debug('ServerApi::getRecipeUpdates resolves', recipes); |
294 | return recipes; | 296 | return recipes; |
295 | } | 297 | } |
296 | 298 | ||
@@ -305,7 +307,7 @@ export default class ServerApi { | |||
305 | const data = await request.json(); | 307 | const data = await request.json(); |
306 | 308 | ||
307 | const recipePreviews = this._mapRecipePreviewModel(data); | 309 | const recipePreviews = this._mapRecipePreviewModel(data); |
308 | console.debug('ServerApi::getRecipes resolves', recipePreviews); | 310 | debug('ServerApi::getRecipes resolves', recipePreviews); |
309 | 311 | ||
310 | return recipePreviews; | 312 | return recipePreviews; |
311 | } | 313 | } |
@@ -322,7 +324,7 @@ export default class ServerApi { | |||
322 | // data = this._addLocalRecipesToPreviews(data); | 324 | // data = this._addLocalRecipesToPreviews(data); |
323 | 325 | ||
324 | const recipePreviews = this._mapRecipePreviewModel(data); | 326 | const recipePreviews = this._mapRecipePreviewModel(data); |
325 | console.debug('ServerApi::getFeaturedRecipes resolves', recipePreviews); | 327 | debug('ServerApi::getFeaturedRecipes resolves', recipePreviews); |
326 | return recipePreviews; | 328 | return recipePreviews; |
327 | } | 329 | } |
328 | 330 | ||
@@ -336,7 +338,7 @@ export default class ServerApi { | |||
336 | const data = await request.json(); | 338 | const data = await request.json(); |
337 | 339 | ||
338 | const recipePreviews = this._mapRecipePreviewModel(data); | 340 | const recipePreviews = this._mapRecipePreviewModel(data); |
339 | console.debug('ServerApi::searchRecipePreviews resolves', recipePreviews); | 341 | debug('ServerApi::searchRecipePreviews resolves', recipePreviews); |
340 | return recipePreviews; | 342 | return recipePreviews; |
341 | } | 343 | } |
342 | 344 | ||
@@ -350,7 +352,7 @@ export default class ServerApi { | |||
350 | 352 | ||
351 | fs.ensureDirSync(recipeTempDirectory); | 353 | fs.ensureDirSync(recipeTempDirectory); |
352 | const res = await fetch(packageUrl); | 354 | const res = await fetch(packageUrl); |
353 | console.debug('Recipe downloaded', recipeId); | 355 | debug('Recipe downloaded', recipeId); |
354 | const buffer = await res.buffer(); | 356 | const buffer = await res.buffer(); |
355 | fs.writeFileSync(archivePath, buffer); | 357 | fs.writeFileSync(archivePath, buffer); |
356 | 358 | ||
@@ -392,7 +394,7 @@ export default class ServerApi { | |||
392 | const data = await request.json(); | 394 | const data = await request.json(); |
393 | 395 | ||
394 | const plan = new PlanModel(data); | 396 | const plan = new PlanModel(data); |
395 | console.debug('ServerApi::getPlans resolves', plan); | 397 | debug('ServerApi::getPlans resolves', plan); |
396 | return plan; | 398 | return plan; |
397 | } | 399 | } |
398 | 400 | ||
@@ -408,7 +410,7 @@ export default class ServerApi { | |||
408 | } | 410 | } |
409 | const data = await request.json(); | 411 | const data = await request.json(); |
410 | 412 | ||
411 | console.debug('ServerApi::getHostedPage resolves', data); | 413 | debug('ServerApi::getHostedPage resolves', data); |
412 | return data; | 414 | return data; |
413 | } | 415 | } |
414 | 416 | ||
@@ -421,7 +423,7 @@ export default class ServerApi { | |||
421 | } | 423 | } |
422 | const data = await request.json(); | 424 | const data = await request.json(); |
423 | 425 | ||
424 | console.debug('ServerApi::getPaymentDashboardUrl resolves', data); | 426 | debug('ServerApi::getPaymentDashboardUrl resolves', data); |
425 | return data; | 427 | return data; |
426 | } | 428 | } |
427 | 429 | ||
@@ -434,7 +436,7 @@ export default class ServerApi { | |||
434 | } | 436 | } |
435 | const data = await request.json(); | 437 | const data = await request.json(); |
436 | const orders = this._mapOrderModels(data); | 438 | const orders = this._mapOrderModels(data); |
437 | console.debug('ServerApi::getSubscriptionOrders resolves', orders); | 439 | debug('ServerApi::getSubscriptionOrders resolves', orders); |
438 | return orders; | 440 | return orders; |
439 | } | 441 | } |
440 | 442 | ||
@@ -451,7 +453,7 @@ export default class ServerApi { | |||
451 | } | 453 | } |
452 | const data = await request.json(); | 454 | const data = await request.json(); |
453 | const news = this._mapNewsModels(data); | 455 | const news = this._mapNewsModels(data); |
454 | console.debug('ServerApi::getLatestNews resolves', news); | 456 | debug('ServerApi::getLatestNews resolves', news); |
455 | return news; | 457 | return news; |
456 | } | 458 | } |
457 | 459 | ||
@@ -465,7 +467,7 @@ export default class ServerApi { | |||
465 | throw request; | 467 | throw request; |
466 | } | 468 | } |
467 | 469 | ||
468 | console.debug('ServerApi::hideNews resolves', id); | 470 | debug('ServerApi::hideNews resolves', id); |
469 | } | 471 | } |
470 | 472 | ||
471 | // Health Check | 473 | // Health Check |
@@ -476,7 +478,7 @@ export default class ServerApi { | |||
476 | if (!request.ok) { | 478 | if (!request.ok) { |
477 | throw request; | 479 | throw request; |
478 | } | 480 | } |
479 | console.debug('ServerApi::healthCheck resolves'); | 481 | debug('ServerApi::healthCheck resolves'); |
480 | } | 482 | } |
481 | 483 | ||
482 | async getLegacyServices() { | 484 | async getLegacyServices() { |
@@ -502,7 +504,7 @@ export default class ServerApi { | |||
502 | return service; | 504 | return service; |
503 | })); | 505 | })); |
504 | 506 | ||
505 | console.debug('ServerApi::getLegacyServices resolves', services); | 507 | debug('ServerApi::getLegacyServices resolves', services); |
506 | return services; | 508 | return services; |
507 | } | 509 | } |
508 | } catch (err) { | 510 | } catch (err) { |
@@ -535,7 +537,7 @@ export default class ServerApi { | |||
535 | 537 | ||
536 | return new ServiceModel(service, recipe); | 538 | return new ServiceModel(service, recipe); |
537 | } catch (e) { | 539 | } catch (e) { |
538 | console.debug(e); | 540 | debug(e); |
539 | return null; | 541 | return null; |
540 | } | 542 | } |
541 | } | 543 | } |
@@ -553,7 +555,7 @@ export default class ServerApi { | |||
553 | 555 | ||
554 | await this.getRecipePackage(recipeId); | 556 | await this.getRecipePackage(recipeId); |
555 | 557 | ||
556 | console.debug('Rerun ServerAPI::getInstalledRecipes'); | 558 | debug('Rerun ServerAPI::getInstalledRecipes'); |
557 | await this.getInstalledRecipes(); | 559 | await this.getInstalledRecipes(); |
558 | 560 | ||
559 | recipe = this.recipes.find(r => r.id === recipeId); | 561 | recipe = this.recipes.find(r => r.id === recipeId); |
@@ -653,7 +655,7 @@ export default class ServerApi { | |||
653 | 655 | ||
654 | return recipes; | 656 | return recipes; |
655 | } catch (err) { | 657 | } catch (err) { |
656 | console.debug('Could not load dev recipes'); | 658 | debug('Could not load dev recipes'); |
657 | return false; | 659 | return false; |
658 | } | 660 | } |
659 | } | 661 | } |
diff --git a/src/index.html b/src/index.html index 6c259e5be..5ce7f6a96 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -15,6 +15,11 @@ | |||
15 | 15 | ||
16 | const { isDevMode } = require('./environment'); | 16 | const { isDevMode } = require('./environment'); |
17 | if (isDevMode) { | 17 | if (isDevMode) { |
18 | const debugging = require('debug'); | ||
19 | debugging.enable(process.env.DEBUG); | ||
20 | |||
21 | const debug = debugging('Index'); | ||
22 | |||
18 | document.querySelector('body').classList.add('isDevMode'); | 23 | document.querySelector('body').classList.add('isDevMode'); |
19 | 24 | ||
20 | (function() { | 25 | (function() { |
@@ -25,7 +30,7 @@ | |||
25 | document.body.appendChild(s); | 30 | document.body.appendChild(s); |
26 | 31 | ||
27 | s.onload = () => { | 32 | s.onload = () => { |
28 | console.log('livereload loaded'); | 33 | debug('livereload loaded'); |
29 | const originalReloadBehaviour = window._onLiveReloadFileChanged; | 34 | const originalReloadBehaviour = window._onLiveReloadFileChanged; |
30 | 35 | ||
31 | window._onLiveReloadFileChanged = (file) => { | 36 | window._onLiveReloadFileChanged = (file) => { |
@@ -33,10 +38,10 @@ | |||
33 | originalReloadBehaviour(file); | 38 | originalReloadBehaviour(file); |
34 | } else { | 39 | } else { |
35 | if (file.path.includes('/build/webview/')) { | 40 | if (file.path.includes('/build/webview/')) { |
36 | console.log('Livereload: Reloading all webvies'); | 41 | debug('Livereload: Reloading all webvies'); |
37 | const webviews = document.querySelectorAll('webview').forEach(webview => webview.reload()); | 42 | const webviews = document.querySelectorAll('webview').forEach(webview => webview.reload()); |
38 | } else { | 43 | } else { |
39 | console.log('Livereload: skip reload as only main process files have changed'); | 44 | debug('Livereload: skip reload as only main process files have changed'); |
40 | } | 45 | } |
41 | } | 46 | } |
42 | } | 47 | } |
diff --git a/src/lib/analytics.js b/src/lib/analytics.js index b13bf8faa..585cbcdba 100644 --- a/src/lib/analytics.js +++ b/src/lib/analytics.js | |||
@@ -2,6 +2,8 @@ import { remote } from 'electron'; | |||
2 | import { GA_ID } from '../config'; | 2 | import { GA_ID } from '../config'; |
3 | // import { isDevMode } from '../environment'; | 3 | // import { isDevMode } from '../environment'; |
4 | 4 | ||
5 | const debug = require('debug')('Analytics'); | ||
6 | |||
5 | const { app } = remote; | 7 | const { app } = remote; |
6 | 8 | ||
7 | /* eslint-disable */ | 9 | /* eslint-disable */ |
@@ -28,13 +30,13 @@ ga('send', 'App'); | |||
28 | export function gaPage(page) { | 30 | export function gaPage(page) { |
29 | ga('send', 'pageview', page); | 31 | ga('send', 'pageview', page); |
30 | 32 | ||
31 | console.debug('GA track page', page); | 33 | debug('GA track page', page); |
32 | } | 34 | } |
33 | 35 | ||
34 | export function gaEvent(category, action, label) { | 36 | export function gaEvent(category, action, label) { |
35 | ga('send', 'event', category, action, label); | 37 | ga('send', 'event', category, action, label); |
36 | 38 | ||
37 | console.debug('GA track page', category, action); | 39 | debug('GA track page', category, action); |
38 | } | 40 | } |
39 | 41 | ||
40 | setTimeout(() => { | 42 | setTimeout(() => { |
diff --git a/src/stores/RecipesStore.js b/src/stores/RecipesStore.js index 67fee1d50..a24308f6a 100644 --- a/src/stores/RecipesStore.js +++ b/src/stores/RecipesStore.js | |||
@@ -5,6 +5,8 @@ import CachedRequest from './lib/CachedRequest'; | |||
5 | import Request from './lib/Request'; | 5 | import Request from './lib/Request'; |
6 | import { matchRoute } from '../helpers/routing-helpers'; | 6 | import { matchRoute } from '../helpers/routing-helpers'; |
7 | 7 | ||
8 | const debug = require('debug')('RecipeStore'); | ||
9 | |||
8 | export default class RecipesStore extends Store { | 10 | export default class RecipesStore extends Store { |
9 | @observable allRecipesRequest = new CachedRequest(this.api.recipes, 'all'); | 11 | @observable allRecipesRequest = new CachedRequest(this.api.recipes, 'all'); |
10 | @observable installRecipeRequest = new Request(this.api.recipes, 'install'); | 12 | @observable installRecipeRequest = new Request(this.api.recipes, 'install'); |
@@ -34,7 +36,7 @@ export default class RecipesStore extends Store { | |||
34 | return activeRecipe; | 36 | return activeRecipe; |
35 | } | 37 | } |
36 | 38 | ||
37 | console.warn('Recipe not installed'); | 39 | debug(`Recipe ${match.id} not installed`); |
38 | } | 40 | } |
39 | 41 | ||
40 | return null; | 42 | return null; |
@@ -54,10 +56,8 @@ export default class RecipesStore extends Store { | |||
54 | 56 | ||
55 | // Actions | 57 | // Actions |
56 | @action async _install({ recipeId }) { | 58 | @action async _install({ recipeId }) { |
57 | // console.log(this.installRecipeRequest._promise); | ||
58 | const recipe = await this.installRecipeRequest.execute(recipeId)._promise; | 59 | const recipe = await this.installRecipeRequest.execute(recipeId)._promise; |
59 | await this.allRecipesRequest.invalidate({ immediately: true })._promise; | 60 | await this.allRecipesRequest.invalidate({ immediately: true })._promise; |
60 | // console.log(this.installRecipeRequest._promise); | ||
61 | 61 | ||
62 | return recipe; | 62 | return recipe; |
63 | } | 63 | } |
@@ -67,7 +67,7 @@ export default class RecipesStore extends Store { | |||
67 | const recipes = {}; | 67 | const recipes = {}; |
68 | 68 | ||
69 | // Hackfix, reference this.all to fetch services | 69 | // Hackfix, reference this.all to fetch services |
70 | console.debug(`Check Recipe updates for ${this.all.map(recipe => recipe.id)}`); | 70 | debug(`Check Recipe updates for ${this.all.map(recipe => recipe.id)}`); |
71 | 71 | ||
72 | recipeIds.forEach((r) => { | 72 | recipeIds.forEach((r) => { |
73 | const recipe = this.one(r); | 73 | const recipe = this.one(r); |
diff --git a/src/stores/RequestStore.js b/src/stores/RequestStore.js index 4140ca362..595852583 100644 --- a/src/stores/RequestStore.js +++ b/src/stores/RequestStore.js | |||
@@ -2,6 +2,8 @@ import { action, computed, observable } from 'mobx'; | |||
2 | 2 | ||
3 | import Store from './lib/Store'; | 3 | import Store from './lib/Store'; |
4 | 4 | ||
5 | const debug = require('debug')('RequestsStore'); | ||
6 | |||
5 | export default class RequestStore extends Store { | 7 | export default class RequestStore extends Store { |
6 | @observable userInfoRequest; | 8 | @observable userInfoRequest; |
7 | @observable servicesRequest; | 9 | @observable servicesRequest; |
@@ -52,7 +54,7 @@ export default class RequestStore extends Store { | |||
52 | } | 54 | } |
53 | 55 | ||
54 | this._autoRetry(); | 56 | this._autoRetry(); |
55 | console.debug(`Retry required requests delayed in ${(delay) / 1000}s`); | 57 | debug(`Retry required requests delayed in ${(delay) / 1000}s`); |
56 | }, delay); | 58 | }, delay); |
57 | } | 59 | } |
58 | } | 60 | } |
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index c2dbff55d..f7d92b1ff 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -10,6 +10,8 @@ import CachedRequest from './lib/CachedRequest'; | |||
10 | import { matchRoute } from '../helpers/routing-helpers'; | 10 | import { matchRoute } from '../helpers/routing-helpers'; |
11 | import { gaEvent } from '../lib/analytics'; | 11 | import { gaEvent } from '../lib/analytics'; |
12 | 12 | ||
13 | const debug = require('debug')('ServiceStore'); | ||
14 | |||
13 | export default class ServicesStore extends Store { | 15 | export 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'); |
@@ -109,7 +111,7 @@ export default class ServicesStore extends Store { | |||
109 | return activeService; | 111 | return activeService; |
110 | } | 112 | } |
111 | 113 | ||
112 | console.warn('Service not available'); | 114 | debug('Service not available'); |
113 | } | 115 | } |
114 | 116 | ||
115 | return null; | 117 | return null; |
@@ -123,10 +125,10 @@ export default class ServicesStore extends Store { | |||
123 | const recipesStore = this.stores.recipes; | 125 | const recipesStore = this.stores.recipes; |
124 | 126 | ||
125 | if (recipesStore.isInstalled(recipeId)) { | 127 | if (recipesStore.isInstalled(recipeId)) { |
126 | console.debug('Recipe is installed'); | 128 | debug(`Recipe ${recipeId} is installed`); |
127 | this._redirectToAddServiceRoute(recipeId); | 129 | this._redirectToAddServiceRoute(recipeId); |
128 | } else { | 130 | } else { |
129 | console.warn('Recipe is not installed'); | 131 | debug(`Recipe ${recipeId} is not installed`); |
130 | // We access the RecipeStore action directly | 132 | // We access the RecipeStore action directly |
131 | // returns Promise instead of action | 133 | // returns Promise instead of action |
132 | await this.stores.recipes._install({ recipeId }); | 134 | await this.stores.recipes._install({ recipeId }); |
@@ -493,7 +495,7 @@ export default class ServicesStore extends Store { | |||
493 | if (service) { | 495 | if (service) { |
494 | service.webview.openDevTools(); | 496 | service.webview.openDevTools(); |
495 | } else { | 497 | } else { |
496 | console.warn('No service is active'); | 498 | debug('No service is active'); |
497 | } | 499 | } |
498 | } | 500 | } |
499 | 501 | ||
@@ -1643,6 +1643,12 @@ dateformat@^2.0.0: | |||
1643 | version "2.0.0" | 1643 | version "2.0.0" |
1644 | resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-2.0.0.tgz#2743e3abb5c3fc2462e527dca445e04e9f4dee17" | 1644 | resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-2.0.0.tgz#2743e3abb5c3fc2462e527dca445e04e9f4dee17" |
1645 | 1645 | ||
1646 | debug-electron@^0.0.4: | ||
1647 | version "0.0.4" | ||
1648 | resolved "https://registry.yarnpkg.com/debug-electron/-/debug-electron-0.0.4.tgz#9b035349ac8107b4e43da200d2339c4fd5b169e7" | ||
1649 | dependencies: | ||
1650 | debug "^2.4.1" | ||
1651 | |||
1646 | debug@1.0.4: | 1652 | debug@1.0.4: |
1647 | version "1.0.4" | 1653 | version "1.0.4" |
1648 | resolved "https://registry.yarnpkg.com/debug/-/debug-1.0.4.tgz#5b9c256bd54b6ec02283176fa8a0ede6d154cbf8" | 1654 | resolved "https://registry.yarnpkg.com/debug/-/debug-1.0.4.tgz#5b9c256bd54b6ec02283176fa8a0ede6d154cbf8" |
@@ -1667,6 +1673,12 @@ debug@^2.1.3, debug@^2.2.0, debug@^2.5.1, debug@^2.6.1, debug@^2.6.3, debug@^2.6 | |||
1667 | dependencies: | 1673 | dependencies: |
1668 | ms "2.0.0" | 1674 | ms "2.0.0" |
1669 | 1675 | ||
1676 | debug@^2.4.1: | ||
1677 | version "2.6.9" | ||
1678 | resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" | ||
1679 | dependencies: | ||
1680 | ms "2.0.0" | ||
1681 | |||
1670 | debug@^3.0.1: | 1682 | debug@^3.0.1: |
1671 | version "3.0.1" | 1683 | version "3.0.1" |
1672 | resolved "https://registry.yarnpkg.com/debug/-/debug-3.0.1.tgz#0564c612b521dc92d9f2988f0549e34f9c98db64" | 1684 | resolved "https://registry.yarnpkg.com/debug/-/debug-3.0.1.tgz#0564c612b521dc92d9f2988f0549e34f9c98db64" |