From a6488e15fe7e081ea501896abc5886a647bab1d6 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 8 Dec 2019 17:33:21 +0100 Subject: [PATCH] Don't treat the execute tab as a special tab in the web panel, otherwise configurations with enabled_plugins/disabled_plugins won't work with it --- platypush/backend/http/app/routes/index.py | 8 ++++++-- platypush/backend/http/static/js/plugins/execute/index.js | 2 +- platypush/backend/http/templates/index.html | 7 +------ platypush/backend/http/templates/nav.html | 6 ------ 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/platypush/backend/http/app/routes/index.py b/platypush/backend/http/app/routes/index.py index da6eccf5..375344a2 100644 --- a/platypush/backend/http/app/routes/index.py +++ b/platypush/backend/http/app/routes/index.py @@ -1,3 +1,4 @@ +import json import os from flask import Blueprint, render_template, request @@ -31,6 +32,7 @@ def index(): if plugin not in configured_plugins: configured_plugins[plugin] = {} + configured_plugins['execute'] = {} disabled_plugins = set(request.args.get('disabled_plugins', '').split(',')) js_folder = os.path.abspath( @@ -38,8 +40,10 @@ def index(): style_folder = os.path.abspath( os.path.join(template_folder, '..', 'static', 'css', 'dist')) - for plugin, conf in configured_plugins.items(): + for plugin, conf in configured_plugins.copy().items(): if plugin in disabled_plugins: + if plugin == 'execute': + configured_plugins.pop('execute') continue template_file = os.path.join( @@ -67,7 +71,7 @@ def index(): websocket_port=get_websocket_port(), template_folder=template_folder, static_folder=static_folder, plugins=Config.get_plugins(), backends=Config.get_backends(), - procedures=Config.get_procedures(), + procedures=json.dumps(Config.get_procedures()), has_ssl=http_conf.get('ssl_cert') is not None) diff --git a/platypush/backend/http/static/js/plugins/execute/index.js b/platypush/backend/http/static/js/plugins/execute/index.js index 14e22959..ffa8b574 100644 --- a/platypush/backend/http/static/js/plugins/execute/index.js +++ b/platypush/backend/http/static/js/plugins/execute/index.js @@ -32,7 +32,7 @@ Vue.component('execute', { methods: { refresh: async function() { this.loading = true; - this.procedures = JSON.parse(this.config); + this.procedures = window.config.procedures; this.plugins = await request('inspect.get_all_plugins', {html_doc: true}); for (const plugin of Object.values(this.plugins)) { diff --git a/platypush/backend/http/templates/index.html b/platypush/backend/http/templates/index.html index 910d8b7c..c564c140 100644 --- a/platypush/backend/http/templates/index.html +++ b/platypush/backend/http/templates/index.html @@ -8,7 +8,6 @@ - {% for script in scripts.values() %} {% endfor %} @@ -73,9 +71,6 @@
- -
    -
  • - - - -
  • - {% for plugin in plugins|sort %}