release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
2 changed files with 63 additions and 45 deletions
Showing only changes of commit d4795a549f - Show all commits

View File

@ -1,12 +1,13 @@
import {boot} from 'quasar/wrappers';
import {RouteConfig} from 'vue-router';
import {VueRouter} from 'vue-router/types/router';
import {Store} from 'vuex';
import {StateInterface} from 'src/store';
import {FG_Plugin} from 'src/plugins';
import { boot } from 'quasar/wrappers';
import { RouteConfig } from 'vue-router';
import { VueRouter } from 'vue-router/types/router';
import { Store } from 'vuex';
import { StateInterface } from 'src/store';
import { FG_Plugin } from 'src/plugins';
import routes from 'src/router/routes';
import {axios} from 'boot/axios';
import {AxiosResponse} from 'axios';
import { axios } from 'boot/axios';
import { AxiosResponse } from 'axios';
import { flatRoutes } from '@dreamonkey/vue-routes-flattener';
const config = {
// Do not change required Modules !!
@ -25,15 +26,15 @@ interface BackendPlugin {
}
interface BackendPlugins {
[key: string]: BackendPlugin
[key: string]: BackendPlugin | null;
}
interface Backend {
plugins: [key: string];
plugins: BackendPlugins[];
version: string;
}
export {Backend}
export { Backend };
function combineRoutes(
target: RouteConfig[],
@ -200,9 +201,9 @@ function loadPlugin(
});
} else {
console.exception(`Could not find required Plugin ${requiredModule}`);
router.push({name: 'error'}).catch((e) => {
console.warn(e)
})
router.push({ name: 'error' }).catch(e => {
console.warn(e);
});
}
});
return loadedPlugins;
@ -223,7 +224,7 @@ async function getBackend(): Promise<Backend | null> {
// "async" is optional;
// more info on params: https://quasar.dev/quasar-cli/cli-documentation/boot-files#Anatomy-of-a-boot-file
export default boot<Store<StateInterface>>(({Vue, router, store}) => {
export default boot<Store<StateInterface>>(({ Vue, router, store }) => {
const plugins: FG_Plugin.Plugin[] = [];
const backendPromise = getBackend();
@ -245,33 +246,44 @@ export default boot<Store<StateInterface>>(({Vue, router, store}) => {
});
// check dependencies
backendPromise.then((backend) => {
console.log(backend)
backendPromise
.then(backend => {
console.log(backend);
if (backend) {
plugins.forEach((plugin: FG_Plugin.Plugin) => {
plugin.requiredModules.forEach((requiredModule: string) => {
if (!(config.requiredModules.includes(requiredModule) || config.loadModules.includes(requiredModule))) {
console.error(`Plugin ${plugin.name} need Plugin ${requiredModule}`)
router.push({name: 'error'}).catch((e) => {
console.warn(e)
})
if (
!(
config.requiredModules.includes(requiredModule) ||
config.loadModules.includes(requiredModule)
)
) {
console.error(
`Plugin ${plugin.name} need Plugin ${requiredModule}`
);
router.push({ name: 'error' }).catch(e => {
console.warn(e);
});
}
})
plugin.requiredBackendModules.forEach((requiredBackendModule: string) => {
});
plugin.requiredBackendModules.forEach(
(requiredBackendModule: string) => {
if (!(requiredBackendModule in backend.plugins)) {
console.error(`Plugin ${plugin.name} need Plugin ${requiredBackendModule} in backend.`)
router.push({name: 'error'}).catch(err => {
console.warn(err)
})
console.error(
`Plugin ${plugin.name} need Plugin ${requiredBackendModule} in backend.`
);
router.push({ name: 'error' }).catch(err => {
console.warn(err);
});
}
})
})
}
);
});
}
})
.catch(e => {
console.error(e)
})
console.error(e);
});
// load plugins
loadedPlugins = loadPlugin(
@ -282,12 +294,19 @@ export default boot<Store<StateInterface>>(({Vue, router, store}) => {
store,
router
);
loadedPlugins = loadPlugin(loadedPlugins, config.loadModules, backendPromise, plugins, store, router);
loadedPlugins = loadPlugin(
loadedPlugins,
config.loadModules,
backendPromise,
plugins,
store,
router
);
loadedPlugins.widgets.sort((a, b) => b.priority - a.priority);
// add new routes for plugins
router.addRoutes(loadedPlugins.routes);
// add new routes for plugins, flatten them to allow empty parent routes
router.addRoutes(flatRoutes(loadedPlugins.routes));
// save plugins in VM-variable
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access

View File

@ -1,6 +1,5 @@
<template>
<q-input
class="col-xs-12 col-sm-6 q-pa-sm"
filled
:readonly="readonly"
:label="label"