diff --git a/bin/lib/ail_queues.py b/bin/lib/ail_queues.py index a5950a5d..81014024 100755 --- a/bin/lib/ail_queues.py +++ b/bin/lib/ail_queues.py @@ -50,6 +50,9 @@ class AILQueue: subscribers[queue_name].add(module) self.subscribers_modules = subscribers + def get_out_queues(self): + return list(self.subscribers_modules.keys()) + def get_nb_messages(self): return r_queues.llen(f'queue:{self.name}:in') @@ -205,11 +208,12 @@ def save_queue_digraph(): digraph = get_queue_digraph() dot_file = os.path.join(os.environ['AIL_HOME'], 'doc/ail_queues.dot') svg_file = os.path.join(os.environ['AIL_HOME'], 'doc/ail_queues.svg') + svg_static = os.path.join(os.environ['AIL_HOME'], 'var/www/static/image/ail_queues.svg') with open(dot_file, 'w') as f: f.write(digraph) print('dot', '-Tsvg', dot_file, '-o', svg_file) - process = subprocess.run(['dot', '-Tsvg', dot_file, '-o', svg_file], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.run(['dot', '-Tsvg', dot_file, '-o', svg_file, '-o', svg_static], stdout=subprocess.PIPE, stderr=subprocess.PIPE) if process.returncode == 0: # modified_files = process.stdout # print(process.stdout) diff --git a/bin/modules/abstract_module.py b/bin/modules/abstract_module.py index 79b7bb0d..ea419ef5 100644 --- a/bin/modules/abstract_module.py +++ b/bin/modules/abstract_module.py @@ -85,6 +85,9 @@ class AbstractModule(ABC): self.queue.send_message(message, queue_name) # add to new set_module + def get_available_queues(self): + return self.queue.get_out_queues() + def regex_search(self, regex, obj_id, content): return regex_helper.regex_search(self.r_cache_key, regex, obj_id, content, max_time=self.max_execution_time) diff --git a/var/www/blueprints/settings_b.py b/var/www/blueprints/settings_b.py index 0b5b1eff..518f6fb9 100644 --- a/var/www/blueprints/settings_b.py +++ b/var/www/blueprints/settings_b.py @@ -40,9 +40,9 @@ def create_json_response(data, status_code): def settings_page(): git_metadata = git_status.get_git_metadata() ail_version = ail_updates.get_ail_version() - #admin_level = current_user.is_in_role('admin') + admin_level = current_user.is_in_role('admin') return render_template("settings_index.html", git_metadata=git_metadata, - ail_version=ail_version) + ail_version=ail_version, admin_level=admin_level) @settings_b.route("/settings/background_update/json", methods=['GET']) @login_required @@ -50,6 +50,12 @@ def settings_page(): def get_background_update_metadata_json(): return jsonify(ail_updates.get_update_background_metadata()) +@settings_b.route("/settings/modules", methods=['GET']) +@login_required +@login_read_only +def settings_modules(): + admin_level = current_user.is_in_role('admin') + return render_template("settings/modules.html", admin_level=admin_level) diff --git a/var/www/templates/settings/menu_sidebar.html b/var/www/templates/settings/menu_sidebar.html index ac560f4c..10eca7a4 100644 --- a/var/www/templates/settings/menu_sidebar.html +++ b/var/www/templates/settings/menu_sidebar.html @@ -103,5 +103,17 @@ {% endif %} +