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

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

View File

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