diff --git a/module/execution/control.php b/module/execution/control.php index cba5cc75a9..1c9c672ea7 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2205,6 +2205,7 @@ class execution extends control if(empty($groupBy)) $groupBy = 'default'; /* Save to session. */ + $this->session->set('taskSearchValue', ''); $uri = $this->app->getURI(true); $this->app->session->set('taskList', $uri, 'execution'); $this->app->session->set('bugList', $uri, 'qa'); @@ -3831,6 +3832,7 @@ class execution extends control if($lastEditedTime > $enterTime or $groupBy != 'default' or !empty($searchValue)) { + if($from == 'execution') $this->session->set('taskSearchValue', $searchValue); $kanbanGroup = $from == 'execution' ? $this->loadModel('kanban')->getExecutionKanban($executionID, $browseType, $groupBy, $searchValue) : $this->loadModel('kanban')->getRDKanban($executionID, $browseType, 'id_asc', 0, $groupBy, $searchValue); return print(json_encode($kanbanGroup)); } diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js index 3515ab4bdf..1a785f4d17 100644 --- a/module/execution/js/taskkanban.js +++ b/module/execution/js/taskkanban.js @@ -384,18 +384,14 @@ function updateKanban(kanbanID, data) if(data == null) { - $("#kanbans").hide(); - $("#emptyBox").removeClass('hidden'); + $kanban.hide(); return false; } - else - { - $("#kanbans").show(); - $("#emptyBox").addClass('hidden'); - } + $kanban.show(); $kanban.data('zui.kanban').render(data); resetKanbanHeight(); + return true; } /** @@ -1185,7 +1181,7 @@ $(function() var lastUpdateData; setInterval(function() { - $.get(createLink('execution', 'ajaxUpdateKanban', "executionID=" + executionID + "&entertime=" + entertime + "&browseType=" + browseType + "&groupBy=" + groupBy), function(data) + $.get(createLink('execution', 'ajaxUpdateKanban', "executionID=" + executionID + "&entertime=" + entertime + "&browseType=" + browseType + "&groupBy=" + groupBy + '&from=execution&searchValue=' + searchValue), function(data) { if(data && lastUpdateData !== data) { @@ -1315,7 +1311,9 @@ function searchCards(value) searchValue = value; $.get(createLink('execution', 'ajaxUpdateKanban', "executionID=" + executionID + "&entertime=0&browseType=" + browseType + "&groupBy=" + groupBy + '&from=execution&searchValue=' + value), function(data) { + lastUpdateData = data; var kanbanData = $.parseJSON(data); + var hideAll = true; if(groupBy == 'default') { var kanbanLane = ''; @@ -1325,12 +1323,21 @@ function searchCards(value) if(kanbanList[i] == 'bug') kanbanLane = kanbanData.bug; if(kanbanList[i] == 'task') kanbanLane = kanbanData.task; - if(browseType == kanbanList[i] || browseType == 'all') updateKanban(kanbanList[i], kanbanLane); + if(browseType == kanbanList[i] || browseType == 'all') hideAll = !updateKanban(kanbanList[i], kanbanLane) && hideAll; } } else { - updateKanban(browseType, kanbanGroup[groupBy]); + hideAll = !updateKanban(browseType, kanbanData[groupBy]) && hideAll; + } + + if(hideAll) + { + $("#emptyBox").removeClass('hidden'); + } + else + { + $("#emptyBox").addClass('hidden'); } }); } diff --git a/module/kanban/control.php b/module/kanban/control.php index 1b83d01bfb..4c8eb677a2 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1764,7 +1764,8 @@ class kanban extends control $this->dao->update(TABLE_STORYSTAGE)->set('stage')->eq($toColumn->type)->where('story')->eq($cardID)->exec(); } - $kanbanGroup = $regionID == 0 ? $this->kanban->getExecutionKanban($executionID, $browseType, $groupBy) : $this->kanban->getRDKanban($executionID, $browseType, $orderBy, $regionID, $groupBy); + $taskSearchValue = $this->session->taskSearchValue ? $this->session->taskSearchValue : ''; + $kanbanGroup = $regionID == 0 ? $this->kanban->getExecutionKanban($executionID, $browseType, $groupBy, $taskSearchValue) : $this->kanban->getRDKanban($executionID, $browseType, $orderBy, $regionID, $groupBy); echo json_encode($kanbanGroup); } diff --git a/module/kanban/model.php b/module/kanban/model.php index 3e38a35088..f453ac6468 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -1327,12 +1327,13 @@ class kanbanModel extends model * @param int $executionID * @param string $browseType all|story|bug|task * @param string $groupBy + * @param string $searchValue * @access public * @return array */ - public function getExecutionKanban($executionID, $browseType = 'all', $groupBy = 'default') + public function getExecutionKanban($executionID, $browseType = 'all', $groupBy = 'default', $searchValue = '') { - if($groupBy != 'default') return $this->getKanban4Group($executionID, $browseType, $groupBy); + if($groupBy != 'default') return $this->getKanban4Group($executionID, $browseType, $groupBy, $searchValue); $lanes = $this->dao->select('*')->from(TABLE_KANBANLANE) ->where('execution')->eq($executionID) @@ -1414,14 +1415,14 @@ class kanbanModel extends model if($lane->type == 'task') { - if(!empty($searchValue) and strpos($object->name, $searchValue) === false) continue; + if($searchValue != '' and strpos($object->name, $searchValue) === false) continue; $cardData['name'] = $object->name; $cardData['status'] = $object->status; $cardData['left'] = $object->left; } else { - if(!empty($searchValue) and strpos($object->title, $searchValue) === false) continue; + if($searchValue != '' and strpos($object->title, $searchValue) === false) continue; $cardData['title'] = $object->title; } @@ -1432,9 +1433,10 @@ class kanbanModel extends model $laneData['cards'][$column->type][] = $cardData; $cardOrder ++; } - if(!isset($laneData['cards'][$column->type])) $laneData['cards'][$column->type] = array(); + if($searchValue == '' and !isset($laneData['cards'][$column->type])) $laneData['cards'][$column->type] = array(); } + if($searchValue != '' and empty($laneData['cards'])) continue; $kanbanGroup[$lane->type]['id'] = $laneID; $kanbanGroup[$lane->type]['columns'] = array_values($columnData); $kanbanGroup[$lane->type]['lanes'][] = $laneData; @@ -1563,24 +1565,24 @@ class kanbanModel extends model if($browseType == 'task') { - if(!empty($searchValue) and strpos($object->name, $searchValue) === false) continue; + if($searchValue != '' and strpos($object->name, $searchValue) === false) continue; $cardData['name'] = $object->name; $cardData['status'] = $object->status; $cardData['left'] = $object->left; } else { - if(!empty($searchValue) and strpos($object->title, $searchValue) === false) continue; + if($searchValue != '' and strpos($object->title, $searchValue) === false) continue; $cardData['title'] = $object->title; } $laneData['cards'][$column->columnType][] = $cardData; $cardOrder ++; } - if(empty($searchValue) and !isset($laneData['cards'][$column->columnType])) $laneData['cards'][$column->columnType] = array(); + if($searchValue == '' and !isset($laneData['cards'][$column->columnType])) $laneData['cards'][$column->columnType] = array(); } - if(!empty($searchValue) and empty($laneData['cards'])) continue;; + if($searchValue != '' and empty($laneData['cards'])) continue; $kanbanGroup[$groupBy]['id'] = $groupBy . $laneID; $kanbanGroup[$groupBy]['columns'] = array_values($columnData); $kanbanGroup[$groupBy]['lanes'][] = $laneData;