edit ci tasks

This commit is contained in:
aaronchen2k
2020-01-09 16:41:29 +08:00
parent e6f7211ddd
commit c1cd688f28
7 changed files with 161 additions and 31 deletions
+6 -3
View File
@@ -278,6 +278,7 @@ class ci extends control
$this->view->position[] = $this->lang->citask->create;
$this->view->repoList = $this->ci->listRepoForSelection("true");
$this->view->jenkinsList = $this->ci->listJenkinsForSelection("true");
$this->view->module = 'citask';
$this->display();
@@ -292,7 +293,7 @@ class ci extends control
*/
public function editCitask($id)
{
$citask = $this->ci->getJenkinsByID($id);
$citask = $this->ci->getCitaskByID($id);
if($_POST)
{
$this->ci->updateCitask($id);
@@ -307,9 +308,11 @@ class ci extends control
$this->view->position[] = html::a(inlink('browseCitask'), $this->lang->citask->common);
$this->view->position[] = $this->lang->citask->edit;
$this->view->citask = $citask;
$this->view->citask = $citask;
$this->view->module = 'jenkins';
$this->view->repoList = $this->ci->listRepoForSelection("true");
$this->view->jenkinsList = $this->ci->listJenkinsForSelection("true");
$this->view->module = 'citask';
$this->display();
}
+7
View File
@@ -0,0 +1,7 @@
.row.text-with-input .col {
line-height: 32px;
}
.only-pick-time thead th, .only-pick-time tfoot th {
color: transparent !important;
}
+46
View File
@@ -0,0 +1,46 @@
$(function()
{
triggerTypeChanged(triggerType);
});
function triggerTypeChanged(type) {
if(type == 'tag') {
$('.tag-fields').removeClass('hidden');
$('.comment-fields').addClass('hidden');
scheduleTypeChanged();
} else if(type == 'commit') {
$('.tag-fields').addClass('hidden');
$('.comment-fields').removeClass('hidden');
$('.corn-fields').addClass('hidden');
$('.custom-fields').addClass('hidden');
scheduleTypeChanged();
} else if(type == 'schedule') {
$('.tag-fields').addClass('hidden');
$('.comment-fields').addClass('hidden');
var val = $("input[name='scheduleType']:checked").val();
scheduleTypeChanged(val? val: 'corn');
}
}
function scheduleTypeChanged(type) {
if(type == 'corn') {
$('.schedule-fields').removeClass('hidden');
$('.corn-fields').removeClass('hidden');
$('.custom-fields').addClass('hidden');
} else if(type == 'custom') {
$('.schedule-fields').removeClass('hidden');
$('.corn-fields').addClass('hidden');
$('.custom-fields').removeClass('hidden');
} else {
$('.schedule-fields').addClass('hidden');
$('.corn-fields').addClass('hidden');
$('.custom-fields').addClass('hidden');
}
}
+16
View File
@@ -687,4 +687,20 @@ class ciModel extends model
return $repos;
}
/**
* list jenkins for ci task edit
*
* @return mixed
*/
public function listJenkinsForSelection($whr)
{
$repos = $this->dao->select('id, name')->from(TABLE_JENKINS)
->where('deleted')->eq('0')
->beginIF(!empty(whr))->andWhere($whr)->fi()
->orderBy(id)
->fetchPairs();
$repos[''] = '';
return $repos;
}
}
+10 -10
View File
@@ -1,17 +1,17 @@
<?php
/**
* The browse view file of jenkins module of ZenTaoPMS.
* The browse view file of citask module of ZenTaoPMS.
*
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Gang Liu <liugang@cnezsoft.com>
* @package jenkins
* @package citask
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include 'header.html.php'; ?>
<?php js::set('confirmDelete', $lang->jenkins->confirmDelete); ?>
<?php js::set('confirmDelete', $lang->citask->confirmDelete); ?>
<div id='mainContent' class='main-row'>
<div class='side-col' id='sidebar'>
@@ -37,11 +37,11 @@
</tr>
</thead>
<tbody>
<?php foreach (citaskList as $id => $task): ?>
<?php foreach ($citaskList as $id => $task): ?>
<tr>
<td class='text-center'><?php echo $id; ?></td>
<td class='text' title='<?php echo $task->name; ?>'><?php echo $task->name; ?></td>
<td class='text' title='<?php echo $task->jenkinsServer; ?>'><?php echo $task->jenkinsServer; ?></td>
<td class='text' title='<?php echo $task->citaskServer; ?>'><?php echo $task->jenkinsServer; ?></td>
<td class='text' title='<?php echo $task->jenkinsTask; ?>'><?php echo $task->jenkinsTask; ?></td>
<td class='text' title='<?php echo $lang->citask->buildTypeList[$task->buildType]; ?>'>
<?php echo $lang->citask->buildTypeList[$task->buildType]; ?></td>
@@ -51,10 +51,10 @@
<td class='c-actions text-right'>
<?php
common::printIcon('ci', 'editJenkins', "jenkinsID=$id", '', 'list', 'edit');
if (common::hasPriv('ci', 'deleteJenkins')) {
$deleteURL = $this->createLink('ci', 'deleteJenkins', "jenkinsID=$id&confirm=yes");
echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"jenkinsList\", confirmDelete)", '<i class="icon-trash"></i>', '', "title='{$lang->jenkins->delete}' class='btn'");
common::printIcon('ci', 'editCitask', "citaskID=$id", '', 'list', 'edit');
if (common::hasPriv('ci', 'deleteCitask')) {
$deleteURL = $this->createLink('ci', 'deleteCitask', "citaskID=$id&confirm=yes");
echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"citaskList\", confirmDelete)", '<i class="icon-trash"></i>', '', "title='{$lang->citask->delete}' class='btn'");
}
?>
</td>
@@ -62,7 +62,7 @@
<?php endforeach; ?>
</tbody>
</table>
<?php if ($jenkinss): ?>
<?php if ($citaskList): ?>
<div class='table-footer'><?php $pager->show('rignt', 'pagerjs'); ?></div>
<?php endif; ?>
</form>
+1 -1
View File
@@ -99,7 +99,7 @@
</tr>
<tr>
<th><?php echo $lang->jenkins->desc; ?></th>
<th><?php echo $lang->citask->desc; ?></th>
<td colspan="3"><?php echo html::textarea('desc', '', "rows='3' class='form-control'"); ?></td>
</tr>
<tr>
+75 -17
View File
@@ -13,6 +13,8 @@
<?php include 'header.html.php'; ?>
<?php include '../../common/view/form.html.php'; ?>
<?php js::set('triggerType', $citask->triggerType)?>
<div id='mainContent' class='main-row'>
<div class='side-col' id='sidebar'>
<?php include 'menu.html.php'; ?>
@@ -20,37 +22,93 @@
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->jenkins->edit; ?></h2>
<h2><?php echo $lang->citask->edit; ?></h2>
</div>
<form id='jenkinsForm' method='post' class='form-ajax'>
<form id='citaskForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->jenkins->name; ?></th>
<td class='required'><?php echo html::input('name', $jenkins->name, "class='form-control'"); ?></td>
<td></td>
<th><?php echo $lang->citask->name; ?></th>
<td colspan="3" class='required'><?php echo html::input('name', $citask->name, "class='form-control'"); ?></td>
</tr>
<tr>
<th><?php echo $lang->jenkins->serviceUrl; ?></th>
<td class='required'><?php echo html::input('serviceUrl', $jenkins->serviceUrl, "class='form-control'"); ?></td>
<td></td>
<th><?php echo $lang->citask->repo; ?></th>
<td><?php echo html::select('repo', $repoList, $citask->repo, "class='form-control chosen'"); ?></td>
<th><?php echo $lang->citask->buildType; ?></th>
<td><?php echo html::select('buildType', $lang->citask->buildTypeList, 'buildAndDeploy', "class='form-control chosen'"); ?></td>
</tr>
<tr id="credential-field">
<th class='thWidth'><?php echo $lang->credential->common; ?></th>
<td style="width:550px"><?php echo html::select('credential', $credentialList, $jenkins->credential, "class='form-control'"); ?></td>
<td></td>
<tr>
<th><?php echo $lang->citask->jenkins; ?></th>
<td><?php echo html::select('jenkins', $jenkinsList, $citask->jenkins, "class='form-control chosen'"); ?></td>
<th><?php echo $lang->citask->jenkinsTask; ?></th>
<td><?php echo html::input('jenkinsTask', $citask->jenkinsTask, "class='form-control'"); ?></td>
</tr>
<tr>
<th><?php echo $lang->citask->triggerType; ?></th>
<td><?php echo html::select('triggerType', $lang->citask->triggerTypeList, $citask->triggerType,
"onchange='triggerTypeChanged(this.value)' class='form-control chosen'"); ?></td>
<th class="schedule-fields"><?php echo $lang->citask->scheduleType; ?></th>
<td class="schedule-fields"><?php echo html::radio('scheduleType', $lang->citask->scheduleTypeList, $citask->scheduleType,
"onclick='scheduleTypeChanged(this.value)'");?></td>
</tr>
<tr class="tag-fields">
<th><?php echo $lang->citask->tagKeywords; ?></th>
<td><?php echo html::input('tagKeywords', $citask->tagKeywords, "class='form-control'"); ?></td>
<td colspan="2"><span style="font-style: italic">*build_*</span></td>
</tr>
<tr class="comment-fields">
<th><?php echo $lang->citask->commentKeywords; ?></th>
<td><?php echo html::input('commentKeywords', $citask->commentKeywords, "class='form-control'"); ?></td>
<td colspan="2"><span style="font-style: italic">build_now</span></td>
</tr>
<tr class="corn-fields">
<th><?php echo $lang->citask->cornExpression; ?></th>
<td><?php echo html::input('cornExpression', $citask->cornExpression, "class='form-control'"); ?></td>
<td colspan="2"><span style="font-style: italic">0 0 2 * * ?</span></td>
</tr>
<tr class="custom-fields">
<th><?php echo $lang->citask->custom; ?></th>
<td colspan="3">
<div class="row text-with-input">
<div class="col w-50px">
<?php echo $lang->citask->scheduleInterval; ?>
</div>
<div class="col w-100px">
<?php echo html::number('scheduleInterval', $citask->scheduleInterval, "class='form-control'"); ?>
</div>
<div class="col w-30px">
<?php echo $lang->citask->day; ?>,
</div>
<div class="col w-40px">
<?php echo $lang->citask->at; ?>
</div>
<div class="col w-120px">
<?php echo html::select('scheduleDay', $lang->citask->dayTypeList, $citask->scheduleDay,"class='form-control chosen'"); ?>
</div>
<div class="col w-100px">
<?php echo html::input('scheduleTime', $citask->scheduleTime,
"class='form-control form-time time-only' min='1'"); ?>
</div>
<div class="col w-60px">
<?php echo $lang->citask->exe; ?>。
</div>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->jenkins->desc; ?></th>
<td><?php echo html::textarea('desc', $jenkins->desc, "rows='3' class='form-control'"); ?></td>
<td></td>
<th><?php echo $lang->citask->desc; ?></th>
<td colspan="3"><?php echo html::textarea('desc', '', "rows='3' class='form-control'"); ?></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton(); ?>
<?php echo html::backButton() ?>
<?php echo html::backButton(); ?>
</td>
</tr>
</table>