* finish task #6905,6895.

This commit is contained in:
wangyidong
2020-02-18 11:37:37 +08:00
parent 205245f86f
commit d0652826ac
17 changed files with 497 additions and 337 deletions
+1
View File
@@ -60,5 +60,6 @@ CREATE TABLE `zt_cibuild` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `zt_cijob` ADD `svnFolder` varchar(255) COLLATE 'utf8_general_ci' NOT NULL AFTER `triggerType`;
INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES
('*/5', '*', '*', '*', '*', 'moduleName=ci&methodName=checkBuildStatus', '同步Jenkins任务状态', 'zentao', 1, 'normal', '0000-00-00 00:00:00');
+10 -1
View File
@@ -29,7 +29,7 @@ class Git
$infos = array();
foreach($list as $entry)
{
{
list($mod, $kind, $revision, $size, $name) = preg_split('/[\t ]+/', $entry);
/* Get commit info. */
@@ -70,6 +70,15 @@ class Git
return $infos;
}
public function tags($path, $revision = 'HEAD')
{
chdir($this->root);
$cmd = escapeCmd("$this->client tag --sort=taggerdate");
$list = execCmd($cmd . ' 2>&1', 'array', $result);
if($result) return array();
return $list;
}
public function branch()
{
chdir($this->root);
+6 -1
View File
@@ -18,11 +18,16 @@ class scm
return $this->engine->ls($path, $revision);
}
public function tags($path, $revision, $onlyDir = true)
{
return $this->engine->tags($path, $revision, $onlyDir);
}
public function branch()
{
return $this->engine->branch();
}
public function log($path, $fromRevision = 0, $toRevision = 'HEAD', $count = 0)
{
return $this->engine->log($path, $fromRevision, $toRevision);
+13
View File
@@ -65,6 +65,19 @@ class Subversion
return $infos;
}
public function tags($path, $revision = 'HEAD', $onlyDir = true)
{
$infos = $this->ls($path, $revision);
$tags = array();
foreach($infos as $info)
{
if($onlyDir and $info->kind != 'dir') continue;
$tags[$info->name] = $info->name;
}
return $tags;
}
public function branch()
{
return array();
+1
View File
@@ -541,6 +541,7 @@ class bug extends control
* View a bug.
*
* @param int $bugID
* @param string $form
* @access public
* @return void
*/
+27 -11
View File
@@ -1,5 +1,4 @@
<?php
/**
* The control file of ci module of ZenTaoPMS.
*
@@ -94,8 +93,17 @@ class ci extends control
$this->view->position[] = html::a(inlink('browseJob'), $this->lang->ci->job);
$this->view->position[] = $this->lang->ci->create;
$this->view->repoList = $this->loadModel('repo')->listForSelectionWithType("true");
$this->view->jenkinsList = $this->loadModel('jenkins')->listForSelection("true");
$repoList = $this->loadModel('repo')->getAllRepos();
$repoPairs = array(0 => '');
$repoTypes = array();
foreach($repoList as $repo)
{
$repoPairs[$repo->id] = $repo->name;
$repoTypes[$repo->id] = $repo->SCM;
}
$this->view->repoPairs = $repoPairs;
$this->view->repoTypes = $repoTypes;
$this->view->jenkinsList = $this->loadModel('jenkins')->listForSelection("true");
$this->display();
}
@@ -119,17 +127,25 @@ class ci extends control
$this->app->loadLang('action');
$repo = $this->loadModel('repo')->getRepoByID($job->repo);
$job->repoType = $repo->id . '-' . $repo->SCM;
$this->view->job = $job;
$this->view->repoList = $this->loadModel('repo')->listForSelectionWithType("true");
$this->view->jenkinsList = $this->loadModel('jenkins')->listForSelection("true");
$this->view->title = $this->lang->ci->job . $this->lang->colon . $this->lang->ci->edit;
$this->view->position[] = html::a(inlink('browseJob'), $this->lang->ci->job);
$this->view->position[] = $this->lang->ci->edit;
$repo = $this->loadModel('repo')->getRepoByID($job->repo);
$repoList = $this->loadModel('repo')->getAllRepos();
$repoPairs = array(0 => '', $repo->id => $repo->name);
$repoTypes[$repo->id] = $repo->SCM;
foreach($repoList as $repo)
{
$repoPairs[$repo->id] = $repo->name;
$repoTypes[$repo->id] = $repo->SCM;
}
$this->view->repoPairs = $repoPairs;
$this->view->repoTypes = $repoTypes;
$this->view->job = $job;
$this->view->jenkinsList = $this->loadModel('jenkins')->listForSelection("true");
$this->display();
}
@@ -233,4 +249,4 @@ class ci extends control
$this->send(array('result' => 'success'));
}
}
}
-47
View File
@@ -1,47 +0,0 @@
$(function()
{
repoTypeChanged('Git');
triggerTypeChanged(triggerType);
});
function repoTypeChanged(type) {
if(type.indexOf('Subversion') > -1) {
$('.svn-fields').removeClass('hidden');
} else {
$('.svn-fields').addClass('hidden');
}
}
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');
$('.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: 'custom');
}
}
function scheduleTypeChanged(type) {
if(type == 'custom') {
$('.schedule-fields').removeClass('hidden');
$('.custom-fields').removeClass('hidden');
} else {
$('.schedule-fields').addClass('hidden');
$('.custom-fields').addClass('hidden');
}
}
+109
View File
@@ -0,0 +1,109 @@
$('#repo').change(function()
{
var repoID = $(this).val();
var type = 'Git';
if(typeof(repoTypes[repoID]) != 'undefined') type = repoTypes[repoID];
$('.svn-fields').toggleClass('hidden', type != 'Subversion');
$('#repoType').val(type);
if(type == 'Subversion')
{
$('#svnFolderBox').html("<div class='load-indicator loading'></div>");
$.getJSON(createLink('repo', 'ajaxGetSVNTags', 'repoID=' + repoID), function(svnTags)
{
var tags = svnTags['tags'];
var parents = svnTags['parent'];
html = "<select id='svnFolder' name='svnFolder' class='form-control'>";
for(tag in parents)
{
var info = parents[tag];
html += "<option value='" + info['path'] + "' data-encodePath='" + info['encodePath'] + "'>" + info['path'] + "</option>";
}
for(tag in tags)
{
var info = tags[tag];
html += "<option value='" + info['path'] + "' data-encodePath='" + info['encodePath'] + "'>" + info['path'] + "</option>";
}
html += '</select>';
$('#svnFolderBox').html(html);
$('#svnFolderBox #svnFolder').chosen();
})
}
})
$(document).on('change', '#svnFolder', function()
{
var repoID = $('#repo').val();
var selectedTag = $(this).val();
var encodePath = $(this).find("option:selected").attr('data-encodePath');
$('#svnFolderBox').html("<div class='load-indicator loading'></div>");
$.getJSON(createLink('repo', 'ajaxGetSVNTags', 'repoID=' + repoID + '&path=' + encodePath), function(svnTags)
{
var tags = svnTags['tags'];
var parents = svnTags['parent'];
html = "<select id='svnFolder' name='svnFolder' class='form-control'>";
for(tag in parents)
{
var info = parents[tag];
html += "<option value='" + info['path'] + "' data-encodePath='" + info['encodePath'] + "'>" + info['path'] + "</option>";
}
for(tag in tags)
{
var info = tags[tag];
html += "<option value='" + info['path'] + "' data-encodePath='" + info['encodePath'] + "'>" + info['path'] + "</option>";
}
html += '</select>';
$('#svnFolderBox').html(html);
$('#svnFolderBox #svnFolder').val(selectedTag).chosen();
})
})
$(function()
{
$('#repo').change();
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');
$('.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 : 'custom');
}
}
function scheduleTypeChanged(type)
{
if(type == 'custom')
{
$('.schedule-fields').removeClass('hidden');
$('.custom-fields').removeClass('hidden');
}
else
{
$('.schedule-fields').addClass('hidden');
$('.custom-fields').addClass('hidden');
}
}
-61
View File
@@ -1,61 +0,0 @@
$(function()
{
repoTypeChanged(repoType);
triggerTypeChanged(triggerType);
});
function exeJob(id) {
var link = createLink('ci', 'exeJob', 'id=' + id);
console.log(link);
$.ajax({
type:"POST",
url: link,
data: {},
datatype: "json",
success:function(str){
$('.exe-job-button').tooltip('show', '发送执行请求成功!');
}
});
}
function repoTypeChanged(type) {
if(type.indexOf('Subversion') > -1) {
$('.svn-fields').removeClass('hidden');
} else {
$('.svn-fields').addClass('hidden');
}
}
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');
$('.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: 'custom');
}
}
function scheduleTypeChanged(type) {
if(type == 'custom') {
$('.schedule-fields').removeClass('hidden');
$('.custom-fields').removeClass('hidden');
} else {
$('.schedule-fields').addClass('hidden');
$('.custom-fields').addClass('hidden');
}
}
+118
View File
@@ -0,0 +1,118 @@
$('#repo').change(function()
{
var repoID = $(this).val();
var type = 'Git';
if(typeof(repoTypes[repoID]) != 'undefined') type = repoTypes[repoID];
$('.svn-fields').toggleClass('hidden', type != 'Subversion');
$('#repoType').val(type);
if(type == 'Subversion')
{
$('#svnFolderBox').html("<div class='load-indicator loading'></div>");
var params = 'repoID=' + repoID;
if(jobRepo == repoID) params = 'repoID=' + repoID + '&path=' + encodeSVNFolder;
$.getJSON(createLink('repo', 'ajaxGetSVNTags', params), function(svnTags)
{
var tags = svnTags['tags'];
var parents = svnTags['parent'];
html = "<select id='svnFolder' name='svnFolder' class='form-control'>";
for(tag in parents)
{
var info = parents[tag];
html += "<option value='" + info['path'] + "' data-encodePath='" + info['encodePath'] + "'>" + info['path'] + "</option>";
}
for(tag in tags)
{
var info = tags[tag];
html += "<option value='" + info['path'] + "' data-encodePath='" + info['encodePath'] + "'>" + info['path'] + "</option>";
}
html += '</select>';
$('#svnFolderBox').html(html);
$('#svnFolderBox #svnFolder').val(svnFolder).chosen();
})
}
})
$(document).on('change', '#svnFolder', function()
{
var repoID = $('#repo').val();
var selectedTag = $(this).val();
var encodePath = $(this).find("option:selected").attr('data-encodePath');
$('#svnFolderBox').html("<div class='load-indicator loading'></div>");
$.getJSON(createLink('repo', 'ajaxGetSVNTags', 'repoID=' + repoID + '&path=' + encodePath), function(svnTags)
{
var tags = svnTags['tags'];
var parents = svnTags['parent'];
html = "<select id='svnFolder' name='svnFolder' class='form-control'>";
for(tag in parents)
{
var info = parents[tag];
html += "<option value='" + info['path'] + "' data-encodePath='" + info['encodePath'] + "'>" + info['path'] + "</option>";
}
for(tag in tags)
{
var info = tags[tag];
html += "<option value='" + info['path'] + "' data-encodePath='" + info['encodePath'] + "'>" + info['path'] + "</option>";
}
html += '</select>';
$('#svnFolderBox').html(html);
$('#svnFolderBox #svnFolder').val(selectedTag).chosen();
})
})
$(function()
{
$('#repo').change();
triggerTypeChanged(triggerType);
});
function exeJob(id) {
var link = createLink('ci', 'exeJob', 'id=' + id);
$.ajax({
type:"POST",
url: link,
data: {},
datatype: "json",
success:function(str)
{
$('.exe-job-button').tooltip('show', '发送执行请求成功!');
}
});
}
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');
$('.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: 'custom');
}
}
function scheduleTypeChanged(type) {
if(type == 'custom') {
$('.schedule-fields').removeClass('hidden');
$('.custom-fields').removeClass('hidden');
} else {
$('.schedule-fields').addClass('hidden');
$('.custom-fields').addClass('hidden');
}
}
+16 -20
View File
@@ -59,33 +59,31 @@ class ciModel extends model
$job = fixer::input('post')
->add('createdBy', $this->app->user->account)
->add('createdDate', helper::now())
->remove('repoType')
->get();
$arr = explode("-", $job->repo);
$job->repo = $arr[0];
$repoType = $arr[1];
$this->dao->insert(TABLE_CI_JOB)->data($job)
->batchCheck($this->config->job->create->requiredFields, 'notempty')
->batchCheckIF($job->triggerType === 'schedule' && $job->scheduleType == 'cron', "cronExpression", 'notempty')
->batchCheckIF($job->triggerType === 'schedule' && $job->scheduleType == 'custom', "scheduleDay,scheduleTime,scheduleInterval", 'notempty')
->batchCheckIF($repoType == 'Subversion', "svnFolder", 'notempty')
->batchCheckIF($this->post->repoType == 'Subversion', "svnFolder", 'notempty')
->autoCheck()
->exec();
if ($job->triggerType === 'schedule')
$jobId = $this->dao->lastInsertID();
if($job->triggerType =='schedule')
{
$jobId = $this->dao->lastInsertID();
$arr = explode(":", $job->scheduleTime);
$arr = explode(":", $job->scheduleTime);
$hour = $arr[0];
$min = $arr[1];
$min = $arr[1];
if ($job->scheduleDay == 'everyDay')
if($job->scheduleDay == 'everyDay')
{
$days = '1-7';
} else if ($job->scheduleDay == 'workDay')
}
elseif($job->scheduleDay == 'workDay')
{
$days = '1-5';
}
@@ -112,17 +110,15 @@ class ciModel extends model
$job = fixer::input('post')
->add('editedBy', $this->app->user->account)
->add('editedDate', helper::now())
->remove('repoType')
->get();
$arr = explode("-", $job->repo);
$job->repo = $arr[0];
$repoType = $arr[1];
$this->dao->update(TABLE_CI_JOB)->data($job)
->batchCheck($this->config->job->edit->requiredFields, 'notempty')
->batchCheckIF($job->triggerType === 'schedule' && $job->scheduleType == 'cron', "cronExpression", 'notempty')
->batchCheckIF($job->triggerType === 'schedule' && $job->scheduleType == 'custom', "scheduleDay,scheduleTime,scheduleInterval", 'notempty')
->batchCheckIF($repoType == 'Subversion', "svnFolder", 'notempty')
->batchCheckIF($this->post->repoType == 'Subversion', "svnFolder", 'notempty')
->autoCheck()
->where('id')->eq($id)
@@ -132,15 +128,15 @@ class ciModel extends model
{
$command = 'moduleName=ci&methodName=exeJob&parm=' . $id;
$arr = explode(":", $job->scheduleTime);
$arr = explode(":", $job->scheduleTime);
$hour = $arr[0];
$min = $arr[1];
$min = $arr[1];
$jobId = $this->dao->lastInsertID();
if ($job->scheduleDay == 'everyDay')
if($job->scheduleDay == 'everyDay')
{
$days = '1-7';
} else if ($job->scheduleDay == 'workDay')
}
elseif($job->scheduleDay == 'workDay')
{
$days = '2-6';
}
+1 -4
View File
@@ -16,7 +16,6 @@
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<?php
$buildName = $build ? " <span class='label label-danger'>Build:{$build->name}</span>" : '';
echo html::a($this->inlink('browsejob', ""), "<span class='text'>{$lang->ci->task}</span>", '', "class='btn btn-link" . ('browseJob' == $method ? ' btn-active-text' : '') . "'");
echo html::a($this->inlink('browsebuild', ""), "<span class='text'>{$lang->ci->history}</span>", '', "class='btn btn-link" . ('browseBuild' == $method ? ' btn-active-text' : '') . "'");
?>
@@ -30,8 +29,7 @@
</div>
</div>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div id='mainContent'>
<form class='main-table' id='ajaxForm' method='post'>
<table id='jobList' class='table has-sort-head table-fixed'>
<thead>
@@ -92,6 +90,5 @@
<div class='table-footer'><?php $pager->show('rignt', 'pagerjs'); ?></div>
<?php endif; ?>
</form>
</div>
</div>
<?php include '../../common/view/footer.html.php'; ?>
+65 -86
View File
@@ -12,93 +12,72 @@
?>
<?php include '../../common/view/header.html.php'; ?>
<?php js::set('repoType', 'Git')?>
<?php js::set('triggerType', 'tag')?>
<?php js::set('repoTypes', $repoTypes)?>
<?php js::set('triggerType', 'tag')?>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->job->create; ?></h2>
</div>
<form id='jobForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->job->name; ?></th>
<td class='required'><?php echo html::input('name', '', "class='form-control'"); ?></td>
<td colspan="2" ></td>
</tr>
<tr>
<th><?php echo $lang->ci->repo; ?></th>
<td><?php echo html::select('repo', $repoList, '',
"onchange='repoTypeChanged(this.value)' class='form-control chosen'"); ?></td>
<th class="svn-fields"><?php echo $lang->job->svnFolder; ?></th>
<td class="svn-fields"><?php echo html::input('svnFolder', $job->svnFolder, "class='form-control'"); ?></td>
</tr>
<tr>
<th><?php echo $lang->job->jenkins; ?></th>
<td><?php echo html::select('jenkins', $jenkinsList, '', "class='form-control chosen'"); ?></td>
<th><?php echo $lang->job->jenkinsJob; ?></th>
<td><?php echo html::input('jenkinsJob', '', "class='form-control'"); ?></td>
</tr>
<tr>
<th><?php echo $lang->job->triggerType; ?></th>
<td><?php echo html::select('triggerType', $lang->job->triggerTypeList, '',
"onchange='triggerTypeChanged(this.value)' class='form-control chosen'"); ?></td>
<td colspan="2"></td>
</tr>
<tr class="tag-fields" class="tag-fields">
<th><?php echo $lang->job->example; ?></th>
<td colspan="3"><?php echo $lang->job->tagEx; ?></td>
</tr>
<tr class="comment-fields" class="comment-fields">
<th><?php echo $lang->job->example; ?></th>
<td colspan="3"><?php echo $lang->job->commitEx; ?></td>
</tr>
<tr class="custom-fields">
<th><?php echo $lang->job->custom; ?></th>
<td colspan="3">
<div class="row text-with-input">
<div class="col w-50px">
<?php echo $lang->job->scheduleInterval; ?>
</div>
<div class="col w-100px">
<?php echo html::number('scheduleInterval', '1', "class='form-control'"); ?>
</div>
<div class="col w-40px">
<?php echo $lang->job->day; ?>,
</div>
<div class="col <?php echo $this->app->getClientLang() == 'en' ? 'w-100px' : '2-30px'; ?>">
<?php echo $lang->job->at; ?>
</div>
<div class="col w-150px">
<?php echo html::select('scheduleDay', $lang->job->dayTypeList, '',"class='form-control chosen'"); ?>
</div>
<div class="col w-100px">
<?php echo html::input('scheduleTime', '2:00',
"class='form-control form-time time-only' min='1'"); ?>
</div>
<div class="col w-120px">
<?php echo $lang->job->exe; ?>。
</div>
</div>
</td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton(); ?>
<?php echo html::backButton(); ?>
</td>
</tr>
</table>
</form>
</div>
<div class='main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->job->create; ?></h2>
</div>
<form id='jobForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->job->name; ?></th>
<td class='required'><?php echo html::input('name', '', "class='form-control'"); ?></td>
<td colspan="2" ></td>
</tr>
<tr>
<th><?php echo $lang->ci->repo; ?></th>
<td><?php echo html::select('repo', $repoPairs, '', "class='form-control chosen'"); ?></td>
<th class="svn-fields hidden"><?php echo $lang->job->svnFolder; ?></th>
<td class="svn-fields hidden" id='svnFolderBox'></td>
</tr>
<tr>
<th><?php echo $lang->job->jenkins; ?></th>
<td><?php echo html::select('jenkins', $jenkinsList, '', "class='form-control chosen'"); ?></td>
<th><?php echo $lang->job->jenkinsJob; ?></th>
<td><?php echo html::input('jenkinsJob', '', "class='form-control'"); ?></td>
</tr>
<tr>
<th><?php echo $lang->job->triggerType; ?></th>
<td><?php echo html::select('triggerType', $lang->job->triggerTypeList, '', "onchange='triggerTypeChanged(this.value)' class='form-control chosen'"); ?></td>
<td colspan="2"></td>
</tr>
<tr class="tag-fields" class="tag-fields">
<th><?php echo $lang->job->example; ?></th>
<td colspan="3"><?php echo $lang->job->tagEx; ?></td>
</tr>
<tr class="comment-fields" class="comment-fields">
<th><?php echo $lang->job->example; ?></th>
<td colspan="3"><?php echo $lang->job->commitEx; ?></td>
</tr>
<tr class="custom-fields">
<th><?php echo $lang->job->custom; ?></th>
<td colspan="3">
<div class="row text-with-input">
<div class="col w-50px"><?php echo $lang->job->scheduleInterval;?></div>
<div class="col w-100px"><?php echo html::number('scheduleInterval', '1', "class='form-control'");?></div>
<div class="col w-40px"><?php echo $lang->job->day;?>, </div>
<div class="col <?php echo $this->app->getClientLang() == 'en' ? 'w-100px' : '2-30px'; ?>"><?php echo $lang->job->at;?></div>
<div class="col w-150px"><?php echo html::select('scheduleDay', $lang->job->dayTypeList, '',"class='form-control chosen'");?></div>
<div class="col w-100px"><?php echo html::input('scheduleTime', '2:00', "class='form-control form-time time-only' min='1'");?></div>
<div class="col w-120px"><?php echo $lang->job->exe;?>。 </div>
</div>
</td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton(); ?>
<?php echo html::backButton(); ?>
<?php echo html::hidden('repoType');?>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<?php include '../../common/view/footer.html.php'; ?>
<?php include '../../common/view/footer.html.php';?>
+70 -87
View File
@@ -12,94 +12,77 @@
?>
<?php include '../../common/view/header.html.php'; ?>
<?php js::set('repoType', $job->repoType)?>
<?php js::set('triggerType', $job->triggerType)?>
<?php js::set('repoTypes', $repoTypes)?>
<?php js::set('triggerType', $job->triggerType);?>
<?php js::set('jobRepo', $job->repo);?>
<?php js::set('svnFolder', $job->svnFolder);?>
<?php js::set('encodeSVNFolder', $this->loadModel('repo')->encodePath($job->svnFolder));?>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->job->edit; ?></h2>
</div>
<form id='jobForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->job->name; ?></th>
<td class='required'><?php echo html::input('name', $job->name, "class='form-control'"); ?></td>
<td colspan="2" ></td>
</tr>
<tr>
<th><?php echo $lang->ci->repo; ?></th>
<td><?php echo html::select('repo', $repoList, $job->repoType,
"onchange='repoTypeChanged(this.value)' class='form-control chosen'"); ?></td>
<th class="svn-fields"><?php echo $lang->job->svnFolder; ?></th>
<td class="svn-fields"><?php echo html::input('svnFolder', $job->svnFolder, "class='form-control'"); ?></td>
</tr>
<tr>
<th><?php echo $lang->job->jenkins; ?></th>
<td><?php echo html::select('jenkins', $jenkinsList, $job->jenkins, "class='form-control chosen'"); ?></td>
<th><?php echo $lang->job->jenkinsJob; ?></th>
<td><?php echo html::input('jenkinsJob', $job->jenkinsJob, "class='form-control'"); ?></td>
</tr>
<tr>
<th><?php echo $lang->job->triggerType; ?></th>
<td><?php echo html::select('triggerType', $lang->job->triggerTypeList, $job->triggerType,
"onchange='triggerTypeChanged(this.value)' class='form-control chosen'"); ?></td>
<td colspan="2"></td>
</tr>
<tr class="tag-fields">
<th><?php echo $lang->job->example; ?></th>
<td colspan="3"><?php echo $lang->job->tagEx; ?></td>
</tr>
<tr class="comment-fields">
<th><?php echo $lang->job->example; ?></th>
<td colspan="3"><?php echo $lang->job->commitEx; ?></td>
</tr>
<tr class="custom-fields">
<th><?php echo $lang->job->custom; ?></th>
<td colspan="3">
<div class="row text-with-input">
<div class="col w-50px">
<?php echo $lang->job->scheduleInterval; ?>
</div>
<div class="col w-100px">
<?php echo html::number('scheduleInterval', $job->scheduleInterval, "class='form-control'"); ?>
</div>
<div class="col w-40px">
<?php echo $lang->job->day; ?>,&nbsp;&nbsp;
</div>
<div class="col <?php echo $this->app->getClientLang() == 'en' ? 'w-100px' : '2-30px'; ?>">
<?php echo $lang->job->at; ?>
</div>
<div class="col w-150px">
<?php echo html::select('scheduleDay', $lang->job->dayTypeList, $job->scheduleDay,"class='form-control chosen'"); ?>
</div>
<div class="col w-100px">
<?php echo html::input('scheduleTime', $job->scheduleTime,
"class='form-control form-time time-only' min='1'"); ?>
</div>
<div class="col w-120px">
<?php echo $lang->job->exe; ?>.
</div>
</div>
</td>
</tr>
<tr>
<th></th>
<td colspan="2" class='text-center form-actions'>
<?php echo html::submitButton(); ?>
<?php echo html::backButton(); ?>
&nbsp;
<?php echo html::commonButton($lang->job->exeNow, "onclick=exeJob($job->id) data-tip-class='tooltip-success'", "btn btn-info exe-job-button"); ?>
</td>
</tr>
</table>
</form>
</div>
<div class='main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->job->edit; ?></h2>
</div>
<form id='jobForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->job->name; ?></th>
<td class='required'><?php echo html::input('name', $job->name, "class='form-control'"); ?></td>
<td colspan="2" ></td>
</tr>
<tr>
<th><?php echo $lang->ci->repo; ?></th>
<td><?php echo html::select('repo', $repoPairs, $job->repo, "class='form-control chosen'"); ?></td>
<th class="svn-fields hidden"><?php echo $lang->job->svnFolder; ?></th>
<td class="svn-fields hidden" id='svnFolderBox'></td>
</tr>
<tr>
<th><?php echo $lang->job->jenkins; ?></th>
<td><?php echo html::select('jenkins', $jenkinsList, $job->jenkins, "class='form-control chosen'"); ?></td>
<th><?php echo $lang->job->jenkinsJob; ?></th>
<td><?php echo html::input('jenkinsJob', $job->jenkinsJob, "class='form-control'"); ?></td>
</tr>
<tr>
<th><?php echo $lang->job->triggerType; ?></th>
<td><?php echo html::select('triggerType', $lang->job->triggerTypeList, $job->triggerType, "onchange='triggerTypeChanged(this.value)' class='form-control chosen'"); ?></td>
<td colspan="2"></td>
</tr>
<tr class="tag-fields">
<th><?php echo $lang->job->example; ?></th>
<td colspan="3"><?php echo $lang->job->tagEx; ?></td>
</tr>
<tr class="comment-fields">
<th><?php echo $lang->job->example; ?></th>
<td colspan="3"><?php echo $lang->job->commitEx; ?></td>
</tr>
<tr class="custom-fields">
<th><?php echo $lang->job->custom; ?></th>
<td colspan="3">
<div class="row text-with-input">
<div class="col w-50px"><?php echo $lang->job->scheduleInterval;?></div>
<div class="col w-100px"><?php echo html::number('scheduleInterval', $job->scheduleInterval, "class='form-control'");?></div>
<div class="col w-40px"><?php echo $lang->job->day; ?>,&nbsp;&nbsp;</div>
<div class="col <?php echo $this->app->getClientLang() == 'en' ? 'w-100px' : '2-30px'; ?>"><?php echo $lang->job->at;?></div>
<div class="col w-150px"><?php echo html::select('scheduleDay', $lang->job->dayTypeList, $job->scheduleDay,"class='form-control chosen'");?></div>
<div class="col w-100px"><?php echo html::input('scheduleTime', $job->scheduleTime, "class='form-control form-time time-only' min='1'");?></div>
<div class="col w-120px"><?php echo $lang->job->exe; ?>.</div>
</div>
</td>
</tr>
<tr>
<th></th>
<td colspan="2" class='text-center form-actions'>
<?php echo html::submitButton(); ?>
<?php echo html::backButton(); ?>
<?php echo html::hidden('repoType', zget($repoTypes, $job->repo, 'Git'));?>
&nbsp;
<?php echo html::commonButton($lang->job->exeNow, "onclick=exeJob($job->id) data-tip-class='tooltip-success'", "btn btn-info exe-job-button");?>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<?php include '../../common/view/footer.html.php'; ?>
<?php include '../../common/view/footer.html.php';?>
+2 -2
View File
@@ -105,8 +105,8 @@ class jenkinsModel extends model
{
$repos = $this->dao->select('id, name')->from(TABLE_JENKINS)
->where('deleted')->eq('0')
->beginIF(!empty(whr))->andWhere('(' . $whr . ')')->fi()
->orderBy(id)
->beginIF(!empty($whr))->andWhere('(' . $whr . ')')->fi()
->orderBy('id')
->fetchPairs();
$repos[''] = '';
return $repos;
+54
View File
@@ -731,4 +731,58 @@ class repo extends control
if($commits > 0) die('finished');
}
}
public function ajaxGetSVNTags($repoID, $path = '', $revision = 'HEAD')
{
if($this->get->path) $entry = $this->get->path;
$repo = $this->repo->getRepoByID($repoID);
if($repo->SCM != 'Subversion') die(json_encode(array()));
$this->scm->setEngine($repo);
$path = $this->repo->decodePath($path);
$tags = $this->scm->tags($path, $revision);
$parentInfos = array();
$parentPath = '';
$info = array();
$info['path'] = '/';
$info['url'] = $repo->path . $info['path'];
$info['encodePath'] = $this->repo->encodePath($info['path']);
$parentInfos['/'] = $info;
foreach(explode('/', $path) as $parent)
{
if(empty($parent)) continue;
$parentPath .= '/' . $parent;
$info = array();
$info['path'] = $parentPath;
$info['url'] = $repo->path . $info['path'];
$info['encodePath'] = $this->repo->encodePath($info['path']);
$parentInfos[$parent] = $info;
}
$tagInfos = array();
foreach($tags as $tag)
{
$info = array();
$info['path'] = '/';
if($path) $info['path'] .= $path . '/';
$info['path'] .= $tag;
$info['url'] = $repo->path . $info['path'];
$info['encodePath'] = $this->repo->encodePath($info['path']);
$tagInfos[$tag] = $info;
}
$svnTags = array();
$svnTags['parent'] = $parentInfos;
$svnTags['tags'] = $tagInfos;
die(json_encode($svnTags));
}
}
+4 -17
View File
@@ -741,6 +741,7 @@ class repoModel extends model
*/
public function encodePath($path = '')
{
if(empty($path)) return $path;
return helper::safe64Encode(urlencode($path));
}
@@ -753,6 +754,7 @@ class repoModel extends model
*/
public function decodePath($path = '')
{
if(empty($path)) return $path;
return trim(urldecode(helper::safe64Decode($path)), '/');
}
@@ -929,21 +931,6 @@ class repoModel extends model
$repos[''] = '';
return $repos;
}
/**
* list repos for jenkins job edit, key will be 12-git
*
* @return mixed
*/
public function listForSelectionWithType($whr)
{
$repos = $this->dao->select("concat(id, '-', SCM), name")->from(TABLE_REPO)
->where('deleted')->eq('0')
->beginIF(!empty(whr))->andWhere('(' . $whr . ')')->fi()
->orderBy(id)
->fetchPairs();
$repos[''] = '';
return $repos;
}
/**
* list repos for sync
@@ -954,8 +941,8 @@ class repoModel extends model
{
$repos = $this->dao->select('*')->from(TABLE_REPO)
->where('deleted')->eq('0')
->beginIF(!empty(whr))->andWhere('(' . $whr . ')')->fi()
->orderBy(id)
->beginIF(!empty($whr))->andWhere('(' . $whr . ')')->fi()
->orderBy('id')
->fetchAll();
foreach($repos as $repo)