* Finish display no data tip in different situation,story#52003, task#110464.
This commit is contained in:
@@ -68,14 +68,14 @@ class metric extends control
|
||||
$allResultData = array();
|
||||
if(!empty($current))
|
||||
{
|
||||
$metric = $this->metric->getByID($current->id);
|
||||
$current = $this->metric->getByID($current->id);
|
||||
|
||||
$result = $this->metric->getResultByCode($metric->code, array(), 'cron', $pager);
|
||||
$allResult = $this->metric->getResultByCode($metric->code, array(), 'cron');
|
||||
$result = $this->metric->getResultByCode($current->code, array(), 'cron', $pager);
|
||||
$allResult = $this->metric->getResultByCode($current->code, array(), 'cron');
|
||||
|
||||
$resultHeader = $this->metric->getViewTableHeader($metric);
|
||||
$resultData = $this->metric->getViewTableData($metric, $result);
|
||||
$allResultData = $this->metric->getViewTableData($metric, $allResult);
|
||||
$resultHeader = $this->metric->getViewTableHeader($current);
|
||||
$resultData = $this->metric->getViewTableData($current, $result);
|
||||
$allResultData = $this->metric->getViewTableData($current, $allResult);
|
||||
}
|
||||
|
||||
$dateType = $current ? $current->dateType : 'nodate';
|
||||
@@ -103,6 +103,7 @@ class metric extends control
|
||||
$this->view->chartTypeList = $this->metric->getChartTypeList($resultHeader);
|
||||
$this->view->echartOptions = $this->metric->getEchartsOptions($resultHeader, $allResultData);
|
||||
$this->view->metricRecordType = $this->metric->getMetricRecordType($current->code, $current->scope);
|
||||
$this->view->noDataTip = $this->metric->getNoDataTip($current->code);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -338,6 +339,7 @@ class metric extends control
|
||||
$this->view->metric = $metric;
|
||||
$this->view->chartTypeList = $this->metric->getChartTypeList($resultHeader);
|
||||
$this->view->echartOptions = $this->metric->getEchartsOptions($resultHeader, $allResultData);
|
||||
$this->view->noDataTip = $this->metric->getNoDataTip($metric->code);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -123,7 +123,10 @@ $lang->metric->noDesc = "No description available";
|
||||
$lang->metric->noFormula = "No calculation rules available";
|
||||
$lang->metric->noCalc = "The PHP algorithm for this metric has not been implemented yet";
|
||||
$lang->metric->noSQL = "No SQL";
|
||||
$lang->metric->noData = "No data available";
|
||||
|
||||
$lang->metric->noData = "No data available.";
|
||||
$lang->metric->noDataBeforeCollect = "No data is available until the time for data collection.";
|
||||
$lang->metric->noDataAfterCollect = "No data is available after the time for data collection.";
|
||||
|
||||
$lang->metric->legendBasicInfo = 'Basic Information';
|
||||
$lang->metric->legendCreateInfo = 'Creation and Editing Information';
|
||||
|
||||
@@ -123,7 +123,10 @@ $lang->metric->noDesc = "No description available";
|
||||
$lang->metric->noFormula = "No calculation rules available";
|
||||
$lang->metric->noCalc = "The PHP algorithm for this metric has not been implemented yet";
|
||||
$lang->metric->noSQL = "No SQL";
|
||||
$lang->metric->noData = "No data available";
|
||||
|
||||
$lang->metric->noData = "No data available.";
|
||||
$lang->metric->noDataBeforeCollect = "No data is available until the time for data collection.";
|
||||
$lang->metric->noDataAfterCollect = "No data is available after the time for data collection.";
|
||||
|
||||
$lang->metric->legendBasicInfo = 'Basic Information';
|
||||
$lang->metric->legendCreateInfo = 'Creation and Editing Information';
|
||||
|
||||
@@ -123,7 +123,10 @@ $lang->metric->noDesc = "No description available";
|
||||
$lang->metric->noFormula = "No calculation rules available";
|
||||
$lang->metric->noCalc = "The PHP algorithm for this metric has not been implemented yet";
|
||||
$lang->metric->noSQL = "No SQL";
|
||||
$lang->metric->noData = "No data available";
|
||||
|
||||
$lang->metric->noData = "No data available.";
|
||||
$lang->metric->noDataBeforeCollect = "No data is available until the time for data collection.";
|
||||
$lang->metric->noDataAfterCollect = "No data is available after the time for data collection.";
|
||||
|
||||
$lang->metric->legendBasicInfo = 'Basic Information';
|
||||
$lang->metric->legendCreateInfo = 'Creation and Editing Information';
|
||||
|
||||
@@ -123,7 +123,10 @@ $lang->metric->noDesc = "暂无描述";
|
||||
$lang->metric->noFormula = "暂无计算规则";
|
||||
$lang->metric->noCalc = "暂未实现度量项PHP算法";
|
||||
$lang->metric->noSQL = "暂无";
|
||||
$lang->metric->noData = "暂时没有数据。";
|
||||
|
||||
$lang->metric->noData = "暂时没有数据。";
|
||||
$lang->metric->noDataBeforeCollect = "未到收集数据的时间,暂无数据。";
|
||||
$lang->metric->noDataAfterCollect = "度量范围内未产生数据,暂无数据。";
|
||||
|
||||
$lang->metric->legendBasicInfo = '基本信息';
|
||||
$lang->metric->legendCreateInfo = '创建编辑信息';
|
||||
|
||||
@@ -2101,4 +2101,31 @@ class metricModel extends model
|
||||
$dates = array_keys($dateLabels);
|
||||
return (string)current($dates);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取没有数据时的提示信息。
|
||||
* Get no data tip.
|
||||
*
|
||||
* @param string $code
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getNoDataTip($code)
|
||||
{
|
||||
$today = helper::today();
|
||||
|
||||
$todayData = $this->metricTao->fetchMetricRecordByDate('all', $today, 1);
|
||||
$todayDataWithCode = $this->metricTao->fetchMetricRecordByDate($code, $today, 1);
|
||||
$dataWithCode = $this->metricTao->fetchMetricRecordByDate($code, null, 1);
|
||||
|
||||
/* 度量项定义之后,未到采集时间,可以理解为今天没有任何数据并且该度量项没有任何数据。*/
|
||||
/* After the metric item is defined, it is not time to collect, which can be understood as there is no data today and the metric item has no data. */
|
||||
if(empty($todayData) && empty($dataWithCode)) return $this->lang->metric->noDataBeforeCollect;
|
||||
|
||||
/* 度量项定义之后,已到采集时间,但是没有采集到数据,可以理解为今天收集到了数据但是该度量项没有任何数据。*/
|
||||
/* After the metric item is defined, it is time to collect, but no data is collected, which can be understood as data is collected today, but the metric item has no data. */
|
||||
if(!empty($todayData) && empty($dataWithCode)) return $this->lang->metric->noDataAfterCollect;
|
||||
|
||||
return $this->lang->metric->noData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,6 +301,28 @@ class metricTao extends metricModel
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期获取度量数据。
|
||||
* Fetch metric record by date.
|
||||
*
|
||||
* @param string $code
|
||||
* @param string $date
|
||||
* @param int $limit
|
||||
* @access protected
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchMetricRecordByDate($code = 'all', $date = '', $limit = 100)
|
||||
{
|
||||
$records = $this->dao->select('*')->from(TABLE_METRICLIB)
|
||||
->where('1 = 1')
|
||||
->beginIF($code != 'all')->andWhere('metricCode')->eq($code)->fi()
|
||||
->beginIF(!empty($date))->andWhere('left(date, 10)')->eq($date)->fi()
|
||||
->beginIF($limit > 0)->limit($limit)->fi()
|
||||
->fetchAll();
|
||||
|
||||
return $records;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取度量数据有效字段。
|
||||
* Get metric record fields.
|
||||
|
||||
@@ -65,5 +65,5 @@ div
|
||||
)->size('100%', '100%')
|
||||
)
|
||||
) : null,
|
||||
$groupData ? null : span($lang->metric->noData, setClass('text-md'))
|
||||
$groupData ? null : span($noDataTip, setClass('text-md'))
|
||||
);
|
||||
|
||||
@@ -437,7 +437,7 @@ $metricBoxs = div
|
||||
)->size('100%', '100%')
|
||||
)
|
||||
) : null,
|
||||
$groupData ? null : span($lang->metric->noData, setClass('text-md'))
|
||||
$groupData ? null : span($noDataTip, setClass('text-md'))
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -394,7 +394,7 @@ div
|
||||
)->size('100%', '100%')
|
||||
)
|
||||
) : null,
|
||||
$groupData ? null : span($lang->metric->noData, setClass('text-md'))
|
||||
$groupData ? null : span($noDataTip, setClass('text-md'))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user