From e8c6079cd67080b5b890a60d74dd7caa49309b6a Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Thu, 5 Aug 2021 10:55:25 +0800 Subject: [PATCH 01/25] * Hide product when permission is available in repo. --- module/repo/view/maintain.html.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/module/repo/view/maintain.html.php b/module/repo/view/maintain.html.php index 3faa6d9ea1..ff384ebb31 100644 --- a/module/repo/view/maintain.html.php +++ b/module/repo/view/maintain.html.php @@ -41,7 +41,11 @@ $productList = explode(',', str_replace(' ', '', $repo->product)); if(isset($productList) and $productList[0]) { - foreach($productList as $productID) echo ' ' . html::a($this->createLink('product', 'browse', "productID=$productID"), zget($products, $productID, $productID)); + foreach($productList as $productID) + { + if(!isset($products[$productID])) continue; + echo ' ' . html::a($this->createLink('product', 'browse', "productID=$productID"), zget($products, $productID, $productID)); + } } ?> From e4bd2b2d01bde7140d2d757b7d7c95b80cbc3f46 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 5 Aug 2021 10:56:02 +0800 Subject: [PATCH 02/25] * fix for get branches from gitlab. --- lib/scm/gitlab.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index 36cd0ac41e..a5c472ed06 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -169,10 +169,15 @@ class gitlab $list = $this->fetch($api, $params); if(empty($list)) break; - foreach($list as $branch) $branches[$branch->name] = $branch->name; + foreach($list as $branch) + { + if(!isset($branch->name)) continue; + $branches[$branch->name] = $branch->name; + } if(count($list) < $params['per_page']) break; } + if(empty($branches)) $branches['master'] = 'master'; asort($branches); return $branches; } From 3bed17c945fdafa666e604cacb146b71854e1f06 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 5 Aug 2021 11:02:24 +0800 Subject: [PATCH 03/25] * adjust style for create job. --- module/job/view/create.html.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/module/job/view/create.html.php b/module/job/view/create.html.php index 8d95dadf6b..ca028801bf 100644 --- a/module/job/view/create.html.php +++ b/module/job/view/create.html.php @@ -38,11 +38,8 @@ - - - - - job->engineTips->success; ?> + + job->engineTips->success;?> From be28e26fd53ff3a14f8a8cabd07cee974c99a85d Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Thu, 5 Aug 2021 11:06:45 +0800 Subject: [PATCH 04/25] * Add selected style in repo browse. --- module/repo/view/browse.html.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/repo/view/browse.html.php b/module/repo/view/browse.html.php index d04c2be3a6..f8b0760fda 100644 --- a/module/repo/view/browse.html.php +++ b/module/repo/view/browse.html.php @@ -17,7 +17,8 @@ $repoName) { - echo "
  • " . html::a($this->createLink('repo', 'browse', "repoID=$id&branchID=&objectID=$objectID"), $repoName, '', "title='{$repoName}' class='text-ellipsis' data-app='{$app->openApp}'") . "
  • "; + $isSelected = $id == $repoID ? 'class="selected"' : ''; + echo "
  • " . html::a($this->createLink('repo', 'browse', "repoID=$id&branchID=&objectID=$objectID"), $repoName, '', "title='{$repoName}' class='text-ellipsis' data-app='{$app->openApp}'") . "
  • "; } ?> From 5b3a681b36c74a0c999cca663b4bbd7e73346165 Mon Sep 17 00:00:00 2001 From: Guan Xiying Date: Thu, 5 Aug 2021 11:12:55 +0800 Subject: [PATCH 05/25] * Unset schedule triggerType for gitlab job. --- module/job/js/create.js | 10 ++++++++++ module/job/js/edit.js | 12 +++++++++++- module/job/view/create.html.php | 2 +- module/job/view/edit.html.php | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/module/job/js/create.js b/module/job/js/create.js index 6904494634..36e3d909a3 100644 --- a/module/job/js/create.js +++ b/module/job/js/create.js @@ -105,10 +105,20 @@ $(document).ready(function() }) }) + var scheduleOption = ""; $('#engine').change(function() { $('#jenkinsServerTR').toggle($('#engine').val() == 'jenkins'); $('#gitlabServerTR').toggle($('#engine').val() == 'gitlab'); + + if($(this).val() == 'gitlab') + { + $('#triggerType').find('[value=schedule]').remove(); + } + else if($('#triggerType').find('[value=schedule]').size() == 0 ) + { + $('#triggerType').append(scheduleOption); + } }); $('#engine').change(); diff --git a/module/job/js/edit.js b/module/job/js/edit.js index 39e680371b..65f5dcd1dc 100644 --- a/module/job/js/edit.js +++ b/module/job/js/edit.js @@ -110,10 +110,20 @@ $(document).ready(function() }) }) + var scheduleOption = ""; $('#engine').change(function() - { + { $('#jenkinsServerTR').toggle($('#engine').val() == 'jenkins'); $('#gitlabServerTR').toggle($('#engine').val() == 'gitlab'); + + if($(this).val() == 'gitlab') + { + $('#triggerType').find('[value=schedule]').remove(); + } + else if($('#triggerType').find('[value=schedule]').size() == 0 ) + { + $('#triggerType').append(scheduleOption); + } }); $('#engine').change(); diff --git a/module/job/view/create.html.php b/module/job/view/create.html.php index 8d95dadf6b..fbeeafc6a1 100644 --- a/module/job/view/create.html.php +++ b/module/job/view/create.html.php @@ -59,7 +59,7 @@ job->triggerType; ?> - job->triggerTypeList, '', "class='form-control chosen'");?> + job->triggerTypeList, '', "class='form-control'");?> diff --git a/module/job/view/edit.html.php b/module/job/view/edit.html.php index 0b09296d5b..d6761cda66 100644 --- a/module/job/view/edit.html.php +++ b/module/job/view/edit.html.php @@ -53,7 +53,7 @@ job->triggerType;?> job->triggerTypeList['tag'] = $lang->job->dirChange;?> - job->triggerTypeList, $job->triggerType, "class='form-control chosen'");?> + job->triggerTypeList, $job->triggerType, "class='form-control'");?> From 350e308e481bd612862ff2b019f5b45227a9057b Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 5 Aug 2021 11:13:03 +0800 Subject: [PATCH 06/25] * Fix the problem of clicking on favorites of contributed documents. --- module/my/js/doc.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/module/my/js/doc.js b/module/my/js/doc.js index ef9e5db6f3..8bc0e6f26f 100644 --- a/module/my/js/doc.js +++ b/module/my/js/doc.js @@ -17,3 +17,8 @@ $('.ajaxCollect').click(function (event) { }, 'json'); return false; }); + +$('.ajaxCollect').click(function() +{ + window.location.reload(); +}) From a3a24aaff2798e42e7306573c405eb50e214e709 Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Thu, 5 Aug 2021 11:13:34 +0800 Subject: [PATCH 07/25] * Adjust page style when no data in compile browse. --- module/compile/view/browse.html.php | 7 ++++++- module/job/view/browse.html.php | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/module/compile/view/browse.html.php b/module/compile/view/browse.html.php index 3407431d45..52871c2508 100644 --- a/module/compile/view/browse.html.php +++ b/module/compile/view/browse.html.php @@ -19,7 +19,11 @@ ?> - + +
    +

    noData;?>

    +
    +
    @@ -67,4 +71,5 @@ + diff --git a/module/job/view/browse.html.php b/module/job/view/browse.html.php index 6e043bd9d1..1377b630ea 100644 --- a/module/job/view/browse.html.php +++ b/module/job/view/browse.html.php @@ -20,6 +20,16 @@ " . $lang->job->create, '', "class='btn btn-primary'");?> + +
    +

    + noData;?> + + createLink('job', 'create'), " " . $lang->job->create, '', "class='btn btn-info'");?> + +

    +
    +
    @@ -71,4 +81,5 @@ + From 50874e716bb2ec77b8d4cedfc6bc8cd08272d467 Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Thu, 5 Aug 2021 11:13:34 +0800 Subject: [PATCH 08/25] * Align the equals sign. --- module/project/js/edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/project/js/edit.js b/module/project/js/edit.js index dc5ed1f790..92efb7743f 100644 --- a/module/project/js/edit.js +++ b/module/project/js/edit.js @@ -20,7 +20,7 @@ $(function() var lastProductSelect = $('#productsBox .input-group:last select:first'); if($(lastProductSelect).val() == 0) { - var lastProductSelectID = $(lastProductSelect).attr("id"); + var lastProductSelectID = $(lastProductSelect).attr("id"); var lastProductSelectName = $(lastProductSelect).attr("name"); $('#' + lastProductSelectID + '_chosen').remove(); $(lastProductSelect).replaceWith(data.newProducts); From fcd81023513d3113bb99d9e76ab9d62b90939672 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Thu, 5 Aug 2021 11:54:16 +0800 Subject: [PATCH 09/25] * Add priority to task and story when importing issue from gitlab. --- module/story/model.php | 1 + module/task/model.php | 1 + 2 files changed, 2 insertions(+) diff --git a/module/story/model.php b/module/story/model.php index 84cebc4e6b..cf0f32c553 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -363,6 +363,7 @@ class storyModel extends model $story->stage = 'projected'; $story->openedBy = $this->app->user->account; $story->version = 1; + $story->pri = 3; $story->assignedDate = isset($story->assignedTo) ? helper::now() : 0; if(isset($story->execution)) unset($story->execution); diff --git a/module/task/model.php b/module/task/model.php index 2d1fedd99c..db89381a78 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -467,6 +467,7 @@ class taskModel extends model $task->estimate = 0; $task->estStarted = '0000-00-00'; $task->left = 1; + $task->pri = 3; $task->type = 'devel'; $this->dao->insert(TABLE_TASK)->data($task, $skip = 'id,product') From e65f0cfc739eb0f3775e9771ab83dbca02855168 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Thu, 5 Aug 2021 11:57:31 +0800 Subject: [PATCH 10/25] * Fix api of jihu. --- api/v1/entries/projectissue.php | 36 ++++++++++++++++++---- api/v1/entries/projectissues.php | 52 +++++++++++++++----------------- config/filter.php | 1 + 3 files changed, 56 insertions(+), 33 deletions(-) diff --git a/api/v1/entries/projectissue.php b/api/v1/entries/projectissue.php index b3f30d5154..bf6a5d56c4 100644 --- a/api/v1/entries/projectissue.php +++ b/api/v1/entries/projectissue.php @@ -17,16 +17,18 @@ class projectIssueEntry extends entry if(count($idParams) < 2) $this->sendError(400, 'The id of issue is wrong.'); $type = $idParams[0]; - $id = $idParams[1]; + $id = intval($idParams[1]); - $issue = new stdclass(); + $issue = new stdclass(); switch($type) { case 'story': $this->app->loadLang('story'); - $storyStatus = array('' => '', 'draft' => 'wait', 'active' => 'active', 'changed' => 'active', 'closed' => 'closed'); + $storyStatus = array('' => '', 'draft' => 'opened', 'active' => 'opened', 'changed' => 'opened', 'closed' => 'closed'); $story = $this->dao->select('*')->from(TABLE_STORY)->where('id')->eq($id)->fetch(); + if(!$story) $this->send404($issueID); + $issue->id = $issueID; $issue->title = $story->title; $issue->labels = array($this->app->lang->story->common, zget($this->app->lang->story->categoryList, $story->category)); @@ -35,17 +37,20 @@ class projectIssueEntry extends entry $issue->openedDate = $story->openedDate; $issue->openedBy = $story->openedBy; $issue->lastEditedDate = $story->lastEditedDate < '1970-01-01 01:01:01' ? $story->openedDate : $story->lastEditedDate; + $issue->lastEditedBy = $story->lastEditedDate < '1970-01-01 01:01:01' ? $story->openedBy : $story->lastEditedBy; $issue->status = $storyStatus[$story->status]; $issue->url = $this->createLink('story', 'view', "storyID=$id"); - $storySpec = $this->dao->select('*')->from(TABLE_STORYSPEC)->where('story')->eq($id)->andWhere('version')->eq($story->version)->fetch(); + $storySpec = $this->dao->select('*')->from(TABLE_STORYSPEC)->where('story')->eq($id)->andWhere('version')->eq($story->version)->fetch(); $issue->desc = $storySpec->spec; break; case 'bug': $this->app->loadLang('bug'); - $bugStatus = array('' => '', 'active' => 'active', 'resolved' => 'done', 'closed' => 'closed'); + $bugStatus = array('' => '', 'active' => 'opened', 'resolved' => 'opened', 'closed' => 'closed'); $bug = $this->dao->select('*')->from(TABLE_BUG)->where('id')->eq($id)->fetch(); + if(!$bug) $this->send404($issueID); + $issue->id = $issueID; $issue->title = $bug->title; $issue->labels = array($this->app->lang->bug->common, zget($this->app->lang->bug->typeList, $bug->type)); @@ -54,15 +59,17 @@ class projectIssueEntry extends entry $issue->openedDate = $bug->openedDate; $issue->openedBy = $bug->openedBy; $issue->lastEditedDate = $bug->lastEditedDate < '1970-01-01 01:01:01' ? $bug->openedDate : $bug->lastEditedDate; + $issue->lastEditedBy = $bug->lastEditedDate < '1970-01-01 01:01:01' ? $bug->openedBy : $bug->lastEditedBy; $issue->status = $bugStatus[$bug->status]; $issue->url = $this->createLink('bug', 'view', "bugID=$id"); $issue->desc = $bug->steps; break; case 'task': $this->app->loadLang('task'); - $taskStatus = array('' => '', 'wait' => 'wait', 'doing' => 'active', 'done' => 'done', 'pause' => 'pause', 'cancel' => 'cancel', 'closed' => 'closed'); + $taskStatus = array('' => '', 'wait' => 'opened', 'doing' => 'opened', 'done' => 'opened', 'pause' => 'opened', 'cancel' => 'opened', 'closed' => 'closed'); $task = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($id)->fetch(); + if(!$task) $this->send404($issueID); $issue->id = $issueID; $issue->title = $task->name; @@ -72,15 +79,32 @@ class projectIssueEntry extends entry $issue->openedDate = $task->openedDate; $issue->openedBy = $task->openedBy; $issue->lastEditedDate = $task->lastEditedDate < '1970-01-01 01:01:01' ? $task->openedDate : $task->lastEditedDate; + $issue->lastEditedBy = $task->lastEditedDate < '1970-01-01 01:01:01' ? $task->openedBy : $task->lastEditedBy; $issue->status = $taskStatus[$task->status]; $issue->url = $this->createLink('task', 'view', "taskID=$id"); $issue->desc = $task->desc; break; + default: + $this->send404($issueID); } + $actions = $this->loadModel('action')->getList($type, $issueID); + $this->send(200, array('issue' => $this->format($issue, 'openedDate:time,lastEditedDate:time'))); } + /** + * Send 404 response. + * + * @param string $issueID + * @access private + * @return string + */ + private function send404($issueID) + { + $this->sendError(404, 'The issue does not exist.'); + } + /** * Create url of issue. * diff --git a/api/v1/entries/projectissues.php b/api/v1/entries/projectissues.php index 5ceb24cb2e..0990d8b74f 100644 --- a/api/v1/entries/projectissues.php +++ b/api/v1/entries/projectissues.php @@ -15,36 +15,24 @@ class projectIssuesEntry extends entry $taskFields = 'id,status'; $taskStatus = array('' => ''); - $taskStatus['wait'] = 'wait'; - $taskStatus['active'] = 'doing'; - $taskStatus['done'] = 'done'; - $taskStatus['pause'] = 'pause'; - $taskStatus['cancel'] = 'cancel'; + $taskStatus['opened'] = 'wait,doing,done,pause'; $taskStatus['closed'] = 'closed'; $storyFields = 'id,status'; $storyStatus = array('' => ''); - $storyStatus['wait'] = 'draft'; - $storyStatus['active'] = 'active,changed'; - $storyStatus['done'] = ''; - $storyStatus['pause'] = ''; - $storyStatus['cancel'] = ''; + $storyStatus['opened'] = 'draft,active,changed'; $storyStatus['closed'] = 'closed'; $bugFields = 'id,status'; $bugStatus = array('' => ''); - $bugStatus['wait'] = ''; - $bugStatus['active'] = 'active'; - $bugStatus['done'] = 'resolved'; - $bugStatus['pause'] = ''; - $bugStatus['cancel'] = ''; + $bugStatus['opened'] = 'active,resolved'; $bugStatus['closed'] = 'closed'; $productID = (int)$productID; $status = $this->param('status', ''); $label = $this->param('label', ''); $search = $this->param('search', ''); - $page = $this->param('page', 0); + $page = intval($this->param('page', 1)); $limit = $this->param('limit', 20); $order = $this->param('order', 'openedDate_desc'); @@ -52,22 +40,28 @@ class projectIssuesEntry extends entry $order = $orderParams[0]; $sort = (isset($orderParams[1]) and strtolower($orderParams[1]) == 'desc') ? 'desc' : 'asc'; + if($status == 'all') $status = ''; + if(!in_array($status, array('opened', 'closed', ''))) return $this->sendError(400, 'The status is not supported'); + switch($order) { + case 'openedDate': + $taskFields .= ',openedDate'; + $storyFields .= ',openedDate'; + $bugFields .= ',openedDate'; + break; case 'title': $taskFields .= ',name as title'; $storyFields .= ',title'; $bugFields .= ',title'; + break; case 'lastEditedDate': $taskFields .= ",if(lastEditedDate < '1970-01-01 01-01-01', openedDate, lastEditedDate) as lastEditedDate"; $storyFields .= ",if(lastEditedDate < '1970-01-01 01-01-01', openedDate, lastEditedDate) as lastEditedDate"; $bugFields .= ",if(lastEditedDate < '1970-01-01 01-01-01', openedDate, lastEditedDate) as lastEditedDate"; + break; default: - $taskFields .= ',openedDate'; - $storyFields .= ',openedDate'; - $bugFields .= ',openedDate'; - - $order = 'openedDate'; + $this->sendError(400, 'The order is not supported'); } $issues = array(); @@ -100,10 +94,11 @@ class projectIssuesEntry extends entry } array_multisort(array_column($issues, 'order'), $sort == 'asc' ? SORT_ASC : SORT_DESC, $issues); - $issues = array_slice($issues, $page * $limit, $limit); + $total = count($issues); + $issues = $page < 1 ? array() : array_slice($issues, ($page-1) * $limit, $limit); $result = $this->processIssues($issues); - $this->send(200, array('page' => $page, 'total' => count($issues),'limit' => $limit, 'issues' => $result)); + $this->send(200, array('page' => $page, 'total' => $total, 'limit' => $limit, 'issues' => $result)); } /** @@ -151,7 +146,8 @@ class projectIssuesEntry extends entry $r->openedDate = $task->openedDate; $r->openedBy = $task->openedBy; $r->lastEditedDate = $task->lastEditedDate < '1970-01-01 01:01:01' ? $task->openedDate : $task->lastEditedDate; - $r->status = $task->status; + $r->lastEditedBy = $task->lastEditedDate < '1970-01-01 01:01:01' ? $task->openedBy : $task->lastEditedBy; + $r->status = $issue['status']; $r->url = $this->createLink('task', 'view', "taskID=$task->id"); } else if($issue['type'] == 'story') @@ -166,7 +162,8 @@ class projectIssuesEntry extends entry $r->openedDate = $story->openedDate; $r->openedBy = $story->openedBy; $r->lastEditedDate = $story->lastEditedDate < '1970-01-01 01:01:01' ? $story->openedDate : $story->lastEditedDate; - $r->status = $story->status; + $r->lastEditedBy = $story->lastEditedDate < '1970-01-01 01:01:01' ? $story->openedBy : $story->lastEditedBy; + $r->status = $issue['status']; $r->url = $this->createLink('story', 'view', "storyID=$story->id"); } else if($issue['type'] == 'bug') @@ -181,7 +178,8 @@ class projectIssuesEntry extends entry $r->openedDate = $bug->openedDate; $r->openedBy = $bug->openedBy; $r->lastEditedDate = $bug->lastEditedDate < '1970-01-01 01:01:01' ? $bug->openedDate : $bug->lastEditedDate; - $r->status = $bug->status; + $r->lastEditedBy = $bug->lastEditedDate < '1970-01-01 01:01:01' ? $bug->openedBy : $bug->lastEditedBy; + $r->status = $issue['status']; $r->url = $this->createLink('bug', 'view', "bugID=$bug->id"); } @@ -203,7 +201,7 @@ class projectIssuesEntry extends entry { foreach($array as $key => $values) { - if($values and strpos($value, $values) !== FALSE) return $key; + if($values and strpos($values, $value) !== FALSE) return $key; } return ''; diff --git a/config/filter.php b/config/filter.php index 0b6aa26736..2b07fbc15f 100644 --- a/config/filter.php +++ b/config/filter.php @@ -114,6 +114,7 @@ $filter->svn->cat = new stdclass(); $filter->svn->diff = new stdclass(); $filter->task->create = new stdclass(); $filter->task->export = new stdclass(); +$filter->execution->story = new stdclass(); $filter->testcase->default = new stdclass(); $filter->testcase->create = new stdclass(); $filter->testcase->browse = new stdclass(); From 0f17432c531cb7e519ae8f450bd30acd3901a7f2 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 5 Aug 2021 13:08:17 +0800 Subject: [PATCH 11/25] * adjust for create job. --- module/job/control.php | 2 +- module/job/lang/en.php | 13 ++++++------- module/job/lang/zh-cn.php | 13 ++++++------- module/job/lang/zh-tw.php | 13 ++++++------- module/job/model.php | 11 ++++++----- module/job/view/create.html.php | 4 ++-- module/job/view/edit.html.php | 4 ++-- module/job/view/exec.html.php | 8 ++++---- module/repo/lang/zh-tw.php | 2 +- 9 files changed, 34 insertions(+), 36 deletions(-) diff --git a/module/job/control.php b/module/job/control.php index a834c59787..f694c351f0 100644 --- a/module/job/control.php +++ b/module/job/control.php @@ -272,7 +272,7 @@ class job extends control $this->view->title = $this->lang->job->runPipeline; $this->view->refList = $refList; $this->view->job = $job; - $this->view->pipelineTips = $this->lang->job->pipeline->pipelineTips; + $this->view->pipelineTips = $this->lang->job->pipelineTips; return $this->display(); } diff --git a/module/job/lang/en.php b/module/job/lang/en.php index 0908ac058c..8ed24b504a 100644 --- a/module/job/lang/en.php +++ b/module/job/lang/en.php @@ -25,7 +25,7 @@ $lang->job->jkJob = 'Jenkins Task'; $lang->job->buildSpec = 'Build Target'; // 'pipeline@server' $lang->job->engine = 'Engine'; $lang->job->server = 'Server'; -$lang->job->Pipeline = 'Pipeline'; +$lang->job->pipeline = 'Pipeline'; $lang->job->buildType = 'Build Type'; $lang->job->frame = 'Frame'; $lang->job->triggerType = 'Trigger'; @@ -81,9 +81,8 @@ $lang->job->engineTips = new stdclass; $lang->job->engineTips->success = 'Build engine will use the built pipeline in GitLab.'; $lang->job->engineTips->error = 'No pipeline is currently available in the GitLab project, please go to GitLab configuration first. '; -$lang->job->pipeline = new stdclass; -$lang->job->pipeline->pipelineTips = "Run for branch name or tag"; -$lang->job->pipeline->variables = "Variables"; -$lang->job->pipeline->variablesKeyPlaceHolder = "Input variable key"; -$lang->job->pipeline->variablesValuePlaceHolder = "Input variable value"; -$lang->job->pipeline->variablesTips = "Specify variable values to be used in this run. The values specified in CI/CD settings will be used by default."; +$lang->job->pipelineTips = "Run for branch name or tag"; +$lang->job->pipelineVariables = "Variables"; +$lang->job->pipelineVariablesKeyPlaceHolder = "Input variable key"; +$lang->job->pipelineVariablesValuePlaceHolder = "Input variable value"; +$lang->job->pipelineVariablesTips = "Specify variable values to be used in this run. The values specified in CI/CD settings will be used by default."; diff --git a/module/job/lang/zh-cn.php b/module/job/lang/zh-cn.php index 2cb5b31ee1..6209ba46a4 100644 --- a/module/job/lang/zh-cn.php +++ b/module/job/lang/zh-cn.php @@ -25,7 +25,7 @@ $lang->job->jkJob = 'Jenkins任务'; $lang->job->buildSpec = '构建对象'; // 'pipeline@server' $lang->job->engine = '构建引擎'; $lang->job->server = '服务器'; -$lang->job->Pipeline = '流水线'; +$lang->job->pipeline = '流水线'; $lang->job->buildType = '构建类型'; $lang->job->frame = '工具/框架'; $lang->job->triggerType = '触发方式'; @@ -81,9 +81,8 @@ $lang->job->engineTips = new stdclass; $lang->job->engineTips->success = '构建引擎将使用GitLab项目内置的流水线。'; $lang->job->engineTips->error = '当前GitLab项目内没有可用的流水线,请先前往GitLab配置。'; -$lang->job->pipeline = new stdclass; -$lang->job->pipeline->pipelineTips = "选择要运行流水线的分支名或标签名"; -$lang->job->pipeline->variables = "变量"; -$lang->job->pipeline->variablesKeyPlaceHolder = "输入变量的名称"; -$lang->job->pipeline->variablesValuePlaceHolder = "输入变量的值"; -$lang->job->pipeline->variablesTips = "指定要在此次运行中使用的变量值。CI/CD设置中指定的值将用作默认值。"; +$lang->job->pipelineTips = "选择要运行流水线的分支名或标签名"; +$lang->job->pipelineVariables = "变量"; +$lang->job->pipelineVariablesKeyPlaceHolder = "输入变量的名称"; +$lang->job->pipelineVariablesValuePlaceHolder = "输入变量的值"; +$lang->job->pipelineVariablesTips = "指定要在此次运行中使用的变量值。CI/CD设置中指定的值将用作默认值。"; diff --git a/module/job/lang/zh-tw.php b/module/job/lang/zh-tw.php index 1097d9df41..e42281a78e 100644 --- a/module/job/lang/zh-tw.php +++ b/module/job/lang/zh-tw.php @@ -25,7 +25,7 @@ $lang->job->jkJob = 'Jenkins任務'; $lang->job->buildSpec = '構建對象'; // 'pipeline@server' $lang->job->engine = '構建引擎'; $lang->job->server = '伺服器'; -$lang->job->Pipeline = '流水綫'; +$lang->job->pipeline = '流水綫'; $lang->job->buildType = '構建類型'; $lang->job->frame = '工具/框架'; $lang->job->triggerType = '觸發方式'; @@ -81,9 +81,8 @@ $lang->job->engineTips = new stdclass; $lang->job->engineTips->success = '構建引擎將使用GitLab項目內置的流水綫。'; $lang->job->engineTips->error = '當前GitLab項目內沒有可用的流水綫,請先前往GitLab配置。'; -$lang->job->pipeline = new stdclass; -$lang->job->pipeline->pipelineTips = "選擇要運行流水綫的分支名或標籤名"; -$lang->job->pipeline->variables = "變數"; -$lang->job->pipeline->variablesKeyPlaceHolder = "輸入變數的名稱"; -$lang->job->pipeline->variablesValuePlaceHolder = "輸入變數的值"; -$lang->job->pipeline->variablesTips = "指定要在此次運行中使用的變數值。CI/CD設置中指定的值將用作預設值。"; +$lang->job->pipelineTips = "選擇要運行流水綫的分支名或標籤名"; +$lang->job->pipelineVariables = "變數"; +$lang->job->pipelineVariablesKeyPlaceHolder = "輸入變數的名稱"; +$lang->job->pipelineVariablesValuePlaceHolder = "輸入變數的值"; +$lang->job->pipelineVariablesTips = "指定要在此次運行中使用的變數值。CI/CD設置中指定的值將用作預設值。"; diff --git a/module/job/model.php b/module/job/model.php index 3600f69ee0..0493080e36 100644 --- a/module/job/model.php +++ b/module/job/model.php @@ -122,8 +122,8 @@ class jobModel extends model if($job->engine == 'jenkins') { - $job->server = $job->jkServer; - $job->pipeline = $job->jkTask; + $job->server = zget($job, 'jkServer', ''); + $job->pipeline = zget($job, 'jkTask', ''); } if(strtolower($job->engine) == 'gitlab') @@ -177,7 +177,7 @@ class jobModel extends model ->batchCheckIF(($this->post->repoType == 'Subversion' and $job->triggerType == 'tag'), "svnDir", 'notempty') ->autoCheck() ->exec(); - if(dao::isError()) return dao::getError(); + if(dao::isError()) return false; $id = $this->dao->lastInsertId(); if(strtolower($job->engine) == 'jenkins') $this->initJob($id, $job, $this->post->repoType); @@ -206,8 +206,8 @@ class jobModel extends model if($job->engine == 'jenkins') { - $job->server = $job->jkServer; - $job->pipeline = $job->jkTask; + $job->server = zget($job, 'jkServer', ''); + $job->pipeline = zget($job, 'jkTask', ''); } if(strtolower($job->engine) == 'gitlab') @@ -263,6 +263,7 @@ class jobModel extends model ->autoCheck() ->where('id')->eq($id) ->exec(); + if(dao::isError()) return false; $this->initJob($id, $job, $this->post->repoType); return true; diff --git a/module/job/view/create.html.php b/module/job/view/create.html.php index ca028801bf..16e9d90914 100644 --- a/module/job/view/create.html.php +++ b/module/job/view/create.html.php @@ -86,12 +86,12 @@ - - - + - - + + - + - + diff --git a/module/repo/control.php b/module/repo/control.php index aeb1d3e529..d1fc55a808 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -1156,4 +1156,17 @@ class repo extends control die($branchesHtml); } + + /** + * Ajax load product by repoID. + * + * @param int $repoID + * @access public + * @return void + */ + public function ajaxLoadPorducts($repoID) + { + $productPairs = $this->repo->getProductsByRepo($repoID); + echo html::select('product', array('') + $productPairs, key($productPairs), "class='form-control chosen'"); + } } diff --git a/module/repo/model.php b/module/repo/model.php index f96cad2fe1..f693c6dec3 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -596,6 +596,22 @@ class repoModel extends model return $cachePath . '/' . $repoID . '-' . md5("{$this->cookie->repoBranch}-$path-$revision"); } + /** + * Get products by repoID. + * + * @param int $repoID + * @access public + * @return array + */ + public function getProductsByRepo($repoID) + { + $repo = $this->getRepoByID($repoID); + return $this->dao->select('id,name')->from(TABLE_PRODUCT) + ->where('id')->in($repo->product) + ->andWhere('deleted')->eq(0) + ->fetchPairs(); + } + /** * Save commit. * From 62cdfe21985db70c9b477cb7ac47400f0fb7f8c8 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 5 Aug 2021 13:25:34 +0800 Subject: [PATCH 14/25] * Fix bug #14049. --- module/doc/control.php | 6 ++++-- module/execution/control.php | 4 ++++ module/product/control.php | 2 ++ module/project/control.php | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 0fd59e4825..58b07227a7 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -318,8 +318,9 @@ class doc extends control { $this->app->rawMethod = $objectType; unset($this->lang->doc->menu->product['subMenu']); - if($this->config->systemMode == 'new') unset($this->lang->doc->menu->project['subMenu']); unset($this->lang->doc->menu->custom['subMenu']); + if($this->config->systemMode == 'new') unset($this->lang->doc->menu->project['subMenu']); + if($this->config->systemMode == 'classic') unset($this->lang->doc->menu->execution['subMenu']); } $lib = $this->doc->getLibByID($libID); @@ -422,8 +423,9 @@ class doc extends control $this->app->rawMethod = $objectType; unset($this->lang->doc->menu->product['subMenu']); - if($this->config->systemMode == 'new') unset($this->lang->doc->menu->project['subMenu']); unset($this->lang->doc->menu->custom['subMenu']); + if($this->config->systemMode == 'new') unset($this->lang->doc->menu->project['subMenu']); + if($this->config->systemMode == 'classic') unset($this->lang->doc->menu->execution['subMenu']); /* High light menu. */ if(strpos(',product,project,execution,custom,book,', ",$objectType,") !== false) diff --git a/module/execution/control.php b/module/execution/control.php index eaf395ea53..0d0cb3c83d 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1220,6 +1220,10 @@ class execution extends control if($this->config->systemMode == 'new') $selectedExecutionID = key($this->executions); $this->execution->setMenu($selectedExecutionID); } + elseif($this->app->openApp == 'doc') + { + unset($this->lang->doc->menu->execution['subMenu']); + } $this->app->loadLang('program'); $this->app->loadLang('stage'); diff --git a/module/product/control.php b/module/product/control.php index 71a5dcfcae..d99757534c 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -362,6 +362,8 @@ class product extends control if($programID) $lines = array('') + $this->product->getLinePairs($programID); if($this->config->systemMode == 'classic') $lines = array('') + $this->product->getLinePairs(); + if($this->app->openApp == 'doc') unset($this->lang->doc->menu->product['subMenu']); + $this->view->title = $this->lang->product->create; $this->view->position[] = $this->view->title; $this->view->groups = $this->loadModel('group')->getPairs(); diff --git a/module/project/control.php b/module/project/control.php index 29c2257158..3bb58b5208 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -373,6 +373,8 @@ class project extends control } } + if($this->app->openApp == 'doc') unset($this->lang->doc->menu->project['subMenu']); + $this->view->title = $this->lang->project->create; $this->view->position[] = $this->lang->project->create; From ef0788a58d0f44a8b5bb31f1c3915e9d74ce7381 Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Thu, 5 Aug 2021 13:28:31 +0800 Subject: [PATCH 15/25] * Adjust page style of repo browse. --- module/repo/css/browse.css | 1 + module/repo/view/browse.html.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/module/repo/css/browse.css b/module/repo/css/browse.css index 6d03a01e34..bc556b5de1 100644 --- a/module/repo/css/browse.css +++ b/module/repo/css/browse.css @@ -2,3 +2,4 @@ #sidebar>.sidebar-toggle>.icon {right: -2px; left: auto;} .main-row {width: 99%;} .btn-toolbar > .last-sync-time {display: inline-block; float: left; margin-right: 10px;} +.dropdown-menu>li.selected>a:after {content: '';} diff --git a/module/repo/view/browse.html.php b/module/repo/view/browse.html.php index f8b0760fda..f3ff4699df 100644 --- a/module/repo/view/browse.html.php +++ b/module/repo/view/browse.html.php @@ -30,8 +30,9 @@ $branchName) { + $isSelected = $id == $branchID ? 'class="selected"' : ''; $base64BranchID = base64_encode($id); - echo "
  • " . html::a($this->createLink('repo', 'browse', "repoID=$repoID&branchID=$base64BranchID&objectID=$objectID"), $branchName, '', "title='{$branchName}' class='text-ellipsis' data-app='{$app->openApp}'") . "
  • "; + echo "
  • " . html::a($this->createLink('repo', 'browse', "repoID=$repoID&branchID=$base64BranchID&objectID=$objectID"), $branchName, '', "title='{$branchName}' class='text-ellipsis' data-app='{$app->openApp}'") . "
  • "; } ?> From 7f5db66701e04953a004cf457054bc185b6e8d1c Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 5 Aug 2021 13:30:57 +0800 Subject: [PATCH 16/25] * adjust for delete repo and jenkins. --- module/jenkins/control.php | 3 +++ module/jenkins/lang/en.php | 3 +++ module/jenkins/lang/zh-cn.php | 3 +++ module/jenkins/lang/zh-tw.php | 3 +++ module/repo/control.php | 16 ++++++++-------- module/repo/lang/en.php | 1 + module/repo/lang/zh-cn.php | 1 + module/repo/lang/zh-tw.php | 1 + 8 files changed, 23 insertions(+), 8 deletions(-) diff --git a/module/jenkins/control.php b/module/jenkins/control.php index 5540161481..baae37b4bf 100644 --- a/module/jenkins/control.php +++ b/module/jenkins/control.php @@ -111,6 +111,9 @@ class jenkins extends control { if($confim != 'yes') die(js::confirm($this->lang->jenkins->confirmDelete, inlink('delete', "id=$id&confirm=yes"))); + $jobs = $this->dao->select('*')->from(TABLE_JOB)->where('server')->eq($id)->andWhere('engine')->eq('jenkins')->andWhere('deleted')->eq('0')->fetchAll(); + if($jobs) die(js::alert($this->lang->jenkins->error->linkedJob)); + $this->jenkins->delete(TABLE_PIPELINE, $id); die(js::reload('parent')); } diff --git a/module/jenkins/lang/en.php b/module/jenkins/lang/en.php index dd8b436308..79c656485d 100644 --- a/module/jenkins/lang/en.php +++ b/module/jenkins/lang/en.php @@ -20,3 +20,6 @@ $lang->jenkins->lblCreate = 'Create Jenkins Server'; $lang->jenkins->desc = 'Description'; $lang->jenkins->tokenFirst = 'Use token if not empty.'; $lang->jenkins->tips = 'Cancel "Prevent Cross Site Request Forgery exploits" when using password.'; + +$lang->jenkins->error = new stdclass(); +$lang->jenkins->error->linkedJob = 'Failed. This jenkins has associated with the compile.'; diff --git a/module/jenkins/lang/zh-cn.php b/module/jenkins/lang/zh-cn.php index 1c64df3e28..8910a5b36f 100644 --- a/module/jenkins/lang/zh-cn.php +++ b/module/jenkins/lang/zh-cn.php @@ -20,3 +20,6 @@ $lang->jenkins->lblCreate = '添加Jenkins服务器'; $lang->jenkins->desc = '描述'; $lang->jenkins->tokenFirst = 'Token不为空时,优先使用Token。'; $lang->jenkins->tips = '使用密码时,请在Jenkins全局安全设置中禁用"防止跨站点请求伪造"选项。'; + +$lang->jenkins->error = new stdclass(); +$lang->jenkins->error->linkedJob = '删除失败,该Jenkins跟构建有关联,请取消关联或删除构建。'; diff --git a/module/jenkins/lang/zh-tw.php b/module/jenkins/lang/zh-tw.php index e19ffbbae3..6ce5017741 100644 --- a/module/jenkins/lang/zh-tw.php +++ b/module/jenkins/lang/zh-tw.php @@ -20,3 +20,6 @@ $lang->jenkins->lblCreate = '添加Jenkins伺服器'; $lang->jenkins->desc = '描述'; $lang->jenkins->tokenFirst = 'Token不為空時,優先使用Token。'; $lang->jenkins->tips = '使用密碼時,請在Jenkins全局安全設置中禁用"防止跨站點請求偽造"選項。'; + +$lang->jenkins->error = new stdclass(); +$lang->jenkins->error->linkedJob = '刪除失敗,該Jenkins跟構建有關聯,請取消關聯或刪除構建。'; diff --git a/module/repo/control.php b/module/repo/control.php index aeb1d3e529..467ae8a5af 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -203,16 +203,16 @@ class repo extends control */ public function delete($repoID, $objectID = 0, $confirm = 'no') { - if($confirm == 'no') - { - die(js::confirm($this->lang->repo->notice->delete, $this->repo->createLink('delete', "repoID=$repoID&objectID=$objectID&confirm=yes"))); - } + if($confirm == 'no') die(js::confirm($this->lang->repo->notice->delete, $this->repo->createLink('delete', "repoID=$repoID&objectID=$objectID&confirm=yes"))); + $error = ''; $relationID = $this->dao->select('id')->from(TABLE_RELATION)->where('extra')->eq($repoID)->fetch(); - if($relationID) - { - die(js::alert($this->lang->repo->error->deleted)); - } + if($relationID) $error .= $this->lang->repo->error->deleted; + + $jobs = $this->dao->select('*')->from(TABLE_JOB)->where('repo')->eq($repoID)->andWhere('deleted')->eq('0')->fetchAll(); + if($jobs) $error .= ($error ? '\n' : '') . $this->lang->repo->error->linkedJob; + + if($error) die(js::alert($error)); $this->dao->delete()->from(TABLE_REPO)->where('id')->eq($repoID)->exec(); $this->dao->delete()->from(TABLE_REPOHISTORY)->where('repo')->eq($repoID)->exec(); diff --git a/module/repo/lang/en.php b/module/repo/lang/en.php index 6635178c15..dfd6d50b88 100644 --- a/module/repo/lang/en.php +++ b/module/repo/lang/en.php @@ -172,6 +172,7 @@ $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 might be wrong. Please change the encoding and try again."; $lang->repo->error->deleted = "Deletion of the repository failed. The current repository has a commit record associated with the design."; +$lang->repo->error->linkedJob = "Deletion of the repository failed. The current repository has associated with the Compile."; $lang->repo->error->clientPath = "The client installation directory cannot have spaces!"; $lang->repo->syncTips = 'You may find the reference about how to set Git sync from here.'; diff --git a/module/repo/lang/zh-cn.php b/module/repo/lang/zh-cn.php index ad138e6402..31a702cf54 100644 --- a/module/repo/lang/zh-cn.php +++ b/module/repo/lang/zh-cn.php @@ -172,6 +172,7 @@ $lang->repo->error->output = "执行命令:%s\n错误结果(%s): %s\n $lang->repo->error->clientVersion = "客户端版本过低,请升级或更换SVN客户端"; $lang->repo->error->encoding = "编码可能错误,请更换编码重试。"; $lang->repo->error->deleted = "删除版本库失败,当前版本库有提交记录与设计关联"; +$lang->repo->error->linkedJob = "删除版本库失败,当前版本库与构建有关联,请取消关联或删除构建。"; $lang->repo->error->clientPath = "客户端安装目录不能有空格!"; $lang->repo->syncTips = '请参照这里,设置版本库定时同步。'; diff --git a/module/repo/lang/zh-tw.php b/module/repo/lang/zh-tw.php index cf5bfef6ab..36698a32df 100644 --- a/module/repo/lang/zh-tw.php +++ b/module/repo/lang/zh-tw.php @@ -172,6 +172,7 @@ $lang->repo->error->output = "執行命令:%s\n錯誤結果(%s): %s\n $lang->repo->error->clientVersion = "客戶端版本過低,請升級或更換SVN客戶端"; $lang->repo->error->encoding = "編碼可能錯誤,請更換編碼重試。"; $lang->repo->error->deleted = "刪除版本庫失敗,當前版本庫有提交記錄與設計關聯"; +$lang->repo->error->linkedJob = "刪除版本庫失敗,當前版本庫與構建有關聯,請取消關聯或刪除構建。"; $lang->repo->error->clientPath = "客戶端安裝目錄不能有空格!"; $lang->repo->syncTips = '請參照這裡,設置版本庫定時同步。'; From 75f83bac4aae5e9c467651fe6051a7aad102d40d Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Thu, 5 Aug 2021 13:33:29 +0800 Subject: [PATCH 17/25] * Adjust style of jenkins and job browse. --- module/jenkins/view/browse.html.php | 2 +- module/job/view/browse.html.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/jenkins/view/browse.html.php b/module/jenkins/view/browse.html.php index cddf5ca7ab..1a398f80ba 100644 --- a/module/jenkins/view/browse.html.php +++ b/module/jenkins/view/browse.html.php @@ -25,7 +25,7 @@
    - + diff --git a/module/job/view/browse.html.php b/module/job/view/browse.html.php index 1377b630ea..2d99b02251 100644 --- a/module/job/view/browse.html.php +++ b/module/job/view/browse.html.php @@ -52,13 +52,13 @@ $job):?> - + engine) == 'gitlab') $job->pipeline = $this->loadModel('gitlab')->getObjectNameForJob($job->server, $job->pipeline);?> pipeline) . '@' . $job->jenkinsName;?> - + job->getTriggerConfig($job);?> From efb55c623dcdd88a65463e56b22511ed9cad7029 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Thu, 5 Aug 2021 13:55:08 +0800 Subject: [PATCH 18/25] * Finish task #40916. --- module/upgrade/control.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/upgrade/control.php b/module/upgrade/control.php index f1d0f1bf7d..4135a97c49 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -582,6 +582,8 @@ class upgrade extends control if(empty($repos)) { + $this->dao->delete()->from(TABLE_BLOCK)->exec(); + $this->dao->delete()->from(TABLE_CONFIG)->where('`key`')->eq('blockInited')->exec(); $this->loadModel('setting')->deleteItems('owner=system&module=common§ion=global&key=upgradeStep'); die(js::locate($this->createLink('upgrade', 'afterExec', "fromVersion=&processed=no"))); } From cfda81bede2418f7163a6feb9fb520bc6006175f Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 5 Aug 2021 13:57:57 +0800 Subject: [PATCH 19/25] * fix for edit job. --- module/ci/control.php | 1 + module/job/view/edit.html.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/module/ci/control.php b/module/ci/control.php index 88358edef3..d06c715240 100644 --- a/module/ci/control.php +++ b/module/ci/control.php @@ -123,6 +123,7 @@ class ci extends control $caseResult = $post->funcResult; $firstCase = array_shift($caseResult); $productID = $firstCase->productId; + if(empty($productID) and !empty($firstCase->id)) $productID = $this->dao->select('product')->from(TABLE_CASE)->where('id')->eq((int)$firstCase->id)->fetch('product'); } if(empty($productID)) die(json_encode(array('result' => 'fail', 'message' => 'productID is not found'))); diff --git a/module/job/view/edit.html.php b/module/job/view/edit.html.php index a54f03e1fb..b318c8d3fa 100644 --- a/module/job/view/edit.html.php +++ b/module/job/view/edit.html.php @@ -34,7 +34,7 @@ - From e8e9f39c4705aabc0720edba533e28e0e3d108a6 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Thu, 5 Aug 2021 13:59:58 +0800 Subject: [PATCH 20/25] * Delete code in master. --- module/upgrade/control.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/module/upgrade/control.php b/module/upgrade/control.php index 4135a97c49..f1d0f1bf7d 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -582,8 +582,6 @@ class upgrade extends control if(empty($repos)) { - $this->dao->delete()->from(TABLE_BLOCK)->exec(); - $this->dao->delete()->from(TABLE_CONFIG)->where('`key`')->eq('blockInited')->exec(); $this->loadModel('setting')->deleteItems('owner=system&module=common§ion=global&key=upgradeStep'); die(js::locate($this->createLink('upgrade', 'afterExec', "fromVersion=&processed=no"))); } From e6d377561b690b5b0efd3b19589d4377dd0558db Mon Sep 17 00:00:00 2001 From: dingguodong Date: Thu, 5 Aug 2021 14:01:46 +0800 Subject: [PATCH 21/25] * Fix bug when checking compile status and adding privileges etc. --- module/ci/lang/en.php | 5 +++-- module/ci/lang/zh-cn.php | 5 +++-- module/ci/lang/zh-tw.php | 5 +++-- module/group/lang/resource.php | 10 ++++++---- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/module/ci/lang/en.php b/module/ci/lang/en.php index 97657af48f..c220f9ae75 100644 --- a/module/ci/lang/en.php +++ b/module/ci/lang/en.php @@ -1,6 +1,7 @@ ci->common = 'CI'; -$lang->ci->commitResult = 'Interface: Commit Test Result.'; +$lang->ci->common = 'CI'; +$lang->ci->commitResult = 'Interface: Commit Test Result.'; +$lang->ci->checkCompileStatus = 'Interface: Fetch Test Result.'; $lang->ci->job = 'Job'; $lang->ci->task = 'Task'; diff --git a/module/ci/lang/zh-cn.php b/module/ci/lang/zh-cn.php index 17fd9755c9..6617262317 100644 --- a/module/ci/lang/zh-cn.php +++ b/module/ci/lang/zh-cn.php @@ -1,6 +1,7 @@ ci->common = '持续集成'; -$lang->ci->commitResult = '接口:提交测试结果'; +$lang->ci->common = '持续集成'; +$lang->ci->commitResult = '接口:提交测试结果'; +$lang->ci->checkCompileStatus = '接口:获取测试结果'; $lang->ci->job = '构建'; $lang->ci->task = '构建任务'; diff --git a/module/ci/lang/zh-tw.php b/module/ci/lang/zh-tw.php index 6a983a797e..a3577d5f20 100644 --- a/module/ci/lang/zh-tw.php +++ b/module/ci/lang/zh-tw.php @@ -1,6 +1,7 @@ ci->common = '持續整合'; -$lang->ci->commitResult = '介面:提交測試結果'; +$lang->ci->common = '持續整合'; +$lang->ci->commitResult = '介面:提交測試結果'; +$lang->ci->checkCompileStatus = '介面:獲取測試結果'; $lang->ci->job = '構建'; $lang->ci->task = '構建任務'; diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index c2323e4594..1fc8b0f9be 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -977,9 +977,11 @@ $lang->repo->methodOrder[60] = 'download'; $lang->repo->methodOrder[65] = 'setRules'; $lang->resource->ci = new stdclass(); -$lang->resource->ci->commitResult = 'commitResult'; +$lang->resource->ci->commitResult = 'commitResult'; +$lang->resource->ci->checkCompileStatus = 'checkCompileStatus'; -$lang->ci->methodOrder[5] = 'commitResult'; +$lang->ci->methodOrder[5] = 'commitResult'; +$lang->ci->methodOrder[10] = 'checkCompileStatus'; $lang->resource->compile = new stdclass(); $lang->resource->compile->browse = 'browse'; @@ -1133,7 +1135,7 @@ $lang->resource->gitlab->importIssue = 'importIssue'; $lang->resource->gitlab->delete = 'delete'; $lang->resource->gitlab->bindUser = 'bindUser'; $lang->resource->gitlab->bindProduct = 'bindProduct'; -$lang->resource->gitlab->webhook = 'webhook'; +//$lang->resource->gitlab->webhook = 'webhook'; $lang->gitlab->methodOrder[5] = 'browse'; $lang->gitlab->methodOrder[10] = 'create'; @@ -1142,7 +1144,7 @@ $lang->gitlab->methodOrder[20] = 'importIssue'; $lang->gitlab->methodOrder[30] = 'delete'; $lang->gitlab->methodOrder[35] = 'bindUser'; $lang->gitlab->methodOrder[40] = 'bindProduct'; -$lang->gitlab->methodOrder[45] = 'webhook'; +//$lang->gitlab->methodOrder[45] = 'webhook'; /* Git. */ $lang->resource->git = new stdclass(); From 72dae0756cbd726d5e5d614690e0d62250e95c2b Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Thu, 5 Aug 2021 14:01:54 +0800 Subject: [PATCH 22/25] * Fix scheme of http request. --- module/common/model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/common/model.php b/module/common/model.php index 97de423ed5..e2eec40243 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1997,6 +1997,7 @@ EOD; { $httpType = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http'; if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') $httpType = 'https'; + if(isset($_SERVER['REQUEST_SCHEME']) and strtolower($_SERVER['REQUEST_SCHEME']) == 'https') $httpType = 'https'; $httpHost = $_SERVER['HTTP_HOST']; return "$httpType://$httpHost"; } From 1975cdb024a78ac8974d0072811af2383f2e0c45 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 5 Aug 2021 14:05:19 +0800 Subject: [PATCH 23/25] * fix bug #14038. --- module/testcase/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/testcase/model.php b/module/testcase/model.php index 567961391e..4a67b07d71 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -1476,7 +1476,7 @@ class testcaseModel extends model break; case 'title': if($case->branch) echo "{$branches[$case->branch]} "; - if($modulePairs and $case->module) echo "{$modulePairs[$case->module]} "; + if($modulePairs and $case->module and isset($modulePairs[$case->module])) echo "{$modulePairs[$case->module]} "; echo $canView ? ($fromCaseID ? html::a($caseLink, $case->title, null, "style='color: $case->color' data-app='{$this->app->openApp}'") . html::a(helper::createLink('testcase', 'view', "caseID=$fromCaseID"), "[#$fromCaseID]", '', "data-app='{$this->app->openApp}'") : html::a($caseLink, $case->title, null, "style='color: $case->color' data-app='{$this->app->openApp}'")) : "$case->title"; break; case 'branch': From 086657a301be36b03a13e5beea96d6245c8f58b1 Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Thu, 5 Aug 2021 14:13:48 +0800 Subject: [PATCH 24/25] * Adjust style of compile browse. --- module/compile/view/browse.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/compile/view/browse.html.php b/module/compile/view/browse.html.php index 52871c2508..91588ca7c3 100644 --- a/module/compile/view/browse.html.php +++ b/module/compile/view/browse.html.php @@ -44,7 +44,7 @@ $build):?> - + pipeline) . '@' . $build->jenkinsName;?> From 38606a8bd330616e1afd7f18651053109d1695e6 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 5 Aug 2021 14:28:26 +0800 Subject: [PATCH 25/25] * fix bug for show unitCases in modal. --- module/testtask/control.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/testtask/control.php b/module/testtask/control.php index dadfd0d636..e3d16c988c 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -62,6 +62,10 @@ class testtask extends control if(empty($products) and !helper::isAjaxRequest()) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName=$openApp&activeMenu=testtask&objectID=$objectID"))); } + else + { + $products = $this->product->getPairs(); + } $this->view->products = $this->products = $products; }
    job->jkHost; ?> +
    - job->Pipeline; ?> + job->pipeline; ?> ''), '', "class='form-control chosen'"); ?>
    diff --git a/module/job/view/edit.html.php b/module/job/view/edit.html.php index 0b09296d5b..d3dba1f892 100644 --- a/module/job/view/edit.html.php +++ b/module/job/view/edit.html.php @@ -104,12 +104,12 @@ engine == 'jenkins'):?>
    job->server;?> +
    server, "class='form-control chosen'");?>
    - job->Pipeline;?> + job->pipeline;?> ''), $job->pipeline, "class='form-control chosen'");?>
    diff --git a/module/job/view/exec.html.php b/module/job/view/exec.html.php index 8de34f652e..d9eecffb8a 100644 --- a/module/job/view/exec.html.php +++ b/module/job/view/exec.html.php @@ -8,16 +8,16 @@
    job->pipeline->variables; ?>job->pipelineVariables; ?>
    job->pipeline->variablesKeyPlaceHolder}'");?>job->pipeline->variablesValuePlaceHolder}'");?>job->pipelineVariablesKeyPlaceHolder}'");?>job->pipelineVariablesValuePlaceHolder}'");?>
    job->pipeline->variablesTips; ?>job->pipelineVariablesTips; ?>
    diff --git a/module/repo/lang/zh-tw.php b/module/repo/lang/zh-tw.php index 0ec43bc677..cf5bfef6ab 100644 --- a/module/repo/lang/zh-tw.php +++ b/module/repo/lang/zh-tw.php @@ -43,7 +43,7 @@ $lang->repo->line = '行'; $lang->repo->expand = '點擊展開'; $lang->repo->collapse = '點擊摺疊'; -$lang->repo->id = '編號'; +$lang->repo->id = 'ID'; $lang->repo->SCM = '類型'; $lang->repo->name = '名稱'; $lang->repo->path = '地址'; From 4937cb49ad2b0a3c79c40b7c8bd9fdbd71d92800 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Thu, 5 Aug 2021 13:23:15 +0800 Subject: [PATCH 12/25] * Fix bug: bug table error. --- api/v1/entries/projectissues.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/v1/entries/projectissues.php b/api/v1/entries/projectissues.php index 0990d8b74f..f1d87f7790 100644 --- a/api/v1/entries/projectissues.php +++ b/api/v1/entries/projectissues.php @@ -38,7 +38,7 @@ class projectIssuesEntry extends entry $orderParams = explode('_', $order); $order = $orderParams[0]; - $sort = (isset($orderParams[1]) and strtolower($orderParams[1]) == 'desc') ? 'desc' : 'asc'; + $sort = (isset($orderParams[1]) and strtolower($orderParams[1]) == 'asc') ? 'asc' : 'desc'; if($status == 'all') $status = ''; if(!in_array($status, array('opened', 'closed', ''))) return $this->sendError(400, 'The status is not supported'); @@ -128,7 +128,7 @@ class projectIssuesEntry extends entry if(!empty($tasks)) $tasks = $this->dao->select('*')->from(TABLE_TASK)->where('id')->in($tasks)->fetchAll('id'); if(!empty($stories)) $stories = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($stories)->fetchAll('id'); - if(!empty($bugs)) $bugs = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($bugs)->fetchAll('id'); + if(!empty($bugs)) $bugs = $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($bugs)->fetchAll('id'); $result = array(); foreach($issues as $issue) From 776a2d45b2276b8c0a0b7743254df5a6e9cb1125 Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Thu, 5 Aug 2021 13:23:29 +0800 Subject: [PATCH 13/25] * Adjust logic of product link job. --- module/job/control.php | 9 ++++++++- module/job/js/create.js | 11 +++++++++++ module/job/js/edit.js | 11 +++++++++++ module/job/view/create.html.php | 2 +- module/repo/control.php | 13 +++++++++++++ module/repo/model.php | 16 ++++++++++++++++ 6 files changed, 60 insertions(+), 2 deletions(-) diff --git a/module/job/control.php b/module/job/control.php index a834c59787..c465141222 100644 --- a/module/job/control.php +++ b/module/job/control.php @@ -122,6 +122,13 @@ class job extends control $repoTypes[$repo->id] = $repo->SCM; } + $products = $this->repo->getProductsByRepo($job->repo); + if(!isset($products[$job->product])) + { + $jobProduct = $this->loadModel('product')->getByID($job->product); + if($jobProduct and $jobProduct->deleted == 0) $products += array($job->product => $jobProduct->name); + } + $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; @@ -129,7 +136,7 @@ class job extends control $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->products = array(0 => '') + $products; $this->view->jenkinsServerList = $this->loadModel('jenkins')->getPairs(); $this->view->pipelines = $this->jenkins->getTasks($job->server); diff --git a/module/job/js/create.js b/module/job/js/create.js index 36e3d909a3..7038077ab2 100644 --- a/module/job/js/create.js +++ b/module/job/js/create.js @@ -3,6 +3,17 @@ $(document).ready(function() $('#repo').change(function() { var repoID = $(this).val(); + var link = createLink('repo', 'ajaxLoadPorducts', 'repoID=' + repoID); + $.get(link, function(data) + { + if(data) + { + $('#product').replaceWith(data); + $('#product_chosen').remove(); + $('#product').chosen(); + } + }); + var type = 'Git'; if(typeof(repoTypes[repoID]) != 'undefined') type = repoTypes[repoID]; diff --git a/module/job/js/edit.js b/module/job/js/edit.js index 65f5dcd1dc..1f90a1c89c 100644 --- a/module/job/js/edit.js +++ b/module/job/js/edit.js @@ -3,6 +3,17 @@ $(document).ready(function() $('#repo').change(function() { var repoID = $(this).val(); + var link = createLink('repo', 'ajaxLoadPorducts', 'repoID=' + repoID); + $.get(link, function(data) + { + if(data) + { + $('#product').replaceWith(data); + $('#product_chosen').remove(); + $('#product').chosen(); + } + }); + var type = 'Git'; if(typeof(repoTypes[repoID]) != 'undefined') type = repoTypes[repoID]; diff --git a/module/job/view/create.html.php b/module/job/view/create.html.php index 457d56b8c2..156baca3ec 100644 --- a/module/job/view/create.html.php +++ b/module/job/view/create.html.php @@ -48,7 +48,7 @@
    job->product; ?>
    job->frame; ?>jenkins->id); ?> jenkins->name); ?> jenkins->url); ?>actions; ?>actions; ?>
    createLink('job', 'view', "jobID={$job->id}", 'html', true), $job->name, '', "class='iframe' data-width='90%'") : $job->name;?>createLink('job', 'view', "jobID={$job->id}", 'html', true), $job->name, '', "class='iframe' data-width='90%'") : $job->name;?> repoName;?> job->engineList, $job->engine);?> job->frameList, $job->frame);?> lastStatus) echo zget($lang->compile->statusList, $job->lastStatus);?>
    job->engine;?>job->engineList, $job->engine, "class='form-control chosen'");?> + job->engineList, $job->engine, '') . html::hidden('engine', $job->engine);?>
    createLink('job', 'view', "jobID={$build->job}&compileID={$build->id}", 'html', true), $build->name, '', "class='iframe' data-width='90%'") : $build->name;?>createLink('job', 'view', "jobID={$build->job}&compileID={$build->id}", 'html', true), $build->name, '', "class='iframe' data-width='90%'") : $build->name;?> engine;?> repoName;?>