Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
2916ea82
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2916ea82
编写于
12月 28, 2016
作者:
S
Sam Rose
提交者:
Sam Rose
2月 01, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update pipeline and commit URL and text on CI status change
上级
40a82435
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
56 addition
and
5 deletion
+56
-5
app/assets/javascripts/merge_request_widget.js.es6
app/assets/javascripts/merge_request_widget.js.es6
+21
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-1
app/views/projects/merge_requests/widget/_heading.html.haml
app/views/projects/merge_requests/widget/_heading.html.haml
+1
-1
app/views/projects/merge_requests/widget/_show.html.haml
app/views/projects/merge_requests/widget/_show.html.haml
+4
-0
changelogs/unreleased/25811-pipeline-number-and-url-do-not-update-when-new-pipeline-is-triggered.yml
...-and-url-do-not-update-when-new-pipeline-is-triggered.yml
+4
-0
spec/javascripts/merge_request_widget_spec.js
spec/javascripts/merge_request_widget_spec.js
+24
-2
未找到文件。
app/assets/javascripts/merge_request_widget.js.es6
浏览文件 @
2916ea82
...
...
@@ -154,12 +154,22 @@
return;
}
if (data.environments && data.environments.length) _this.renderEnvironments(data.environments);
if (data.status !== _this.opts.ci_status && (data.status != null)) {
if (data.status !== _this.opts.ci_status ||
data.sha !== _this.opts.ci_sha ||
data.pipeline !== _this.opts.ci_pipeline) {
_this.opts.ci_status = data.status;
_this.showCIStatus(data.status);
if (data.coverage) {
_this.showCICoverage(data.coverage);
}
if (data.pipeline) {
_this.opts.ci_pipeline = data.pipeline;
_this.updatePipelineUrls(data.pipeline);
}
if (data.sha) {
_this.opts.ci_sha = data.sha;
_this.updateCommitUrls(data.sha);
}
if (showNotification) {
status = _this.ciLabelForStatus(data.status);
if (status === "preparing") {
...
...
@@ -248,6 +258,16 @@
return $('.js-merge-button,.accept-action .dropdown-toggle').removeClass('btn-danger btn-info btn-create').addClass(css_class);
};
MergeRequestWidget.prototype.updatePipelineUrls = function(id) {
const pipelineUrl = this.opts.pipeline_path;
$('.pipeline').text(`#${id}`).attr('href', [pipelineUrl, id].join('/'));
};
MergeRequestWidget.prototype.updateCommitUrls = function(id) {
const commitsUrl = this.opts.commits_path;
$('.js-commit-link').text(`#${id}`).attr('href', [commitsUrl, id].join('/'));
};
return MergeRequestWidget;
})();
})(window.gl || (window.gl = {}));
app/controllers/projects/merge_requests_controller.rb
浏览文件 @
2916ea82
...
...
@@ -434,7 +434,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
title:
merge_request
.
title
,
sha:
(
merge_request
.
diff_head_commit
.
short_id
if
merge_request
.
diff_head_sha
),
status:
status
,
coverage:
coverage
coverage:
coverage
,
pipeline:
pipeline
.
try
(
:id
)
}
render
json:
response
...
...
app/views/projects/merge_requests/widget/_heading.html.haml
浏览文件 @
2916ea82
...
...
@@ -10,7 +10,7 @@
=
ci_label_for_status
(
status
)
for
=
succeed
"."
do
=
link_to
@pipeline
.
short_sha
,
namespace_project_commit_path
(
@merge_request
.
source_project
.
namespace
,
@merge_request
.
source_project
,
@pipeline
.
sha
),
class:
"monospace"
=
link_to
@pipeline
.
short_sha
,
namespace_project_commit_path
(
@merge_request
.
source_project
.
namespace
,
@merge_request
.
source_project
,
@pipeline
.
sha
),
class:
"monospace
js-commit-link
"
%span
.ci-coverage
-
elsif
@merge_request
.
has_ci?
...
...
app/views/projects/merge_requests/widget/_show.html.haml
浏览文件 @
2916ea82
...
...
@@ -24,6 +24,10 @@
preparing
:
"
{{status}} build
"
,
normal
:
"
Build {{status}}
"
},
ci_sha
:
"
#{
@merge_request
.
head_pipeline
?
@merge_request
.
head_pipeline
.
short_sha
:
''
}
"
,
ci_pipeline
:
#{
@merge_request
.
head_pipeline
.
try
(
:id
).
to_json
}
,
commits_path
:
"
#{
project_commits_path
(
@project
)
}
"
,
pipeline_path
:
"
#{
project_pipelines_path
(
@project
)
}
"
,
pipelines_path
:
"
#{
pipelines_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
)
}
"
};
...
...
changelogs/unreleased/25811-pipeline-number-and-url-do-not-update-when-new-pipeline-is-triggered.yml
0 → 100644
浏览文件 @
2916ea82
---
title
:
Update pipeline and commit links when CI status is updated
merge_request
:
8351
author
:
spec/javascripts/merge_request_widget_spec.js
浏览文件 @
2916ea82
/* eslint-disable space-before-function-paren, quotes, comma-dangle, dot-notation, quote-props, no-var, max-len */
/*= require merge_request_widget */
/*= require smart_interval */
/*= require lib/utils/datetime_utility */
(
function
()
{
...
...
@@ -21,7 +22,11 @@
normal
:
"
Build {{status}}
"
},
gitlab_icon
:
"
gitlab_logo.png
"
,
builds_path
:
"
http://sampledomain.local/sampleBuildsPath
"
ci_pipeline
:
80
,
ci_sha
:
"
12a34bc5
"
,
builds_path
:
"
http://sampledomain.local/sampleBuildsPath
"
,
commits_path
:
"
http://sampledomain.local/commits
"
,
pipeline_path
:
"
http://sampledomain.local/pipelines
"
};
this
[
"
class
"
]
=
new
window
.
gl
.
MergeRequestWidget
(
this
.
opts
);
});
...
...
@@ -118,10 +123,11 @@
});
});
return
describe
(
'
getCIStatus
'
,
function
()
{
describe
(
'
getCIStatus
'
,
function
()
{
beforeEach
(
function
()
{
this
.
ciStatusData
=
{
"
title
"
:
"
Sample MR title
"
,
"
pipeline
"
:
80
,
"
sha
"
:
"
12a34bc5
"
,
"
status
"
:
"
success
"
,
"
coverage
"
:
98
...
...
@@ -165,6 +171,22 @@
this
[
"
class
"
].
getCIStatus
(
true
);
return
expect
(
spy
).
not
.
toHaveBeenCalled
();
});
it
(
'
should update the pipeline URL when the pipeline changes
'
,
function
()
{
var
spy
;
spy
=
spyOn
(
this
[
"
class
"
],
'
updatePipelineUrls
'
).
and
.
stub
();
this
[
"
class
"
].
getCIStatus
(
false
);
this
.
ciStatusData
.
pipeline
+=
1
;
this
[
"
class
"
].
getCIStatus
(
false
);
return
expect
(
spy
).
toHaveBeenCalled
();
});
it
(
'
should update the commit URL when the sha changes
'
,
function
()
{
var
spy
;
spy
=
spyOn
(
this
[
"
class
"
],
'
updateCommitUrls
'
).
and
.
stub
();
this
[
"
class
"
].
getCIStatus
(
false
);
this
.
ciStatusData
.
sha
=
"
9b50b99a
"
;
this
[
"
class
"
].
getCIStatus
(
false
);
return
expect
(
spy
).
toHaveBeenCalled
();
});
});
});
}).
call
(
this
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录