This commit is contained in:
tanghucheng
2023-06-29 10:09:25 +08:00
9 changed files with 78 additions and 27 deletions
+2 -1
View File
@@ -35,9 +35,10 @@ class projectReleasesEntry extends entry
{
$result = array();
$releases = $data->data->releases;
$pager = $data->data->pager;
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date,mailto:userList');
return $this->send(200, array('total' => count($result), 'releases' => $result));
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'releases' => $result));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
+2 -1
View File
@@ -32,9 +32,10 @@ class releasesEntry extends entry
{
$result = array();
$releases = $data->data->releases;
$pager = $data->data->pager;
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date,mailto:userList');
return $this->send(200, array('total' => count($result), 'releases' => $result));
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'releases' => $result));
}
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
+1
View File
@@ -9,6 +9,7 @@ INSERT INTO `zt_privlang` (`objectID`, `objectType`, `lang`, `key`, `value`, `de
ALTER TABLE `zt_traincourse` ADD `importedStatus` enum('wait','doing','done') NOT NULL DEFAULT 'wait' AFTER `desc`;
ALTER TABLE `zt_traincourse` ADD `lastUpdatedTime` int UNSIGNED NOT NULL DEFAULT 0 AFTER `importedStatus`;
ALTER TABLE `zt_traincourse` MODIFY COLUMN `code` varchar(255) DEFAULT '' NOT NULL;
UPDATE `zt_im_chat` SET `createdDate` = NULL WHERE `createdDate` = '0000-00-00 00:00:00';
UPDATE `zt_im_chat` SET `editedDate` = NULL WHERE `editedDate` = '0000-00-00 00:00:00';
+1 -1
View File
@@ -3073,7 +3073,7 @@ CREATE TABLE IF NOT EXISTS `zt_deployscope` (
-- DROP TABLE IF EXISTS `zt_traincourse`;
CREATE TABLE IF NOT EXISTS `zt_traincourse` (
`id` mediumint(8) NOT NULL AUTO_INCREMENT,
`code` varchar(50) NOT NULL DEFAULT '',
`code` varchar(255) NOT NULL DEFAULT '',
`category` mediumint(8) NOT NULL DEFAULT '0',
`name` varchar(255) NOT NULL DEFAULT '',
`status` varchar(10) NOT NULL DEFAULT '',
+33 -17
View File
@@ -1185,7 +1185,6 @@ class bug extends control
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->view->currentModuleID = $currentModuleID;
$this->view->executions = $executions;
$this->view->stories = $bug->execution ? $this->story->getExecutionStoryPairs($bug->execution) : $this->story->getProductStoryPairs($bug->product, $bug->branch, 0, 'all', 'id_desc', 0, 'full', 'story', false);
$this->view->branchOption = $branchOption;
$this->view->branchTagOption = $branchTagOption;
$this->view->tasks = $this->task->getExecutionTaskPairs($bug->execution);
@@ -1202,7 +1201,7 @@ class bug extends control
*
* @param int $bugID
* @access public
* @return mixed
* @return int
*/
public function ajaxGetAllBuilds($bugID)
{
@@ -1239,30 +1238,47 @@ class bug extends control
if(($bug->resolvedBuild) and isset($allBuilds[$bug->resolvedBuild])) $oldResolvedBuild[$bug->resolvedBuild] = $allBuilds[$bug->resolvedBuild];
$builds = new stdclass();
$builds->openedBuilds = array_map(function($key, $value)
{
return (object) array('value' => $key, 'text' => $value);
}, array_keys($openedBuilds), array_values($openedBuilds));
$builds->openedBuilds = $this->bug->convertArrayToObjectArray($openedBuilds);
$resolvedBuilds = $openedBuilds + $oldResolvedBuild;
$builds->resolvedBuilds = array_map(function($key, $value)
{
return (object) array('value' => $key, 'text' => $value);
}, array_keys($resolvedBuilds), array_values($resolvedBuilds));
$builds->resolvedBuilds = $this->bug->convertArrayToObjectArray($resolvedBuilds);
$builds->resolvedBuildName = zget($resolvedBuilds, $bug->resolvedBuild);
echo json_encode($builds);
return print(helper::jsonEncode($builds));
}
/**
* Ajax get testTasks.
*
* @param int $bugID
* @access public
* @return int
*/
public function ajaxGetTestTasks($bugID)
{
$bug = $this->bug->getById($bugID);
$testTasks = $this->loadModel('testtask')->getPairs($bug->product, $bug->execution, $bug->testtask);
$testTasks = array_map(function($key, $value)
{
return (object) array('value' => $key, 'text' => $value);
}, array_keys($testTasks), array_values($testTasks));
echo json_encode($testTasks);
$testTasks = $this->loadModel('testtask')->getPairs($bug->product, $bug->execution, $bug->testtask, 'noempty');
$testTasks = $this->bug->convertArrayToObjectArray($testTasks);
return print(helper::jsonEncode($testTasks));
}
/**
* Ajax get stories.
*
* @param int $bugID
* @access public
* @return int
*/
public function ajaxGetStories($bugID)
{
$bug = $this->bug->getById($bugID);
$stories = $bug->execution ? $this->story->getExecutionStoryPairs($bug->execution) : $this->story->getProductStoryPairs($bug->product, $bug->branch, 0, 'all', 'id_desc', 0, 'full', 'story', false);
if(isset($stories[0])) unset($stories[0]);
$stories = $this->bug->convertArrayToObjectArray($stories);
return print(helper::jsonEncode($stories));
}
/**
+2 -2
View File
@@ -319,7 +319,7 @@ function loadProductStories(productID)
if(typeof(branch) == 'undefined') branch = 0;
if(typeof(oldStoryID) == 'undefined') oldStoryID = 0;
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleId=0&storyID=' + oldStoryID);
$('#storyIdBox').load(link, function(){$('#story').chosen();});
$('#storyIdBox').load(link, function(){$('#story').picker();});
}
/**
@@ -773,7 +773,7 @@ function setStories(moduleID, productID, storyID)
$('#story').replaceWith(stories);
$('#story_chosen').remove();
$('#story').next('.picker').remove();
$("#story").chosen();
$("#story").picker();
});
}
+20 -3
View File
@@ -9,7 +9,7 @@ $(function()
if(picker) picker.destroy();
var options = $.extend({}, originOptions, {searchDelay : 1000});
var options = $.extend({}, originOptions, {searchDelay: 1000});
$element.picker(options);
};
@@ -17,6 +17,7 @@ $(function()
initPicker($('#duplicateBug'));
renderBuilds();
renderTestTasks();
renderStories();
$('#duplicateBug').picker(
{
@@ -59,7 +60,7 @@ function renderBuilds()
$('#openedBuild').data('zui.picker').setValue(oldOpenedBuild);
var resolvedBuilds = data.resolvedBuilds;
$('#resolvedBuild').data('zui.picker').destroy();
$('#resolvedBuild').picker({list: resolvedBuilds});
$('#resolvedBuild').picker({list: resolvedBuilds, allowSingleDeselect: 'true'});
$('#resolvedBuild').data('zui.picker').setValue(oldResolvedBuild);
resolution = $('#resolution').val();
@@ -93,11 +94,27 @@ function renderTestTasks()
$.get(createLink('bug', 'ajaxGetTestTasks', 'bugID=' + bugID), function(data)
{
$('#testtask').data('zui.picker').destroy();
$('#testtask').picker({list: data});
$('#testtask').picker({list: data, allowSingleDeselect: 'true'});
$('#testtask').data('zui.picker').setValue(bugTestTask);
}, 'json');
}
/**
* render stories.
*
* @access public
* @return void
*/
function renderStories()
{
$.get(createLink('bug', 'ajaxGetStories', 'bugID=' + bugID), function(data)
{
$('#story').data('zui.picker').destroy();
$('#story').picker({list: data, allowSingleDeselect: 'true'});
$('#story').data('zui.picker').setValue(oldStoryID);
}, 'json');
}
/**
* Set duplicate field.
*
+15
View File
@@ -3796,4 +3796,19 @@ class bugModel extends model
return $index;
}
/**
* Convert array to object array.
*
* @param int $data
* @access public
* @return array
*/
public function convertArrayToObjectArray($data)
{
return array_map(function($key, $value)
{
return (object) array('value' => $key, 'text' => $value);
}, array_keys($data), array_values($data));
}
}
+2 -2
View File
@@ -221,7 +221,7 @@ if($this->app->tab == 'project') js::set('objectID', $bug->project);
</tr>
<tr>
<th><?php echo $lang->bug->story;?></th>
<td><div id='storyIdBox'><?php echo html::select('story', $stories, $bug->story, "class='form-control chosen'");?></div>
<td><div id='storyIdBox'><?php echo html::select('story', array(), '', "class='form-control picker-select'");?></div>
</td>
</tr>
<tr>
@@ -314,7 +314,7 @@ if($this->app->tab == 'project') js::set('objectID', $bug->project);
</tr>
<tr>
<th><?php echo $lang->bug->testtask;?></th>
<td id='testtaskBox'><?php echo html::select('testtask', array(), '', 'class="form-control picker-select"');?></td>
<td id='testtaskBox'><?php echo html::select('testtask', array(), $bug->testtask, 'class="form-control picker-select"');?></td>
</tr>
<tr>
<th><?php echo $lang->bug->fromCase;?></th>