From a509495b9fb1c9f2326ee3768c3c5ea2377f3b9e Mon Sep 17 00:00:00 2001 From: Jiiks Date: Thu, 25 Jan 2018 14:46:53 +0200 Subject: [PATCH 1/6] Functional plugin reload --- client/src/modules/ui/components/bd/PluginsView.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/modules/ui/components/bd/PluginsView.vue b/client/src/modules/ui/components/bd/PluginsView.vue index 0e04b3e7..97d25375 100644 --- a/client/src/modules/ui/components/bd/PluginsView.vue +++ b/client/src/modules/ui/components/bd/PluginsView.vue @@ -15,6 +15,7 @@ async function refreshLocalPlugins() { try { await PluginManager.refreshPlugins(); + this.$forceUpdate(); } catch (err) { } @@ -36,8 +37,9 @@ } } - function reloadPlugin(plugin) { - this.pluginManager.reloadPlugin(plugin.name); + async function reloadPlugin(plugin) { + await this.pluginManager.reloadPlugin(plugin.name); + this.$forceUpdate(); } function showSettings(plugin) { From 5faaaa0276ed7f77c0bc805bbf97b63487d50424 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Thu, 25 Jan 2018 14:47:26 +0200 Subject: [PATCH 2/6] add todo --- client/src/modules/ui/components/bd/PluginsView.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/modules/ui/components/bd/PluginsView.vue b/client/src/modules/ui/components/bd/PluginsView.vue index 97d25375..33ab2de3 100644 --- a/client/src/modules/ui/components/bd/PluginsView.vue +++ b/client/src/modules/ui/components/bd/PluginsView.vue @@ -29,6 +29,7 @@ this.local = false; } + //TODO Display error if plugin fails to start/stop function togglePlugin(plugin) { if (plugin.enabled) { this.pluginManager.stopPlugin(plugin); From e66c1ce447aa154220d92bc777a2118031a0f53a Mon Sep 17 00:00:00 2001 From: Jiiks Date: Thu, 25 Jan 2018 14:50:07 +0200 Subject: [PATCH 3/6] Hide settings button if plugin doesn't have any settings --- client/src/modules/core/pluginmanager.js | 1 + .../src/modules/ui/components/bd/templates/PluginCard.html | 2 +- tests/plugins/Example 2/config.json | 6 +----- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/client/src/modules/core/pluginmanager.js b/client/src/modules/core/pluginmanager.js index 2f0be7c3..1c3d9fc6 100644 --- a/client/src/modules/core/pluginmanager.js +++ b/client/src/modules/core/pluginmanager.js @@ -17,6 +17,7 @@ class Plugin { constructor(pluginInternals) { this.__pluginInternals = pluginInternals; + this.hasSettings = this.pluginConfig && this.pluginConfig.length > 0; this.start = this.start.bind(this); this.stop = this.stop.bind(this); } diff --git a/client/src/modules/ui/components/bd/templates/PluginCard.html b/client/src/modules/ui/components/bd/templates/PluginCard.html index 9bd5c75a..0b82de6a 100644 --- a/client/src/modules/ui/components/bd/templates/PluginCard.html +++ b/client/src/modules/ui/components/bd/templates/PluginCard.html @@ -14,7 +14,7 @@
v{{plugin.version}} by {{plugin.authors.join(', ').replace(/,(?!.*,)/gmi, ' and')}}
- - - - - diff --git a/client/src/modules/ui/vueui.js b/client/src/modules/ui/vueui.js index e948eaa5..b36d79df 100644 --- a/client/src/modules/ui/vueui.js +++ b/client/src/modules/ui/vueui.js @@ -9,17 +9,28 @@ */ const $ = require('jquery'); -const Vue = require('vue'); +const Vue = require('vue').default; +const VTooltip = require('v-tooltip'); const BdSettingsWrapper = (require('./components/BdSettingsWrapper.vue')).default; class UI { constructor() { - $('body').append($('').append($('
', { + $('body').append($('') + .append($('
', { id: 'bd-settings' - }))); + })).append($(''))); - this.vueInstance = new Vue.default({ + Vue.use(VTooltip, { + defaultContainer: 'bdtooltips', + defaultClass: 'bd-tooltip', + defaultTargetClass: 'bd-has-tooltip', + defaultInnerSelector: '.bd-tooltip-inner', + defaultTemplate: '
' + }); + + + this.vueInstance = new Vue({ el: '#bd-settings', template: '', components: { BdSettingsWrapper } @@ -29,4 +40,6 @@ class UI { } -module.exports = { UI } \ No newline at end of file +module.exports = { UI } + + diff --git a/client/src/styles/partials/bdsettings/index.scss b/client/src/styles/partials/bdsettings/index.scss index 836a858b..66455ea4 100644 --- a/client/src/styles/partials/bdsettings/index.scss +++ b/client/src/styles/partials/bdsettings/index.scss @@ -2,3 +2,4 @@ @import './sidebarview.scss'; @import './plugins.scss'; @import './plugincard.scss'; +@import './tooltips.scss'; \ No newline at end of file diff --git a/client/src/styles/partials/bdsettings/tooltips.scss b/client/src/styles/partials/bdsettings/tooltips.scss new file mode 100644 index 00000000..7b789799 --- /dev/null +++ b/client/src/styles/partials/bdsettings/tooltips.scss @@ -0,0 +1,36 @@ +bdtooltips { + left: 0; + position: absolute; + right: 0; + top: 0; + z-index: 9000; +} + +.bd-tooltip { + background-color: #000; + border-radius: 5px; + box-shadow: 0 2px 10px 0 rgba(0,0,0,.2); + color: #dcddde; + contain: layout; + font-size: 14px; + font-weight: 500; + max-width: 190px; + padding: 8px 12px; + position: absolute; + word-wrap: break-word; + z-index: 9001; + margin-bottom: 10px; +} + +.bd-tooltip:after { + border: 5px solid transparent; + content: " "; + height: 0; + pointer-events: none; + width: 0; + border-top-color: #000; + left: 50%; + margin-left: -5px; + position: absolute; + top: 100%; +} diff --git a/package.json b/package.json index d252deaa..e29f5f2d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "gulp-watch": "^5.0.0", "codemirror": "^5.23.0", "vue-codemirror": "^4.0.3", - "vue-material-design-icons": "^1.0.0" + "vue-material-design-icons": "^1.0.0", + "v-tooltip": "^2.0.0-rc.30" }, "scripts": {