Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/stores/views.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineStore } from 'pinia';
import { useSettingsStore } from './settings';
import { useBucketsStore } from './buckets';

interface IElement {
type: string;
Expand Down Expand Up @@ -54,7 +55,7 @@ const desktopViews: View[] = [
},
];

const androidViews = [
export const androidViews: View[] = [
{
id: 'summary',
name: 'Summary',
Expand All @@ -68,7 +69,6 @@ const androidViews = [
},
];

// FIXME: Decide depending on what kind of device is being viewed, not from which device it is being viewed from.
export const defaultViews = !process.env.VUE_APP_ON_ANDROID ? desktopViews : androidViews;

interface State {
Expand Down Expand Up @@ -107,6 +107,14 @@ export const useViewsStore = defineStore('views', {
restoreDefaults(this: State) {
this.views = defaultViews;
},
viewsForHost(host: string): View[] {
const bucketsStore = useBucketsStore();
const available = bucketsStore.available(host);
if (available.android && !available.window) {
return androidViews;
}
return this.views;
},
addView(this: State, view: View) {
this.views.push({ ...view, elements: [] });
},
Expand Down
9 changes: 2 additions & 7 deletions src/views/Buckets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -262,18 +262,13 @@ export default {
key: 'id',
label: this.$t('buckets.bucketId'),
sortable: true,
thStyle: { width: '45%' },
},
{
key: 'hostname',
sortable: true,
thStyle: { width: '25%' },
thStyle: { width: '65%' },
},
{
key: 'last_updated',
label: this.$t('buckets.updated'),
sortable: true,
thStyle: { width: '15%' },
thStyle: { width: '20%' },
},
{
key: 'actions',
Expand Down
4 changes: 3 additions & 1 deletion src/views/activity/Activity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ export default {
};
},
computed: {
...mapState(useViewsStore, ['views']),
views(): import('~/stores/views').View[] {
return this.viewsStore.viewsForHost(this.host);
},
...mapState(useSettingsStore, ['devmode']),
...mapState(useSettingsStore, ['always_active_pattern']),

Expand Down
5 changes: 3 additions & 2 deletions src/views/activity/ActivityView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import 'vue-awesome/icons/times';
import 'vue-awesome/icons/trash';
import 'vue-awesome/icons/undo';

import { mapState } from 'pinia';
import draggable from 'vuedraggable';

import { useViewsStore } from '~/stores/views';
Expand All @@ -76,7 +75,9 @@ export default {
return { editing: false };
},
computed: {
...mapState(useViewsStore, ['views']),
views: function () {
return useViewsStore().viewsForHost(this.$route.params.host || '');
},
view: function () {
if (this.view_id == 'default') {
return this.views[0];
Expand Down
Loading