Skip to content

Commit

Permalink
refactor: Rename ActivityDaily to just Activity
Browse files Browse the repository at this point in the history
  • Loading branch information
johan-bjareholt committed Apr 26, 2020
1 parent c366500 commit bc4e950
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 61 deletions.
24 changes: 12 additions & 12 deletions src/components/SelectableVisualization.vue
Expand Up @@ -22,17 +22,17 @@ div
:colorfunc="e => e.data.$domain",
with_limit)
div(v-if="type == 'top_editor_files'")
aw-summary(:fields="$store.state.activity_daily.editor.top_files",
aw-summary(:fields="$store.state.activity.editor.top_files",
:namefunc="top_editor_files_namefunc",
:colorfunc="e => e.data.language",
with_limit)
div(v-if="type == 'top_editor_languages'")
aw-summary(:fields="$store.state.activity_daily.editor.top_languages",
aw-summary(:fields="$store.state.activity.editor.top_languages",
:namefunc="e => e.data.language",
:colorfunc="e => e.data.language",
with_limit)
div(v-if="type == 'top_editor_projects'")
aw-summary(:fields="$store.state.activity_daily.editor.top_projects",
aw-summary(:fields="$store.state.activity.editor.top_projects",
:namefunc="top_editor_projects_namefunc",
:colorfunc="e => e.data.language",
with_limit)
Expand Down Expand Up @@ -110,19 +110,19 @@ export default {
},
computed: {
top_apps: function() {
return this.$store.state.activity_daily.window.top_apps;
return this.$store.state.activity.window.top_apps;
},
top_titles: function() {
return this.$store.state.activity_daily.window.top_titles;
return this.$store.state.activity.window.top_titles;
},
top_domains: function() {
return this.$store.state.activity_daily.browser.top_domains;
return this.$store.state.activity.browser.top_domains;
},
top_urls: function() {
return this.$store.state.activity_daily.browser.top_urls;
return this.$store.state.activity.browser.top_urls;
},
top_categories: function() {
return this.$store.state.activity_daily.category.top;
return this.$store.state.activity.category.top;
},
top_categories_hierarchy: function() {
if (this.top_categories) {
Expand All @@ -145,21 +145,21 @@ export default {
methods: {
get_type_available: function(type) {
if (type === 'top_apps' || type === 'top_titles') {
return this.$store.state.activity_daily.window.available;
return this.$store.state.activity.window.available;
} else if (type === 'top_domains' || type === 'top_urls') {
return this.$store.state.activity_daily.browser.available;
return this.$store.state.activity.browser.available;
} else if (
type === 'top_editor_files' ||
type === 'top_editor_languages' ||
type === 'top_editor_projects'
) {
return this.$store.state.activity_daily.editor.available;
return this.$store.state.activity.editor.available;
} else if (
type === 'top_categories' ||
type === 'category_tree' ||
type === 'category_sunburst'
) {
return this.$store.state.activity_daily.category.available;
return this.$store.state.activity.category.available;
} else {
console.error('Unknown type available: ', type);
return false;
Expand Down
32 changes: 16 additions & 16 deletions src/route.js
Expand Up @@ -3,14 +3,14 @@ import VueRouter from 'vue-router';

const Home = () => import('./views/Home.vue');

// Daily activity views for desktop
const ActivityDaily = () => import('./views/activity/daily/ActivityDaily.vue');
const ActivityDailySummary = () => import('./views/activity/daily/ActivityDailySummary.vue');
const ActivityDailyWindow = () => import('./views/activity/daily/ActivityDailyWindow.vue');
const ActivityDailyBrowser = () => import('./views/activity/daily/ActivityDailyBrowser.vue');
const ActivityDailyEditor = () => import('./views/activity/daily/ActivityDailyEditor.vue');

// Activity views for desktop
const Activity = () => import('./views/activity/Activity.vue');
const ActivitySummary = () => import('./views/activity/ActivitySummary.vue');
const ActivityWindow = () => import('./views/activity/ActivityWindow.vue');
const ActivityBrowser = () => import('./views/activity/ActivityBrowser.vue');
const ActivityEditor = () => import('./views/activity/ActivityEditor.vue');
const ActivityAndroid = () => import('./views/activity/ActivityAndroid.vue');

const Buckets = () => import('./views/Buckets.vue');
const Bucket = () => import('./views/Bucket.vue');
const QueryExplorer = () => import('./views/QueryExplorer.vue');
Expand All @@ -29,34 +29,34 @@ const router = new VueRouter({
{ path: '/activity/android/:host/:date?', component: ActivityAndroid, props: true },
{
path: '/activity/:host/:periodLength?/:date?',
component: ActivityDaily,
component: Activity,
props: true,
children: [
{
path: 'summary',
meta: { subview: 'summary' },
name: 'activity-daily-summary',
component: ActivityDailySummary,
name: 'activity-summary',
component: ActivitySummary,
props: true,
},
{
path: 'window',
meta: { subview: 'window' },
name: 'activity-daily-window',
component: ActivityDailyWindow,
name: 'activity-window',
component: ActivityWindow,
props: true,
},
{
path: 'browser',
meta: { subview: 'browser' },
name: 'activity-daily-browser',
component: ActivityDailyBrowser,
name: 'activity-browser',
component: ActivityBrowser,
},
{
path: 'editor',
meta: { subview: 'editor' },
name: 'activity-daily-editor',
component: ActivityDailyEditor,
name: 'activity-editor',
component: ActivityEditor,
},
// Unspecified should redirect to summary view is the summary view
// (needs to be last since otherwise it'll always match first)
Expand Down
4 changes: 2 additions & 2 deletions src/store/index.js
@@ -1,6 +1,6 @@
import Vue from 'vue';
import Vuex from 'vuex';
import activity_daily from './modules/activity_daily';
import activity from './modules/activity';
import buckets from './modules/buckets';
import settings from './modules/settings';
//import createLogger from '../../../src/plugins/logger';
Expand All @@ -11,7 +11,7 @@ const debug = process.env.NODE_ENV !== 'production';

export default new Vuex.Store({
modules: {
activity_daily,
activity,
buckets,
settings,
},
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/views/Dev.vue
Expand Up @@ -32,10 +32,10 @@ export default {
},
methods: {
query_window_timing: async function() {
await this.$store.dispatch('activity_daily/query_window', this.queryOptions);
await this.$store.dispatch('activity/query_window', this.queryOptions);
},
query_browser_timing: async function() {
await this.$store.dispatch('activity_daily/query_browser', this.queryOptions);
await this.$store.dispatch('activity/query_browser', this.queryOptions);
},
},
};
Expand Down
Expand Up @@ -5,7 +5,7 @@ div
p
| Host: {{ host }}
br
| Active time: {{ $store.state.activity_daily.active.duration | friendlyduration }}
| Active time: {{ $store.state.activity.active.duration | friendlyduration }}

div.d-flex
div.p-1
Expand Down Expand Up @@ -38,16 +38,16 @@ div

ul.row.nav.nav-tabs.my-3.px-3
li.nav-item
router-link.nav-link(:to="{ name: 'activity-daily-summary', params: $route.params }")
router-link.nav-link(:to="{ name: 'activity-summary', params: $route.params }")
h5 Summary
li.nav-item
router-link.nav-link(:to="{ name: 'activity-daily-window', params: $route.params }")
router-link.nav-link(:to="{ name: 'activity-window', params: $route.params }")
h5 Window
li.nav-item
router-link.nav-link(:to="{ name: 'activity-daily-browser', params: $route.params }")
router-link.nav-link(:to="{ name: 'activity-browser', params: $route.params }")
h5 Browser
li.nav-item
router-link.nav-link(:to="{ name: 'activity-daily-editor', params: $route.params }")
router-link.nav-link(:to="{ name: 'activity-editor', params: $route.params }")
h5 Editor

div
Expand Down Expand Up @@ -157,9 +157,7 @@ export default {
return `/activity/${this.host}/${this.periodLength}`;
},
periodusage: function() {
return this.$store.getters['activity_daily/getActiveHistoryAroundTimeperiod'](
this.timeperiod
);
return this.$store.getters['activity/getActiveHistoryAroundTimeperiod'](this.timeperiod);
},
timeperiod: function() {
// TODO: Get start of day/week/month (depending on periodLength) with offset
Expand Down Expand Up @@ -230,7 +228,7 @@ export default {
},
refresh: async function(force) {
await this.$store.dispatch('activity_daily/ensure_loaded', {
await this.$store.dispatch('activity/ensure_loaded', {
timeperiod: this.timeperiod,
host: this.host,
force: force,
Expand All @@ -240,7 +238,7 @@ export default {
},
load_demo: async function() {
await this.$store.dispatch('activity_daily/load_demo');
await this.$store.dispatch('activity/load_demo');
},
},
};
Expand Down
Expand Up @@ -6,25 +6,25 @@ div
small Make sure you have a browser watcher installed to use this feature
div(v-if="browserBuckets.length > 0")

h6 Active browser time: {{ $store.state.activity_daily.browser.duration | friendlyduration }}
h6 Active browser time: {{ $store.state.activity.browser.duration | friendlyduration }}

div.row
div.col-md-6
h5 Top Browser Domains
div(v-if="browserBuckets")
aw-summary(:fields="$store.state.activity_daily.browser.top_domains", :namefunc="e => e.data.$domain", :colorfunc="e => e.data.$domain", with_limit)
aw-summary(:fields="$store.state.activity.browser.top_domains", :namefunc="e => e.data.$domain", :colorfunc="e => e.data.$domain", with_limit)

div.col-md-6
h5 Top Browser URLs
div(v-if="browserBuckets")
aw-summary(:fields="$store.state.activity_daily.browser.top_urls", :namefunc="e => e.data.url", :colorfunc="e => e.data.$domain", with_limit)
aw-summary(:fields="$store.state.activity.browser.top_urls", :namefunc="e => e.data.url", :colorfunc="e => e.data.$domain", with_limit)

//div(v-if="periodLength === 'day'")
br
hr
b-form-checkbox(v-model="timelineShowAFK")
| Show AFK time
aw-timeline-inspect(:chunks="$store.state.activity_daily.web_chunks", :show_afk='timelineShowAFK', :chunkfunc='e => e.data.$domain', :eventfunc='e => e.data.url')
aw-timeline-inspect(:chunks="$store.state.activity.web_chunks", :show_afk='timelineShowAFK', :chunkfunc='e => e.data.$domain', :eventfunc='e => e.data.url')
br
</template>

Expand All @@ -49,7 +49,7 @@ export default {
},
computed: {
browserBuckets: function() {
return this.$store.state.activity_daily.buckets.browser_buckets;
return this.$store.state.activity.buckets.browser_buckets;
},
},
};
Expand Down
Expand Up @@ -5,23 +5,23 @@ div
h6 No editor buckets available
small Make sure you have an editor watcher installed to use this feature
div(v-if="editorBuckets.length")
h6 Active editor time: {{ $store.state.activity_daily.editor.duration | friendlyduration }}
h6 Active editor time: {{ $store.state.activity.editor.duration | friendlyduration }}
div.row(style="padding-top: 0.5em;")
div.col-md-4
h5 Top file activity
aw-summary(:fields="$store.state.activity_daily.editor.top_files",
aw-summary(:fields="$store.state.activity.editor.top_files",
:namefunc="top_editor_files_namefunc",
:colorfunc="top_editor_files_colorfunc", with_limit)

div.col-md-4
h5 Top language activity
aw-summary(:fields="$store.state.activity_daily.editor.top_languages",
aw-summary(:fields="$store.state.activity.editor.top_languages",
:namefunc="top_editor_languages_namefunc",
:colorfunc="top_editor_languages_colorfunc", with_limit)

div.col-md-4
h5 Top project activity
aw-summary(:fields="$store.state.activity_daily.editor.top_projects",
aw-summary(:fields="$store.state.activity.editor.top_projects",
:namefunc="top_editor_projects_namefunc",
:colorfunc="top_editor_projects_colorfunc", with_limit)
br
Expand Down Expand Up @@ -63,7 +63,7 @@ export default {
computed: {
editorBuckets: function() {
return this.$store.state.activity_daily.buckets.editor_buckets;
return this.$store.state.activity.buckets.editor_buckets;
},
dateEnd: function() {
return moment(this.date)
Expand Down
Expand Up @@ -80,16 +80,16 @@ export default {
},
computed: {
top_apps: function() {
return this.$store.state.activity_daily.window.top_apps;
return this.$store.state.activity.window.top_apps;
},
top_titles: function() {
return this.$store.state.activity_daily.window.top_titles;
return this.$store.state.activity.window.top_titles;
},
top_categories: function() {
return this.$store.state.activity_daily.category.top;
return this.$store.state.activity.category.top;
},
top_domains: function() {
return this.$store.state.activity_daily.browser.top_domains;
return this.$store.state.activity.browser.top_domains;
},
top_categories_hierarchy: function() {
if (this.top_categories) {
Expand All @@ -106,7 +106,7 @@ export default {
}
},
datasets: function() {
const data = split_by_hour_into_data(this.$store.state.activity_daily.active.events);
const data = split_by_hour_into_data(this.$store.state.activity.active.events);
return [
{
label: 'Total time',
Expand Down
Expand Up @@ -37,16 +37,16 @@ export default {
},
computed: {
top_apps: function() {
return this.$store.state.activity_daily.window.top_apps;
return this.$store.state.activity.window.top_apps;
},
top_titles: function() {
return this.$store.state.activity_daily.window.top_titles;
return this.$store.state.activity.window.top_titles;
},
bucket_id_window: function() {
return this.$store.state.activity_daily.buckets.window_buckets[0];
return this.$store.state.activity.buckets.window_buckets[0];
},
bucket_id_afk: function() {
return this.$store.state.activity_daily.buckets.afk_buckets[0];
return this.$store.state.activity.buckets.afk_buckets[0];
},
},
};
Expand Down

0 comments on commit bc4e950

Please sign in to comment.