ui - various bug fixes more or less related to UI

This commit is contained in:
florian 2021-08-09 13:19:10 +02:00
parent 2ec28c79cb
commit bcd421de09
No known key found for this signature in database
GPG Key ID: 3D80806F12602A7C
10 changed files with 38 additions and 22 deletions

View File

@ -1 +1 @@
set_cookie_flag {{ COOKIE_FLAGS }}{% if COOKIE_AUTO_SECURE_FLAG == "yes" %} Secure{% endif %}; set_cookie_flag {{ COOKIE_FLAGS }}{% if COOKIE_AUTO_SECURE_FLAG == "yes" and (AUTO_LETS_ENCRYPT == "yes" or USE_CUSTOM_HTTPS == "yes" or GENERATE_SELF_SIGNED_SSL == "yes") %} Secure{% endif %};

View File

@ -50,9 +50,17 @@ class Templator :
real_config["ROOT_FOLDER"] += "/" + real_config["ROOT_SITE_SUBFOLDER"] real_config["ROOT_FOLDER"] += "/" + real_config["ROOT_SITE_SUBFOLDER"]
return real_config return real_config
def __filter_var(self, variable) :
filters = ["FIRST_SERVER", "NGINX_PREFIX"]
for filter in filters :
if variable == filter or variable.endswith("_" + filter) :
return True
return False
def __save_config(self, type, config) : def __save_config(self, type, config) :
data = "" data = ""
for variable, value in config.items() : for variable, value in config.items() :
if not self.__filter_var(variable) :
data += variable + "=" + value + "\n" data += variable + "=" + value + "\n"
file = self.__output_path file = self.__output_path
if type == "global" : if type == "global" :

View File

@ -3,7 +3,7 @@ def load_variables(path) :
with open(path) as f : with open(path) as f :
lines = f.read().splitlines() lines = f.read().splitlines()
for line in lines : for line in lines :
if line.startswith("#") : if line.startswith("#") or line == "" or not "=" in line :
continue continue
var = line.split("=")[0] var = line.split("=")[0]
value = line[len(var)+1:] value = line[len(var)+1:]

View File

@ -937,7 +937,7 @@
"env": "REDIRECT_TO", "env": "REDIRECT_TO",
"id": "redirect-to", "id": "redirect-to",
"label": "Redirect every requests to another web service", "label": "Redirect every requests to another web service",
"regex": "^https?://.*$", "regex": "^(https?://.+|.{0})$",
"type": "text" "type": "text"
} }
] ]
@ -1001,7 +1001,7 @@
"env": "LOCAL_PHP", "env": "LOCAL_PHP",
"id": "local-php", "id": "local-php",
"label": "local php", "label": "local php",
"regex": "^\\/[a-zA-Z\\-0-9_\\.\\/]*$", "regex": "^(\\/[a-zA-Z\\-0-9_\\.\\/]*|.{0})$",
"type": "text" "type": "text"
}, },
{ {
@ -1010,7 +1010,7 @@
"env": "LOCAL_PHP_PATH", "env": "LOCAL_PHP_PATH",
"id": "local-php-path", "id": "local-php-path",
"label": "Local php path", "label": "Local php path",
"regex": "^\\/[a-zA-Z\\-0-9_\\.\\/]*$", "regex": "^(\\/[a-zA-Z\\-0-9_\\.\\/]*|.{0})$",
"type": "text" "type": "text"
} }
] ]
@ -1225,7 +1225,7 @@
"env": "REDIS_HOST", "env": "REDIS_HOST",
"id": "redis-host", "id": "redis-host",
"label": "Hostname/IP of the Redis service", "label": "Hostname/IP of the Redis service",
"regex": "^[A-Za-z0-9\\-\\.\\_]+$", "regex": "^([A-Za-z0-9\\-\\.\\_]+|.{0})$",
"type": "text" "type": "text"
} }
] ]

View File

@ -13,6 +13,8 @@ class Config :
env = f.read() env = f.read()
data = {} data = {}
for line in env.split("\n") : for line in env.split("\n") :
if not "=" in line :
continue
var = line.split("=")[0] var = line.split("=")[0]
val = line.replace(var + "=", "", 1) val = line.replace(var + "=", "", 1)
data[var] = val data[var] = val
@ -37,6 +39,7 @@ class Config :
if not first_server in servers : if not first_server in servers :
servers.append(first_server) servers.append(first_server)
for k, v in service.items() : for k, v in service.items() :
if not k.startswith(first_server + "_") :
conf[first_server + "_" + k] = v conf[first_server + "_" + k] = v
conf["SERVER_NAME"] = " ".join(servers) conf["SERVER_NAME"] = " ".join(servers)
env_file = "/tmp/" + str(uuid.uuid4()) + ".env" env_file = "/tmp/" + str(uuid.uuid4()) + ".env"

View File

@ -34,6 +34,7 @@ class Instances :
result = False result = False
except : except :
result = False result = False
return result
def __instance_from_id(self, id) : def __instance_from_id(self, id) :
instances = self.get_instances() instances = self.get_instances()
@ -91,7 +92,6 @@ class Instances :
all_reload = False all_reload = False
elif instance["type"] == "container" or instance["type"] == "service" : elif instance["type"] == "container" or instance["type"] == "service" :
all_reload = self.__api_request(instance, "/reload") all_reload = self.__api_request(instance, "/reload")
return all_reload return all_reload
def reload_instance(self, id) : def reload_instance(self, id) :

View File

@ -57,6 +57,7 @@ function deleteService(id) {
function reloadInstance(id) { function reloadInstance(id) {
post("reload", "instances", getData('form-instance-' + id)); post("reload", "instances", getData('form-instance-' + id));
return false;
} }
function startInstance(id) { function startInstance(id) {

View File

@ -5,10 +5,12 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
{% if operation != "" %} {% 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"> <div class="alert alert-primary alert-dismissible fade show text-break" role="alert">
{{ operation }} {{ operation }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div> </div>
</div>
{% endif %} {% endif %}
{% if instances|length == 0 %} {% if instances|length == 0 %}
@ -38,7 +40,7 @@
<i class="fas fa-cogs"></i> <i class="fas fa-cogs"></i>
</button> </button>
<ul class="dropdown-menu" aria-labelledby="btnGroupDrop1"> <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 %} {% 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> <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 %} {% if instance["type"] == "local" %}<li><a class="dropdown-item" href="#" onClick="return restartInstance('{{ instance["id"] }}');">Restart</a></li>{% endif %}

View File

@ -4,17 +4,19 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
<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 != "" %} {% 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"> <div class="alert alert-primary alert-dismissible fade show text-break" role="alert">
{{ operation }} {{ operation }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div> </div>
</div>
{% endif %} {% 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 services|length == 0 %} {% if services|length == 0 %}
<div class="alert alert-primary text-center"> <div class="alert alert-primary text-center">
No service to show... No service to show...