@@ -77,10 +77,11 @@ const _state = {
7777 } ,
7878
7979 buckets : {
80- afk_buckets : [ ] ,
81- window_buckets : [ ] ,
82- editor_buckets : [ ] ,
83- browser_buckets : [ ] ,
80+ afk : [ ] ,
81+ window : [ ] ,
82+ editor : [ ] ,
83+ browser : [ ] ,
84+ android : [ ] ,
8485 } ,
8586} ;
8687
@@ -178,8 +179,8 @@ const actions = {
178179 const start = moment ( ) ;
179180 const classes = loadClassesForQuery ( ) ;
180181 const q = queries . windowQuery (
181- state . buckets . window_buckets [ 0 ] ,
182- state . buckets . afk_buckets [ 0 ] ,
182+ state . buckets . window [ 0 ] ,
183+ state . buckets . afk [ 0 ] ,
183184 filterAFK ,
184185 classes ,
185186 filterCategories
@@ -192,7 +193,7 @@ const actions = {
192193 async query_android ( { state, commit } , { timeperiod, filterCategories } : QueryOptions ) {
193194 const periods = [ timeperiodToStr ( timeperiod ) ] ;
194195 const classes = loadClassesForQuery ( ) ;
195- const q = queries . appQuery ( state . buckets . window_buckets [ 0 ] , classes , filterCategories ) ;
196+ const q = queries . appQuery ( state . buckets . window [ 0 ] , classes , filterCategories ) ;
196197 const data = await this . _vm . $aw . query ( periods , q ) . catch ( this . errorHandler ) ;
197198 commit ( 'query_window_completed' , data [ 0 ] ) ;
198199 } ,
@@ -211,9 +212,9 @@ const actions = {
211212 async query_browser ( { state, commit } , { timeperiod, filterAFK } : QueryOptions ) {
212213 const periods = [ timeperiodToStr ( timeperiod ) ] ;
213214 const q = queries . browserSummaryQuery (
214- state . buckets . browser_buckets ,
215- state . buckets . window_buckets [ 0 ] ,
216- state . buckets . afk_buckets [ 0 ] ,
215+ state . buckets . browser ,
216+ state . buckets . window [ 0 ] ,
217+ state . buckets . afk [ 0 ] ,
217218 filterAFK
218219 ) ;
219220 const data = await this . _vm . $aw . query ( periods , q ) ;
@@ -231,7 +232,7 @@ const actions = {
231232
232233 async query_editor ( { state, commit } , { timeperiod } ) {
233234 const periods = [ timeperiodToStr ( timeperiod ) ] ;
234- const q = queries . editorActivityQuery ( state . buckets . editor_buckets ) ;
235+ const q = queries . editorActivityQuery ( state . buckets . editor ) ;
235236 const data = await this . _vm . $aw . query ( periods , q ) ;
236237 commit ( 'query_editor_completed' , data [ 0 ] ) ;
237238 } ,
@@ -251,7 +252,7 @@ const actions = {
251252 } ) ;
252253 const data = await this . _vm . $aw . query (
253254 periods ,
254- queries . dailyActivityQuery ( state . buckets . afk_buckets [ 0 ] )
255+ queries . dailyActivityQuery ( state . buckets . afk [ 0 ] )
255256 ) ;
256257 const active_history = _ . zipObject (
257258 periods ,
@@ -267,7 +268,7 @@ const actions = {
267268 } ) ;
268269 const data = await this . _vm . $aw . query (
269270 periods ,
270- queries . dailyActivityQueryAndroid ( state . buckets . window_buckets [ 0 ] )
271+ queries . dailyActivityQueryAndroid ( state . buckets . window [ 0 ] )
271272 ) ;
272273 let active_history = _ . zipObject ( periods , data ) ;
273274 active_history = _ . mapValues ( active_history , ( duration , key ) => {
@@ -282,15 +283,14 @@ const actions = {
282283 } ,
283284
284285 async set_available ( { commit, state } ) {
285- const window_available =
286- state . buckets . afk_buckets . length > 0 && state . buckets . window_buckets . length > 0 ;
286+ const window_available = state . buckets . afk . length > 0 && state . buckets . window . length > 0 ;
287287 const browser_available =
288- state . buckets . afk_buckets . length > 0 &&
289- state . buckets . window_buckets . length > 0 &&
290- state . buckets . browser_buckets . length > 0 ;
291- const active_available = state . buckets . afk_buckets . length > 0 ;
292- const editor_available = state . buckets . editor_buckets . length > 0 ;
293- const android_available = state . buckets . window_buckets [ 0 ] . includes ( ' android' ) ;
288+ state . buckets . afk . length > 0 &&
289+ state . buckets . window . length > 0 &&
290+ state . buckets . browser . length > 0 ;
291+ const active_available = state . buckets . afk . length > 0 ;
292+ const editor_available = state . buckets . editor . length > 0 ;
293+ const android_available = state . buckets . android . length > 0 ;
294294 commit ( 'set_available' , {
295295 window_available : window_available ,
296296 browser_available : browser_available ,
@@ -302,10 +302,11 @@ const actions = {
302302
303303 async get_buckets ( { commit, rootGetters } , { host } ) {
304304 const buckets = {
305- afk_buckets : rootGetters [ 'buckets/afkBucketsByHost' ] ( host ) ,
306- window_buckets : rootGetters [ 'buckets/windowBucketsByHost' ] ( host ) ,
307- browser_buckets : rootGetters [ 'buckets/browserBuckets' ] ,
308- editor_buckets : rootGetters [ 'buckets/editorBuckets' ] ,
305+ afk : rootGetters [ 'buckets/afkBucketsByHost' ] ( host ) ,
306+ window : rootGetters [ 'buckets/windowBucketsByHost' ] ( host ) ,
307+ android : rootGetters [ 'buckets/androidBucketsByHost' ] ( host ) ,
308+ browser : rootGetters [ 'buckets/browserBuckets' ] ,
309+ editor : rootGetters [ 'buckets/editorBuckets' ] ,
309310 } ;
310311 console . log ( 'Available buckets: ' , buckets ) ;
311312 commit ( 'buckets' , buckets ) ;
0 commit comments