This commit is contained in:
hufangzhou
2021-09-15 15:06:11 +08:00
14 changed files with 46 additions and 23 deletions
+16 -5
View File
@@ -118,7 +118,7 @@ class ciModel extends model
/**
* Sync gitlab task status.
*
*
* @param object $compile
* @access public
* @return void
@@ -127,10 +127,21 @@ class ciModel extends model
{
$this->loadModel('gitlab');
$now = helper::now();
$pipeline = $this->gitlab->apiGetSinglePipeline($compile->server, $compile->pipeline, $compile->queue);
$jobs = $this->gitlab->apiGetJobs($compile->server, $compile->pipeline, $compile->queue);
$now = helper::now();
/* The value of `$compile->pipeline` is like `'{"project":"46","reference":"master"}'` in current design. */
$pipeline = json_decode($compile->pipeline);
$compile->project = isset($pipeline->project) ? $pipeline->project : $compile->pipeline;
$pipeline = $this->gitlab->apiGetSinglePipeline($compile->server, $compile->project, $compile->queue);
if(!isset($pipeline->id) or isset($pipeline->message)) /* The pipeline is not available. */
{
$pipeline->status = 'create_fail'; /* Set the status to fail. */
$this->dao->update(TABLE_JOB)->set('lastExec')->eq($now)->set('lastStatus')->eq($pipeline->status)->where('id')->eq($compile->job)->exec();
return false;
}
$jobs = $this->gitlab->apiGetJobs($compile->server, $compile->project, $compile->queue);
$data = new stdclass;
$data->status = $pipeline->status;
$data->updateDate = $now;
@@ -140,7 +151,7 @@ class ciModel extends model
if(empty($job->duration) or $job->duration == '') $job->duration = '-';
$data->logs = "<font style='font-weight:bold'>&gt;&gt;&gt; Job: $job->name, Stage: $job->stage, Status: $job->status, Duration: $job->duration Sec\r\n </font>";
$data->logs .= "Job URL: <a href=\"$job->web_url\" target='_blank'>$job->web_url</a> \r\n";
$data->logs .= $this->transformAnsiToHtml($this->gitlab->apiGetJobLog($compile->server, $compile->pipeline, $job->id));
$data->logs .= $this->transformAnsiToHtml($this->gitlab->apiGetJobLog($compile->server, $compile->project, $job->id));
}
$this->dao->update(TABLE_COMPILE)->data($data)->where('id')->eq($compile->id)->exec();
+4 -4
View File
@@ -12,10 +12,10 @@
class compile extends control
{
/**
* Construct
*
* @param string $moduleName
* @param string $methodName
* Construct
*
* @param string $moduleName
* @param string $methodName
* @access public
* @return void
*/
+1 -1
View File
@@ -48,7 +48,7 @@
<?php
$disabled = !empty($gitlab->isAdminToken) ? '' : 'disabled';
common::printLink('gitlab', 'edit', "gitlabID=$id", "<i class='icon icon-edit'></i> ", '',"title={$lang->gitlab->edit} class='btn btn-primary'");
common::printLink('gitlab', 'bindUser', "id=$id", "<i class='icon icon-group'></i> ", '', "title={$lang->gitlab->bindUser} class='btn btn-primary {$disabled}' ,'disabled'");
common::printLink('gitlab', 'bindUser', "id=$id", "<i class='icon icon-group'></i> ", '', "title={$lang->gitlab->bindUser} class='btn {$disabled}' ,'disabled'");
if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'delete', "gitlabID=$id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->delete}' class='btn'");
?>
</td>
+1 -1
View File
@@ -58,7 +58,7 @@ $lang->install->introductionContent = <<<EOT
<p>Project is used to organize the manpower for development, track and manage the project process, and complete the project in a faster, better, and less costly way.</p>
</div>
<div class='block-details block-right'>
<p class='block-title'><i class='icon icon-product'></i><strong>Execution</strong></p>
<p class='block-title'><i class='icon icon-run'></i><strong>Execution</strong></p>
<p>Execution is used to decompose, assign, and track tasks to ensure that project goals can be implemented by manpower.<p>
</div>
</div>
+1 -1
View File
@@ -58,7 +58,7 @@ $lang->install->introductionContent = <<<EOT
<p>项目用来组织相应的人力进行研发,做好项目过程的跟踪管理,多快好省地完成项目。</p>
</div>
<div class='block-details block-right'>
<p class='block-title'><i class='icon icon-product'></i><strong>执行</strong></p>
<p class='block-title'><i class='icon icon-run'></i><strong>执行</strong></p>
<p>执行用来做任务的分解、指派和跟踪,保证项目目标可以落实到人来执行。<p>
</div>
</div>
+1
View File
@@ -24,6 +24,7 @@ class jobModel extends model
if(strtolower($job->engine) == 'gitlab')
{
$pipeline = json_decode($job->pipeline);
if(!isset($pipeline->reference)) return $job;
$job->project = $pipeline->project;
$job->reference = $pipeline->reference;
}
+1 -1
View File
@@ -44,7 +44,7 @@
<tr class='gitlabRepo hide'>
<th><?php echo $lang->job->repo; ?></th>
<td> <?php echo html::select('gitlabRepo', $gitlabRepos, $job->repo, "class='chosen form-control'");?> </td>
<td> <?php echo html::select('reference', $refList, $job->reference, "class='chosen form-control'");?> </td>
<td> <?php echo html::select('reference', $refList, isset($job->reference) ? $job->reference : '', "class='chosen form-control'");?> </td>
</tr>
<tr>
<th><?php echo $lang->job->product;?></th>
+1 -1
View File
@@ -327,7 +327,7 @@ class mrModel extends model
$todo->assignedBy = $this->app->user->account;
$todo->date = date("Y-m-d", strtotime($rawTodo->target->created_at));
$todo->assignedDate = $rawTodo->target->created_at;
$todo->begin = date("Hi", strtotime($rawTodo->target->created_at));
$todo->begin = ceil(date("Hi", strtotime($rawTodo->target->created_at))/10)*10;
$todo->end = '2400'; /* 2400 means end is 'undefined'. */
$todo->type = 'custom';
$todo->idvalue = $rawTodo->id;
+1 -1
View File
@@ -182,7 +182,7 @@ class programModel extends model
->on('t1.project = t2.id')
->where('t2.deleted')->eq(0)
->andWhere('t1.product')->in($productPairs)
->andWhere('t2.status')->eq('doing')
->andWhere('t2.status')->in('wait,doing')
->andWhere('t2.type')->eq('project')
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->projects)->fi()
->fetchGroup('product');
+8
View File
@@ -1017,6 +1017,14 @@ class projectModel extends model
if($oldProject->parent != $project->parent) $this->loadModel('program')->processNode($projectID, $project->parent, $oldProject->path, $oldProject->grade);
/* Fix whitelist changes. */
$oldWhitelist = explode(',', $oldProject->whitelist) and $oldWhitelist = array_filter($oldWhitelist);
$newWhitelist = explode(',', $project->whitelist) and $newWhitelist = array_filter($newWhitelist);
if(count($oldWhitelist) == count($newWhitelist) and count(array_diff($oldWhitelist, $newWhitelist)) == 0) unset($project->whitelist);
/* Add linkedproducts changes. */
$oldProject->linkedProducts = implode(',', $linkedProducts);
$project->linkedProducts = implode(',', $_POST['products']);
return common::createChanges($oldProject, $project);
}
}
+2 -2
View File
@@ -385,9 +385,9 @@ class task extends control
$task = $this->task->getById($taskID);
if($this->post->comment != '' or !empty($changes) or !empty($files))
{
$action = (!empty($changes) or !empty($files)) ? 'Edited' : 'Commented';
$action = (!empty($changes) or !empty($files)) ? 'Edited' : 'Commented';
$fileAction = !empty($files) ? $this->lang->addFiles . join(',', $files) . "\n" : '';
$actionID = $this->action->create('task', $taskID, $action, $fileAction . $this->post->comment);
$actionID = $this->action->create('task', $taskID, $action, $fileAction . $this->post->comment);
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
}
+2 -3
View File
@@ -848,8 +848,7 @@ class taskModel extends model
$now = helper::now();
$task = fixer::input('post')
->setDefault('story, estimate, left, consumed', 0)
->setDefault('estStarted', '0000-00-00')
->setDefault('deadline', '0000-00-00')
->setDefault('realStarted', '0000-00-00 00:00:00')
->setIF(is_numeric($this->post->estimate), 'estimate', (float)$this->post->estimate)
->setIF(is_numeric($this->post->consumed), 'consumed', (float)$this->post->consumed)
->setIF(is_numeric($this->post->left), 'left', (float)$this->post->left)
@@ -1922,7 +1921,7 @@ class taskModel extends model
if($task->assignedTo == 'closed') $task->assignedToRealName = 'Closed';
foreach($task as $key => $value)
{
if(strpos($key, 'Date') !== false and !(int)substr($value, 0, 4)) $task->$key = '';
if((strpos($key, 'Date') !== false or strpos('estStarted|deadline', $key) !== false) and !(int)substr($value, 0, 4)) $task->$key = '';
}
$task->files = $this->loadModel('file')->getByObject('task', $taskID);
+3 -3
View File
@@ -176,11 +176,11 @@
<table class='table table-form'>
<tr>
<th class='thWidth'><?php echo $lang->task->estStarted;?></th>
<td><?php echo html::input('estStarted', helper::isZeroDate($task->estStarted) ? '' : $task->estStarted, "class='form-control form-date'");?></td>
<td><?php echo html::input('estStarted', $task->estStarted, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->task->deadline;?></th>
<td><?php echo html::input('deadline', helper::isZeroDate($task->deadline) ? '' : $task->deadline, "class='form-control form-date'");?></td>
<td><?php echo html::input('deadline', $task->deadline, "class='form-control form-date'");?></td>
</tr>
<tr>
<th><?php echo $lang->task->estimate;?></th>
@@ -211,7 +211,7 @@
</tr>
<tr>
<th><?php echo $lang->task->realStarted;?></th>
<td><?php echo html::input('realStarted', helper::isZeroDate($task->realStarted) ? helper::now() : $task->realStarted, "class='form-control form-datetime'");?></td>
<td><?php echo html::input('realStarted', helper::isZeroDate($task->realStarted) ? '' : $task->realStarted, "class='form-control form-datetime'");?></td>
</tr>
<tr>
<th><?php echo $lang->task->finishedBy;?></th>
+4
View File
@@ -552,6 +552,10 @@ function checkTutorial()
window.location.reload();
}).error(function(){alert(lang.timeout)});
}
else
{
window.location.href = createLink('tutorial', 'index');
}
}
}