release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
4 changed files with 28 additions and 21 deletions
Showing only changes of commit b7aeea0a23 - Show all commits

View File

@ -5,7 +5,6 @@ import { api } from 'boot/axios';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
import { Notify } from 'quasar'; import { Notify } from 'quasar';
import { notEmpty } from 'src/utils/validators';
const config: { [key: string]: Array<string> } = { const config: { [key: string]: Array<string> } = {
// Do not change required Modules !! // Do not change required Modules !!

View File

@ -1,5 +1,6 @@
const config = { const config = {
baseURL: '/api', baseURL: '/api',
pollingInterval: 30000,
}; };
export default config; export default config;

View File

@ -104,11 +104,12 @@
import EssentialLink from 'src/components/navigation/EssentialLink.vue'; import EssentialLink from 'src/components/navigation/EssentialLink.vue';
import ShortcutLink from 'src/components/navigation/ShortcutLink.vue'; import ShortcutLink from 'src/components/navigation/ShortcutLink.vue';
import Notification from 'src/components/Notification.vue'; import Notification from 'src/components/Notification.vue';
import { Screen } from 'quasar'; import { defineComponent, ref, inject, computed, onBeforeMount, onBeforeUnmount } from 'vue';
import { defineComponent, ref, inject, computed, onBeforeMount } from 'vue';
import { useMainStore } from 'src/stores'; import { useMainStore } from 'src/stores';
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from 'src/plugins';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { Screen } from 'quasar';
import config from 'src/config';
const essentials: FG_Plugin.MenuLink[] = [ const essentials: FG_Plugin.MenuLink[] = [
{ {
@ -126,24 +127,25 @@ export default defineComponent({
const mainStore = useMainStore(); const mainStore = useMainStore();
const flaschengeist = inject<FG_Plugin.Flaschengeist>('flaschengeist'); const flaschengeist = inject<FG_Plugin.Flaschengeist>('flaschengeist');
const leftDrawer = ref(false); const leftDrawer = ref(false);
const shortcuts = flaschengeist?.shortcuts; const leftDrawerMini = ref(false);
const mainLinks = flaschengeist?.menuLinks; const shortcuts = flaschengeist?.shortcuts || [];
const mainLinks = flaschengeist?.menuLinks || [];
const notifications = computed(() => mainStore.notifications.slice().reverse()); const notifications = computed(() => mainStore.notifications.slice().reverse());
const noPermission = ref(window.Notification.permission !== 'granted'); const noPermission = ref(window.Notification.permission !== 'granted');
const polling = ref(NaN);
function requestPermission() { onBeforeMount(() => pollNotification());
void window.Notification.requestPermission().then( onBeforeUnmount(() => window.clearInterval(polling.value));
(p) => (noPermission.value = p !== 'granted')
);
}
onBeforeMount(() => window.setInterval(() => void mainStore.loadNotifications(), 30000));
const leftDrawerOpen = computed({ const leftDrawerOpen = computed({
get: () => (leftDrawer.value || Screen.gt.sm ? true : false), get: () => (leftDrawer.value || Screen.gt.sm ? true : false),
set: (val: boolean) => (leftDrawer.value = val), set: (val: boolean) => (leftDrawer.value = val),
}); });
const leftDrawerMini = ref(false);
const subLinks = computed(() => {
const matched = router.currentRoute.value.matched[1];
return flaschengeist?.menuLinks.find((link) => matched.name == link.link)?.children;
});
function leftDrawerClicker() { function leftDrawerClicker() {
if (leftDrawerMini.value) { if (leftDrawerMini.value) {
@ -151,11 +153,6 @@ export default defineComponent({
} }
} }
const subLinks = computed(() => {
const matched = router.currentRoute.value.matched[1];
return flaschengeist?.menuLinks.find((link) => matched.name == link.link)?.children;
});
function logout() { function logout() {
void router.push({ name: 'login', params: { logout: 'logout' } }); void router.push({ name: 'login', params: { logout: 'logout' } });
void mainStore.logout(); void mainStore.logout();
@ -165,6 +162,18 @@ export default defineComponent({
await mainStore.removeNotification(id); await mainStore.removeNotification(id);
} }
function requestPermission() {
void window.Notification.requestPermission().then(
(p) => (noPermission.value = p !== 'granted')
);
}
function pollNotification() {
polling.value = window.setInterval(() => {
void mainStore.loadNotifications(<FG_Plugin.Flaschengeist>flaschengeist);
}, config.pollingInterval);
}
return { return {
essentials, essentials,
leftDrawerOpen, leftDrawerOpen,

View File

@ -5,7 +5,6 @@ import { FG_Plugin } from 'src/plugins';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import { api } from 'src/boot/axios'; import { api } from 'src/boot/axios';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { inject } from 'vue';
function loadCurrentSession() { function loadCurrentSession() {
const session = LocalStorage.getItem<FG.Session>('session'); const session = LocalStorage.getItem<FG.Session>('session');
@ -109,8 +108,7 @@ export const useMainStore = defineStore({
); );
}, },
async loadNotifications() { async loadNotifications(flaschengeist: FG_Plugin.Flaschengeist) {
const flaschengeist = inject<FG_Plugin.Flaschengeist>('flaschengeist');
const params = const params =
this.notifications.length > 0 this.notifications.length > 0
? { from: this.notifications[this.notifications.length - 1].time } ? { from: this.notifications[this.notifications.length - 1].time }