* Adjust editing a job.

This commit is contained in:
dingguodong
2021-07-27 09:23:51 +08:00
parent 5f437c5387
commit 704cee37ec
3 changed files with 41 additions and 26 deletions
+10 -10
View File
@@ -122,16 +122,16 @@ class job extends control
$repoTypes[$repo->id] = $repo->SCM;
}
$this->view->title = $this->lang->ci->job . $this->lang->colon . $this->lang->job->edit;
$this->view->position[] = html::a(inlink('browse'), $this->lang->ci->job);
$this->view->position[] = $this->lang->job->edit;
$this->view->repoPairs = $repoPairs;
$this->view->repoTypes = $repoTypes;
$this->view->repoType = zget($repoTypes, $job->repo, 'Git');
$this->view->job = $job;
$this->view->products = array(0 => '') + $this->loadModel('product')->getProductPairsByProject($this->projectID);
$this->view->serverList = $this->loadModel('jenkins')->getPairs();
$this->view->pipelines = $this->jenkins->getTasks($job->server);
$this->view->title = $this->lang->ci->job . $this->lang->colon . $this->lang->job->edit;
$this->view->position[] = html::a(inlink('browse'), $this->lang->ci->job);
$this->view->position[] = $this->lang->job->edit;
$this->view->repoPairs = $repoPairs;
$this->view->repoTypes = $repoTypes;
$this->view->repoType = zget($repoTypes, $job->repo, 'Git');
$this->view->job = $job;
$this->view->products = array(0 => '') + $this->loadModel('product')->getProductPairsByProject($this->projectID);
$this->view->jenkinsServerList = $this->loadModel('jenkins')->getPairs();
$this->view->pipelines = $this->jenkins->getTasks($job->server);
$this->display();
}
+25 -11
View File
@@ -1,7 +1,13 @@
$('#repo').change(function()
{
var repoID = $(this).val();
var type = 'Git';
$.getJSON(createLink('job', 'ajaxGetProductByRepo', 'repoID=' + repoID), function(product)
{
console.log(product);
}
);
var type = 'Git';
if(typeof(repoTypes[repoID]) != 'undefined') type = repoTypes[repoID];
$('.svn-fields').addClass('hidden');
@@ -86,30 +92,38 @@ $('#triggerType').change(function()
}
});
$('#server').change(function()
$('#jkServer').change(function()
{
var jenkinsID = $(this).val();
$('#pipelineBox #pipeline').remove();
$('#pipelineBox #pipeline_chosen').remove();
$('#pipelineBox .input-group').append("<div class='load-indicator loading'></div>");
$.getJSON(createLink('jenkins', 'ajaxGetTasks', 'jenkinsID=' + jenkinsID), function(tasks)
$('#jenkinsServerTR #jkTask').remove();
$('#jenkinsServerTR #jkTask_chosen').remove();
$('#jenkinsServerTR .input-group').append("<div class='load-indicator loading'></div>");
$.getJSON(createLink('jenkins', 'ajaxGetJenkinsTasks', 'jenkinsID=' + jenkinsID), function(tasks)
{
html = "<select id='pipeline' name='pipeline' class='form-control'>";
html = "<select id='jkTask' name='jkTask' class='form-control'>";
for(taskKey in tasks)
{
var task = tasks[taskKey];
html += "<option value='" + taskKey + "'>" + task + "</option>";
}
html += '</select>';
$('#pipelineBox .loading').remove();
$('#pipelineBox .input-group').append(html);
$('#jenkinsServerTR .loading').remove();
$('#jenkinsServerTR .input-group').append(html);
$('#pipelineBox #pipeline').val(pipeline).chosen({drop_direction: 'auto'});
$('#jenkinsServerTR #jkTask').val(jkTask).chosen();
})
})
$('#engine').change(function()
{
$('#jenkinsServerTR').toggle($('#engine').val() == 'jenkins');
$('#gitlabServerTR').toggle($('#engine').val() == 'gitlab');
});
$('#engine').change();
$('#jkServer').change();
$(function()
{
$('#server').change();
$('#triggerType').change();
});
+6 -5
View File
@@ -17,6 +17,7 @@
<?php js::set('pipeline', $job->pipeline);?>
<?php js::set('dirChange', $lang->job->dirChange);?>
<?php js::set('buildTag', $lang->job->buildTag);?>
<?php js::set('jkTask', $job->pipeline);?>
<div id='mainContent' class='main-row'>
<div class='main-content'>
@@ -33,7 +34,7 @@
</tr>
<tr>
<th><?php echo $lang->job->engine; ?></th>
<td><?php echo html::select('engine', $lang->job->engineList, $job->engine, "class='form-control chosen'");?>
<td class='required'><?php echo html::select('engine', $lang->job->engineList, $job->engine, "class='form-control chosen'");?>
</td>
</tr>
<tr>
@@ -101,15 +102,15 @@
</td>
</tr>
<?php if($job->engine == 'jenkins'):?>
<tr>
<tr id="jenkinsServerTR">
<th><?php echo $lang->job->server; ?></th>
<td colspan='2'>
<div class='table-row'>
<div class='table-col'><?php echo html::select('server', $serverList, $job->server, "class='form-control chosen'");?></div>
<div id='pipelineBox' class='table-col'>
<div class='table-col'><?php echo html::select('jkServer', $jenkinsServerList, $job->server, "class='form-control chosen'");?></div>
<div class='table-col'>
<div class='input-group'>
<span class='input-group-addon'><?php echo $lang->job->pipeline; ?></span>
<?php echo html::select('pipeline', array('' => ''), $job->pipeline, "class='form-control chosen'");?>
<?php echo html::select('jkTask', array('' => ''), $job->pipeline, "class='form-control chosen'");?>
</div>
</div>
</div>