ui - various bug fixes more or less related to UI
This commit is contained in:
@@ -44,7 +44,7 @@ csrf = CSRFProtect()
|
||||
csrf.init_app(app)
|
||||
@app.errorhandler(CSRFError)
|
||||
def handle_csrf_error(e):
|
||||
return render_template("error.html", title="Error", error="Wrong CSRF token !"), 401
|
||||
return render_template("error.html", title="Error", error="Wrong CSRF token !"), 401
|
||||
|
||||
@app.route('/login', methods=["GET", "POST"])
|
||||
def login() :
|
||||
@@ -146,7 +146,7 @@ def services():
|
||||
operation = app.config["CONFIG"].edit_service(request.form["OLD_SERVER_NAME"], variables)
|
||||
elif request.form["operation"] == "delete" :
|
||||
operation = app.config["CONFIG"].delete_service(request.form["SERVER_NAME"])
|
||||
|
||||
|
||||
# Reload instances
|
||||
reload = app.config["INSTANCES"].reload_instances()
|
||||
if not reload :
|
||||
|
||||
@@ -13,6 +13,8 @@ class Config :
|
||||
env = f.read()
|
||||
data = {}
|
||||
for line in env.split("\n") :
|
||||
if not "=" in line :
|
||||
continue
|
||||
var = line.split("=")[0]
|
||||
val = line.replace(var + "=", "", 1)
|
||||
data[var] = val
|
||||
@@ -37,7 +39,8 @@ class Config :
|
||||
if not first_server in servers :
|
||||
servers.append(first_server)
|
||||
for k, v in service.items() :
|
||||
conf[first_server + "_" + k] = v
|
||||
if not k.startswith(first_server + "_") :
|
||||
conf[first_server + "_" + k] = v
|
||||
conf["SERVER_NAME"] = " ".join(servers)
|
||||
env_file = "/tmp/" + str(uuid.uuid4()) + ".env"
|
||||
self.__dict_to_env(env_file, conf)
|
||||
|
||||
@@ -34,6 +34,7 @@ class Instances :
|
||||
result = False
|
||||
except :
|
||||
result = False
|
||||
return result
|
||||
|
||||
def __instance_from_id(self, id) :
|
||||
instances = self.get_instances()
|
||||
@@ -91,7 +92,6 @@ class Instances :
|
||||
all_reload = False
|
||||
elif instance["type"] == "container" or instance["type"] == "service" :
|
||||
all_reload = self.__api_request(instance, "/reload")
|
||||
|
||||
return all_reload
|
||||
|
||||
def reload_instance(self, id) :
|
||||
|
||||
@@ -57,6 +57,7 @@ function deleteService(id) {
|
||||
|
||||
function reloadInstance(id) {
|
||||
post("reload", "instances", getData('form-instance-' + id));
|
||||
return false;
|
||||
}
|
||||
|
||||
function startInstance(id) {
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
<div class="row justify-content-center">
|
||||
|
||||
{% if operation != "" %}
|
||||
<div class="alert alert-primary alert-dismissible fade show text-break" role="alert">
|
||||
{{ operation }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
<div class="col col-12 col-lg-4 mt-5 text-center">
|
||||
<div class="alert alert-primary alert-dismissible fade show text-break" role="alert">
|
||||
{{ operation }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -38,7 +40,7 @@
|
||||
<i class="fas fa-cogs"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="btnGroupDrop1">
|
||||
<li><a class="dropdown-item" href="#" onClick="reloadInstance('{{ instance["id"] }}');">Reload</a></li>
|
||||
<li><a class="dropdown-item" href="#" onClick="return reloadInstance('{{ instance["id"] }}');">Reload</a></li>
|
||||
{% if instance["type"] == "local" %}<li><a class="dropdown-item" href="#" onClick="return startInstance('{{ instance["id"] }}');">Start</a></li>{% endif %}
|
||||
<li><a class="dropdown-item" href="#" onClick="return stopInstance('{{ instance["id"] }}');">Stop</a></li>
|
||||
{% if instance["type"] == "local" %}<li><a class="dropdown-item" href="#" onClick="return restartInstance('{{ instance["id"] }}');">Restart</a></li>{% endif %}
|
||||
|
||||
@@ -4,17 +4,19 @@
|
||||
|
||||
<div class="row justify-content-center">
|
||||
|
||||
{% if operation != "" %}
|
||||
<div class="col col-12 col-lg-4 mt-5 text-center">
|
||||
<div class="alert alert-primary alert-dismissible fade show text-break" role="alert">
|
||||
{{ operation }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="col col-12 mb-3 text-center">
|
||||
<button class="btn btn-success" data-bs-toggle="modal" data-bs-target="#modal-new"><i class="fas fa-plus"></i> New</button>
|
||||
</div>
|
||||
|
||||
{% if operation != "" %}
|
||||
<div class="alert alert-primary alert-dismissible fade show text-break" role="alert">
|
||||
{{ operation }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if services|length == 0 %}
|
||||
<div class="alert alert-primary text-center">
|
||||
No service to show...
|
||||
|
||||
Reference in New Issue
Block a user