Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
一杯枸杞茶ya
csdn-workflow
提交
79f5d018
C
csdn-workflow
项目概览
一杯枸杞茶ya
/
csdn-workflow
与 Fork 源项目一致
Fork自
gitcode_dev / csdn-workflow
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
csdn-workflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
79f5d018
编写于
1月 26, 2018
作者:
F
Fatih Acet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement fetchCurrentProject.
上级
16e8db6a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
41 addition
and
10 deletion
+41
-10
CHANGELOG.md
CHANGELOG.md
+16
-5
src/gitlab_service.js
src/gitlab_service.js
+25
-5
未找到文件。
CHANGELOG.md
浏览文件 @
79f5d018
# Change Log
All notable changes to the "gitlab-workflow" extension will be documented in this file.
# CHANGELOG
Check
[
Keep a Changelog
](
http://keepachangelog.com/
)
for recommendations on how to structure this file.
## [0.2.0] - 2018-01-27
### Added
-
Added a new service layer to opearate git commands.
-
Added a new service layer to talk with GitLab API.
-
Added new methods to get info from Git and GitLab.
-
Implemented MR link on status bar.
-
Implemented pipeline status on status bar.
-
Implemented UI flow to ask and store GitLab Personal Access Token.
## [Unreleased]
-
Initial release
\ No newline at end of file
### Changed
-
Removed
`gitlab.userId`
necessity.
## [0.1.1] - 2018-01-25
### Added
-
Implemented show issues assinged to me.
-
Implemented show merge requests assinged to me.
src/gitlab_service.js
浏览文件 @
79f5d018
...
...
@@ -6,7 +6,7 @@ async function fetch(path) {
const
config
=
{
url
:
`
${
apiRoot
}${
path
}
`
,
headers
:
{
'
PRIVATE-TOKEN
'
:
'
TOKEN
'
,
// FIXME
'
PRIVATE-TOKEN
'
:
'
f9vX_GfmWc_SLzz7Siaq
'
,
// FIXME: Make token UI
}
};
...
...
@@ -19,15 +19,21 @@ async function fetch(path) {
}
}
// FIXME: Don't rely
created-by-me
//
FIXME: Fix project id
// FIXME: Don't rely
on `created-by-me`. It doesn't have to be my own MR.
//
Currently GL API doesn't support finding MR by branch name or commit id.
async
function
fetchMyOpenMergeRequests
()
{
return
await
fetch
(
'
/projects/13083/merge_requests?scope=created-by-me&state=opened
'
);
const
project
=
await
fetchCurrentProject
();
if
(
project
)
{
return
await
fetch
(
`/projects/
${
project
.
id
}
/merge_requests?scope=created-by-me&state=opened`
);
}
return
null
;
}
async
function
fetchOpenMergeRequestForCurrentBranch
()
{
const
branchName
=
await
gitService
.
fetchBranchName
();
const
mrs
=
await
fetchMyOpenMergeRequests
();
// FIXME: I doesn't have to be my MR
const
mrs
=
await
fetchMyOpenMergeRequests
();
return
mrs
.
filter
(
mr
=>
mr
.
source_branch
===
branchName
)[
0
];
}
...
...
@@ -50,6 +56,20 @@ async function fetchLastPipelineForCurrentBranch() {
return
null
;
}
async
function
fetchCurrentProject
()
{
const
remote
=
await
gitService
.
fetchGitRemote
();
if
(
remote
)
{
const
{
namespace
,
project
}
=
remote
;
const
projectData
=
await
fetch
(
`/projects/
${
namespace
}
%2F
${
project
}
`
);
return
projectData
||
null
;
}
return
null
;
}
exports
.
fetchMyOpenMergeRequests
=
fetchMyOpenMergeRequests
;
exports
.
fetchOpenMergeRequestForCurrentBranch
=
fetchOpenMergeRequestForCurrentBranch
;
exports
.
fetchLastPipelineForCurrentBranch
=
fetchLastPipelineForCurrentBranch
;
exports
.
fetchCurrentProject
=
fetchCurrentProject
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录