Skip to content

Commit 5a47ebe

Browse files
committed
added fully covered examples of data for demomode
1 parent 3ea66bb commit 5a47ebe

1 file changed

Lines changed: 31 additions & 12 deletions

File tree

src/store/modules/activity_daily.ts

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,6 @@ const actions = {
111111
}
112112
},
113113

114-
async load_demo({ commit }) {
115-
// A function to load some demo data (for screenshots and stuff)
116-
commit('query_window_completed', {
117-
app_events: [{ duration: 10, data: { app: 'test' } }],
118-
});
119-
commit('query_browser_completed', {});
120-
commit('query_editor_completed', {});
121-
},
122-
123114
async query_window({ commit }, { host, timeperiod, filterAFK, filterCategories }: QueryOptions) {
124115
const start = moment();
125116
const periods = [timeperiodToStr(timeperiod)];
@@ -197,6 +188,34 @@ const actions = {
197188
commit('browser_buckets', browser_buckets);
198189
commit('editor_buckets', editor_buckets);
199190
},
191+
192+
async load_demo({ commit }) {
193+
// A function to load some demo data (for screenshots and stuff)
194+
commit('start_loading', {});
195+
196+
commit('query_window_completed', {
197+
duration: 30,
198+
app_events: [{ duration: 10, data: { app: 'test' } }],
199+
title_events: [{ duration: 10, data: { title: 'test' }}],
200+
cat_events: [{ duration: 10, data: { $category: ['test', 'subtest'] }}],
201+
active_events: [{ timestamp: new Date().toISOString(), duration: 1.5*60*60, data: { afk: 'not-afk' }}],
202+
});
203+
204+
commit('browser_buckets', ['aw-watcher-firefox']);
205+
commit('query_browser_completed', {
206+
duration: 20,
207+
domains: [{ duration: 10, data: { $domain: "github.com" } }],
208+
urls: [{ duration: 10, data: { url: "https://github.com/ActivityWatch/activitywatch" } }],
209+
});
210+
211+
commit('editor_buckets', ['aw-watcher-vim']);
212+
commit('query_editor_completed', {
213+
duration: 30,
214+
files: [{ duration: 10, data: { file: "test.py" }}],
215+
languages: [{ duration: 10, data: { language: "python" }}],
216+
projects: [{ duration: 10, data: { project: "aw-core" }}],
217+
});
218+
},
200219
};
201220

202221
// mutations
@@ -214,9 +233,9 @@ const mutations = {
214233
state.top_urls = null;
215234

216235
state.editor_duration = 0;
217-
state.top_editor_files = null,
218-
state.top_editor_languages = null,
219-
state.top_editor_projects = null,
236+
state.top_editor_files = null;
237+
state.top_editor_languages = null;
238+
state.top_editor_projects = null;
220239

221240
state.top_categories = null;
222241
state.active_duration = null;

0 commit comments

Comments
 (0)