From: Roman Bazalevsky Date: Mon, 16 Dec 2019 09:53:04 +0000 (+0300) Subject: Отслеживание даты начала данных в БД. X-Git-Url: https://git.rvb.name/squid-reports.git/commitdiff_plain/HEAD Отслеживание даты начала данных в БД. --- diff --git a/web/api.php b/web/api.php index 4da8707..dbb7100 100644 --- a/web/api.php +++ b/web/api.php @@ -61,6 +61,8 @@ $data["site-header"] = $site_header; connect_db(); + + $startdate = exec_query("select min(access_date) sd from access_log"); $cats = exec_query("select mnemo,name,description from rep_cat"); @@ -80,6 +82,7 @@ $data["dictionaries"] = Array( "user_id" => $users, "host_id" => $hosts); $data["online_refresh"] = $online_refresh; $data["online_history"] = $online_history; + $data["start_date"] = $startdate[0]["sd"]; break; diff --git a/web/squid.js b/web/squid.js index 0260b10..8c85cca 100644 --- a/web/squid.js +++ b/web/squid.js @@ -33,6 +33,7 @@ online_connections = null online_hosts = [] timer = null +start_date = null assigned_colors = [] @@ -144,6 +145,9 @@ function UpdatePageProps(props) { refresh = props["online_refresh"] online_history = props["online_history"] + start_date = new Date(props["start_date"]) + start_date.setHours(0,0,0,0) + cats = props["cats"] for (var i in res["columns"]) { @@ -653,6 +657,12 @@ function DateLeft() { var delta = Math.round(((dTo.getTime() - dFrom.getTime()))/(86400*1000)) dTo.setDate(dTo.getDate() - (1 + delta)) dFrom.setDate(dFrom.getDate() - (1 + delta)) + if (dTo