diff --git a/module/execution/control.php b/module/execution/control.php index a8c683cb5a..a6ecf3c7e9 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2436,19 +2436,6 @@ class execution extends control $this->execution->setMenu($execution->id); $this->app->loadLang('bug'); - if($execution->type == 'kanban') - { - $this->app->loadClass('date'); - - list($begin, $end) = $this->execution->getBeginEnd4CFD($execution); - $dateList = date::getDateList($begin, $end, 'Y-m-d', 'noweekend'); - $chartData = $this->execution->buildCFDData($executionID, $dateList, 'task'); - if(isset($chartData['line'])) $chartData['line'] = array_reverse($chartData['line']); - - $this->view->begin = helper::safe64Encode(urlencode($begin)); - $this->view->end = helper::safe64Encode(urlencode($end)); - } - /* Load pager. */ $this->app->loadClass('pager', true); $pager = new pager(0, 30, 1); @@ -4364,4 +4351,28 @@ class execution extends control $this->display(); } + + /** + * AJAX: Get brun kanban html. + * + * @param int $executionID + * @access public + * @return void + */ + public function ajaxGetCFD(int $executionID) + { + $this->app->loadClass('date'); + + $execution = $this->execution->getById($executionID, true); + list($begin, $end) = $this->execution->getBeginEnd4CFD($execution); + $dateList = date::getDateList($begin, $end, 'Y-m-d', 'noweekend'); + $chartData = $this->execution->buildCFDData($executionID, $dateList, 'task'); + if(isset($chartData['line'])) $chartData['line'] = array_reverse($chartData['line']); + + $this->view->begin = helper::safe64Encode(urlencode($begin)); + $this->view->end = helper::safe64Encode(urlencode($end)); + $this->view->chartData = $chartData; + + $this->display(); + } } diff --git a/module/execution/css/ajaxgetcfd.ui.css b/module/execution/css/ajaxgetcfd.ui.css new file mode 100644 index 0000000000..e18acc65b2 --- /dev/null +++ b/module/execution/css/ajaxgetcfd.ui.css @@ -0,0 +1 @@ +.table-empty-tip {line-height: 150px;} diff --git a/module/execution/ui/ajaxgetburn.html.php b/module/execution/ui/ajaxgetburn.html.php index e234415a2e..da92ca789e 100644 --- a/module/execution/ui/ajaxgetburn.html.php +++ b/module/execution/ui/ajaxgetburn.html.php @@ -33,7 +33,7 @@ panel $lang->more ) : null, ), - echarts + common::hasPriv('execution', 'burn') ? echarts ( set::grid(array('left' => '0', 'right' => '50px', 'bottom' => '0', 'containLabel' => true)), set::xAxis @@ -164,7 +164,7 @@ panel ), ) ), - )->size('100%', '85%') + )->size('100%', '85%') : null ); /* ====== Render page ====== */ diff --git a/module/execution/ui/ajaxgetcfd.html.php b/module/execution/ui/ajaxgetcfd.html.php new file mode 100644 index 0000000000..0724ecfa53 --- /dev/null +++ b/module/execution/ui/ajaxgetcfd.html.php @@ -0,0 +1,77 @@ + + * @package execution + * @link https://www.zentao.net + */ +namespace zin; +panel +( + div + ( + set::class('flex flex-nowrap justify-between'), + div + ( + set('class', 'panel-title'), + $execution->name . $lang->execution->CFD, + ), + common::hasPriv('execution', 'cfd') ? btn + ( + setClass('ghost text-gray'), + set::url(createLink('execution', 'cfd', "executionID={$execution->id}")), + $lang->more + ) : null, + ), + div + ( + common::hasPriv('execution', 'cfd') ? isset($chartData['labels']) && count($chartData['labels']) != 1 ? echarts + ( + set::series($chartSeries), + set::tooltip(array( + 'trigger' => 'axis', + 'axisPointer' => array('type' => 'cross', 'label' => array('backgroundColor' => '#6a7985')), + 'textStyle' => array('fontWeight' => 100), + 'formatter' => "RAWJSRAWJS" + )), + set::legend(array( + 'data' => array_keys(array_reverse($chartData['line'])) + )), + set::grid(array( + 'left' => '3%', + 'right' => '5%', + 'bottom' => '3%', + 'containLabel' => true + )), + set::xAxis(array(array( + 'type' => 'category', + 'boundaryGap' => false, + 'data' => $chartData['labels'], + 'name' => $lang->execution->burnXUnit, + 'axisLine' => array('show' => true, 'lineStyle' =>array('color' => '#999', 'width' =>1)) + ))), + set::yAxis(array(array( + 'type' => 'value', + 'name' => $lang->execution->count, + 'minInterval' => 1, + 'nameTextStyle' => array('fontWeight' => 'normal'), + 'axisPointer' => array('label' => array('show' => true, 'precision' => 0)), + 'axisLine' => array('show' => true, 'lineStyle' => array('color' => '#999', 'width' => 1)) + ))) + )->size('100%', 500) : div + ( + setClass('table-empty-tip text-center'), + span + ( + setClass('text-gray'), + $lang->execution->noPrintData + ) + ) : null + ), +); + +/* ====== Render page ====== */ +render(); diff --git a/module/execution/ui/view.html.php b/module/execution/ui/view.html.php index ec39aca7f8..951b99d805 100644 --- a/module/execution/ui/view.html.php +++ b/module/execution/ui/view.html.php @@ -51,7 +51,7 @@ else array( 'id' => 1, 'size' => 'sm', - 'domID' => 'cfdBlock' + 'fetch' => createLink('execution', 'ajaxGetCFD', "executionID={$execution->id}") ), array( 'id' => 2, diff --git a/module/task/config/form.php b/module/task/config/form.php index 9e77e9fe5d..c38fd6a9df 100644 --- a/module/task/config/form.php +++ b/module/task/config/form.php @@ -7,7 +7,7 @@ $config->task->form->testTask = new stdclass(); global $app; $config->task->form->create = common::formConfig('task', 'create'); -$config->task->form->create['execution'] = array('type' => 'int', 'required' => true); +$config->task->form->create['execution'] = array('type' => 'int', 'required' => true, 'default' => 0); $config->task->form->create['type'] = array('type' => 'string', 'required' => true, 'default' => ''); $config->task->form->create['module'] = array('type' => 'int', 'required' => false); $config->task->form->create['story'] = array('type' => 'int', 'required' => false); diff --git a/module/task/control.php b/module/task/control.php index 6cf4fcf1f9..18691364a4 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -59,7 +59,7 @@ class task extends control /* Submit the data process after create the task form. */ if(!empty($_POST)) { - $taskData = $this->taskZen->buildTaskForCreate($this->post->execution); + $taskData = $this->taskZen->buildTaskForCreate($this->post->execution ? $this->post->execution : $executionID); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); /* Check whether a task with the same name is created within the specified time. */