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
This commit is contained in:
parent
be5c5d365c
commit
a6488e15fe
4 changed files with 8 additions and 15 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from flask import Blueprint, render_template, request
|
from flask import Blueprint, render_template, request
|
||||||
|
@ -31,6 +32,7 @@ def index():
|
||||||
if plugin not in configured_plugins:
|
if plugin not in configured_plugins:
|
||||||
configured_plugins[plugin] = {}
|
configured_plugins[plugin] = {}
|
||||||
|
|
||||||
|
configured_plugins['execute'] = {}
|
||||||
disabled_plugins = set(request.args.get('disabled_plugins', '').split(','))
|
disabled_plugins = set(request.args.get('disabled_plugins', '').split(','))
|
||||||
|
|
||||||
js_folder = os.path.abspath(
|
js_folder = os.path.abspath(
|
||||||
|
@ -38,8 +40,10 @@ def index():
|
||||||
style_folder = os.path.abspath(
|
style_folder = os.path.abspath(
|
||||||
os.path.join(template_folder, '..', 'static', 'css', 'dist'))
|
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 in disabled_plugins:
|
||||||
|
if plugin == 'execute':
|
||||||
|
configured_plugins.pop('execute')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
template_file = os.path.join(
|
template_file = os.path.join(
|
||||||
|
@ -67,7 +71,7 @@ def index():
|
||||||
websocket_port=get_websocket_port(),
|
websocket_port=get_websocket_port(),
|
||||||
template_folder=template_folder, static_folder=static_folder,
|
template_folder=template_folder, static_folder=static_folder,
|
||||||
plugins=Config.get_plugins(), backends=Config.get_backends(),
|
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)
|
has_ssl=http_conf.get('ssl_cert') is not None)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ Vue.component('execute', {
|
||||||
methods: {
|
methods: {
|
||||||
refresh: async function() {
|
refresh: async function() {
|
||||||
this.loading = true;
|
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});
|
this.plugins = await request('inspect.get_all_plugins', {html_doc: true});
|
||||||
|
|
||||||
for (const plugin of Object.values(this.plugins)) {
|
for (const plugin of Object.values(this.plugins)) {
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/normalize.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/normalize.css') }}">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='font-awesome/css/all.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='font-awesome/css/all.css') }}">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/dist/webpanel.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/dist/webpanel.css') }}">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/dist/webpanel/plugins/execute.css') }}">
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
if (!window.config) {
|
if (!window.config) {
|
||||||
|
@ -20,6 +19,7 @@
|
||||||
has_ssl: {{ 'true' if has_ssl else 'false' }},
|
has_ssl: {{ 'true' if has_ssl else 'false' }},
|
||||||
templates: JSON.parse('{{ utils.to_json(templates)|safe }}'),
|
templates: JSON.parse('{{ utils.to_json(templates)|safe }}'),
|
||||||
scripts: JSON.parse('{{ utils.to_json(scripts)|safe }}'),
|
scripts: JSON.parse('{{ utils.to_json(scripts)|safe }}'),
|
||||||
|
procedures: JSON.parse('{{ procedures.replace("\'", "\\\'")|safe }}'),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,6 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% include 'elements.html' %}
|
{% include 'elements.html' %}
|
||||||
{% include 'plugins/execute/index.html' %}
|
|
||||||
|
|
||||||
{% for plugin, conf in templates.items() %}
|
{% for plugin, conf in templates.items() %}
|
||||||
{% with configuration=templates[plugin] %}
|
{% with configuration=templates[plugin] %}
|
||||||
|
@ -59,7 +58,6 @@
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<script type="text/javascript" src="{{ url_for('static', filename='js/plugins/execute/index.js') }}"></script>
|
|
||||||
{% for script in scripts.values() %}
|
{% for script in scripts.values() %}
|
||||||
<script type="text/javascript" src="{{ url_for('static', filename=script['_script_file']) }}"></script>
|
<script type="text/javascript" src="{{ url_for('static', filename=script['_script_file']) }}"></script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -73,9 +71,6 @@
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div class="plugins-container">
|
<div class="plugins-container">
|
||||||
<plugin tag="execute" key="execute" :class="{hidden: selectedPlugin != 'execute'}"
|
|
||||||
config="{{ utils.to_json(procedures) }}"></plugin>
|
|
||||||
|
|
||||||
<plugin v-for="(conf, plugin) in {{ utils.to_json(templates) }}"
|
<plugin v-for="(conf, plugin) in {{ utils.to_json(templates) }}"
|
||||||
:tag="plugin.replace(/\./g, '-')"
|
:tag="plugin.replace(/\./g, '-')"
|
||||||
:key="plugin"
|
:key="plugin"
|
||||||
|
|
|
@ -20,12 +20,6 @@
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li :class="{selected: 'execute' == selectedPlugin}" title="execute">
|
|
||||||
<a href="#execute" @click="selectedPlugin = 'execute'">
|
|
||||||
<i class="{{ pluginIcons['execute'] }}"></i>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{% for plugin in plugins|sort %}
|
{% for plugin in plugins|sort %}
|
||||||
<li :class="{selected: '{{ plugin }}' == selectedPlugin}" title="{{ plugin }}">
|
<li :class="{selected: '{{ plugin }}' == selectedPlugin}" title="{{ plugin }}">
|
||||||
<a href="#{{ plugin }}" @click="selectedPlugin = '{{ plugin }}'">
|
<a href="#{{ plugin }}" @click="selectedPlugin = '{{ plugin }}'">
|
||||||
|
|
Loading…
Reference in a new issue