From 10c1b57c64ef86c73eb3c4dd63ef387ae007fa25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Wed, 14 Oct 2020 15:00:13 +0200 Subject: [PATCH 1/4] fixed bug: tag developer in home hatte kein 'key' --- src/pages/about/About.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/about/About.vue b/src/pages/about/About.vue index 231ef63..7781ae1 100644 --- a/src/pages/about/About.vue +++ b/src/pages/about/About.vue @@ -54,8 +54,8 @@ class="fit row inline wrap justify-around items-start content-start q-gutter-sm" > Date: Wed, 14 Oct 2020 17:13:03 +0200 Subject: [PATCH 2/4] update invertiertes Logo --- public/logo-dark.svg | 388 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 379 insertions(+), 9 deletions(-) diff --git a/public/logo-dark.svg b/public/logo-dark.svg index ce9ce36..6110815 100644 --- a/public/logo-dark.svg +++ b/public/logo-dark.svg @@ -12,7 +12,7 @@ id="svg3052" version="1.1" inkscape:version="0.48.5 r10040" - sodipodi:docname="Loewe_hellaufdunkel.svg"> + sodipodi:docname="Loewe_dunkelaufhell.svg"> @@ -21,6 +21,7 @@ image/svg+xml + @@ -43,16 +44,385 @@ fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" - inkscape:zoom="0.60299194" - inkscape:cx="269.43314" - inkscape:cy="330.40328" + inkscape:zoom="0.82402179" + inkscape:cx="262.55905" + inkscape:cy="317.95276" inkscape:window-x="0" inkscape:window-y="25" inkscape:window-maximized="1" - inkscape:current-layer="svg3052" /> + inkscape:current-layer="svg3052" + showguides="true" + inkscape:guide-bbox="true" /> + style="fill:#000000;stroke:none;stroke-opacity:1;fill-opacity:1" + d="m 302.43314,25.002222 c 6.553,9.444 14.412,5.55 25,7.665 22.576,4.51 46.413,3.319 66,17.335 -0.433,2.331 -0.861,4.626 -0.961,7.002 -0.803,19.117 28.163,-1.909 36.961,12.998 l -19,0 0,2 15,1 -1,3 c 5.604,0.015 14.814,-0.831 16,6 l 13,2 -2,4 16,5 0,1 -10,0 8,5 -11,3.999998 0,2 c 8.174,2.765 13.451,3.617 11,13 l 22,5 -1,6 15,7 c -0.397,7.726 5.939,9.128 12,12 l -2,2 6,9 -4,-1 9,11 -21,-10 7,8 -13,-5 0,1 13,8 0,1 -16,-6 19,13 0,1 -23,-8 17,16 -4,0 11,6 -4,6 11,0 c -3.583,5.677 -10.296,3.721 -16,3 l 5,7 -18,-1 17,48 -15,-9 18.197,80 9.803,63 -1,0 -12,-20 c -1.523,16.752 14.065,32.866 9,50 l -11,-28 -4,7 13,48 -1,0 -7,-8 2,22 -10,-7 0,36 -8,-11 -1,0 0,34 -11,-13 -1,0 -1,22 -1,0 -6,-13 -1,32 c -12.745,-6.973 -13.742,-30.391 -11,-43 l 1,0 5,19 c 4.199,-8.727 2,-23.253 2,-33 l 17,13 -1,-35 15,17 -5,-40 10,6 c -1.702,-13.395 -4.452,-26.656 -6.427,-40 -0.943,-6.366 -1.045,-12.426 -8.573,-13 l 6,17 -9,-7 8,19 -9,-5 2,29 -1,0 -10,-15 4,49 -18,-22 -1,32 -11,-11 -3,50 -1,0 -6,-22 -2,26 -8,-9 -1,38 -1,0 -5,-30 -5,16 -5,-8 -1,0 c -2.982,7.685 -6.474,24.104 -13,29 l 0,-7 c -10.929,10.907 -10.752,32.088 -16,46 l -1,0 -4,-28 -6,10 -6,-16 -2,0 -3,13 c -3.688,-2.807 -2.997,-7.717 -3,-12 l -9,10 0,-5 -6,8 -1,0 -6,-11 -7,37 -1,0 -4,-42 c -11.141,10.183 -8.273,27.757 -8,41 -8.508,-5.823 -9,-23.73 -9,-33 l -1,0 c -1.745,13.807 -0.665,41.737 -13,51 l -2,-31 -1,0 -3,32 -1,0 -5,-34 -6,12 -1,0 -1,-26 -7,6 0,-12 -6,8 1,-19 -4,6 -1,0 c 0,-9.624 -0.076,-14.927 9,-20 l 2,14 2,0 9,-11 c -0.092,11.067 -4.242,21.488 5,30 l 3,-17 1,0 5,21 1,0 12,-35 1,0 3,14 c 8.296,-4.708 12.803,-20.878 17.734,-28.985 7.513,-12.353 16.391,-25.551 25.281,-37.015 6.304,-8.13 14.962,-16.495 18.985,-26 l -10,6 16,-26 -12,10 16,-54 -32,32 10,-1 -6,9 9,-3 -9,12 7,-3 -16,33 7,-2 -6.637,12.012 -9.548,5.132 -14.815,24.856 -1,-4 -1,0 -2,8 -7,-8 -4,21 -1,0 -1,-3 -1,0 -3,13 -2,0 -6,-10 -1,0 -9,-0.758 -14,3.758 -2,0 c -2.337,-2.413 -3.336,-3.233 -6,-1 l -3,0 -1,-3 -1,0 -2,15 -1,0 -2,-14 -1,0 -3,21 -11,-13 1,8 -1,0 -4,-9 -2,9 -2,0 -7,-28 -4,8 -1,0 -3,-14 -4,7 -1,0 -1,-12 -3,2 -5,-3 -3.6,-38.985 -14.4,-18.015 2,0 -9,-17 3,1 -3,-23 -6,4 1,-18 -5,4 0,-7 -5.609,14 -7.923,20 -0.468,43 -1,0 -4,-5 0,31 -1,0 -5,-18 -1,0 -1,6 -1,0 -1,-8 -4,7 -5,-3 -8,10 12,-42 1,0 0,8 6.91,-21 12.09,-46 1,0 1,3 5,-32 1,0 5,5 1,-18 -3,4 -2,0 -6,-10 0,-9 -3,2 0,-6 -10,6 c 1.372,-6.806 7.595,-12.902 13,-17 l 1,3 4,-3 -1,7 8,-9 0,17 6,-3 0,14 3,-2 1,0 -6,21 3,-3 1,0 1,9 1,0 2,-5 1,0 c -1.173,14.859 -7.608,31.588 7,42 l 2,19 5,0 -4,9 5,-2 c 5.22,10.662 5.302,21.605 5,33 l 3,-2 4,3 -1,7 5,-4 -6,24 3,-3 1,0 3,5 0,4 4,-2 -2,6 7,-4 6,0 -6,13 6,-4 0,6 4,-4 1,0 -2,17 7,-7 c 1.499,4.719 1.798,9.422 7,11 l 0,9 8,-24 1,0 2,6 2,0 4,-7 1,4 1,0 3,-8 1,0 1,8 2,0 1,-6 1,0 2,5 3,-4 4,6 1,-5 3,3 3,0 0,-3 3,4 2,0 1,-5 1,0 1,3 1,0 1,-4 1,0 1,12 1,0 5,-19 1,0 1,10 1,0 1,-18 1,0 8,6 0,-12 9,9 -3,-16 5,2 -1,-8 1,-1 5,0 -4,-9 6,2 0,-11 4,0 -5,-13 5,2 c 0,-6.318 -1.168,-13.973 0.969,-20 7.838,-22.108 30.482,-42.303 21.031,-67 l 5,1 1,-1 -1,-18 5,2 -1,-11 5,4 c -0.982,-7.762 -2.973,-20.126 5,-25 l 0,12 1,0 c 2.297,-5.61 4.881,-4.758 10,-3 l -3,-22 1,0 4,7 -1,-26 1,0 6,12 c -0.802,-4.322 -0.184,-10.13 -2.742,-13.826 -10.862,-15.694 -38.618,-21.294 -46.258,-39.174 l 47,34 c -2.72,-12.83 -3.796,-30.406 -11.363,-41.891 -2.722,-4.133 -14.033,-7.517 -18.073,-3.621 -2.839,2.737 -3.392,8.846 -4.564,12.512 l -1,0 c -0.039,-14.058 -6.361,-15.552 -18,-19 7.003,-6.759 12.896,-5.634 13,-18 l -5,-1 c 1.515,-6.349 -2.328,-8.461 -7,-12.2 -13.444,-10.76 -20.833,-5.938 -36,-1.8 1.216,-5.303 10.331,-14.962 1.978,-18.214 -8.992,-3.5 -14.48,15.03 -19.397,19.245 -12.527,10.737 -39.528,19.173 -29.738,41.969 2.256,5.251 7.628,8.005 10.157,13 l -14,2 2,8 17,-10 1,1 -2,5 c 6.86,2.018 9.941,5.484 17,2 l -1,5 35,13 -17,-14 c 10.764,4.08 18.773,14.392 30,17.433 7.449,2.018 10.851,-4.71 7,-10.433 2.921,-5.846 -0.958,-11.131 -2,-17 l 5,-2 c 12.807,16.076 30.348,22.607 37,44 l -8,-11 -1,0 3,21 -4,-2 2,11 -4,-2 0,8 -1,0 -3,-3 -3,16 -1,0 -2,-28 6,3 1,-1 -6,-28 3,1 c -4.124,-9.905 -9.171,-17.105 -19,-22 1.719,5.423 4.318,12.256 3.737,18 -0.558,5.515 -3.889,10.336 -3.104,16 5.042,36.352 -3.804,70.18 -9.337,106 -3.204,20.746 -7.584,46.892 -22.389,63 -10.983,11.948 -21.241,9 -35.907,9 -14.368,0 -28.701,0.826 -43,0.996 -9.004,0.107 -18.733,1.445 -25.791,-5.325 -10.703,-10.265 -11.365,-34.39 -13.209,-48.671 l -6,2 3,-6 -1,-1 -4,1 2,-4 -4,-2 c 10.758,-6.06 5.872,-12.082 0,-20 l 5,0 -7,-7 5,1 c 1.778,-11.174 -3.009,-24.094 -5.339,-35 -3.794,-17.755 -5.373,-38.062 -11.929,-55 -3.262,-8.43 -13.447,-13.698 -14.732,-22 3.267,2.557 6.448,6.926 10.715,7.792 10.344,2.098 17.856,-15.874 27.285,-17.792 l -4,7 3,-1 c -4.284,13.728 -0.505,48.136 11,58 1.83,-14.403 13.252,-47.552 0,-57 l 3,-11 -12,4 0,-1 c 9.395,-4.395 21.382,-4.23 30,-9.089 29.29,-16.512 -8.211,-43.176 -19.606,-56.197 -3.301,-3.772 -4.298,-9.229 -6.394,-13.714 3.095,0.231 7.862,3.562 10.586,2.663 4.855,-1.603 6.08,-6.106 12.414,-6.573 10.306,-0.76 20.744,2.367 31,0.581 12.074,-2.101 23.947,-9.212 33,3.329 l 1,0 6,-8 -5,0 c 0.361,-7.57 -5.294,-13.578 -13,-14.631 -8.26,-1.129 -15.823,4.604 -24,4.6 -7.875,-0.003 -12.585,-6.636 -20,-7.755 -7.889,-1.19 -14.844,4.349 -22,6.786 6.045,-7.472 17.29,-12.544 27,-9.437 4.673,1.496 8.019,6.153 13,6.844 7.068,0.981 14.797,-4.818 22,-5.407 -5.357,-9.504 -16.186,-6.702 -25,-6 l 1,-3 -12,1 -2,-11 14,-6 -2,8 8,-4 c 0.201,17.03 15.531,2.556 22,-2 l 0,6 13,-3 12,10 -28,3 c 2.071,6.623 8.76,5.91 14,8.818 10.845,6.018 22.287,19.855 35,15.182 l -22,-14 c 8.955,-2.572 28.466,8.679 28.899,-9 0.051,-2.072 -0.431,-4.149 -1.356,-6 -2.59,-5.185 -7.349,-8.083 -8.543,-14 6.427,3.717 11.598,9.366 12.659,17 0.652,4.69 -2.24,8.225 1.341,12 l -1,7 -5,5 16.015,0.298 15.985,7.702 -1,4 c 12.432,-2.309 11.264,-7.379 -1,-10 l 0,-4 -15,-4 12,-17 -8,4 0,-3 -4,1 2,-10 c -3.228,-0.692 -3.02,-2.101 -2,-5 l -6,0 1,-4 -10,0 5,-8 -6,-1 1,-3 -1,-1 -14,-0.481 -15,8.481 c 6.671,-10.725 16.999,-15.137 17,-28 -4.652,0.358 -13.348,2.461 -17.566,-0.113 -5.767,-3.52 -2.434,-25.706998 -2.434,-31.886998 -8.701,6.72 -17.549,22.939 -17,33.999998 l 9,-9 c -2.702,8.307 -1.856,21.834 -6.742,28.826 -10.416,14.907 -22.246,8.081 -22.258,-7.826 l 1,0 1,5 4,-2 2,5 4,-23 1,0 2,4 c 3.04,-7.895 4.045,-15.846998 -3,-21.999998 l 0,7 -9,-6 0,5 -9,-6 4,18.999998 -12,-9.999998 -1,7.999998 -9,-4 4,8 -27,-10.999998 13,14.999998 -16,-5 3,4 0,1 -14,1 2,7 -14,0.236 -12,9.215 -10.715,4.392 -15.285,17.157 3,0 0,1 0,1 -7,4 c 0.397,4.632 -1.859,6.375 -6,8 l 1,4 -7,3 0,2 3,1 0,2 c -3.61,2.579 -15.288,8.272 -11,13 -6.063,4.494 -11.166,10.289 -19,11 l 0,2 11,-1 0,1 -10,8 c 7.394,0.061 29.355,8.52 32,0 l -9,-3 0,-1 c 5.877,1.011 10.392,4.372 14,-2 l 1,0 c 3.707,12.617 20.008,13.517 31,17 l 0,1 -31,-8 c 0.721,6.402 9.521,6.613 14,10 -5.827,1.598 -11.814,-4.179 -16.682,-2.502 -3.775,1.301 -1.79,6.656 0.83,7.938 4.061,1.987 8.895,0.675 11.852,4.564 -9.226,-0.397 -18.73,-4.131 -28,-3.44 -4.565,0.341 -9.36,3.024 -14,3.9 -2.94,0.554 -12.636004,0.922 -13.369004,4.62 -0.775,3.912 8.370004,2.92 10.369004,2.92 12.122,0.001 24.983,1.283 37,0 l 1,1 0,2 -1,1 c -11.561,-2.146 -18.333,0.041 -27,8 l 5,-2 -1,4 30,-4 0,2 c -12.567,-0.732 -33.699,1.863 -40,14 l 4,-1 0,1 c -9.819,6.061 -25.237004,14.023 -32.181004,23.3 -6.779,9.057 -10.526,27.68 -12.819,38.7 l -1,0 3,-19 -1,0 -10,16 c -2.498,-14.774 1.035,-40.26 13,-50 l -5,16 c 8.067,-7.132 18.773,-17.017 23,-27 l -11,2 0,-1 c 9.503,-3.296 16.024,-4.253 21.000004,-14 l -10.000004,7 c 2.699,-7.018 6.952,-14.558 15.000004,-15 l 0,-1 -10.000004,1 -1,-3 -8,8 8,-4 -16,22 0,1 -11,5 0,-1 12,-18 -7,3 5,-13 -23,6 0,-1 17.301,-7.563 6.699,-15.437 -5,1 1,-4 -15,1 5,-9 -9,3 5,-16 -5,1 12,-22 -10,2 11,-17 -12,2 12,-22 -3,0 0,-1 7,-10 -5,0 7,-12 -6,0 8,-11 -5,-1 0,-1 c 8.407,-4.414 19.444,-10.321 16,-20.999998 l 21.000004,-3 -5,-5 c 3.732,-7.998 8.908,-9.324 17,-9 l -1,3 7,2 -7,3 5,6 -7,0 19,11.999998 0,1 -34,-7.999998 c 10.46,14.683998 35.82,12.379998 51,19.999998 l 0,1 c -4.524,-0.013 -9.571,-1.434 -14,-0.641 -4.959,0.887 -8.667,5.02 -13,7.314 -9.424,4.989 -19.374,5.948 -25,16.327 l 10,-3 -24.000004,19 11.000004,-3 -9.000004,13 12.000004,-7 -34.000004,37 7,-3 -14,24 1,1 17,-6 -12,14 c 12.488,0 18.897,-8.944 26,-19 l -5,1 11.000004,-15 -5.000004,0 19.000004,-17 -28.000004,16 c 4.527,-10.562 16.950004,-17.117 26.000004,-23.611 3.202,-2.298 10.865,-5.128 7,-9.389 l 12,-9 -4,0 0,-1 6,-6 -20,7 0,-1 27,-14 -1,-2 16,-5 -2,-4 18,0 -1,-4 7,0 -3,-5 10,-1 0,-2 -7,-3 4,-5 -21,-8.999998 0,-1 19,4 0,-1 -16,-8 0,-1 12,4 -12,-11 -13,6 -1,-1 c 7.934,-12.252 20.873,-3.833 31,-2 l -7,-8 c 28.505,-0.019 57.217,-3.954 86,-4 7.973,-0.013 27.035,3.256 33.682,-1.179 4.91,-3.276 3.182,-18.329 4.636,-23.767 0.867,-3.241 4.144,-5.136 5.682,-8.054 -2.728,0.016 -4.525,-2.863 -8,-3 -49.181,-1.94 -104.881,-3.021 -151,15 l -1,-1 c 6.345,-9.899 25.583,-9.786 36,-12.373 40.292,-10.009 82.797,0.837 123,-6.627 l 0,-4" + id="path3358" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 4324681b753bc787bb2c66fbaf6b4f1da4a73427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Wed, 14 Oct 2020 22:27:20 +0200 Subject: [PATCH 3/4] =?UTF-8?q?ShortCuts=20und=20Versionen=20hinzugef?= =?UTF-8?q?=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Code leicht aufgerÀumt und verbessert. --- src/boot/plugins.ts | 165 +++++++++++------- src/components/CompositionComponent.vue | 59 ------- .../navigation/PluginChildrenLinks.vue | 27 --- src/components/navigation/ShortCutLink.vue | 20 +++ src/layouts/MainLayout.vue | 37 +++- src/pages/Index.vue | 49 ------ src/pages/about/About.vue | 4 +- src/plugins/plugin-example/pages/Plugin.vue | 2 +- src/plugins/plugin-example/plugin.ts | 5 +- src/plugins/user-plugin/pages/Plugin.vue | 2 +- src/plugins/user-plugin/plugin.ts | 14 +- src/plugins/user/pages/User.vue | 2 +- src/plugins/user/plugin.ts | 5 +- 13 files changed, 177 insertions(+), 214 deletions(-) delete mode 100644 src/components/CompositionComponent.vue delete mode 100644 src/components/navigation/PluginChildrenLinks.vue create mode 100644 src/components/navigation/ShortCutLink.vue delete mode 100644 src/pages/Index.vue diff --git a/src/boot/plugins.ts b/src/boot/plugins.ts index f4eeede..9a9dd7c 100644 --- a/src/boot/plugins.ts +++ b/src/boot/plugins.ts @@ -2,22 +2,29 @@ import { boot } from 'quasar/wrappers'; import { RouteConfig } from 'vue-router'; import { Module } from 'vuex'; -interface PluginRouteConfig extends RouteConfig { - example?: unknown; -} +const config = { + // Do not change required Modules !! + requiredModules: ['user'], + // here you can import plugins. + loadModules: ['plugin1', 'user-plugin'] +}; -interface EssentialLink { - title: string; +// do not change anything here !! + +interface ShortCutLink { link: string; - icon?: string; + icon: string; } interface Plugin { name: string; - routes: PluginRouteConfig[] | RouteConfig[]; + routes: RouteConfig[]; store?: Module[]; mainLink: PluginMainLink; requiredModules: string[]; + shortCuts: ShortCutLink[]; + shortCutsOut: ShortCutLink[]; + version: string; } interface PluginMainLink extends PluginChildLink { @@ -31,15 +38,29 @@ interface PluginChildLink { icon: string; } -const config = { - // Do not change required Modules !! - requiredModules: ['user'], - // here you can import plugins. - loadModules: ['plugin1', 'user-plugin'] +interface LoadedPlugin { + name: string; + version: string; +} + +interface LoadedPlugins { + plugins: LoadedPlugin[]; + routes: RouteConfig[]; + mainLinks: PluginMainLink[]; + shortcuts: ShortCutLink[]; + shortcutsOut: ShortCutLink[]; +} + +export { + Plugin, + PluginChildLink, + PluginMainLink, + ShortCutLink, + LoadedPlugins, + LoadedPlugin }; -export { PluginRouteConfig, Plugin, PluginChildLink, PluginMainLink }; - +// combine routes from source to target function combineRoutes( target: RouteConfig[], source: RouteConfig[] @@ -52,6 +73,7 @@ function combineRoutes( } ); if (targetRouteConfig) { + // if exists first layer in target exist iterate through 2nd layer e.g. /main/user, /main/about sourceRouteConfig.children?.forEach( (sourcePluginChildRouteConfig: RouteConfig) => { const targetPluginRouteConfig: @@ -62,16 +84,20 @@ function combineRoutes( } ); if (targetPluginRouteConfig) { + // if 2nd layer in target exist check if target has children path. if (targetPluginRouteConfig.children) { + // if target has children path, add children from source. targetPluginRouteConfig.children = Object.assign( targetPluginRouteConfig.children, sourcePluginChildRouteConfig.children ); } else { + // if not set children of targen from children of source targetPluginRouteConfig.children = sourcePluginChildRouteConfig.children; } } else { + // if target not exists in 2nd layer, add source to children of first targen // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore targetRouteConfig.children.push(sourcePluginChildRouteConfig); @@ -79,90 +105,105 @@ function combineRoutes( } ); } else { + // if target not exists in first layer, add source target.push(sourceRouteConfig); } }); return target; } +// combine Links of Plugins from source to target function combineMainLinks( target: PluginMainLink[], source: PluginMainLink ): PluginMainLink[] { - console.log('target', target); - console.log('source', source); const targetPluginMainLink: PluginMainLink | undefined = target.find( (targetPluginMainLink: PluginMainLink) => { console.log(targetPluginMainLink.title, source.title); return targetPluginMainLink.title == source.title; } ); - console.log('targetPluginMainLink', targetPluginMainLink); if (targetPluginMainLink) { source.children.forEach((sourcePluginChildLink: PluginChildLink) => { targetPluginMainLink.children.push(sourcePluginChildLink); }); } else { - console.log('push source', source); target.push(source); } - console.log('merged', target); return target; } +// loade plugins +function loadPlugin( + loadedPlugins: LoadedPlugins, + modules: string[], + plugins: Plugin[], + store: any +): LoadedPlugins { + modules.forEach(requiredModule => { + const plugin = plugins.find(plugin => { + return plugin.name == requiredModule; + }); + if (plugin) { + loadedPlugins.routes = combineRoutes(loadedPlugins.routes, plugin.routes); + if (plugin.store) { + plugin.store.forEach(store_module => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access + store.registerModule(store_module); + }); + } + loadedPlugins.mainLinks = combineMainLinks( + loadedPlugins.mainLinks, + plugin.mainLink + ); + loadedPlugins.shortcuts.concat(plugin.shortCuts); + loadedPlugins.shortcutsOut.concat(plugin.shortCutsOut); + loadedPlugins.plugins.push({ + name: plugin.name, + version: plugin.version + }); + } else { + console.exception(`Don't find required Plugin ${requiredModule}`); + } + }); + return loadedPlugins; +} + // "async" is optional; // more info on params: https://quasar.dev/quasar-cli/cli-documentation/boot-files#Anatomy-of-a-boot-file export default boot(({ Vue, router, store }) => { - const pluginsContext = require.context('src/plugins', true, /.+\/plugin.ts$/); - let pluginMainLinks: PluginMainLink[] = []; const plugins: Plugin[] = []; + let loadedPlugins: LoadedPlugins = { + routes: [], + plugins: [], + mainLinks: [], + shortcuts: [], + shortcutsOut: [] + }; + + // get all plugins + const pluginsContext = require.context('src/plugins', true, /.+\/plugin.ts$/); pluginsContext.keys().forEach((fileName: string) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access plugins.push(pluginsContext(fileName).default); }); - let routes: RouteConfig[] = []; + // load plugins + loadedPlugins = loadPlugin( + loadedPlugins, + config.requiredModules, + plugins, + store + ); + loadedPlugins = loadPlugin(loadedPlugins, config.loadModules, plugins, store); - config.requiredModules.forEach(requiredModule => { - const plugin = plugins.find(plugin => { - return plugin.name == requiredModule; - }); - if (plugin) { - routes = combineRoutes(routes, plugin.routes); - if (plugin.store) { - plugin.store.forEach(store_module => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access - store.registerModule(store_module); - }); - } - pluginMainLinks = combineMainLinks(pluginMainLinks, plugin.mainLink); - } else { - console.exception(`Don't find required Plugin ${requiredModule}`); - } - }); + console.log(loadedPlugins.routes); - config.loadModules.forEach(loadModule => { - const plugin = plugins.find(plugin => { - return plugin.name == loadModule; - }); - if (plugin) { - routes = combineRoutes(routes, plugin.routes); - if (plugin.store) { - plugin.store.forEach(store_module => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access - store.registerModule(store_module); - }); - } - pluginMainLinks = combineMainLinks(pluginMainLinks, plugin.mainLink); - } else { - console.exception(`Don't find Plugin ${loadModule}`); - } - }); - console.log(routes); - router.addRoutes(routes); + // add new routes for plugins + router.addRoutes(loadedPlugins.routes); + + // save plugins in VM-variable // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - Vue.prototype.$flaschengeistPluginsMainLinks = pluginMainLinks; - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - Vue.prototype.$flaschengeistPlugins = plugins; - console.log(pluginMainLinks); + Vue.prototype.$flaschengeistPlugins = loadedPlugins; + console.log(loadedPlugins); }); diff --git a/src/components/CompositionComponent.vue b/src/components/CompositionComponent.vue deleted file mode 100644 index 22b4bd7..0000000 --- a/src/components/CompositionComponent.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - diff --git a/src/components/navigation/PluginChildrenLinks.vue b/src/components/navigation/PluginChildrenLinks.vue deleted file mode 100644 index 1f81695..0000000 --- a/src/components/navigation/PluginChildrenLinks.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - diff --git a/src/components/navigation/ShortCutLink.vue b/src/components/navigation/ShortCutLink.vue new file mode 100644 index 0000000..6a0a446 --- /dev/null +++ b/src/components/navigation/ShortCutLink.vue @@ -0,0 +1,20 @@ + + + diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index e5d2370..203aa4f 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -23,8 +23,12 @@
- - +
import EssentialLink from 'components/navigation/EssentialLink.vue'; +import ShortCutLink from 'components/navigation/ShortCutLink.vue'; import { Screen } from 'quasar'; -import { PluginMainLink } from 'boot/plugins'; +import { LoadedPlugins, PluginMainLink } from 'boot/plugins'; import { defineComponent, ref, computed } from '@vue/composition-api'; const links = [ @@ -114,15 +119,30 @@ const links = [ } ]; +const shortcuts = [ + { + link: 'about', + icon: 'mdi-information' + }, + { + link: 'user', + icon: 'mdi-account' + }, + { + link: 'user-plugin1', + icon: 'mdi-account-plus' + } +]; + declare module 'vue/types/vue' { interface Vue { - $flaschengeistPluginsMainLinks: PluginMainLink[]; + $flaschengeistPlugins: LoadedPlugins; } } export default defineComponent({ name: 'MainLayout', - components: { EssentialLink }, + components: { EssentialLink, ShortCutLink }, setup(_, ctx) { const leftDrawer = ref(false); @@ -142,7 +162,7 @@ export default defineComponent({ const pluginChildLinks = computed(() => { const test: | PluginMainLink - | undefined = ctx.root.$flaschengeistPluginsMainLinks.find( + | undefined = ctx.root.$flaschengeistPlugins.mainLinks.find( (plugin: PluginMainLink) => { if (ctx.root.$route.matched.length > 1) { return plugin.name == ctx.root.$route.matched[1].name; @@ -170,7 +190,8 @@ export default defineComponent({ leftDrawerClicker, links, pluginChildLinks, - showRoute + showRoute, + shortcuts }; } }); diff --git a/src/pages/Index.vue b/src/pages/Index.vue deleted file mode 100644 index 1d56395..0000000 --- a/src/pages/Index.vue +++ /dev/null @@ -1,49 +0,0 @@ - - - diff --git a/src/pages/about/About.vue b/src/pages/about/About.vue index 7781ae1..e6e5c63 100644 --- a/src/pages/about/About.vue +++ b/src/pages/about/About.vue @@ -36,12 +36,12 @@ {{ plugin.name }} - Version + {{ plugin.version }} diff --git a/src/plugins/plugin-example/pages/Plugin.vue b/src/plugins/plugin-example/pages/Plugin.vue index 0beeb75..c0fd5a6 100644 --- a/src/plugins/plugin-example/pages/Plugin.vue +++ b/src/plugins/plugin-example/pages/Plugin.vue @@ -15,7 +15,7 @@ import { mainLink } from '../plugin'; export default defineComponent({ // name: 'PageName' setup(_, ctx) { - const a = ctx.root.$flaschengeistPluginsMainLinks; + const a = ctx.root.$flaschengeistPlugins.mainLinks; return { a, mainLink }; } }); diff --git a/src/plugins/plugin-example/plugin.ts b/src/plugins/plugin-example/plugin.ts index 8708048..ce84cc2 100644 --- a/src/plugins/plugin-example/plugin.ts +++ b/src/plugins/plugin-example/plugin.ts @@ -26,7 +26,10 @@ const plugin: Plugin = { routes, mainLink, name: mainLink.name, - requiredModules: [] + requiredModules: [], + shortCuts: [], + shortCutsOut: [], + version: '1.0.2' }; export { mainLink }; diff --git a/src/plugins/user-plugin/pages/Plugin.vue b/src/plugins/user-plugin/pages/Plugin.vue index 0beeb75..c0fd5a6 100644 --- a/src/plugins/user-plugin/pages/Plugin.vue +++ b/src/plugins/user-plugin/pages/Plugin.vue @@ -15,7 +15,7 @@ import { mainLink } from '../plugin'; export default defineComponent({ // name: 'PageName' setup(_, ctx) { - const a = ctx.root.$flaschengeistPluginsMainLinks; + const a = ctx.root.$flaschengeistPlugins.mainLinks; return { a, mainLink }; } }); diff --git a/src/plugins/user-plugin/plugin.ts b/src/plugins/user-plugin/plugin.ts index e850196..beeb0a9 100644 --- a/src/plugins/user-plugin/plugin.ts +++ b/src/plugins/user-plugin/plugin.ts @@ -1,4 +1,4 @@ -import { Plugin, PluginMainLink } from 'boot/plugins'; +import { Plugin, PluginMainLink, ShortCutLink } from 'boot/plugins'; import routes from './routes'; const mainLink: PluginMainLink = { @@ -22,11 +22,21 @@ const mainLink: PluginMainLink = { ] }; +const shortCuts: ShortCutLink[] = [ + { + link: 'user-plugin2', + icon: 'mdi-account-minus' + } +]; + const plugin: Plugin = { routes, mainLink, name: mainLink.name, - requiredModules: ['user'] + requiredModules: ['user'], + shortCuts, + shortCutsOut: [], + version: '0.1.0' }; export { mainLink }; diff --git a/src/plugins/user/pages/User.vue b/src/plugins/user/pages/User.vue index 7ac07fd..5acf604 100644 --- a/src/plugins/user/pages/User.vue +++ b/src/plugins/user/pages/User.vue @@ -21,7 +21,7 @@ import { mainLink } from '../plugin'; export default defineComponent({ // name: 'PageName' setup(_, ctx) { - const a = ctx.root.$flaschengeistPluginsMainLinks; + const a = ctx.root.$flaschengeistPlugins.mainLinks; return { a, mainLink }; } }); diff --git a/src/plugins/user/plugin.ts b/src/plugins/user/plugin.ts index 7a04344..d977e55 100644 --- a/src/plugins/user/plugin.ts +++ b/src/plugins/user/plugin.ts @@ -13,7 +13,10 @@ const plugin: Plugin = { routes, mainLink, name: mainLink.name, - requiredModules: [] + requiredModules: [], + shortCutsOut: [], + shortCuts: [], + version: '0.0.1' }; export { mainLink }; From 01afa232c40aa7e68d212f82adc40f1ee66bd6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Wed, 14 Oct 2020 22:41:50 +0200 Subject: [PATCH 4/4] Zeigt jetzt auch die ShortCuts an. About-Page wurde noch ein bisschen angepasst. --- src/boot/plugins.ts | 13 +++++++++---- src/layouts/OutLayout.vue | 12 +++++++++++- src/pages/about/About.vue | 2 +- src/plugins/plugin-example/plugin.ts | 6 +++--- src/plugins/user-plugin/plugin.ts | 6 +++--- src/plugins/user/plugin.ts | 4 ++-- 6 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/boot/plugins.ts b/src/boot/plugins.ts index 9a9dd7c..fc0ed43 100644 --- a/src/boot/plugins.ts +++ b/src/boot/plugins.ts @@ -22,8 +22,8 @@ interface Plugin { store?: Module[]; mainLink: PluginMainLink; requiredModules: string[]; - shortCuts: ShortCutLink[]; - shortCutsOut: ShortCutLink[]; + shortcuts: ShortCutLink[]; + shortcutsOut: ShortCutLink[]; version: string; } @@ -156,8 +156,12 @@ function loadPlugin( loadedPlugins.mainLinks, plugin.mainLink ); - loadedPlugins.shortcuts.concat(plugin.shortCuts); - loadedPlugins.shortcutsOut.concat(plugin.shortCutsOut); + loadedPlugins.shortcuts = loadedPlugins.shortcuts.concat( + plugin.shortcuts + ); + loadedPlugins.shortcutsOut = loadedPlugins.shortcutsOut.concat( + plugin.shortcutsOut + ); loadedPlugins.plugins.push({ name: plugin.name, version: plugin.version @@ -206,4 +210,5 @@ export default boot(({ Vue, router, store }) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access Vue.prototype.$flaschengeistPlugins = loadedPlugins; console.log(loadedPlugins); + console.log(Vue.prototype.$flaschengeistPlugins); }); diff --git a/src/layouts/OutLayout.vue b/src/layouts/OutLayout.vue index 9c4807e..858735e 100644 --- a/src/layouts/OutLayout.vue +++ b/src/layouts/OutLayout.vue @@ -13,6 +13,14 @@ Flaschengeist +
+ +
import { defineComponent } from '@vue/composition-api'; +import ShortCutLink from 'components/navigation/ShortCutLink.vue'; export default defineComponent({ - name: 'OutLayout' + name: 'OutLayout', + components: { ShortCutLink } }); diff --git a/src/pages/about/About.vue b/src/pages/about/About.vue index e6e5c63..24cf4b7 100644 --- a/src/pages/about/About.vue +++ b/src/pages/about/About.vue @@ -4,7 +4,7 @@ class="fit row justify-center content-center items-center" v-if="$route.name == 'about' || $route.name == 'about_out'" > - + diff --git a/src/plugins/plugin-example/plugin.ts b/src/plugins/plugin-example/plugin.ts index ce84cc2..ff47cdd 100644 --- a/src/plugins/plugin-example/plugin.ts +++ b/src/plugins/plugin-example/plugin.ts @@ -1,4 +1,4 @@ -import { Plugin, PluginMainLink } from 'boot/plugins'; +import { Plugin, PluginMainLink, ShortCutLink } from 'boot/plugins'; import routes from 'src/plugins/plugin-example/routes'; const mainLink: PluginMainLink = { @@ -27,8 +27,8 @@ const plugin: Plugin = { mainLink, name: mainLink.name, requiredModules: [], - shortCuts: [], - shortCutsOut: [], + shortcuts: [], + shortcutsOut: [], version: '1.0.2' }; diff --git a/src/plugins/user-plugin/plugin.ts b/src/plugins/user-plugin/plugin.ts index beeb0a9..45e5641 100644 --- a/src/plugins/user-plugin/plugin.ts +++ b/src/plugins/user-plugin/plugin.ts @@ -22,7 +22,7 @@ const mainLink: PluginMainLink = { ] }; -const shortCuts: ShortCutLink[] = [ +const shortcuts: ShortCutLink[] = [ { link: 'user-plugin2', icon: 'mdi-account-minus' @@ -34,8 +34,8 @@ const plugin: Plugin = { mainLink, name: mainLink.name, requiredModules: ['user'], - shortCuts, - shortCutsOut: [], + shortcuts, + shortcutsOut: [], version: '0.1.0' }; diff --git a/src/plugins/user/plugin.ts b/src/plugins/user/plugin.ts index d977e55..3bef5f6 100644 --- a/src/plugins/user/plugin.ts +++ b/src/plugins/user/plugin.ts @@ -14,8 +14,8 @@ const plugin: Plugin = { mainLink, name: mainLink.name, requiredModules: [], - shortCutsOut: [], - shortCuts: [], + shortcutsOut: [], + shortcuts: [], version: '0.0.1' };