[deps] Update to rc pinia and fix TypeScript version for ESLint

This commit is contained in:
Ferdinand Thiessen 2021-08-30 14:21:53 +02:00
parent fe1fae10f5
commit 1132bfd129
3 changed files with 61 additions and 66 deletions

View File

@ -19,31 +19,31 @@
"@flaschengeist/users": "^1.0.0-alpha.1", "@flaschengeist/users": "^1.0.0-alpha.1",
"axios": "^0.21.1", "axios": "^0.21.1",
"cordova": "^10.0.0", "cordova": "^10.0.0",
"pinia": "2.0.0-beta.5", "pinia": "^2.0.0-rc.6",
"quasar": "^2.0.3" "quasar": "^2.0.4"
}, },
"devDependencies": { "devDependencies": {
"@flaschengeist/types": "^1.0.0-alpha.2", "@flaschengeist/types": "^1.0.0-alpha.4",
"@quasar/app": "^3.0.3", "@quasar/app": "^3.1.0",
"@quasar/extras": "^1.10.9", "@quasar/extras": "^1.10.12",
"@types/node": "^12.20.15", "@types/node": "^12.20.21",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-env": "^1.16.0", "@types/webpack-env": "^1.16.2",
"@typescript-eslint/eslint-plugin": "^4.24.0", "@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.24.0", "@typescript-eslint/parser": "^4.29.3",
"eslint": "^7.26.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-vue": "^7.9.0", "eslint-plugin-vue": "^7.17.0",
"eslint-webpack-plugin": "^2.5.4", "eslint-webpack-plugin": "^3.0.1",
"modify-source-webpack-plugin": "^3.0.0-rc.0", "modify-source-webpack-plugin": "^3.0.0",
"prettier": "^2.3.0", "prettier": "^2.3.2",
"typescript": "^4.2.4", "typescript": "~4.3.5",
"vuedraggable": "^4.0.1" "vuedraggable": "^4.1.0"
}, },
"prettier": { "prettier": {
"singleQuote": true, "singleQuote": true,
"semi": true, "semi": true,
"printWidth": 120, "printWidth": 100,
"arrowParens": "always" "arrowParens": "always"
}, },
"browserslist": [ "browserslist": [

View File

@ -1,5 +1,5 @@
import { Notify } from 'quasar'; import { Notify } from 'quasar';
import { api } from 'boot/axios'; import { api } from 'src/boot/axios';
import { boot } from 'quasar/wrappers'; import { boot } from 'quasar/wrappers';
import routes from 'src/router/routes'; import routes from 'src/router/routes';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
@ -118,7 +118,11 @@ function combineMenuRoutes(
target.children = []; target.children = [];
} }
convertRoutes(sourceMainConfig.route, sourceMainConfig.children); convertRoutes(sourceMainConfig.route, sourceMainConfig.children);
if (sourceMainConfig.children && sourceMainConfig.children.length > 0 && !sourceMainConfig.route.component) if (
sourceMainConfig.children &&
sourceMainConfig.children.length > 0 &&
!sourceMainConfig.route.component
)
Object.assign(sourceMainConfig.route, { Object.assign(sourceMainConfig.route, {
component: () => import('src/components/navigation/EmptyParent.vue'), component: () => import('src/components/navigation/EmptyParent.vue'),
}); });
@ -130,14 +134,20 @@ function combineMenuRoutes(
return target; return target;
} }
function combineRoutes(target: RouteRecordRaw[], source: FG_Plugin.NamedRouteRecordRaw[], mainPath: '/' | '/in') { function combineRoutes(
target: RouteRecordRaw[],
source: FG_Plugin.NamedRouteRecordRaw[],
mainPath: '/' | '/in'
) {
// Search parent // Search parent
target.forEach((target) => { target.forEach((target) => {
if (target.path === mainPath) { if (target.path === mainPath) {
// Parent found = target // Parent found = target
source.forEach((sourceRoute) => { source.forEach((sourceRoute) => {
// Check if source is already in target // Check if source is already in target
const targetRoot = target.children?.find((targetRoot) => sourceRoute.path === targetRoot.path); const targetRoot = target.children?.find(
(targetRoot) => sourceRoute.path === targetRoot.path
);
// Already in target routes, add only children // Already in target routes, add only children
if (targetRoot) { if (targetRoot) {
if (targetRoot.children === undefined) targetRoot.children = []; if (targetRoot.children === undefined) targetRoot.children = [];
@ -145,7 +155,11 @@ function combineRoutes(target: RouteRecordRaw[], source: FG_Plugin.NamedRouteRec
} else { } else {
// Append to target // Append to target
if (target.children === undefined) target.children = []; if (target.children === undefined) target.children = [];
if (sourceRoute.children && sourceRoute.children.length > 0 && sourceRoute.component === undefined) if (
sourceRoute.children &&
sourceRoute.children.length > 0 &&
sourceRoute.component === undefined
)
Object.assign(sourceRoute, { Object.assign(sourceRoute, {
component: () => import('src/components/navigation/EmptyParent.vue'), component: () => import('src/components/navigation/EmptyParent.vue'),
}); });
@ -211,7 +225,11 @@ function combineShortcuts(target: FG_Plugin.Shortcut[], source: FG_Plugin.MenuRo
* @param plugin Plugin to load * @param plugin Plugin to load
* @param router VueRouter instance * @param router VueRouter instance
*/ */
function loadPlugin(loadedPlugins: FG_Plugin.Flaschengeist, plugin: FG_Plugin.Plugin, backend: Backend) { function loadPlugin(
loadedPlugins: FG_Plugin.Flaschengeist,
plugin: FG_Plugin.Plugin,
backend: Backend
) {
// Check if already loaded // Check if already loaded
if (loadedPlugins.plugins.findIndex((p) => p.name === plugin.name) !== -1) return true; if (loadedPlugins.plugins.findIndex((p) => p.name === plugin.name) !== -1) return true;
@ -220,7 +238,8 @@ function loadPlugin(loadedPlugins: FG_Plugin.Flaschengeist, plugin: FG_Plugin.Pl
!plugin.requiredModules.every( !plugin.requiredModules.every(
(required) => (required) =>
backend.plugins[required[0]] !== undefined && backend.plugins[required[0]] !== undefined &&
(required.length == 1 || true) /* validate the version, semver440 from python is... tricky on node*/ (required.length == 1 ||
true) /* validate the version, semver440 from python is... tricky on node*/
) )
) { ) {
console.error(`Plugin ${plugin.name}: Backend modules not satisfied`); console.error(`Plugin ${plugin.name}: Backend modules not satisfied`);
@ -315,7 +334,9 @@ export default boot(async ({ router, app }) => {
// Sort widgets by priority // Sort widgets by priority
/** @todo Remove priority with first beta */ /** @todo Remove priority with first beta */
loadedPlugins.widgets.sort((a, b) => <number>(b.order || b.priority) - <number>(a.order || a.priority)); loadedPlugins.widgets.sort(
(a, b) => <number>(b.order || b.priority) - <number>(a.order || a.priority)
);
/** @todo Can be cleaned up with first beta */ /** @todo Can be cleaned up with first beta */
loadedPlugins.menuLinks.sort((a, b) => { loadedPlugins.menuLinks.sort((a, b) => {
const diff = a.order && b.order ? b.order - a.order : 0; const diff = a.order && b.order ? b.order - a.order : 0;

View File

@ -19,11 +19,7 @@
{{ notifications.length }} {{ notifications.length }}
</q-badge> </q-badge>
<q-menu style="max-height: 400px; overflow: auto"> <q-menu style="max-height: 400px; overflow: auto">
<q-btn <q-btn v-if="useNative && noPermission" label="Benachrichtigungen erlauben" @click="requestPermission" />
v-if="useNative && noPermission"
label="Benachrichtigungen erlauben"
@click="requestPermission"
/>
<template v-if="notifications.length > 0"> <template v-if="notifications.length > 0">
<Notification <Notification
v-for="(notification, index) in notifications" v-for="(notification, index) in notifications"
@ -44,13 +40,7 @@
</q-toolbar> </q-toolbar>
</q-header> </q-header>
<q-drawer <q-drawer v-model="leftDrawer" side="left" bordered :mini="leftDrawerMini" @click.capture="openMenu">
v-model="leftDrawer"
side="left"
bordered
:mini="leftDrawerMini"
@click.capture="openMenu"
>
<!-- Plugins --> <!-- Plugins -->
<essential-expansion-link <essential-expansion-link
v-for="(entry, index) in mainLinks" v-for="(entry, index) in mainLinks"
@ -59,11 +49,7 @@
@add-short-cut="addShortcut" @add-short-cut="addShortcut"
/> />
<q-separator /> <q-separator />
<essential-link <essential-link v-for="(entry, index) in essentials" :key="'essential' + index" :entry="entry" />
v-for="(entry, index) in essentials"
:key="'essential' + index"
:entry="entry"
/>
</q-drawer> </q-drawer>
<q-page-container> <q-page-container>
<router-view /> <router-view />
@ -76,15 +62,7 @@ import EssentialExpansionLink from 'components/navigation/EssentialExpansionLink
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 { import { defineComponent, ref, inject, computed, onBeforeMount, onBeforeUnmount } from 'vue';
defineComponent,
ref,
inject,
computed,
onBeforeMount,
onBeforeUnmount,
ComponentPublicInstance,
} from 'vue';
import { Screen } from 'quasar'; import { Screen } from 'quasar';
import config from 'src/config'; import config from 'src/config';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -107,7 +85,7 @@ export default defineComponent({
EssentialLink, EssentialLink,
ShortcutLink, ShortcutLink,
Notification, Notification,
drag: <ComponentPublicInstance>drag, drag,
}, },
setup() { setup() {
const router = useRouter(); const router = useRouter();
@ -151,23 +129,19 @@ export default defineComponent({
} }
function requestPermission() { function requestPermission() {
void window.Notification.requestPermission().then( void window.Notification.requestPermission().then((p) => (noPermission.value = p !== 'granted'));
(p) => (noPermission.value = p !== 'granted')
);
} }
function pollNotification() { function pollNotification() {
void mainStore void mainStore.loadNotifications(<FG_Plugin.Flaschengeist>flaschengeist).then((notifications) => {
.loadNotifications(<FG_Plugin.Flaschengeist>flaschengeist) if (useNative && !noPermission.value)
.then((notifications) => { notifications.forEach(
if (useNative && !noPermission.value) (notif) =>
notifications.forEach( new window.Notification(notif.text, {
(notif) => timestamp: notif.time.getTime(),
new window.Notification(notif.text, { })
timestamp: notif.time.getTime(), );
}) });
);
});
} }
const shortCuts = computed({ const shortCuts = computed({