release v2.0.0 #4

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

View File

@ -156,13 +156,13 @@ function loadShortCuts(
// loade plugins // loade plugins
function loadPlugin( function loadPlugin(
loadedPlugins: FG_Plugin.LoadedPlugins, loadedPlugins: FG_Plugin.Flaschengeist,
modules: string[], modules: string[],
backendpromise: Promise<Backend | null>, backendpromise: Promise<Backend | null>,
plugins: FG_Plugin.Plugin[], plugins: FG_Plugin.Plugin[],
store: Store<UserSessionState>, store: Store<UserSessionState>,
router: Router router: Router
): FG_Plugin.LoadedPlugins { ): FG_Plugin.Flaschengeist {
modules.forEach((requiredModule) => { modules.forEach((requiredModule) => {
const plugin = plugins.find((plugin) => { const plugin = plugins.find((plugin) => {
return plugin.name == requiredModule; return plugin.name == requiredModule;
@ -223,7 +223,7 @@ export default boot<UserSessionState>(({ router, store, app }) => {
const backendPromise = getBackend(); const backendPromise = getBackend();
let loadedPlugins: FG_Plugin.LoadedPlugins = { let loadedPlugins: FG_Plugin.Flaschengeist = {
routes, routes,
plugins: [], plugins: [],
mainLinks: [], mainLinks: [],
@ -298,6 +298,10 @@ export default boot<UserSessionState>(({ router, store, app }) => {
loadedPlugins.routes.forEach((route) => router.addRoute(route)); loadedPlugins.routes.forEach((route) => router.addRoute(route));
// save plugins in VM-variable // save plugins in VM-variable
<<<<<<< HEAD
console.log(store); console.log(store);
app.provide('flaschengeistPlugins', loadedPlugins); app.provide('flaschengeistPlugins', loadedPlugins);
=======
app.provide('flaschengeist', loadedPlugins);
>>>>>>> 3a1cb84... [Vue3] Fixed usage of plugins
}); });

View File

@ -24,7 +24,7 @@
<!-- Hier kommen die Shortlinks hin --> <!-- Hier kommen die Shortlinks hin -->
<div> <div>
<short-cut-link <short-cut-link
v-for="(shortcut, index) in plugins.shortcuts" v-for="(shortcut, index) in flaschengeist.shortcuts"
:key="'shortcut' + index" :key="'shortcut' + index"
:link="shortcut.link" :link="shortcut.link"
:icon="shortcut.icon" :icon="shortcut.icon"
@ -46,7 +46,7 @@
<!-- Plugins --> <!-- Plugins -->
<q-list> <q-list>
<essential-link <essential-link
v-for="(link, index) in plugins.mainLinks" v-for="(link, index) in flaschengeist.mainLinks"
:key="'plugin' + index" :key="'plugin' + index"
:title="link.title" :title="link.title"
:link="link.link" :link="link.link"
@ -137,7 +137,7 @@ export default defineComponent({
setup() { setup() {
const route = useRoute(); const route = useRoute();
const store = useStore(); const store = useStore();
const plugins = inject<FG_Plugin.LoadedPlugins>('flaschengeistPlugins'); const flaschengeist = inject<FG_Plugin.Flaschengeist>('flaschengeist');
const leftDrawer = ref(false); const leftDrawer = ref(false);
const leftDrawerOpen = ref( const leftDrawerOpen = ref(
@ -155,7 +155,7 @@ export default defineComponent({
} }
const pluginChildLinks = computed(() => { const pluginChildLinks = computed(() => {
const link: FG_Plugin.PluginMainLink | undefined = plugins?.mainLinks.find( const link: FG_Plugin.PluginMainLink | undefined = flaschengeist?.mainLinks.find(
(plugin: FG_Plugin.PluginMainLink) => { (plugin: FG_Plugin.PluginMainLink) => {
if (route.matched.length > 1) { if (route.matched.length > 1) {
return plugin.name == route.matched[1].name; return plugin.name == route.matched[1].name;
@ -185,7 +185,7 @@ export default defineComponent({
pluginChildLinks, pluginChildLinks,
shortcuts, shortcuts,
logout, logout,
plugins, flaschengeist,
}; };
}, },
}); });

View File

@ -10,7 +10,7 @@
</q-toolbar-title> </q-toolbar-title>
<div> <div>
<short-cut-link <short-cut-link
v-for="(shortcut, index) in plugins.shortcutsOut" v-for="(shortcut, index) in shortcuts"
:key="'shortcut' + index" :key="'shortcut' + index"
:link="shortcut.link" :link="shortcut.link"
:icon="shortcut.icon" :icon="shortcut.icon"
@ -50,8 +50,8 @@ export default defineComponent({
name: 'OutLayout', name: 'OutLayout',
components: { ShortCutLink }, components: { ShortCutLink },
setup() { setup() {
const plugins = inject<FG_Plugin.LoadedPlugins>('flaschengeistPlugins'); const shortcuts = inject<FG_Plugin.Flaschengeist>('flaschengeist')?.shortcutsOut || [];
return { plugins }; return { shortcuts };
}, },
}); });
</script> </script>

View File

@ -18,10 +18,10 @@ export default defineComponent({
name: 'Dashboard', name: 'Dashboard',
setup() { setup() {
const widgets = markRaw<Array<Component>>([]); const widgets = markRaw<Array<Component>>([]);
const flaschengeistPlugins = inject<FG_Plugin.LoadedPlugins>('flaschengeistPlugins'); const flaschengeist = inject<FG_Plugin.Flaschengeist>('flaschengeist');
onMounted(() => { onMounted(() => {
flaschengeistPlugins?.widgets.forEach((widget) => { flaschengeist?.widgets.forEach((widget) => {
if (hasPermissions(widget.permissions)) widgets.push(widget.widget); if (hasPermissions(widget.permissions)) widgets.push(widget.widget);
}); });
}); });

View File

@ -26,7 +26,7 @@
<div v-if="$route.name == 'about'" class="col-12 text-h6 q-pa-sm">Geladene Plugins:</div> <div v-if="$route.name == 'about'" class="col-12 text-h6 q-pa-sm">Geladene Plugins:</div>
<div v-if="$route.name == 'about'" class="col-12 q-pa-sm"> <div v-if="$route.name == 'about'" class="col-12 q-pa-sm">
<q-chip <q-chip
v-for="(plugin, index) in $flaschengeistPlugins.plugins" v-for="(plugin, index) in plugins"
:key="'plugin' + index" :key="'plugin' + index"
square square
:color="$q.dark.isActive ? 'accent' : ''" :color="$q.dark.isActive ? 'accent' : ''"
@ -59,8 +59,9 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent, inject } from 'vue';
import Developer from 'components/about/Developer.vue'; import Developer from 'components/about/Developer.vue';
import { FG_Plugin } from 'src/plugins';
const developers = [ const developers = [
{ {
@ -94,10 +95,11 @@ const developers = [
}, },
]; ];
export default defineComponent({ export default defineComponent({
// name: 'PageName' name: 'About',
components: { Developer }, components: { Developer },
setup() { setup() {
return { developers }; const plugins = inject<FG_Plugin.Flaschengeist>('flaschengeist')?.plugins || [];
return { developers, plugins };
}, },
}); });
</script> </script>

2
src/plugins.d.ts vendored
View File

@ -54,7 +54,7 @@ declare namespace FG_Plugin {
version: string; version: string;
} }
interface LoadedPlugins { interface Flaschengeist {
plugins: LoadedPlugin[]; plugins: LoadedPlugin[];
routes: RouteRecordRaw[]; routes: RouteRecordRaw[];
mainLinks: PluginMainLink[]; mainLinks: PluginMainLink[];