diff --git a/app/modules/common/common.py b/app/modules/common/common.py index b065fbe1..c0b74c0f 100644 --- a/app/modules/common/common.py +++ b/app/modules/common/common.py @@ -26,7 +26,7 @@ def _convert_to_time_zone(date: datetime) -> datetime: return native -def get_time_zoned_date(date: datetime, fmt: str = None) -> str: +def get_time_zoned_date(date: datetime, fmt: str = '%Y-%m-%d %H:%M:%S') -> str: """ Formats a given date and returns the formatted date in the specified or default format. @@ -39,12 +39,11 @@ def get_time_zoned_date(date: datetime, fmt: str = None) -> str: :return: The formatted date. :rtype: str """ - native = _convert_to_time_zone(date) date_format = '%Y-%m-%d %H:%M:%S' - if fmt: - return native.strftime(fmt) - else: - return native.strftime(date_format) + if not isinstance(date, datetime): + date = datetime.strptime(date, date_format) + native = _convert_to_time_zone(date) + return native.strftime(fmt) def get_present_time(): diff --git a/inc/ha.js b/app/static/js/ha.js similarity index 99% rename from inc/ha.js rename to app/static/js/ha.js index 58a09b2a..c6875de0 100644 --- a/inc/ha.js +++ b/app/static/js/ha.js @@ -185,7 +185,7 @@ function createHaClusterStep1(edited=false, cluster_id=0, clean=true) { } } }); - $.getScript('/inc/ha.js'); + $.getScript('/app/static/js/ha.js'); var regx = /^[a-z0-9_-]+$/; var dialog_div = $("#create-ha-cluster-step-1").dialog({ autoOpen: false, @@ -614,7 +614,7 @@ function add_vip_ha_cluster(cluster_id, cluster_name, router_id='', vip='', edit } } }); - $.getScript('/inc/ha.js'); + $.getScript('/app/static/js/ha.js'); var dialog_div = $("#add-vip").dialog({ autoOpen: false, resizable: false, @@ -739,7 +739,7 @@ function addCheckToStatus(server_id, server_ip) { ''; $('#add_check-' + server_id).remove(); $("#enabled-check").append(html_tag); - $.getScript('/inc/ha.js'); + $.getScript('/app/static/js/ha.js'); } function removeCheckFromStatus(server_id, server_ip) { var hostname = $('#remove_check-' + server_id).attr('data-name'); diff --git a/app/templates/ha_cluster.html b/app/templates/ha_cluster.html index 74656e17..2ccc26bf 100644 --- a/app/templates/ha_cluster.html +++ b/app/templates/ha_cluster.html @@ -4,7 +4,7 @@ {% block content %} {% from 'include/input_macros.html' import input, checkbox, copy_to_clipboard %} - + diff --git a/config_other/requirements_deb.txt b/config_other/requirements_deb.txt index ed6cc7df..d55eeb62 100644 --- a/config_other/requirements_deb.txt +++ b/config_other/requirements_deb.txt @@ -19,3 +19,5 @@ websockets>=9.0 ansible-core>=2.11.12 ansible-runner==2.3.2 python-whois>=0.8.0 +requests==2.27.1 + diff --git a/config_other/requirements_el9.txt b/config_other/requirements_el9.txt index 78093bff..2a739381 100644 --- a/config_other/requirements_el9.txt +++ b/config_other/requirements_el9.txt @@ -21,3 +21,4 @@ tzlocal==2.0.0 ansible-core>=2.11.12 ansible-runner==2.3.1 python-whois>=0.8.0 +requests==2.27.1 diff --git a/requirements.txt b/requirements.txt index db9a8f52..d728c794 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ configparser>=3.5.0 paramiko-ng>=2.5.0 pytz>=2017.3 tzlocal==2.0.0 -requests>=2.22.0 +requests==2.27.1 pyTelegramBotAPI>=3.6.3 networkx>=2.6 matplotlib>=2.1.2