Merge branch 'master' of https://gitlab.zcorp.cc/easycorp/zentaopms
This commit is contained in:
@@ -46,3 +46,4 @@ $config->action->majorList['execution'] = array('opened', 'edited');
|
||||
|
||||
$config->action->needGetProjectType = 'build,task,bug,case,testcase,caselib,testtask,testsuite,testreport,doc,issue,release,risk,design,opportunity,trainplan,gapanalysis,researchplan,researchreport,';
|
||||
$config->action->needGetRelateField = ',story,productplan,release,task,build,bug,case,testtask,testreport,doc,doclib,issue,risk,opportunity,trainplan,gapanalysis,team,whitelist,researchplan,researchreport,meeting,';
|
||||
$config->action->noLinkModules = ',doclib,module,webhook,gitlab,pipeline,jenkins,';
|
||||
|
||||
@@ -103,7 +103,9 @@ $lang->action->objectTypes['entry'] = 'Entry';
|
||||
$lang->action->objectTypes['webhook'] = 'Webhook';
|
||||
$lang->action->objectTypes['team'] = 'Team';
|
||||
$lang->action->objectTypes['whitelist'] = 'Whitelist';
|
||||
$lang->action->objectTypes['pipeline'] = 'GitLib';
|
||||
$lang->action->objectTypes['pipeline'] = 'GitLab';
|
||||
$lang->action->objectTypes['gitlab'] = 'GitLab';
|
||||
$lang->action->objectTypes['jenkins'] = 'Jenkins';
|
||||
|
||||
/* Used to describe operation history. */
|
||||
$lang->action->desc = new stdclass();
|
||||
|
||||
@@ -103,7 +103,9 @@ $lang->action->objectTypes['entry'] = '应用';
|
||||
$lang->action->objectTypes['webhook'] = 'Webhook';
|
||||
$lang->action->objectTypes['team'] = '团队';
|
||||
$lang->action->objectTypes['whitelist'] = '白名单';
|
||||
$lang->action->objectTypes['pipeline'] = 'GitLib';
|
||||
$lang->action->objectTypes['pipeline'] = 'GitLab';
|
||||
$lang->action->objectTypes['gitlab'] = 'GitLab';
|
||||
$lang->action->objectTypes['jenkins'] = 'Jenkins';
|
||||
|
||||
/* 用来描述操作历史记录。*/
|
||||
$lang->action->desc = new stdclass();
|
||||
|
||||
+20
-3
@@ -569,12 +569,29 @@ class actionModel extends model
|
||||
$objectIds = array_unique($objectIds);
|
||||
$table = $this->config->objectTables[$objectType];
|
||||
$field = $this->config->action->objectNameFields[$objectType];
|
||||
|
||||
$objectNames[$objectType] = $this->dao->select("id, $field AS name")->from($table)->where('id')->in($objectIds)->fetchPairs();
|
||||
if($objectType == 'pipeline')
|
||||
{
|
||||
$objectNames['jenkins'] = $this->dao->select("id, $field AS name")->from($table)->where('id')->in($objectIds)->andWhere('type')->eq('jenkins')->fetchPairs();
|
||||
$objectNames['gitlab'] = $this->dao->select("id, $field AS name")->from($table)->where('id')->in($objectIds)->andWhere('type')->eq('gitlab')->fetchPairs();
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectNames[$objectType] = $this->dao->select("id, $field AS name")->from($table)->where('id')->in($objectIds)->fetchPairs();
|
||||
}
|
||||
}
|
||||
|
||||
/* Add name field to the trashes. */
|
||||
foreach($trashes as $trash) $trash->objectName = isset($objectNames[$trash->objectType][$trash->objectID]) ? $objectNames[$trash->objectType][$trash->objectID] : '';
|
||||
foreach($trashes as $trash)
|
||||
{
|
||||
$objectType = $trash->objectType;
|
||||
if($objectType == 'pipeline')
|
||||
{
|
||||
if(isset($objectNames['gitlab'][$trash->objectID])) $objectType = 'gitlab';
|
||||
if(isset($objectNames['jenkins'][$trash->objectID])) $objectType = 'jenkins';
|
||||
$trash->objectType = $objectType;
|
||||
}
|
||||
$trash->objectName = isset($objectNames[$objectType][$trash->objectID]) ? $objectNames[$objectType][$trash->objectID] : '';
|
||||
}
|
||||
return $trashes;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
$flow = $config->action->customFlows[$action->objectType];
|
||||
$module = $flow->module;
|
||||
}
|
||||
if(strpos(',doclib,module,webhook,', ",{$module},") !== false)
|
||||
if(strpos($this->config->action->noLinkModules, ",{$module},") !== false)
|
||||
{
|
||||
echo $action->objectName;
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ class gitlab extends control
|
||||
$options = "<option value=''></option>";
|
||||
foreach($executions as $index =>$execution)
|
||||
{
|
||||
$options .= "<option value='{$index}' data-name='{$execution}'>{$execution}</option>";
|
||||
$options .= "<option title='{$execution}' value='{$index}' data-name='{$execution}'>{$execution}</option>";
|
||||
}
|
||||
return $this->send($options);
|
||||
}
|
||||
|
||||
@@ -11,9 +11,17 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<style>
|
||||
.chosen-container .chosen-drop.chosen-auto-max-width {max-width: 100%;}
|
||||
</style>
|
||||
<div id="mainContent" class="main-content">
|
||||
<div class="main-header">
|
||||
<h2><?php echo $lang->gitlab->importIssue;?></h2>
|
||||
<?php if(!isonlybody() and empty($importable)):?>
|
||||
<div class='pull-right'>
|
||||
<?php echo html::linkButton($lang->goback, $this->createLink('repo', 'maintain'), 'self', '', 'btn btn-primary');?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php if($importable):?>
|
||||
<form method='post' class='load-indicator main-form form-ajax' enctype='multipart/form-data'>
|
||||
|
||||
+48
-2
@@ -64,7 +64,30 @@ class job extends control
|
||||
if($_POST)
|
||||
{
|
||||
$jobID = $this->job->create();
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
if($this->post->engine == 'gitlab' and isset($errors['server']))
|
||||
{
|
||||
$errors['gitlabRepo'][] = sprintf($this->lang->error->notempty, $this->lang->job->repo);
|
||||
unset($errors['server']);
|
||||
unset($errors['pipeline']);
|
||||
}
|
||||
elseif($this->post->engine == 'jenkins')
|
||||
{
|
||||
if(isset($errors['server']))
|
||||
{
|
||||
$errors['jkServer'] = $errors['server'];
|
||||
unset($errors['server']);
|
||||
}
|
||||
if(isset($errors['pipeline']))
|
||||
{
|
||||
$errors['jkTask'] = $errors['pipeline'];
|
||||
unset($errors['pipeline']);
|
||||
}
|
||||
}
|
||||
return $this->send(array('result' => 'fail', 'message' => $errors));
|
||||
}
|
||||
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $jobID));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
|
||||
}
|
||||
@@ -108,7 +131,30 @@ class job extends control
|
||||
if($_POST)
|
||||
{
|
||||
$this->job->update($id);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
if(dao::isError())
|
||||
{
|
||||
$errors = dao::getError();
|
||||
if($this->post->engine == 'gitlab' and isset($errors['server']))
|
||||
{
|
||||
$errors['gitlabRepo'][] = sprintf($this->lang->error->notempty, $this->lang->job->repo);
|
||||
unset($errors['server']);
|
||||
unset($errors['pipeline']);
|
||||
}
|
||||
elseif($this->post->engine == 'jenkins')
|
||||
{
|
||||
if(isset($errors['server']))
|
||||
{
|
||||
$errors['jkServer'] = $errors['server'];
|
||||
unset($errors['server']);
|
||||
}
|
||||
if(isset($errors['pipeline']))
|
||||
{
|
||||
$errors['jkTask'] = $errors['pipeline'];
|
||||
unset($errors['pipeline']);
|
||||
}
|
||||
}
|
||||
return $this->send(array('result' => 'fail', 'message' => $errors));
|
||||
}
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
|
||||
}
|
||||
|
||||
|
||||
@@ -130,8 +130,8 @@ class jobModel extends model
|
||||
{
|
||||
$job->repo = $job->gitlabRepo;
|
||||
$repo = $this->loadModel('repo')->getRepoByID($job->repo);
|
||||
$job->server = $repo->gitlab;
|
||||
$job->pipeline = $repo->project;
|
||||
$job->server = zget($repo, 'gitlab', '');
|
||||
$job->pipeline = zget($repo, 'project', '');
|
||||
unset($job->gitlabRepo);
|
||||
}
|
||||
|
||||
@@ -216,9 +216,10 @@ class jobModel extends model
|
||||
{
|
||||
$job->repo = $job->gitlabRepo;
|
||||
$repo = $this->loadModel('repo')->getRepoByID($job->repo);
|
||||
$job->server = $repo->gitlab;
|
||||
$job->pipeline = $repo->project;
|
||||
$job->server = zget($repo, 'gitlab', '');
|
||||
$job->pipeline = zget($repo, 'project', '');
|
||||
unset($job->gitlabRepo);
|
||||
}
|
||||
}
|
||||
|
||||
unset($job->jkServer);
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<?php $jenkins = urldecode($job->pipeline) . '@' . $job->jenkinsName;?>
|
||||
<td class='c-name' title='<?php echo $jenkins;?>'><?php echo $jenkins;?></td>
|
||||
<?php $triggerConfig = $this->job->getTriggerConfig($job);?>
|
||||
<td title='<?php echo $triggerConfig;?>'><?php echo $triggerConfig;?></td>
|
||||
<td class='c-name' title='<?php echo $triggerConfig;?>'><?php echo $triggerConfig;?></td>
|
||||
<td class='text-center'><?php if($job->lastStatus) echo zget($lang->compile->statusList, $job->lastStatus);?></td>
|
||||
<td><?php if($job->lastStatus) echo $job->lastExec;?></td>
|
||||
<td class='c-actions text-center'>
|
||||
|
||||
@@ -606,6 +606,7 @@ class repoModel extends model
|
||||
public function getProductsByRepo($repoID)
|
||||
{
|
||||
$repo = $this->getRepoByID($repoID);
|
||||
if(empty($repo)) return array();
|
||||
return $this->dao->select('id,name')->from(TABLE_PRODUCT)
|
||||
->where('id')->in($repo->product)
|
||||
->andWhere('deleted')->eq(0)
|
||||
|
||||
@@ -181,7 +181,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group form-actions">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<?php $class = isonlybody() ? 'col-sm-offset-5 col-sm-7' : 'col-sm-offset-4 col-sm-8';?>
|
||||
<div class="<?php echo $class;?>">
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::backButton();?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user