* Finish task#8193.
This commit is contained in:
+2
-1
@@ -1,4 +1,5 @@
|
||||
ALTER TABLE `zt_doc` ADD `mailto` text AFTER `editedDate`;
|
||||
ALTER TABLE `zt_job` ADD `customParam` text AFTER `lastTag`;
|
||||
ALTER TABLE `zt_doc` ADD `mailto` text AFTER `editedDate`;
|
||||
ALTER TABLE `zt_task` CHANGE `realStarted` `realStarted` datetime NOT NULL AFTER `estStarted`;
|
||||
ALTER TABLE `zt_group` CHANGE `program` `PRJ` mediumint(8) unsigned NOT NULL DEFAULT 0;
|
||||
|
||||
|
||||
@@ -466,6 +466,7 @@ CREATE TABLE IF NOT EXISTS `zt_job` (
|
||||
`lastExec` datetime DEFAULT NULL,
|
||||
`lastStatus` varchar(255) DEFAULT NULL,
|
||||
`lastTag` varchar(255) DEFAULT NULL,
|
||||
`customParam` text NOT NULL,
|
||||
`deleted` enum('0','1') NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -5,3 +5,4 @@
|
||||
#jkHost_chosen .chosen-single{border-right:0px;}
|
||||
#jkJobBox{width:385px;}
|
||||
#svnDirBox .input-group{width:unset !important}
|
||||
#paramDiv .input-group{padding:3px}
|
||||
|
||||
@@ -5,3 +5,4 @@
|
||||
#jkHost_chosen .chosen-single{border-right:0px;}
|
||||
#jkJobBox{width:385px;}
|
||||
#svnDirBox .input-group{width:unset !important}
|
||||
#paramDiv .input-group{padding:3px}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Add item.
|
||||
*
|
||||
* @param obj $obj
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function addItem(obj)
|
||||
{
|
||||
var $inputgroup = $(obj).closest('.input-group').clone();
|
||||
$inputgroup.find('input').val('');
|
||||
$(obj).closest('.input-group').after($inputgroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete item.
|
||||
*
|
||||
* @param obj $obj
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function deleteItem(obj)
|
||||
{
|
||||
if($('#paramDiv').find("input").size() <= 2) return;
|
||||
$(obj).closest('.input-group').remove();
|
||||
}
|
||||
@@ -26,6 +26,9 @@ $lang->job->atTime = 'At Time';
|
||||
$lang->job->lastStatus = 'Last Status';
|
||||
$lang->job->lastExec = 'Last Executed';
|
||||
$lang->job->comment = 'Match Keywords';
|
||||
$lang->job->customParam = 'Benutzerdefinierte Bauparameter';
|
||||
$lang->job->paramName = 'Name';
|
||||
$lang->job->paramValue = 'Wert';
|
||||
|
||||
$lang->job->lblBasic = 'Basic Info';
|
||||
|
||||
@@ -33,6 +36,7 @@ $lang->job->example = 'e.g.';
|
||||
$lang->job->commitEx = "Used to match the keywords used to create a compile. Multiple keywords are separated by ','";
|
||||
$lang->job->cronSample = 'e.g. 0 0 2 * * 2-6/1 means 2:00 a.m. every weekday.';
|
||||
$lang->job->sendExec = 'Send execute request success.';
|
||||
$lang->job->inputName = 'Bitte geben Sie den Parameternamen ein.';
|
||||
|
||||
$lang->job->buildTypeList['build'] = 'Only Build';
|
||||
$lang->job->buildTypeList['buildAndDeploy'] = 'Build And Deploy';
|
||||
|
||||
@@ -26,6 +26,9 @@ $lang->job->atTime = 'At Time';
|
||||
$lang->job->lastStatus = 'Last Status';
|
||||
$lang->job->lastExec = 'Last Executed';
|
||||
$lang->job->comment = 'Match Keywords';
|
||||
$lang->job->customParam = 'Custom build parameters';
|
||||
$lang->job->paramName = 'Name';
|
||||
$lang->job->paramValue = 'Value';
|
||||
|
||||
$lang->job->lblBasic = 'Basic Info';
|
||||
|
||||
@@ -33,6 +36,7 @@ $lang->job->example = 'e.g.';
|
||||
$lang->job->commitEx = "Used to match the keywords used to create a compile. Multiple keywords are separated by ','";
|
||||
$lang->job->cronSample = 'e.g. 0 0 2 * * 2-6/1 means 2:00 a.m. every weekday.';
|
||||
$lang->job->sendExec = 'Send execute request success.';
|
||||
$lang->job->inputName = 'Please enter parameter name.';
|
||||
|
||||
$lang->job->buildTypeList['build'] = 'Only Build';
|
||||
$lang->job->buildTypeList['buildAndDeploy'] = 'Build And Deploy';
|
||||
|
||||
@@ -26,6 +26,9 @@ $lang->job->atTime = 'heure';
|
||||
$lang->job->lastStatus = 'Dern Statut';
|
||||
$lang->job->lastExec = 'Dern Exec';
|
||||
$lang->job->comment = 'Corres Mots cl閟';
|
||||
$lang->job->customParam = 'Paramètres de construction personnalisés';
|
||||
$lang->job->paramName = 'Nom';
|
||||
$lang->job->paramValue = 'PH';
|
||||
|
||||
$lang->job->lblBasic = 'Infos de Base';
|
||||
|
||||
@@ -33,6 +36,7 @@ $lang->job->example = 'ex.';
|
||||
$lang->job->commitEx = "Utilis pour faire correspondre les mots cl閟 utilis閟 pour cr閑r une compilation. Plusieurs mots cl閟 sont s閜ar閟 par ','";
|
||||
$lang->job->cronSample = 'ex: 0 0 2 * * 2-6/1 signifie 2:00 a.m. chaque jour de la semaine.';
|
||||
$lang->job->sendExec = "Envoi de la demande d'ex閏ution r閡ssie.";
|
||||
$lang->job->inputName = 'Veuillez saisir le nom du paramètre.';
|
||||
|
||||
$lang->job->buildTypeList['build'] = 'Seulement Build';
|
||||
$lang->job->buildTypeList['buildAndDeploy'] = 'Build et D閜loiement';
|
||||
|
||||
@@ -26,6 +26,9 @@ $lang->job->atTime = 'Vào lúc';
|
||||
$lang->job->lastStatus = 'Tình trạng cuối';
|
||||
$lang->job->lastExec = 'Xử lý cuối';
|
||||
$lang->job->comment = 'Từ khóa phù hợp';
|
||||
$lang->job->customParam = 'Tham số tự chọn';
|
||||
$lang->job->paramName = 'Tên';
|
||||
$lang->job->paramValue = 'giá';
|
||||
|
||||
$lang->job->lblBasic = 'Basic Info';
|
||||
|
||||
@@ -33,6 +36,7 @@ $lang->job->example = 'ví dụ: ';
|
||||
$lang->job->commitEx = "Used to match the keywords used to create a compile. Multiple keywords are separated by ','";
|
||||
$lang->job->cronSample = 'ví dụ: 0 0 2 * * 2-6/1 means 2:00 a.m. every weekday.';
|
||||
$lang->job->sendExec = 'Gửi execute request success.';
|
||||
$lang->job->inputName = 'Hãy nhập tên tham số.';
|
||||
|
||||
$lang->job->buildTypeList['build'] = 'Chỉ bản dựng';
|
||||
$lang->job->buildTypeList['buildAndDeploy'] = 'Bản dựng và triển khai';
|
||||
|
||||
@@ -26,6 +26,9 @@ $lang->job->atTime = '执行时间';
|
||||
$lang->job->lastStatus = '最后执行状态';
|
||||
$lang->job->lastExec = '最后执行时间';
|
||||
$lang->job->comment = '匹配关键字';
|
||||
$lang->job->customParam = '自定义构建参数';
|
||||
$lang->job->paramName = '名称';
|
||||
$lang->job->paramValue = '值';
|
||||
|
||||
$lang->job->lblBasic = '基本信息';
|
||||
|
||||
@@ -33,6 +36,7 @@ $lang->job->example = '举例';
|
||||
$lang->job->commitEx = "用于匹配创建构建任务的关键字,多个关键字用','分割";
|
||||
$lang->job->cronSample = '如 0 0 2 * * 2-6/1 表示每个工作日凌晨2点';
|
||||
$lang->job->sendExec = '发送执行请求成功!执行结果:%s';
|
||||
$lang->job->inputName = '请输入参数名称。';
|
||||
|
||||
$lang->job->buildTypeList['build'] = '仅构建';
|
||||
$lang->job->buildTypeList['buildAndDeploy'] = '构建部署';
|
||||
|
||||
@@ -26,6 +26,9 @@ $lang->job->atTime = '執行時間';
|
||||
$lang->job->lastStatus = '最後執行狀態';
|
||||
$lang->job->lastExec = '最後執行時間';
|
||||
$lang->job->comment = '匹配關鍵字';
|
||||
$lang->job->customParam = '自定義構建參數';
|
||||
$lang->job->paramName = '名稱';
|
||||
$lang->job->paramValue = '值';
|
||||
|
||||
$lang->job->lblBasic = '基本信息';
|
||||
|
||||
@@ -33,6 +36,7 @@ $lang->job->example = '舉例';
|
||||
$lang->job->commitEx = "用於匹配創建構建任務的關鍵字,多個關鍵字用','分割";
|
||||
$lang->job->cronSample = '如 0 0 2 * * 2-6/1 表示每個工作日凌晨2點';
|
||||
$lang->job->sendExec = '發送執行請求成功!執行結果:%s';
|
||||
$lang->job->inputName = '請輸入參數名稱。';
|
||||
|
||||
$lang->job->buildTypeList['build'] = '僅構建';
|
||||
$lang->job->buildTypeList['buildAndDeploy'] = '構建部署';
|
||||
|
||||
+39
-1
@@ -128,6 +128,23 @@ class jobModel extends model
|
||||
if($job->svnDir == '/' and $_POST['svnDir']) $job->svnDir = array_pop($_POST['svnDir']);
|
||||
}
|
||||
|
||||
$customParam = array();
|
||||
foreach($job->paramName as $key => $paramName)
|
||||
{
|
||||
$paramValue = zget($job->paramValue, $key, '');
|
||||
|
||||
if(empty($paramName) and !empty($paramValue))
|
||||
{
|
||||
dao::$errors[] = $this->lang->job->inputName;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!empty($paramName)) $customParam[$paramName] = $paramValue;
|
||||
}
|
||||
unset($job->paramName);
|
||||
unset($job->paramValue);
|
||||
$job->customParam = json_encode($customParam);
|
||||
|
||||
$this->dao->insert(TABLE_JOB)->data($job)
|
||||
->batchCheck($this->config->job->create->requiredFields, 'notempty')
|
||||
|
||||
@@ -171,6 +188,23 @@ class jobModel extends model
|
||||
if($job->svnDir == '/' and $_POST['svnDir']) $job->svnDir = array_pop($_POST['svnDir']);
|
||||
}
|
||||
|
||||
$customParam = array();
|
||||
foreach($job->paramName as $key => $paramName)
|
||||
{
|
||||
$paramValue = zget($job->paramValue, $key, '');
|
||||
|
||||
if(empty($paramName) and !empty($paramValue))
|
||||
{
|
||||
dao::$errors[] = $this->lang->job->inputName;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!empty($paramName)) $customParam[$paramName] = $paramValue;
|
||||
}
|
||||
unset($job->paramName);
|
||||
unset($job->paramValue);
|
||||
$job->customParam = json_encode($customParam);
|
||||
|
||||
$this->dao->update(TABLE_JOB)->data($job)
|
||||
->batchCheck($this->config->job->edit->requiredFields, 'notempty')
|
||||
|
||||
@@ -240,7 +274,7 @@ class jobModel extends model
|
||||
*/
|
||||
public function exec($id)
|
||||
{
|
||||
$job = $this->dao->select('t1.id,t1.name,t1.repo,t1.jkJob,t1.triggerType,t1.atTime,t2.name as jenkinsName,t2.url,t2.account,t2.token,t2.password')
|
||||
$job = $this->dao->select('t1.id,t1.name,t1.repo,t1.jkJob,t1.triggerType,t1.atTime,t1.customParam,t2.name as jenkinsName,t2.url,t2.account,t2.token,t2.password')
|
||||
->from(TABLE_JOB)->alias('t1')
|
||||
->leftJoin(TABLE_JENKINS)->alias('t2')->on('t1.jkHost=t2.id')
|
||||
->where('t1.id')->eq($id)
|
||||
@@ -298,6 +332,10 @@ class jobModel extends model
|
||||
$compileID = $this->dao->lastInsertId();
|
||||
|
||||
$data->ZENTAO_DATA = "compile={$compileID}";
|
||||
|
||||
//Add custom parameters to the data.
|
||||
foreach(json_decode($job->customParam) as $paramName => $paramValue) $data->$paramName = $paramValue;
|
||||
|
||||
$compile = new stdclass();
|
||||
$compile->queue = $this->loadModel('ci')->sendRequest($url->url, $data, $url->userPWD);
|
||||
$compile->status = $compile->queue ? 'created' : 'create_fail';
|
||||
|
||||
@@ -86,6 +86,19 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->job->customParam;?></th>
|
||||
<td colspan='2' id='paramDiv'>
|
||||
<div class='table-row input-group'>
|
||||
<span class='input-group-addon w-50px'><?php echo $lang->job->paramName; ?></span>
|
||||
<?php echo html::input('paramName[]', '', "class='form-control id='test''"); ?>
|
||||
<span class='input-group-addon w-40px'><?php echo $lang->job->paramValue; ?></span>
|
||||
<?php echo html::input('paramValue[]', '', "class='form-control'"); ?>
|
||||
<span class='input-group-addon w-40px'><a href='javascript:;' onclick='addItem(this);'><i class='icon icon-plus'></i></a></span>
|
||||
<span class='input-group-addon w-40px'><a href='javascript:;' onclick='deleteItem(this)'><i class='icon icon-close'></i></a></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td class='text-center form-actions'>
|
||||
|
||||
@@ -109,6 +109,21 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->job->customParam;?></th>
|
||||
<td colspan='2' id='paramDiv'>
|
||||
<?php foreach(json_decode($job->customParam) as $paramName => $paramValue):?>
|
||||
<div class='table-row input-group'>
|
||||
<span class='input-group-addon w-50px'><?php echo $lang->job->paramName; ?></span>
|
||||
<?php echo html::input('paramName[]', $paramName, "class='form-control'"); ?>
|
||||
<span class='input-group-addon w-40px'><?php echo $lang->job->paramValue; ?></span>
|
||||
<?php echo html::input('paramValue[]', $paramValue, "class='form-control'"); ?>
|
||||
<span class='input-group-addon w-40px'><a href='javascript:;' onclick='addItem(this);'><i class='icon icon-plus'></i></a></span>
|
||||
<span class='input-group-addon w-40px'><a href='javascript:;' onclick='deleteItem(this)'><i class='icon icon-close'></i></a></span>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td colspan="2" class='text-center form-actions'>
|
||||
|
||||
@@ -97,6 +97,14 @@
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->job->customParam;?></th>
|
||||
<td>
|
||||
<?php foreach(json_decode($job->customParam) as $paramName => $paramValue):?>
|
||||
<div><?php echo $paramName . ' : ' . $paramValue;?></div>
|
||||
<?php endforeach;?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user