2020-11-10 00:33:55 +00:00
|
|
|
<template>
|
|
|
|
<q-page
|
|
|
|
padding
|
|
|
|
style="grid-auto-rows: 1fr;"
|
|
|
|
class="fit row justify-around items-start q-col-gutter-sm"
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
v-for="(item, index) in widgets"
|
|
|
|
:key="index"
|
|
|
|
class="col-4 full-height col-sm-6 col-xs-12"
|
|
|
|
>
|
|
|
|
<component v-bind:is="item" />
|
|
|
|
</div>
|
|
|
|
</q-page>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent, onMounted, ref } from '@vue/composition-api';
|
2020-11-13 03:01:53 +00:00
|
|
|
import { hasPermissions } from 'src/components/permission';
|
2020-11-10 00:33:55 +00:00
|
|
|
import { AsyncComponentPromise } from 'vue/types/options';
|
2020-11-13 03:01:53 +00:00
|
|
|
|
2020-11-10 00:33:55 +00:00
|
|
|
export default defineComponent({
|
|
|
|
name: 'Dashboard',
|
|
|
|
setup(_, { root }) {
|
|
|
|
const widgets = ref<Array<AsyncComponentPromise>>([]);
|
2020-11-13 03:01:53 +00:00
|
|
|
|
2020-11-10 00:33:55 +00:00
|
|
|
onMounted(() => {
|
2020-11-13 03:01:53 +00:00
|
|
|
root.$flaschengeistPlugins.widgets.forEach((widget) => {
|
|
|
|
if (hasPermissions(widget.permissions, root.$store))
|
|
|
|
widgets.value.push(widget.widget);
|
|
|
|
});
|
2020-11-10 00:33:55 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
2020-11-13 03:01:53 +00:00
|
|
|
widgets,
|
2020-11-10 00:33:55 +00:00
|
|
|
};
|
2020-11-13 03:01:53 +00:00
|
|
|
},
|
2020-11-10 00:33:55 +00:00
|
|
|
});
|
|
|
|
</script>
|