From 208b5acb30e860ea79b2ae280f51f5361172454d Mon Sep 17 00:00:00 2001 From: bunkerity Date: Mon, 21 Dec 2020 17:34:45 +0100 Subject: [PATCH] UI - minor services list improvement --- ui/entrypoint.py | 4 ++-- ui/templates/instances.html | 2 +- ui/templates/services.html | 38 ++++++++++++++----------------------- ui/utils.py | 5 +++++ 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/ui/entrypoint.py b/ui/entrypoint.py index 4fa6d04..7ee9f14 100644 --- a/ui/entrypoint.py +++ b/ui/entrypoint.py @@ -2,15 +2,15 @@ from flask import Flask, render_template, current_app -import wrappers +import wrappers, utils import os - app = Flask(__name__, static_url_path="/", static_folder="static", template_folder="templates") ABSOLUTE_URI = "" if "ABSOLUTE_URI" in os.environ : ABSOLUTE_URI = os.environ["ABSOLUTE_URI"] app.config["ABSOLUTE_URI"] = ABSOLUTE_URI +app.jinja_env.globals.update(env_to_summary_class=utils.env_to_summary_class) @app.route('/') @app.route('/home') diff --git a/ui/templates/instances.html b/ui/templates/instances.html index 87893ae..800dfd8 100644 --- a/ui/templates/instances.html +++ b/ui/templates/instances.html @@ -20,7 +20,7 @@
-
+
{{ instance["name"] }}
+ +
-
Server name : {{ service["SERVER_NAME"] }}
+
Summary
- Environment variables :
- {% set envfilter = ["PATH", "NGINX_VERSION", "NJS_VERSION", "PKG_RELEASE"] %} - {% for k, v in service.items() %} - {% if not k.startswith("PATH=") and not k.startswith("NGINX_VERSION=") and not k.startswith("NJS_VERSION=") and not k.startswith("PKG_RELEASE=") %} - {{ k + "=" + v }}
- {% endif %} - {% endfor %} +
+
Serve files
+
+
Reverse proxy
+
+
HTTPS
+
+
diff --git a/ui/utils.py b/ui/utils.py index 53232f2..679a0b1 100644 --- a/ui/utils.py +++ b/ui/utils.py @@ -11,3 +11,8 @@ def replace_in_file(file, old_str, new_str) : data = data[::-1].replace(old_str[::-1], new_str[::-1], 1)[::-1] with open(file, "w") as f : f.write(data) + +def env_to_summary_class(var, value) : + if var == value : + return "check text-success" + return "times text-danger"