From 8deb42fbc565eb2232398f93f7d128a8edccb3ce Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Mon, 6 Nov 2023 11:12:58 +0800 Subject: [PATCH] + Add branch and tag page for gitlab. --- module/gitlab/config/dtable.php | 22 ++++++++++++++- module/gitlab/ui/browsebranch.html.php | 39 ++++++++++++++++++++++++++ module/gitlab/ui/browsetag.html.php | 39 ++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 module/gitlab/ui/browsebranch.html.php create mode 100644 module/gitlab/ui/browsetag.html.php diff --git a/module/gitlab/config/dtable.php b/module/gitlab/config/dtable.php index f93ba63029..9fac90e705 100644 --- a/module/gitlab/config/dtable.php +++ b/module/gitlab/config/dtable.php @@ -103,7 +103,7 @@ $config->gitlab->dtable->project->fieldList['actions']['list']['browseTag']['ico $config->gitlab->dtable->project->fieldList['actions']['list']['browseTag']['hint'] = $lang->gitlab->browseTag; $config->gitlab->dtable->project->fieldList['actions']['list']['browseTag']['url'] = helper::createLink('gitlab', 'browseTag', 'gitlabID={gitlabID}&projectID={id}'); -$config->gitlab->dtable->project->fieldList['actions']['list']['manageBranchPriv']['icon'] = 'tag'; +$config->gitlab->dtable->project->fieldList['actions']['list']['manageBranchPriv']['icon'] = 'branch-lock'; $config->gitlab->dtable->project->fieldList['actions']['list']['manageBranchPriv']['hint'] = $lang->gitlab->browseBranchPriv; $config->gitlab->dtable->project->fieldList['actions']['list']['manageBranchPriv']['url'] = helper::createLink('gitlab', 'manageBranchPriv', 'gitlabID={gitlabID}&projectID={id}'); @@ -195,3 +195,23 @@ $config->gitlab->dtable->user->fieldList['actions']['list']['deleteUser']['icon' $config->gitlab->dtable->user->fieldList['actions']['list']['deleteUser']['hint'] = $lang->gitlab->deleteUser; $config->gitlab->dtable->user->fieldList['actions']['list']['deleteUser']['url'] = helper::createLink('gitlab', 'deleteUser', 'gitlabID={gitlabID}&userID={id}'); $config->gitlab->dtable->user->fieldList['actions']['list']['deleteUser']['className'] = 'ajax-submit'; + +$config->gitlab->dtable->branch = new stdclass(); +$config->gitlab->dtable->branch->fieldList['name']['title'] = $lang->gitlab->branch->name; +$config->gitlab->dtable->branch->fieldList['name']['type'] = 'title'; + +$config->gitlab->dtable->branch->fieldList['lastCommitter']['title'] = $lang->gitlab->branch->lastCommitter; +$config->gitlab->dtable->branch->fieldList['lastCommitter']['type'] = 'text'; + +$config->gitlab->dtable->branch->fieldList['lastCommittedDate']['title'] = $lang->gitlab->branch->lastCommittedDate; +$config->gitlab->dtable->branch->fieldList['lastCommittedDate']['type'] = 'text'; + +$config->gitlab->dtable->tag = new stdclass(); +$config->gitlab->dtable->tag->fieldList['name']['title'] = $lang->gitlab->branch->name; +$config->gitlab->dtable->tag->fieldList['name']['type'] = 'title'; + +$config->gitlab->dtable->tag->fieldList['lastCommitter']['title'] = $lang->gitlab->branch->lastCommitter; +$config->gitlab->dtable->tag->fieldList['lastCommitter']['type'] = 'text'; + +$config->gitlab->dtable->tag->fieldList['updated']['title'] = $lang->gitlab->branch->lastCommittedDate; +$config->gitlab->dtable->tag->fieldList['updated']['type'] = 'text'; diff --git a/module/gitlab/ui/browsebranch.html.php b/module/gitlab/ui/browsebranch.html.php new file mode 100644 index 0000000000..55a9cd95cf --- /dev/null +++ b/module/gitlab/ui/browsebranch.html.php @@ -0,0 +1,39 @@ + + * @package gitlab + * @link https://www.zentao.net + */ +namespace zin; + +featureBar +( + backBtn + ( + set::text($lang->goback), + set::url(createLink('gitlab', 'browseProject', "gitlabID={$gitlabID}")), + ) +); +hasPriv('instance', 'manage') ? toolBar +( + item + ( + setClass('btn primary'), + set::text($lang->gitlab->createBranch), + set::icon('plus'), + set::url(createLink('gitlab', 'createBranch', "gitlabID={$gitlabID}&projectID={$projectID}")), + ), +) : null; + +$branchList = initTableData($gitlabBranchList, $config->gitlab->dtable->branch->fieldList, $this->gitlab); +dtable +( + set::cols($config->gitlab->dtable->branch->fieldList), + set::data($branchList), + set::sortLink(createLink('gitlab', 'browseBranch', "gitlabID={$gitlabID}&projectID={$projectID}&orderBy={name}_{sortType}")), + set::orderBy($orderBy) +); diff --git a/module/gitlab/ui/browsetag.html.php b/module/gitlab/ui/browsetag.html.php new file mode 100644 index 0000000000..c68e2e9069 --- /dev/null +++ b/module/gitlab/ui/browsetag.html.php @@ -0,0 +1,39 @@ + + * @package gitlab + * @link https://www.zentao.net + */ +namespace zin; + +featureBar +( + backBtn + ( + set::text($lang->goback), + set::url(createLink('gitlab', 'browseProject', "gitlabID={$gitlabID}")), + ) +); +hasPriv('instance', 'manage') ? toolBar +( + item + ( + setClass('btn primary'), + set::text($lang->gitlab->createTag), + set::icon('plus'), + set::url(createLink('gitlab', 'createTag', "gitlabID={$gitlabID}&projectID={$projectID}")), + ), +) : null; + +$tagList = initTableData($gitlabTagList, $config->gitlab->dtable->tag->fieldList, $this->gitlab); +dtable +( + set::cols($config->gitlab->dtable->tag->fieldList), + set::data($tagList), + set::sortLink(createLink('gitlab', 'browseTag', "gitlabID={$gitlabID}&projectID={$projectID}&orderBy={name}_{sortType}")), + set::orderBy($orderBy), +);