Merge branch 'jenkins_test' into 'master'

Jenkins ui

See merge request easycorp/zentaopms!7435
This commit is contained in:
王怡栋
2023-04-17 07:34:01 +00:00
8 changed files with 92 additions and 43 deletions
+3 -3
View File
@@ -125,9 +125,9 @@ class jenkins extends control
*/
public function ajaxGetJenkinsTasks($id)
{
if(empty($id)) return print(json_encode(array('' => '')));
if(empty($id)) return print('');
$tasks = $this->jenkins->getTasks($id);
echo json_encode($tasks);
$this->view->tasks = $this->jenkins->getTasks($id, 3);
$this->display();
}
}
@@ -83,7 +83,7 @@
</li>
<?php else:?>
<li data-idx='<?php echo $task;?>' data-id='<?php echo $task;?>'>
<a href='###' id='<?php echo $task;?>' class='text-ellipsis' onclick='setJenkinsJob("<?php echo $task;?>","<?php echo $groupName;?>")' title='<?php echo $task;?>' data-key='<?php echo $task;?>' ><?php echo $task;?></a>
<a href='###' id='<?php echo $groupName;?>' class='text-ellipsis' onclick='setJenkinsJob("<?php echo $task;?>","<?php echo $groupName;?>")' title='<?php echo $task;?>' data-key='<?php echo $task;?>' ><?php echo $task;?></a>
</li>
<?php endif;?>
<?php endforeach;?>
+9 -2
View File
@@ -2,7 +2,8 @@
.only-pick-time thead th, .only-pick-time tfoot th {color: transparent !important;}
.checkbox-primary.checkbox-inline {display: inline-block !important;}
.checkbox-primary.checkbox-inline label {padding-left: 5px !important;}
.jktask-label {min-width: 50px; max-width: 300px; border-radius: 0px 4px 4px 0px;}
.jktask-label {width: 326px; border-radius: 0px 4px 4px 0px;}
.search-list {max-width: 500px;}
.input-group-addon {border-radius: 2px 0px 0px 2px !important;}
button.text-right {min-width: 100px; text-align: right;}
#server_chosen .chosen-single {border-right: 0px;}
@@ -10,6 +11,12 @@ button.text-right {min-width: 100px; text-align: right;}
#svnDirBox .input-group {width: unset !important;}
#jenkinsServerTR .input-group-addon {border-left-width: 0 !important;}
#jenkinsServerTR .dropdown {position: relative;}
#jenkinsServerTR .table-col:first-child {width: 375.5px;}
#jenkinsServerTR .table-col:first-child {width: 375px;}
.chosen-container .chosen-drop{z-index: 1100;} /* from c20b7e7a5 */
#dropMenuTasks>.table-row {width: unset;}
#paramName {width: 324px;}
#paramValue {width: 181px;}
#paramDiv .table-row {table-layout: unset;}
+8
View File
@@ -6,3 +6,11 @@
#pipelineBox {width: 385px;}
#svnDirBox .input-group {width: unset !important;}
#jenkinsServerTR .input-group-addon {border-left-width: 0 !important;}
#jenkinsServerTR .dropdown {position: relative;}
#jenkinsServerTR .table-col:first-child {width: 375px;}
#paramName {width: 324px;}
#paramValue {width: 181px;}
#paramDiv .table-row {table-layout: unset;}
.jktask-label {width: 326px; border-radius: 0px 4px 4px 0px;}
.search-list {max-width: 500px;}
+25 -16
View File
@@ -18,7 +18,7 @@ $(document).ready(function()
$('#frameBox .loading').remove();
$('#frameBox .input-group').append(html);
$('#frameBox #frame').chosen();
$('#frame').change();
}
getFrameSelect('');
@@ -171,26 +171,20 @@ $(document).ready(function()
$('#jkServer').change(function()
{
var jenkinsID = $(this).val();
$('#jenkinsServerTR #jkTask').remove();
$('#jenkinsServerTR #jkTask_chosen').remove();
$('#jenkinsServerTR .dropdown,#jenkinsServerTR .input-group-addon').hide();
$('#jenkinsServerTR .input-group').append("<div class='load-indicator loading'></div>");
$.getJSON(createLink('jenkins', 'ajaxGetJenkinsTasks', 'jenkinsID=' + jenkinsID), function(tasks)
{
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>';
$('#jenkinsServerTR .loading').remove();
$('#jenkinsServerTR .input-group').append(html);
setJenkinsJob('', '');
$('#jenkinsServerTR #jkTask').chosen({drop_direction: 'auto'});
})
$.get(createLink('jenkins', 'ajaxGetJenkinsTasks', 'jenkinsID=' + jenkinsID), function(tasks)
{
$('#jenkinsServerTR .loading').remove();
$('#dropMenuTasks').html(tasks);
$('#jenkinsServerTR .dropdown,.input-group-addon').show();
});
/* There has been a problem with handling the prompt label. */
$('#jkTaskLabel').remove();
$('.jktask-label').addClass('text-right');
})
$(document).on('change', '#frame', function()
@@ -253,3 +247,18 @@ $(document).ready(function()
$('#engine').change();
$('#triggerType').change();
});
/**
* Set jenkins job.
*
* @param string $name
* @param string $task
* @access public
* @return void
*/
function setJenkinsJob(name, task)
{
if(name) $('.jktask-label').removeClass('text-right');
$('#jkTask').val(task);
$('.jktask-label .text').html(name);
}
+32 -16
View File
@@ -11,7 +11,7 @@ $(document).ready(function()
var html = "<select id='frame' name='frame' class='form-control chosen'>";
for(frame in frameList)
{
if(job.engine == 'jenkins' || frame != 'sonarqube')
if(job.engine == 'jenkins' || frame != 'sonarqube')
{
html += "<option value='" + frame + "'";
if(frame == job.frame) html += " selected";
@@ -157,26 +157,27 @@ $(document).ready(function()
$('#jkServer').change(function()
{
var jenkinsID = $(this).val();
$('#jenkinsServerTR #jkTask').remove();
$('#jenkinsServerTR #jkTask_chosen').remove();
$('#jenkinsServerTR .dropdown,#jenkinsServerTR .input-group-addon').hide();
$('#jenkinsServerTR .input-group').append("<div class='load-indicator loading'></div>");
$.getJSON(createLink('jenkins', 'ajaxGetJenkinsTasks', 'jenkinsID=' + jenkinsID), function(tasks)
{
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>';
$('#jenkinsServerTR .loading').remove();
$('#jenkinsServerTR .input-group').append(html);
setJenkinsJob('', '');
$('#jenkinsServerTR #jkTask').val(jkTask).chosen();
})
$.get(createLink('jenkins', 'ajaxGetJenkinsTasks', 'jenkinsID=' + jenkinsID), function(tasks)
{
$('#jenkinsServerTR .loading').remove();
$('#dropMenuTasks').html(tasks);
$('#jenkinsServerTR .dropdown,.input-group-addon').show();
if(jenkinsPipeline)
{
if(jenkinsPipeline.substr(0, 5) != '/job/') jenkinsPipeline = '/job/' + jenkinsPipeline + '/';
document.getElementById(jenkinsPipeline).click();
jenkinsPipeline = '';
}
});
/* There has been a problem with handling the prompt label. */
$('#jkTaskLabel').remove();
$('.jktask-label').addClass('text-right');
})
$(document).on('change', '#frame', function()
@@ -260,3 +261,18 @@ $(document).ready(function()
$('#sonarqubeServer').change();
$('#triggerType').change();
});
/**
* Set jenkins job.
*
* @param string $name
* @param string $task
* @access public
* @return void
*/
function setJenkinsJob(name, task)
{
if(name) $('.jktask-label').removeClass('text-right');
$('#jkTask').val(task);
$('.jktask-label .text').html(name);
}
+6 -2
View File
@@ -106,13 +106,17 @@
</tr>
<tr id="jenkinsServerTR">
<th><?php echo $lang->job->jkHost; ?></th>
<td colspan='2' class='required'>
<td colspan='2'>
<div class='table-row'>
<div class='table-col'><?php echo html::select('jkServer', $jenkinsServerList, '', "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('jkTask', array('' => ''), '', "class='form-control chosen'"); ?>
<div class='dropdown'>
<?php echo html::hidden('jkTask');?>
<button data-toggle='dropdown' type='button' class='btn jktask-label required text-right' title=''><span class='text'></span> <span class='caret' style='margin-bottom: -1px'></span></button>
<div id='dropMenuTasks' class='dropdown-menu search-list' data-ride='searchList' data-url=''></div>
</div>
</div>
</div>
</div>
+8 -3
View File
@@ -20,6 +20,7 @@
<?php js::set('jkTask', $job->pipeline);?>
<?php js::set('job', $job);?>
<?php js::set('frameList', $lang->job->frameList);?>
<?php js::set('jenkinsPipeline', $job->engine == 'jenkins' ? $job->pipeline : '');?>
<div id='mainContent' class='main-row'>
<div class='main-content'>
@@ -128,13 +129,17 @@
<?php if($job->engine == 'jenkins'):?>
<tr id="jenkinsServerTR">
<th><?php echo $lang->job->server;?></th>
<td colspan='2' class='required'>
<td colspan='2'>
<div class='table-row'>
<div class='table-col'><?php echo html::select('jkServer', $jenkinsServerList, $job->server, "class='form-control chosen'");?></div>
<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('jkTask', array('' => ''), $job->pipeline, "class='form-control chosen'");?>
<div class='dropdown'>
<?php echo html::hidden('jkTask');?>
<button data-toggle='dropdown' type='button' class='btn jktask-label required text-right' title=''><span class='text'><?php echo $job->pipeline;?></span> <span class='caret' style='margin-bottom: -1px'></span></button>
<div id='dropMenuTasks' class='dropdown-menu search-list' data-ride='searchList' data-url=''></div>
</div>
</div>
</div>
</div>