Files
cloudron-box/dashboard/src/components/Index.vue

69 lines
1.3 KiB
Vue
Raw Normal View History

2024-11-01 14:16:09 +01:00
<template>
<div>
2024-12-27 22:25:00 +01:00
<Notification />
2024-12-26 12:19:48 +01:00
<SupportView v-if="view === VIEWS.SUPPORT" />
<VolumesView v-if="view === VIEWS.VOLUMES" />
2024-11-01 14:16:09 +01:00
</div>
</template>
<script>
2024-12-27 22:25:00 +01:00
import { Notification } from 'pankow';
2024-11-01 14:16:09 +01:00
import SupportView from './SupportView.vue';
2024-12-26 12:19:48 +01:00
import VolumesView from './VolumesView.vue';
2024-11-01 14:16:09 +01:00
const VIEWS = {
2024-12-26 12:19:48 +01:00
SUPPORT: 'support',
VOLUMES: 'volumes',
2024-11-01 14:16:09 +01:00
};
export default {
name: 'Index',
components: {
2024-12-27 22:25:00 +01:00
Notification,
2024-12-26 12:19:48 +01:00
SupportView,
VolumesView,
2024-11-01 14:16:09 +01:00
},
data() {
return {
VIEWS,
accessToken: localStorage.token,
view: ''
};
},
methods: {
},
async mounted() {
if (!localStorage.token) {
console.error('Set localStorage.token');
return;
}
const that = this;
function onHashChange() {
const view = location.hash.slice(2);
if (view === VIEWS.SUPPORT) {
that.view = VIEWS.SUPPORT;
2024-12-26 12:19:48 +01:00
} else if (view === VIEWS.VOLUMES) {
that.view = VIEWS.VOLUMES;
2024-11-01 14:16:09 +01:00
} else {
that.view = '';
}
2024-12-28 12:07:48 +01:00
// hack for layout to avoid consuming space if vue view is not active
document.getElementById('app').style.height = that.view ? 'auto' : '0';
2024-11-01 14:16:09 +01:00
}
window.addEventListener('hashchange', onHashChange);
onHashChange();
}
};
</script>
<style>
</style>