update
This commit is contained in:
@@ -93,7 +93,7 @@ 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')->listForSelection("true");
|
||||
$this->view->repoList = $this->loadModel('repo')->listForSelectionWithType("true");
|
||||
$this->view->jenkinsList = $this->loadModel('jenkins')->listForSelection("true");
|
||||
|
||||
$this->display();
|
||||
@@ -118,14 +118,16 @@ 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')->listForSelection("true");
|
||||
$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;
|
||||
$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;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
+11
-10
@@ -1,8 +1,17 @@
|
||||
$(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');
|
||||
@@ -13,7 +22,6 @@ function triggerTypeChanged(type) {
|
||||
$('.tag-fields').addClass('hidden');
|
||||
$('.comment-fields').removeClass('hidden');
|
||||
|
||||
$('.cron-fields').addClass('hidden');
|
||||
$('.custom-fields').addClass('hidden');
|
||||
|
||||
scheduleTypeChanged();
|
||||
@@ -22,25 +30,18 @@ function triggerTypeChanged(type) {
|
||||
$('.comment-fields').addClass('hidden');
|
||||
|
||||
var val = $("input[name='scheduleType']:checked").val();
|
||||
scheduleTypeChanged(val? val: 'cron');
|
||||
scheduleTypeChanged(val? val: 'custom');
|
||||
}
|
||||
}
|
||||
|
||||
function scheduleTypeChanged(type) {
|
||||
if(type == 'cron') {
|
||||
if(type == 'custom') {
|
||||
$('.schedule-fields').removeClass('hidden');
|
||||
|
||||
$('.cron-fields').removeClass('hidden');
|
||||
$('.custom-fields').addClass('hidden');
|
||||
} else if(type == 'custom') {
|
||||
$('.schedule-fields').removeClass('hidden');
|
||||
|
||||
$('.cron-fields').addClass('hidden');
|
||||
$('.custom-fields').removeClass('hidden');
|
||||
} else {
|
||||
$('.schedule-fields').addClass('hidden');
|
||||
|
||||
$('.cron-fields').addClass('hidden');
|
||||
$('.custom-fields').addClass('hidden');
|
||||
}
|
||||
}
|
||||
+11
-10
@@ -1,5 +1,6 @@
|
||||
$(function()
|
||||
{
|
||||
repoTypeChanged(repoType);
|
||||
triggerTypeChanged(triggerType);
|
||||
});
|
||||
|
||||
@@ -17,6 +18,14 @@ function exeJob(id) {
|
||||
});
|
||||
}
|
||||
|
||||
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');
|
||||
@@ -27,7 +36,6 @@ function triggerTypeChanged(type) {
|
||||
$('.tag-fields').addClass('hidden');
|
||||
$('.comment-fields').removeClass('hidden');
|
||||
|
||||
$('.cron-fields').addClass('hidden');
|
||||
$('.custom-fields').addClass('hidden');
|
||||
|
||||
scheduleTypeChanged();
|
||||
@@ -36,25 +44,18 @@ function triggerTypeChanged(type) {
|
||||
$('.comment-fields').addClass('hidden');
|
||||
|
||||
var val = $("input[name='scheduleType']:checked").val();
|
||||
scheduleTypeChanged(val? val: 'cron');
|
||||
scheduleTypeChanged(val? val: 'custom');
|
||||
}
|
||||
}
|
||||
|
||||
function scheduleTypeChanged(type) {
|
||||
if(type == 'cron') {
|
||||
if(type == 'custom') {
|
||||
$('.schedule-fields').removeClass('hidden');
|
||||
|
||||
$('.cron-fields').removeClass('hidden');
|
||||
$('.custom-fields').addClass('hidden');
|
||||
} else if(type == 'custom') {
|
||||
$('.schedule-fields').removeClass('hidden');
|
||||
|
||||
$('.cron-fields').addClass('hidden');
|
||||
$('.custom-fields').removeClass('hidden');
|
||||
} else {
|
||||
$('.schedule-fields').addClass('hidden');
|
||||
|
||||
$('.cron-fields').addClass('hidden');
|
||||
$('.custom-fields').addClass('hidden');
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ $lang->job->buildTime = 'Build Time';
|
||||
$lang->job->id = 'ID';
|
||||
$lang->job->name = 'Name';
|
||||
$lang->job->repo = 'Repo';
|
||||
$lang->job->svnFolder = 'SVN tag parent URL';
|
||||
$lang->job->jenkins = 'Jenkins Server';
|
||||
$lang->job->jenkinsJob = 'Jenkins Task';
|
||||
$lang->job->triggerType = 'Trigger';
|
||||
|
||||
@@ -3,7 +3,7 @@ $lang->ci->common = '持续集成';
|
||||
$lang->ci->at = '于';
|
||||
|
||||
$lang->ci->jenkins = 'Jenkins';
|
||||
$lang->ci->repo = '代码库';
|
||||
$lang->ci->repo = '版本库';
|
||||
$lang->ci->job = '构建';
|
||||
$lang->ci->browse = '浏览';
|
||||
$lang->ci->create = '新建';
|
||||
@@ -13,17 +13,22 @@ $lang->job = new stdclass();
|
||||
$lang->job->browseBuild = '构建历史';
|
||||
$lang->job->viewLogs = '构建日志';
|
||||
|
||||
$lang->job->create = '新建构建任务';
|
||||
$lang->job->edit = '编辑构建任务';
|
||||
$lang->job->exeNow = '立即执行';
|
||||
$lang->job->delete = '删除构建任务';
|
||||
$lang->job->confirmDelete = '确认删除该构建任务吗?';
|
||||
|
||||
$lang->job->repo = '构建状态';
|
||||
$lang->job->buildStatus = '构建状态';
|
||||
$lang->job->buildStatus = '构建状态';
|
||||
$lang->job->buildStatus = '构建状态';
|
||||
$lang->job->buildTime = '构建时间';
|
||||
|
||||
$lang->job->id = 'ID';
|
||||
$lang->job->name = '名称';
|
||||
$lang->job->repo = '代码库';
|
||||
$lang->job->svnFolder = 'SVN Tag 父URL';
|
||||
$lang->job->jenkins = 'Jenkins服务';
|
||||
$lang->job->buildType = '构建类型';
|
||||
$lang->job->jenkinsJob = 'Jenkins任务名';
|
||||
|
||||
+47
-58
@@ -60,12 +60,16 @@ class ciModel extends model
|
||||
->add('createdBy', $this->app->user->account)
|
||||
->add('createdDate', helper::now())
|
||||
->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')
|
||||
|
||||
->autoCheck()
|
||||
->exec();
|
||||
@@ -73,32 +77,21 @@ class ciModel extends model
|
||||
if ($job->triggerType === 'schedule') {
|
||||
$jobId = $this->dao->lastInsertID();
|
||||
|
||||
if ($job->scheduleType == 'custom') {
|
||||
$arr = explode(":", $job->scheduleTime);
|
||||
$hour = $arr[0];
|
||||
$min = $arr[1];
|
||||
$arr = explode(":", $job->scheduleTime);
|
||||
$hour = $arr[0];
|
||||
$min = $arr[1];
|
||||
|
||||
if ($job->scheduleDay == 'everyDay') {
|
||||
$days = '1-7';
|
||||
} else if ($job->scheduleDay == 'workDay') {
|
||||
$days = '1-5';
|
||||
}
|
||||
|
||||
$cron = (object)array('m' => $min, 'h' => $hour, 'dom' => '*', 'mon' => '*',
|
||||
'dow' => $days . '/' . $job->scheduleInterval, 'command' => 'moduleName=ci&methodName=exeJob&parm=' . $jobId,
|
||||
'remark' => ($this->lang->ci->extJob . $jobId), 'type' => 'zentao',
|
||||
'buildin' => '-1', 'status' => 'normal', 'lastTime' => '0000-00-00 00:00:00');
|
||||
$this->dao->insert(TABLE_CRON)->data($cron)->exec();
|
||||
} else if ($job->scheduleType == 'cron') {
|
||||
$arr = explode(' ', $job->cronExpression);
|
||||
if (count($arr) >= 6) {
|
||||
$cron = (object)array('m' => $arr[1], 'h' => $arr[2], 'dom' => $arr[3], 'mon' => $arr[4],
|
||||
'dow' => $arr[5], 'command' => 'moduleName=ci&methodName=exeJob&parm=' . $jobId,
|
||||
'remark' => ($this->lang->ci->extJob . $jobId), 'type' => 'zentao',
|
||||
'buildin' => '-1', 'status' => 'normal', 'lastTime' => '0000-00-00 00:00:00');
|
||||
$this->dao->insert(TABLE_CRON)->data($cron)->exec();
|
||||
}
|
||||
if ($job->scheduleDay == 'everyDay') {
|
||||
$days = '1-7';
|
||||
} else if ($job->scheduleDay == 'workDay') {
|
||||
$days = '1-5';
|
||||
}
|
||||
|
||||
$cron = (object)array('m' => $min, 'h' => $hour, 'dom' => '*', 'mon' => '*',
|
||||
'dow' => $days . '/' . $job->scheduleInterval, 'command' => 'moduleName=ci&methodName=exeJob&parm=' . $jobId,
|
||||
'remark' => ($this->lang->ci->extJob . $jobId), 'type' => 'zentao',
|
||||
'buildin' => '-1', 'status' => 'normal', 'lastTime' => '0000-00-00 00:00:00');
|
||||
$this->dao->insert(TABLE_CRON)->data($cron)->exec();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -117,12 +110,16 @@ class ciModel extends model
|
||||
->add('editedBy', $this->app->user->account)
|
||||
->add('editedDate', helper::now())
|
||||
->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')
|
||||
|
||||
->autoCheck()
|
||||
->where('id')->eq($id)
|
||||
@@ -131,39 +128,25 @@ class ciModel extends model
|
||||
if ($job->triggerType === 'schedule') {
|
||||
$command = 'moduleName=ci&methodName=exeJob&parm=' . $id;
|
||||
|
||||
if ($job->scheduleType == 'custom') {
|
||||
$arr = explode(":", $job->scheduleTime);
|
||||
$hour = $arr[0];
|
||||
$min = $arr[1];
|
||||
$arr = explode(":", $job->scheduleTime);
|
||||
$hour = $arr[0];
|
||||
$min = $arr[1];
|
||||
|
||||
$jobId = $this->dao->lastInsertID();
|
||||
if ($job->scheduleDay == 'everyDay') {
|
||||
$days = '1-7';
|
||||
} else if ($job->scheduleDay == 'workDay') {
|
||||
$days = '2-6';
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_CRON)
|
||||
->set('m')->eq($min)
|
||||
->set('h')->eq($hour)
|
||||
->set('dom')->eq('*')
|
||||
->set('mon')->eq('*')
|
||||
->set('dow')->eq($days . '/' . $job->scheduleInterval)
|
||||
->set('lastTime')->eq('0000-00-00 00:00:00')
|
||||
->where('command')->eq($command)->exec();
|
||||
} else if ($job->scheduleType == 'cron') {
|
||||
$arr = explode(' ', $job->cronExpression);
|
||||
if (count($arr) >= 6) {
|
||||
$this->dao->update(TABLE_CRON)
|
||||
->set('m')->eq($arr[1])
|
||||
->set('h')->eq($arr[2])
|
||||
->set('dom')->eq($arr[3])
|
||||
->set('mon')->eq($arr[4])
|
||||
->set('dow')->eq($arr[5])
|
||||
->set('lastTime')->eq('0000-00-00 00:00:00')
|
||||
->where('command')->eq($command)->exec();
|
||||
}
|
||||
$jobId = $this->dao->lastInsertID();
|
||||
if ($job->scheduleDay == 'everyDay') {
|
||||
$days = '1-7';
|
||||
} else if ($job->scheduleDay == 'workDay') {
|
||||
$days = '2-6';
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_CRON)
|
||||
->set('m')->eq($min)
|
||||
->set('h')->eq($hour)
|
||||
->set('dom')->eq('*')
|
||||
->set('mon')->eq('*')
|
||||
->set('dow')->eq($days . '/' . $job->scheduleInterval)
|
||||
->set('lastTime')->eq('0000-00-00 00:00:00')
|
||||
->where('command')->eq($command)->exec();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -215,12 +198,18 @@ class ciModel extends model
|
||||
public function listBuild($jobID, $orderBy = 'id_desc', $pager = null, $decode = true)
|
||||
{
|
||||
$list = $this->dao->
|
||||
select('id, name, status, createdDate')->from(TABLE_CI_BUILD)
|
||||
->where('deleted')->eq('0')
|
||||
->andWhere('cijob')->eq($jobID)
|
||||
select('build.id, build.name, build.status, build.createdDate, job.triggerType, repo.name repoName, jenkins.name as jenkinsName')
|
||||
->from(TABLE_CI_BUILD)->alias('build')
|
||||
->leftJoin(TABLE_CI_JOB)->alias('job')->on('build.cijob=job.id')
|
||||
->leftJoin(TABLE_REPO)->alias('repo')->on('job.repo=repo.id')
|
||||
->leftJoin(TABLE_JENKINS)->alias('jenkins')->on('job.jenkins=jenkins.id')
|
||||
|
||||
->where('build.deleted')->eq('0')
|
||||
->andWhere('build.cijob')->eq($jobID)
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
|
||||
<th class='w-60px'><?php common::printOrderLink('id', $orderBy, $vars, $lang->job->id); ?></th>
|
||||
<th class='w-200px text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->job->name); ?></th>
|
||||
<th class='w-200px text-left'><?php echo $lang->ci->repo; ?></th>
|
||||
<th class='w-200px text-left'><?php echo $lang->ci->jenkins; ?></th>
|
||||
<th class='w-200px text-left'><?php echo $lang->job->triggerType; ?></th>
|
||||
|
||||
<th class='w-100px text-left'><?php common::printOrderLink('status', $orderBy, $vars, $lang->job->buildStatus); ?></th>
|
||||
<th class='w-100px text-left'><?php common::printOrderLink('createdDate', $orderBy, $vars, $lang->job->buildTime); ?></th>
|
||||
|
||||
@@ -46,6 +50,12 @@
|
||||
<tr>
|
||||
<td class='text-center'><?php echo $id; ?></td>
|
||||
<td class='text' title='<?php echo $build->name; ?>'><?php echo $build->name; ?></td>
|
||||
<td class='text' title='<?php echo $build->repoName; ?>'><?php echo $build->repoName; ?></td>
|
||||
<td class='text' title='<?php echo $build->jenkinsName; ?>'><?php echo $build->jenkinsName; ?></td>
|
||||
<td class='text' title='<?php echo $lang->job->triggerTypeList[$build->triggerType]; ?>'>
|
||||
<?php echo $lang->job->triggerTypeList[$build->triggerType]; ?>
|
||||
</td>
|
||||
|
||||
<td class='text' title='<?php echo $lang->job->buildStatusList[$build->status]; ?>'>
|
||||
<?php echo $lang->job->buildStatusList[$build->status]; ?>
|
||||
</td>
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
<th class='w-100px text-left'>
|
||||
<?php common::printOrderLink('jenkins', $orderBy, $vars, $lang->job->jenkins); ?></th>
|
||||
<th class='w-100px text-left'><?php echo $lang->job->jenkinsJob; ?></th>
|
||||
<th class='w-100px text-left'><?php echo $lang->job->buildType; ?></th>
|
||||
<th class='w-100px text-left'><?php echo $lang->job->triggerType; ?></th>
|
||||
<th class='w-200px text-left'><?php echo $lang->job->lastExe; ?></th>
|
||||
|
||||
@@ -44,8 +43,6 @@
|
||||
<td class='text' title='<?php echo $job->repoName; ?>'><?php echo $job->repoName; ?></td>
|
||||
<td class='text' title='<?php echo $job->jenkinsName; ?>'><?php echo $job->jenkinsName; ?></td>
|
||||
<td class='text' title='<?php echo $job->jenkinsJob; ?>'><?php echo $job->jenkinsJob; ?></td>
|
||||
<td class='text' title='<?php echo $lang->job->buildTypeList[$job->buildType]; ?>'>
|
||||
<?php echo $lang->job->buildTypeList[$job->buildType]; ?></td>
|
||||
<td class='text' title='<?php echo $lang->job->triggerTypeList[$job->triggerType]; ?>'>
|
||||
<?php echo $lang->job->triggerTypeList[$job->triggerType]; ?></td>
|
||||
<td class='text' title='<?php echo $lang->job->lastBuild; ?>'>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php'; ?>
|
||||
|
||||
<?php js::set('repoType', 'Git')?>
|
||||
<?php js::set('triggerType', 'tag')?>
|
||||
|
||||
<div id='mainContent' class='main-row'>
|
||||
@@ -24,11 +25,16 @@
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->job->name; ?></th>
|
||||
<td colspan="3" class='required'><?php echo html::input('name', '', "class='form-control'"); ?></td>
|
||||
<td class='required'><?php echo html::input('name', '', "class='form-control'"); ?></td>
|
||||
<td colspan="2" ></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->job->repo; ?></th>
|
||||
<td colspan="3"><?php echo html::select('repo', $repoList, '', "class='form-control chosen'"); ?></td>
|
||||
<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>
|
||||
@@ -41,10 +47,7 @@
|
||||
<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>
|
||||
|
||||
<th class="schedule-fields"><?php echo $lang->job->scheduleType; ?></th>
|
||||
<td class="schedule-fields"><?php echo html::radio('scheduleType', $lang->job->scheduleTypeList, 'cron',
|
||||
"onclick='scheduleTypeChanged(this.value)'");?></td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
<tr class="tag-fields" class="tag-fields">
|
||||
<th><?php echo $lang->job->example; ?></th>
|
||||
@@ -54,12 +57,6 @@
|
||||
<th><?php echo $lang->job->example; ?></th>
|
||||
<td colspan="3"><?php echo $lang->job->commitEx; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr class="cron-fields" class="cron-fields">
|
||||
<th><?php echo $lang->job->cronExpression; ?></th>
|
||||
<td><?php echo html::input('cronExpression', '', "class='form-control'"); ?></td>
|
||||
<td colspan="2"><span style="font-style: italic"><?php echo $lang->job->cronSample; ?></span></td>
|
||||
</tr>
|
||||
<tr class="custom-fields">
|
||||
<th><?php echo $lang->job->custom; ?></th>
|
||||
<td colspan="3">
|
||||
@@ -91,10 +88,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php echo $lang->job->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'>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php'; ?>
|
||||
|
||||
<?php js::set('repoType', $job->repoType)?>
|
||||
<?php js::set('triggerType', $job->triggerType)?>
|
||||
|
||||
<div id='mainContent' class='main-row'>
|
||||
@@ -24,11 +25,16 @@
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->job->name; ?></th>
|
||||
<td colspan="3" class='required'><?php echo html::input('name', $job->name, "class='form-control'"); ?></td>
|
||||
<td class='required'><?php echo html::input('name', $job->name, "class='form-control'"); ?></td>
|
||||
<td colspan="2" ></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->job->repo; ?></th>
|
||||
<td colspan="3"><?php echo html::select('repo', $repoList, $job->repo, "class='form-control chosen'"); ?></td>
|
||||
<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>
|
||||
@@ -41,10 +47,7 @@
|
||||
<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>
|
||||
|
||||
<th class="schedule-fields"><?php echo $lang->job->scheduleType; ?></th>
|
||||
<td class="schedule-fields"><?php echo html::radio('scheduleType', $lang->job->scheduleTypeList, $job->scheduleType,
|
||||
"onclick='scheduleTypeChanged(this.value)'");?></td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
<tr class="tag-fields">
|
||||
<th><?php echo $lang->job->example; ?></th>
|
||||
@@ -55,11 +58,6 @@
|
||||
<td colspan="3"><?php echo $lang->job->commitEx; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr class="cron-fields">
|
||||
<th><?php echo $lang->job->cronExpression; ?></th>
|
||||
<td><?php echo html::input('cronExpression', $job->cronExpression, "class='form-control'"); ?></td>
|
||||
<td colspan="2"><span style="font-style: italic"><?php echo $lang->job->cronSample; ?></span></td>
|
||||
</tr>
|
||||
<tr class="custom-fields">
|
||||
<th><?php echo $lang->job->custom; ?></th>
|
||||
<td colspan="3">
|
||||
@@ -90,11 +88,6 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php echo $lang->job->desc; ?></th>
|
||||
<td colspan="3"><?php echo html::textarea('desc', '', "rows='3' class='form-control'"); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td colspan="2" class='text-center form-actions'>
|
||||
|
||||
@@ -122,8 +122,9 @@ class repo extends control
|
||||
|
||||
$this->app->loadLang('action');
|
||||
|
||||
$this->view->repo = $repo;
|
||||
$this->view->repoID = $repoID;
|
||||
$repo->repoType = $repo->id . '-' . $repo->SCM;
|
||||
$this->view->repo = $repo;
|
||||
$this->view->repoID = $repoID;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
|
||||
|
||||
|
||||
@@ -6,7 +6,13 @@ $(function()
|
||||
function scmChanged(scm) {
|
||||
if(scm == 'Git') {
|
||||
$('.account-fields').addClass('hidden');
|
||||
|
||||
$('.tips-git').removeClass('hidden');
|
||||
$('.tips-svn').addClass('hidden');
|
||||
} else {
|
||||
$('.account-fields').removeClass('hidden');
|
||||
|
||||
$('.tips-git').addClass('hidden');
|
||||
$('.tips-svn').removeClass('hidden');
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,13 @@ $(function()
|
||||
function scmChanged(scm) {
|
||||
if(scm == 'Git') {
|
||||
$('.account-fields').addClass('hidden');
|
||||
|
||||
$('.tips-git').removeClass('hidden');
|
||||
$('.tips-svn').addClass('hidden');
|
||||
} else {
|
||||
$('.account-fields').removeClass('hidden');
|
||||
|
||||
$('.tips-git').addClass('hidden');
|
||||
$('.tips-svn').removeClass('hidden');
|
||||
}
|
||||
}
|
||||
@@ -106,8 +106,8 @@ $lang->repo->logStyles['D'] = 'Delete';
|
||||
$lang->repo->encodingList['utf_8'] = 'UTF-8';
|
||||
$lang->repo->encodingList['gbk'] = 'GBK';
|
||||
|
||||
$lang->repo->scmList['Subversion'] = 'Subversion';
|
||||
$lang->repo->scmList['Git'] = 'Git';
|
||||
$lang->repo->scmList['Subversion'] = 'Subversion';
|
||||
|
||||
$lang->repo->notice = new stdclass();
|
||||
$lang->repo->notice->syncing = 'Synchronizing. Please wait ...';
|
||||
@@ -139,11 +139,14 @@ $lang->repo->error->output = "The command is: %s\nThe error is(%s): %s\n"
|
||||
$lang->repo->error->clientVersion = "Client version is too low, please upgrade or change SVN client";
|
||||
$lang->repo->error->encoding = "The encoding maybe wrong. Please change the encoding and try again.";
|
||||
|
||||
$lang->repo->tips = '<strong>You may find the reference about how to set Git sync from <a target="_blank" href="https://www.zentao.net/book/zentaopmshelp/207.html">here</a>.</strong>';
|
||||
$lang->repo->encodingsTips = "The encodings of commit comments, can be comma separated values,e.g. utf-8";
|
||||
$lang->repo->example = new stdclass();
|
||||
$lang->repo->example->client = "For example, /usr/bin/svn, C:\subversion\svn.exe, /usr/bin/git";
|
||||
$lang->repo->example->path = "For example, SVN: http://example.googlecode.com/svn/, GIT: /home/test";
|
||||
$lang->repo->synTips = '<strong>You may find the reference about how to set Git sync from <a target="_blank" href="https://www.zentao.net/book/zentaopmshelp/207.html">here</a>.</strong>';
|
||||
$lang->repo->encodingsTips = "The encodings of commit comments, can be comma separated values,e.g. utf-8";
|
||||
$lang->repo->example = new stdclass();
|
||||
$lang->repo->example->client->git = "e.g. /usr/bin/git";
|
||||
$lang->repo->example->client->svn = "e.g. /usr/bin/svn";
|
||||
$lang->repo->example->path->git = "e.g. /homt/user/myproject";
|
||||
$lang->repo->example->path->svn = "e.g. http://example.googlecode.com/svn/trunk/myproject";
|
||||
|
||||
$lang->repo->example->config = "Config directory is required in https. Use '--config-dir' to generate config dir.";
|
||||
$lang->repo->example->encoding = "input encoding of files";
|
||||
|
||||
|
||||
@@ -107,8 +107,8 @@ $lang->repo->logStyles['D'] = '删除';
|
||||
$lang->repo->encodingList['utf_8'] = 'UTF-8';
|
||||
$lang->repo->encodingList['gbk'] = 'GBK';
|
||||
|
||||
$lang->repo->scmList['Subversion'] = 'Subversion';
|
||||
$lang->repo->scmList['Git'] = 'Git';
|
||||
$lang->repo->scmList['Subversion'] = 'Subversion';
|
||||
|
||||
$lang->repo->notice = new stdclass();
|
||||
$lang->repo->notice->syncing = '正在同步中, 请稍等...';
|
||||
@@ -140,13 +140,15 @@ $lang->repo->error->output = "执行命令:%s\n错误结果(%s): %s\n
|
||||
$lang->repo->error->clientVersion = "客户端版本过低,请升级或更换SVN客户端";
|
||||
$lang->repo->error->encoding = "编码可能错误,请更换编码重试。";
|
||||
|
||||
$lang->repo->tips = '<strong>请参照<a target="_blank" href="https://www.zentao.net/book/zentaopmshelp/207.html">这里</a>,设置版本库定时同步。</strong>';
|
||||
$lang->repo->encodingsTips = "提交日志的编码,可以用逗号连接起来的多个,比如utf-8。";
|
||||
$lang->repo->example = new stdclass();
|
||||
$lang->repo->example->client = "例如:/usr/bin/svn, C:\subversion\svn.exe, /usr/bin/git";
|
||||
$lang->repo->example->path = "例如:SVN: http://example.googlecode.com/svn/, GIT: /homt/test";
|
||||
$lang->repo->example->config = "https需要填写配置目录的位置,通过config-dir选项生成配置目录";
|
||||
$lang->repo->example->encoding = "填写版本库中文件的编码";
|
||||
$lang->repo->synTips = '请参照<a target="_blank" href="https://www.zentao.net/book/zentaopmshelp/207.html">这里</a>,设置版本库定时同步。';
|
||||
$lang->repo->encodingsTips = "提交日志的编码,可以用逗号连接起来的多个,比如utf-8。";
|
||||
$lang->repo->example = new stdclass();
|
||||
$lang->repo->example->client->git = "例如:/usr/bin/git";
|
||||
$lang->repo->example->client->svn = "例如:/usr/bin/svn";
|
||||
$lang->repo->example->path->git = "例如:/homt/user/myproject";
|
||||
$lang->repo->example->path->svn = "例如:http://example.googlecode.com/svn/trunk/myproject";
|
||||
$lang->repo->example->config = "https需要填写配置目录的位置,通过config-dir选项生成配置目录";
|
||||
$lang->repo->example->encoding = "填写版本库中文件的编码";
|
||||
|
||||
$lang->repo->typeList['standard'] = '规范';
|
||||
$lang->repo->typeList['performance'] = '性能';
|
||||
|
||||
+17
-2
@@ -178,7 +178,7 @@ class repoModel extends model
|
||||
if($data->prefix) $data->prefix = '/' . $data->prefix;
|
||||
}
|
||||
|
||||
if($data->encrypt == 'base64') $data->password = base64_encode($data->password);
|
||||
$data->password = base64_encode($data->password);
|
||||
$this->dao->insert(TABLE_REPO)->data($data)
|
||||
->batchCheck($this->config->repo->create->requiredFields, 'notempty')
|
||||
->checkIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
|
||||
@@ -284,7 +284,7 @@ class repoModel extends model
|
||||
$repo = $this->dao->select('*')->from(TABLE_REPO)->where('id')->eq($repoID)->fetch();
|
||||
if(!$repo) return false;
|
||||
|
||||
if($repo->encrypt == 'base64') $repo->password = base64_decode($repo->password);
|
||||
$repo->password = base64_decode($repo->password);
|
||||
$repo->acl = json_decode($repo->acl);
|
||||
return $repo;
|
||||
}
|
||||
@@ -929,6 +929,21 @@ 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
|
||||
|
||||
@@ -24,14 +24,10 @@
|
||||
</div>
|
||||
<form id='repoForm' method='post' class='form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='thWidth'></th>
|
||||
<td colspan="2"><?php echo $lang->repo->tips; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='thWidth'><?php echo $lang->repo->type; ?></th>
|
||||
<td style="width:550px"><?php echo html::select('SCM', $lang->repo->scmList, 'Git', "onchange='scmChanged(this.value)' class='form-control'"); ?></td>
|
||||
<td></td>
|
||||
<td class="tips-git"><?php echo $lang->repo->synTips; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->name; ?></th>
|
||||
@@ -41,7 +37,10 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->path; ?></th>
|
||||
<td class='required'><?php echo html::input('path', '', "class='form-control'"); ?></td>
|
||||
<td class='muted'><?php echo $lang->repo->example->path;?></td>
|
||||
<td class='muted'>
|
||||
<span class="tips-git"><?php echo $lang->repo->example->path->git;?></span>
|
||||
<span class="tips-svn"><?php echo $lang->repo->example->path->svn;?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->encoding; ?></th>
|
||||
@@ -51,7 +50,10 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->client;?></th>
|
||||
<td class='required'><?php echo html::input('client', '', "class='form-control'")?></td>
|
||||
<td class='muted'><?php echo $lang->repo->example->client;?></td>
|
||||
<td class='muted'>
|
||||
<span class="tips-git"><?php echo $lang->repo->example->client->git;?></span>
|
||||
<span class="tips-svn"><?php echo $lang->repo->example->client->svn;?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="account-fields">
|
||||
<th><?php echo $lang->repo->account;?></th>
|
||||
@@ -60,11 +62,7 @@
|
||||
<tr class="account-fields">
|
||||
<th><?php echo $lang->repo->password;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::password('password', '', "class='form-control'");?>
|
||||
<span class='input-group-addon fix-border fix-padding'></span>
|
||||
<?php echo html::select('encrypt', $lang->repo->encryptList, 'base64', "class='form-control'");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -26,14 +26,12 @@
|
||||
</div>
|
||||
<form id='repoForm' method='post' class='form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='thWidth'></th>
|
||||
<td colspan="2"><?php echo $lang->repo->tips; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='thWidth'><?php echo $lang->repo->type; ?></th>
|
||||
<td style="width:550px"><?php echo html::select('SCM', $lang->repo->scmList, $repo->SCM, "onchange='scmChanged(this.value)' class='form-control'"); ?></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<span class="tips-git"><?php echo $lang->repo->synTips; ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->name; ?></th>
|
||||
@@ -43,7 +41,10 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->path; ?></th>
|
||||
<td class='required'><?php echo html::input('path', $repo->path, "class='form-control'"); ?></td>
|
||||
<td class='muted'><?php echo $lang->repo->example->path;?></td>
|
||||
<td class='muted'>
|
||||
<span class="tips-git"><?php echo $lang->repo->example->path->git;?></span>
|
||||
<span class="tips-svn"><?php echo $lang->repo->example->path->svn;?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->encoding; ?></th>
|
||||
@@ -53,7 +54,10 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->client;?></th>
|
||||
<td class='required'><?php echo html::input('client', $repo->client, "class='form-control'")?></td>
|
||||
<td class='muted'><?php echo $lang->repo->example->client;?></td>
|
||||
<td class='muted'>
|
||||
<span class="tips-git"><?php echo $lang->repo->example->client->git;?></span>
|
||||
<span class="tips-svn"><?php echo $lang->repo->example->client->svn;?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="account-fields">
|
||||
<th><?php echo $lang->repo->account;?></th>
|
||||
@@ -62,11 +66,7 @@
|
||||
<tr class="account-fields">
|
||||
<th><?php echo $lang->repo->password;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::password('password', $repo->password, "class='form-control'");?>
|
||||
<span class='input-group-addon fix-border fix-padding'></span>
|
||||
<?php echo html::select('encrypt', $lang->repo->encryptList, $repo->encrypt, "class='form-control'");?>
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user