diff --git a/module/metric/js/common.ui.js b/module/metric/js/common.ui.js
index 8ac8b4d891..033c727014 100644
--- a/module/metric/js/common.ui.js
+++ b/module/metric/js/common.ui.js
@@ -39,7 +39,16 @@ window.renderDTableCell = function(result, {row, col})
});
- var html = `${row.data[col.name]}`;
+ if(Array.isArray(row.data[col.name]))
+ {
+ var value = row.data[col.name][0];
+ var title = updateTimeTip.replace('%s', row.data[col.name][1]);
+ }
+ else
+ {
+ var title = value = row.data[col.name];
+ }
+ var html = `${value}`;
result[0] = {html: html};
return result;
diff --git a/module/metric/lang/de.php b/module/metric/lang/de.php
index 1c9224d1fb..a13a1f5788 100755
--- a/module/metric/lang/de.php
+++ b/module/metric/lang/de.php
@@ -112,6 +112,7 @@ $lang->metric->saveSqlMeasSuccess = "Query success,result is:%s";
$lang->metric->monthText = "%s day";
$lang->metric->errorDateRange = "The start date cannot be longer than the end date";
$lang->metric->errorCalcTimeRange = "The start time of collection cannot be later than the end time of collection";
+$lang->metric->updateTimeTip = "Update snapshot time:%s";
$lang->metric->noDesc = "No description available";
$lang->metric->noFormula = "No calculation rules available";
diff --git a/module/metric/lang/en.php b/module/metric/lang/en.php
index 1c9224d1fb..a13a1f5788 100755
--- a/module/metric/lang/en.php
+++ b/module/metric/lang/en.php
@@ -112,6 +112,7 @@ $lang->metric->saveSqlMeasSuccess = "Query success,result is:%s";
$lang->metric->monthText = "%s day";
$lang->metric->errorDateRange = "The start date cannot be longer than the end date";
$lang->metric->errorCalcTimeRange = "The start time of collection cannot be later than the end time of collection";
+$lang->metric->updateTimeTip = "Update snapshot time:%s";
$lang->metric->noDesc = "No description available";
$lang->metric->noFormula = "No calculation rules available";
diff --git a/module/metric/lang/fr.php b/module/metric/lang/fr.php
index 1c9224d1fb..a13a1f5788 100755
--- a/module/metric/lang/fr.php
+++ b/module/metric/lang/fr.php
@@ -112,6 +112,7 @@ $lang->metric->saveSqlMeasSuccess = "Query success,result is:%s";
$lang->metric->monthText = "%s day";
$lang->metric->errorDateRange = "The start date cannot be longer than the end date";
$lang->metric->errorCalcTimeRange = "The start time of collection cannot be later than the end time of collection";
+$lang->metric->updateTimeTip = "Update snapshot time:%s";
$lang->metric->noDesc = "No description available";
$lang->metric->noFormula = "No calculation rules available";
diff --git a/module/metric/lang/zh-cn.php b/module/metric/lang/zh-cn.php
index de78bc126b..e43880d3f5 100755
--- a/module/metric/lang/zh-cn.php
+++ b/module/metric/lang/zh-cn.php
@@ -112,6 +112,7 @@ $lang->metric->saveSqlMeasSuccess = "查询成功,测试结果:%s";
$lang->metric->monthText = "%s号";
$lang->metric->errorDateRange = "开始日期不能大于结束日期";
$lang->metric->errorCalcTimeRange = "采集开始时间不能大于采集结束时间";
+$lang->metric->updateTimeTip = "更新快照时间:%s";
$lang->metric->noDesc = "暂无描述";
$lang->metric->noFormula = "暂无计算规则";
diff --git a/module/metric/ui/ajaxgetmultiplemetricbox.html.php b/module/metric/ui/ajaxgetmultiplemetricbox.html.php
index f28da1b330..d38cd54584 100644
--- a/module/metric/ui/ajaxgetmultiplemetricbox.html.php
+++ b/module/metric/ui/ajaxgetmultiplemetricbox.html.php
@@ -9,6 +9,7 @@ declare(strict_types=1);
* @link https://www.zentao.net
*/
namespace zin;
+jsVar('updateTimeTip', $lang->metric->updateTimeTip);
$metricID = $metric->id;
diff --git a/module/metric/ui/ajaxgettableandcharts.html.php b/module/metric/ui/ajaxgettableandcharts.html.php
index f803b68580..bebac78cc8 100644
--- a/module/metric/ui/ajaxgettableandcharts.html.php
+++ b/module/metric/ui/ajaxgettableandcharts.html.php
@@ -9,6 +9,7 @@ declare(strict_types=1);
* @link https://www.zentao.net
*/
namespace zin;
+jsVar('updateTimeTip', $lang->metric->updateTimeTip);
div
(
diff --git a/module/metric/ui/preview.html.php b/module/metric/ui/preview.html.php
index d4efb6a365..37d7ed82fc 100644
--- a/module/metric/ui/preview.html.php
+++ b/module/metric/ui/preview.html.php
@@ -10,8 +10,7 @@ declare(strict_types=1);
*/
namespace zin;
-jsVar('resultHeader', isset($resultHeader) ? $resultHeader : array());
-jsVar('resultData', isset($resultData) ? $resultData : array());
+jsVar('updateTimeTip', $lang->metric->updateTimeTip);
jsVar('objectList', $lang->metric->objectList);
jsVar('current', $current);
jsVar('maxSelectNum', $config->metric->maxSelectNum);
diff --git a/module/metric/zen.php b/module/metric/zen.php
index 6e6c3f2c65..5346b0fed8 100644
--- a/module/metric/zen.php
+++ b/module/metric/zen.php
@@ -527,17 +527,18 @@ class metricZen extends metric
return ($dateA > $dateB) ? -1 : 1;
});
- $times = array();
- $objects = array();
+ $times = array();
+ $objects = array();
foreach($data as $dataInfo)
{
- $time = substr($dataInfo->$dateField, 0, 10);
+ $time = substr($dataInfo->$dateField, 0, 10);
+ $calcTime = $dataInfo->calcTime;
$object = $dataInfo->scope;
$value = $dataInfo->value;
- if(!isset($times[$time])) $times[$time] = $time;
+ if(!isset($times[$time])) $times[$time] = $time;
if(!isset($objects[$object])) $objects[$object] = array();
- $objects[$object][$time] = $value;
+ $objects[$object][$time] = array($value, $calcTime);
}
/* e.g $times = array('2023-10-14', '2023-10-15'), $objects = array('object1' => array('2023-10-14' => 2, '2023-10-15 => 3)) */
@@ -630,7 +631,7 @@ class metricZen extends metric
$groupHeader[] = array('name' => $name, 'title' => $day, 'headerGroup' => $year, 'align' => 'center');
}
- $groupData[0][$name] = $dataInfo->value;
+ $groupData[0][$name] = array($dataInfo->value, $dataInfo->calcTime);
}
return array($groupHeader, $groupData);