* Finish task#48008 and fix bug for 48011.

This commit is contained in:
liumengyi
2022-01-21 13:49:47 +08:00
parent d0739e40e3
commit 80da12fc7d
4 changed files with 102 additions and 17 deletions
+50 -10
View File
@@ -1709,10 +1709,11 @@ class execution extends control
* Start execution.
*
* @param int $executionID
* @param string $from
* @access public
* @return void
*/
public function start($executionID)
public function start($executionID, $from = 'execution')
{
$execution = $this->commonAction($executionID);
$executionID = $execution->id;
@@ -1732,7 +1733,14 @@ class execution extends control
$this->loadModel('common')->syncPPEStatus($executionID);
$this->executeHooks($executionID);
die(js::reload('parent.parent'));
if(isonlybody() and $from == 'kanban')
{
return print(js::closeModal('parent.parent', '', "parent.parent.changeStatus('doing')"));
}
else
{
return print(js::reload('parent.parent'));
}
}
$this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->execution->start;
@@ -1747,10 +1755,11 @@ class execution extends control
* Delay execution.
*
* @param int $executionID
* @param string $from
* @access public
* @return void
*/
public function putoff($executionID)
public function putoff($executionID, $from = 'execution')
{
$execution = $this->commonAction($executionID);
$executionID = $execution->id;
@@ -1767,7 +1776,14 @@ class execution extends control
$this->action->logHistory($actionID, $changes);
}
$this->executeHooks($executionID);
die(js::reload('parent.parent'));
if(isonlybody() and $from == 'kanban')
{
return print(js::closeModal('parent.parent', '', "parent.parent.changeStatus('doing')"));
}
else
{
return print(js::reload('parent.parent'));
}
}
$this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->execution->putoff;
@@ -1782,10 +1798,11 @@ class execution extends control
* Suspend execution.
*
* @param int $executionID
* @param string $from
* @access public
* @return void
*/
public function suspend($executionID)
public function suspend($executionID, $from = 'execution')
{
$execution = $this->commonAction($executionID);
$executionID = $execution->id;
@@ -1803,7 +1820,14 @@ class execution extends control
$this->action->logHistory($actionID, $changes);
}
$this->executeHooks($executionID);
die(js::reload('parent.parent'));
if(isonlybody() and $from == 'kanban')
{
return print(js::closeModal('parent.parent', '', "parent.parent.changeStatus('suspended')"));
}
else
{
return print(js::reload('parent.parent'));
}
}
$this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->execution->suspend;
@@ -1818,10 +1842,11 @@ class execution extends control
* Activate execution.
*
* @param int $executionID
* @param string $frim
* @access public
* @return void
*/
public function activate($executionID)
public function activate($executionID, $from = 'execution')
{
$execution = $this->commonAction($executionID);
$executionID = $execution->id;
@@ -1839,7 +1864,14 @@ class execution extends control
$this->action->logHistory($actionID, $changes);
}
$this->executeHooks($executionID);
die(js::reload('parent.parent'));
if(isonlybody() and $from == 'kanban')
{
return print(js::closeModal('parent.parent', '', "parent.parent.changeStatus('doing')"));
}
else
{
return print(js::reload('parent.parent'));
}
}
$newBegin = date('Y-m-d');
@@ -1861,10 +1893,11 @@ class execution extends control
* Close execution.
*
* @param int $executionID
* @param string $from
* @access public
* @return void
*/
public function close($executionID)
public function close($executionID, $from = 'execution')
{
$execution = $this->commonAction($executionID);
$executionID = $execution->id;
@@ -1882,7 +1915,14 @@ class execution extends control
$this->action->logHistory($actionID, $changes);
}
$this->executeHooks($executionID);
die(js::reload('parent.parent'));
if(isonlybody() and $from == 'kanban')
{
return print(js::closeModal('parent.parent', '', "parent.parent.changeStatus('closed')"));
}
else
{
return print(js::reload('parent.parent'));
}
}
$this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->execution->close;
+45
View File
@@ -1,3 +1,46 @@
/**
* When execution status change.
*
* @param stirng executionStatus
* @access public
* @return void
*/
function changeStatus(executionStatus)
{
if(executionStatus == 'wait')
{
$('.startButton').removeClass('hidden');
$('.putoffButton').removeClass('hidden');
$('.suspendButton').removeClass('hidden');
$('.closeButton').removeClass('hidden');
$('.activateButton').addClass('hidden');
}
else if(executionStatus == 'doing')
{
$('.startButton').addClass('hidden');
$('.putoffButton').removeClass('hidden');
$('.suspendButton').removeClass('hidden');
$('.closeButton').removeClass('hidden');
$('.activateButton').addClass('hidden');
}
else if(executionStatus == 'suspended')
{
$('.startButton').addClass('hidden');
$('.putoffButton').addClass('hidden');
$('.suspendButton').addClass('hidden');
$('.closeButton').removeClass('hidden');
$('.activateButton').removeClass('hidden');
}
else if(executionStatus == 'closed')
{
$('.startButton').addClass('hidden');
$('.putoffButton').addClass('hidden');
$('.suspendButton').addClass('hidden');
$('.closeButton').addClass('hidden');
$('.activateButton').removeClass('hidden');
}
}
/**
* Display the kanban in full screen.
*
@@ -1046,6 +1089,8 @@ function initKanban($kanban)
*/
$(function()
{
changeStatus(execution.status);
window.kanbanScaleSize = +$.zui.store.get('executionKanbanScaleSize', 1);
$('#kanbanScaleSize').text(window.kanbanScaleSize);
$('#kanbanScaleControl .btn[data-type="+"]').attr('disabled', window.kanbanScaleSize >= 4 ? 'disabled' : null);
+5 -5
View File
@@ -126,11 +126,11 @@ js::set('hasTaskButton', $hasTaskButton);
if(common::hasPriv('kanban', 'setLaneHeight')) $actions .= '<li>' . html::a(helper::createLink('kanban', 'setLaneHeight', "kanbanID=$execution->id&from=execution", '', true), '<i class="icon icon-size-height"></i>' . $lang->kanban->laneHeight, '', "class='iframe btn btn-link text-left' data-width=$width") . '</li>';
$kanbanActions = '';
if(common::hasPriv('execution', 'edit')) $kanbanActions .= '<li>' . html::a(helper::createLink('execution', 'edit', "executionID=$execution->id", '', true), '<i class="icon icon-edit"></i>' . $lang->kanban->edit, '', "class='iframe btn btn-link text-left' data-width='75%'") . '</li>';
if(in_array('start', $executionActions)) $kanbanActions .= '<li>' . html::a(helper::createLink('execution', 'start', "executionID=$execution->id", '', true), '<i class="icon icon-play"></i>' . $lang->execution->start, '', "class='iframe btn btn-link text-left' data-width='75%'") . '</li>';
if(in_array('putoff', $executionActions)) $kanbanActions .= '<li>' . html::a(helper::createLink('execution', 'putoff', "executionID=$execution->id", '', true), '<i class="icon icon-calendar"></i>' . $lang->execution->putoff, '', "class='iframe btn btn-link text-left' data-width='75%'") . '</li>';
if(in_array('suspend', $executionActions)) $kanbanActions .= '<li>' . html::a(helper::createLink('execution', 'suspend', "executionID=$execution->id", '', true), '<i class="icon icon-pause"></i>' . $lang->execution->suspend, '', "class='iframe btn btn-link text-left' data-width='75%'") . '</li>';
if(in_array('close', $executionActions)) $kanbanActions .= '<li>' . html::a(helper::createLink('execution', 'close', "executionID=$execution->id", '', true), '<i class="icon icon-off"></i>' . $lang->execution->close, '', "class='iframe btn btn-link text-left' data-width='75%'") . '</li>';
if(in_array('activate', $executionActions)) $kanbanActions .= '<li>' . html::a(helper::createLink('execution', 'activate', "executionID=$execution->id", '', true), '<i class="icon icon-magic"></i>' . $lang->execution->activate, '', "class='iframe btn btn-link text-left' data-width='75%'") . '</li>';
if(common::hasPriv('execution', 'start')) $kanbanActions .= '<li class="startButton hidden">' . html::a(helper::createLink('execution', 'start', "executionID=$execution->id&from=kanban", '', true), '<i class="icon icon-play"></i>' . $lang->execution->start, '', "class='iframe btn btn-link text-left' data-width='75%'") . '</li>';
if(common::hasPriv('execution', 'putoff')) $kanbanActions .= '<li class="putoffButton hidden">' . html::a(helper::createLink('execution', 'putoff', "executionID=$execution->id&from=kanban", '', true), '<i class="icon icon-calendar"></i>' . $lang->execution->putoff, '', "class='iframe btn btn-link text-left' data-width='75%'") . '</li>';
if(common::hasPriv('execution', 'suspend')) $kanbanActions .= '<li class="suspendButton hidden">' . html::a(helper::createLink('execution', 'suspend', "executionID=$execution->id&from=kanban", '', true), '<i class="icon icon-pause"></i>' . $lang->execution->suspend, '', "class='iframe btn btn-link text-left' data-width='75%'") . '</li>';
if(common::hasPriv('execution', 'close')) $kanbanActions .= '<li class="closeButton hidden">' . html::a(helper::createLink('execution', 'close', "executionID=$execution->id&from=kanban", '', true), '<i class="icon icon-off"></i>' . $lang->execution->close, '', "class='iframe btn btn-link text-left' data-width='75%'") . '</li>';
if(common::hasPriv('execution', 'activate')) $kanbanActions .= '<li class="activateButton hidden">' . html::a(helper::createLink('execution', 'activate', "executionID=$execution->id&from=kanban", '', true), '<i class="icon icon-magic"></i>' . $lang->execution->activate, '', "class='iframe btn btn-link text-left' data-width='75%'") . '</li>';
if(common::hasPriv('execution', 'delete')) $kanbanActions .= '<li>' . html::a(helper::createLink('execution', 'delete', "executionID=$execution->id"), '<i class="icon icon-trash"></i>' . $lang->delete, 'hiddenwin', "class='btn btn-link text-left'") . '</li>';
if($kanbanActions)
{