* Finish metric list style,task#102161,story#49045.
This commit is contained in:
@@ -53,12 +53,13 @@ class metric extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function preview($scope = 'project', $viewType = 'single')
|
||||
public function preview($scope = 'project', $viewType = 'single', $metricID = 0)
|
||||
{
|
||||
$this->metric->processScopeList();
|
||||
|
||||
$metrics = $this->metric->getList($scope);
|
||||
$current = current($metrics);
|
||||
$current = $this->metric->getByID($metricID);
|
||||
if(empty($current)) $current = current($metrics);
|
||||
|
||||
$metric = $this->metric->getByID($current->id);
|
||||
$result = $this->metric->getResultByCode($metric->code);
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
.side .name-color {color: var(--color-slate-600);}
|
||||
.side .metric-tree {padding-left: 24px; height: calc(100vh - 180px); overflow-y: scroll;}
|
||||
.side .metric-item {padding-bottom: 12px;}
|
||||
.side .metric-current {color: var(--nav-active-color);}
|
||||
.side .metric-item a {color: var(--color-inherit);}
|
||||
.side .metric-item:hover, .side .checkbox-primary:hover {color: var(--color-primary-500);}
|
||||
.side .metric-current {color: var(--color-primary-600);}
|
||||
|
||||
.side .check-list-metric {padding-top: 0; padding-bottom: 12px; gap: 12px;}
|
||||
|
||||
.main .metric-name {height: 48px; padding-left: 16px; margin-bottom: 8px; border-bottom: 1px solid var(--color-slate-300);}
|
||||
.main .flex-between {justify-content: space-between;}
|
||||
|
||||
@@ -118,7 +118,9 @@ class metricModel extends model
|
||||
if(is_array($fieldList)) $fieldList = implode(',', $fieldList);
|
||||
$metric = $this->dao->select($fieldList)->from(TABLE_METRIC)->where('id')->eq($metricID)->fetch();
|
||||
|
||||
if($metric->fromID !== 0)
|
||||
if(!$metric) return false;
|
||||
|
||||
if(!empty($metric->fromID))
|
||||
{
|
||||
$oldMetric = $this->getOldMetricByID($metric->fromID);
|
||||
|
||||
|
||||
@@ -10,21 +10,27 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
if($viewType == 'single')
|
||||
$metricTree = array();
|
||||
$metricCheckList = array();
|
||||
foreach($metrics as $key => $metric)
|
||||
{
|
||||
$metricTree = array();
|
||||
foreach($metrics as $key => $metric)
|
||||
$class = $metric->id == $current->id ? 'metric-current' : '';
|
||||
if($viewType == 'single')
|
||||
{
|
||||
$class = 'metric-item';
|
||||
if($key == 0) $class .= ' metric-current';
|
||||
$metricTree[] = div(setClass($class), $metric->name);
|
||||
$metricTree[] = li
|
||||
(
|
||||
set::className($class . ' metric-item font-medium'),
|
||||
a(
|
||||
$metric->name,
|
||||
set::href(helper::createLink('metric', 'preview', "scope=$scope&viewType=$viewType&metricID={$metric->id}")),
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$class .= ' font-medium checkbox';
|
||||
$metricCheckList[] = array('text' => $metric->name, 'value' => $key, 'typeClass' => $class, 'checked' => $metric->id == $current->id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$metricCheckList = array();
|
||||
$checkedList = array($key);
|
||||
foreach($metrics as $key => $metric) $metricCheckList[] = array('text' => $metric->name, 'value' => $key, 'checked' => in_array($key, $checkedList));
|
||||
}
|
||||
|
||||
$fnGenerateDataDisplay = function() use($resultData, $resultHeader, $lang, $metric)
|
||||
@@ -100,8 +106,13 @@ div
|
||||
div
|
||||
(
|
||||
setClass('metric-tree'),
|
||||
$viewType == 'single' ? $metricTree : checkList
|
||||
$viewType == 'single' ? ul
|
||||
(
|
||||
$metricTree,
|
||||
) :
|
||||
checkList
|
||||
(
|
||||
set::className('check-list-metric'),
|
||||
set::primary(true),
|
||||
set::name('metric'),
|
||||
set::inline(false),
|
||||
|
||||
Reference in New Issue
Block a user