From 1954b60e13563a47391efcc99d944233452a3fd1 Mon Sep 17 00:00:00 2001 From: Aidaho Date: Thu, 18 Apr 2024 09:58:32 +0300 Subject: [PATCH] v7.2.4.0: Update requirements and refactor date formatting function The requirements for el9, deb, and main have been updated to specifically use version 2.27.1 of the "requests" package. In addition, the date formatting function get_time_zoned_date in common.py has been refactored. The default format for the date has been moved to the function arguments, and the function now also checks if the provided date is an instance of datetime before processing it. --- app/modules/common/common.py | 2 ++ {inc => app/static/js}/add.js | 0 {inc => app/static/js}/add_nginx.js | 0 {inc => app/static/js}/admin_settings.js | 0 {inc => app/static/js}/configshow.js | 0 {inc => app/static/js}/hotkeys.js | 0 {inc => app/static/js}/metrics.js | 0 {inc => app/static/js}/nprogress.js | 0 {inc => app/static/js}/overview.js | 26 ++++++++++---------- {inc => app/static/js}/runtimeapi.js | 0 {inc => app/static/js}/select2.js | 0 {inc => app/static/js}/smon.js | 0 app/static/js/waf.js | 2 +- app/templates/add.html | 2 +- app/templates/add_nginx.html | 2 +- app/templates/config.html | 2 +- app/templates/ha_cluster.html | 2 +- app/templates/include/admin_settings.html | 2 +- app/templates/include/main_head.html | 6 ++--- app/templates/include/smon/smon_history.html | 2 +- app/templates/metrics.html | 2 +- app/templates/ovw.html | 4 +-- app/templates/portscanner.html | 2 +- app/templates/runtimeapi.html | 2 +- app/templates/sections.html | 2 +- app/templates/service.html | 4 +-- app/templates/smon/agent.html | 2 +- app/templates/smon/dashboard.html | 2 +- app/templates/smon/manage_status_page.html | 2 +- app/templates/smon/status_page.html | 2 +- app/templates/waf.html | 6 ++--- inc/script.js | 8 +++--- index.html | 6 ++--- 33 files changed, 47 insertions(+), 45 deletions(-) rename {inc => app/static/js}/add.js (100%) rename {inc => app/static/js}/add_nginx.js (100%) rename {inc => app/static/js}/admin_settings.js (100%) rename {inc => app/static/js}/configshow.js (100%) rename {inc => app/static/js}/hotkeys.js (100%) rename {inc => app/static/js}/metrics.js (100%) rename {inc => app/static/js}/nprogress.js (100%) rename {inc => app/static/js}/overview.js (96%) rename {inc => app/static/js}/runtimeapi.js (100%) rename {inc => app/static/js}/select2.js (100%) rename {inc => app/static/js}/smon.js (100%) diff --git a/app/modules/common/common.py b/app/modules/common/common.py index c0b74c0f..8049db66 100644 --- a/app/modules/common/common.py +++ b/app/modules/common/common.py @@ -40,6 +40,8 @@ def get_time_zoned_date(date: datetime, fmt: str = '%Y-%m-%d %H:%M:%S') -> str: :rtype: str """ date_format = '%Y-%m-%d %H:%M:%S' + if not fmt: + fmt = date_format if not isinstance(date, datetime): date = datetime.strptime(date, date_format) native = _convert_to_time_zone(date) diff --git a/inc/add.js b/app/static/js/add.js similarity index 100% rename from inc/add.js rename to app/static/js/add.js diff --git a/inc/add_nginx.js b/app/static/js/add_nginx.js similarity index 100% rename from inc/add_nginx.js rename to app/static/js/add_nginx.js diff --git a/inc/admin_settings.js b/app/static/js/admin_settings.js similarity index 100% rename from inc/admin_settings.js rename to app/static/js/admin_settings.js diff --git a/inc/configshow.js b/app/static/js/configshow.js similarity index 100% rename from inc/configshow.js rename to app/static/js/configshow.js diff --git a/inc/hotkeys.js b/app/static/js/hotkeys.js similarity index 100% rename from inc/hotkeys.js rename to app/static/js/hotkeys.js diff --git a/inc/metrics.js b/app/static/js/metrics.js similarity index 100% rename from inc/metrics.js rename to app/static/js/metrics.js diff --git a/inc/nprogress.js b/app/static/js/nprogress.js similarity index 100% rename from inc/nprogress.js rename to app/static/js/nprogress.js diff --git a/inc/overview.js b/app/static/js/overview.js similarity index 96% rename from inc/overview.js rename to app/static/js/overview.js index 646dbef8..75b870a3 100644 --- a/inc/overview.js +++ b/app/static/js/overview.js @@ -10,7 +10,7 @@ function showHapserversCallBack(serv, hostnamea, service) { $.ajax( { url: "/app/service/" + service + "/" + serv + "/last-edit", beforeSend: function() { - $("#edit_date_"+hostnamea).html(''); + $("#edit_date_"+hostnamea).html(''); }, type: "GET", success: function( data ) { @@ -32,7 +32,7 @@ function overviewHapserverBackends(serv, hostnamea, service) { $.ajax( { url: "/app/service/" + service + "/backends/" + serv[0], beforeSend: function() { - $("#top-"+hostnamea).html(''); + $("#top-"+hostnamea).html(''); }, success: function( data ) { if (data.indexOf('error:') != '-1') { @@ -59,7 +59,7 @@ function showOverviewCallBack(serv, hostnamea) { $.ajax( { url: "/app/overview/server/"+serv, beforeSend: function() { - $("#"+hostnamea).html(''); + $("#"+hostnamea).html(''); }, type: "GET", success: function( data ) { @@ -77,7 +77,7 @@ function showServicesOverview() { $.ajax( { url: "/app/overview/services", beforeSend: function() { - $("#services_ovw").html(''); + $("#services_ovw").html(''); }, type: "GET", @@ -321,8 +321,8 @@ function showBytes(serv) { }, type: "POST", beforeSend: function() { - $("#show_bin_bout").html(''); - $("#sessions").html(''); + $("#show_bin_bout").html(''); + $("#sessions").html(''); }, success: function( data ) { data = data.replace(/\s+/g,' '); @@ -343,7 +343,7 @@ function showNginxConnections(serv) { }, type: "POST", beforeSend: function() { - $("#sessions").html(''); + $("#sessions").html(''); }, success: function( data ) { data = data.replace(/\s+/g,' '); @@ -364,7 +364,7 @@ function showApachekBytes(serv) { }, type: "POST", beforeSend: function() { - $("#sessions").html(''); + $("#sessions").html(''); }, success: function( data ) { data = data.replace(/\s+/g,' '); @@ -385,7 +385,7 @@ function keepalivedBecameMaster(serv) { }, type: "POST", beforeSend: function() { - $("#bin_bout").html(''); + $("#bin_bout").html(''); }, success: function( data ) { data = data.replace(/\s+/g,' '); @@ -407,7 +407,7 @@ function showUsersOverview() { // }, type: "GET", beforeSend: function() { - $("#users-table").html(''); + $("#users-table").html(''); }, success: function( data ) { data = data.replace(/\s+/g,' '); @@ -428,7 +428,7 @@ function showSubOverview() { // }, type: "GET", beforeSend: function() { - $("#sub-table").html(''); + $("#sub-table").html(''); }, success: function( data ) { data = data.replace(/\s+/g,' '); @@ -576,13 +576,13 @@ function ShowOverviewLogs() { url: "/app/overview/logs", type: "GET", beforeSend: function() { - $("#overview-logs").html(''); + $("#overview-logs").html(''); }, success: function( data ) { data = data.replace(/\s+/g,' '); $("#overview-logs").html(data); $.getScript("/inc/fontawesome.min.js") - $.getScript("/inc/overview.js") + $.getScript("/app/static/js/overview.js") } } ); } diff --git a/inc/runtimeapi.js b/app/static/js/runtimeapi.js similarity index 100% rename from inc/runtimeapi.js rename to app/static/js/runtimeapi.js diff --git a/inc/select2.js b/app/static/js/select2.js similarity index 100% rename from inc/select2.js rename to app/static/js/select2.js diff --git a/inc/smon.js b/app/static/js/smon.js similarity index 100% rename from inc/smon.js rename to app/static/js/smon.js diff --git a/app/static/js/waf.js b/app/static/js/waf.js index 34f024d4..6a0efa78 100644 --- a/app/static/js/waf.js +++ b/app/static/js/waf.js @@ -1,6 +1,6 @@ var awesome = "/inc/fontawesome.min.js" var waf = "/app/static/js/waf.js" -var overview = "/inc/overview.js" +var overview = "/app/static/js/overview.js" function showOverviewWaf(serv, hostnamea) { var service = cur_url[1]; if (service == 'haproxy') { diff --git a/app/templates/add.html b/app/templates/add.html index b72a58dd..d12c7a4b 100644 --- a/app/templates/add.html +++ b/app/templates/add.html @@ -20,7 +20,7 @@ {% set header_params = {'add-header': 'add-header', 'set-header': 'set-header', 'del-header': 'del-header'} %} {% set if_values = {'1':'Host name starts with','2':'Host name ends with','3':'Path starts with','4':'Path ends with', '6': 'Src ip'} %} - +