Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
035cb734
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,发现更多精彩内容 >>
提交
035cb734
编写于
2月 02, 2017
作者:
F
Filipa Lacerda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add time ago auto-update to the 2 newest tables
上级
afa92914
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
16 deletion
+43
-16
app/assets/javascripts/commit/pipelines/pipelines_store.js.es6
...ssets/javascripts/commit/pipelines/pipelines_store.js.es6
+28
-0
app/assets/javascripts/commit/pipelines/pipelines_table.js.es6
...ssets/javascripts/commit/pipelines/pipelines_table.js.es6
+5
-2
app/assets/javascripts/vue_pipelines_index/pipeline_actions.js.es6
...s/javascripts/vue_pipelines_index/pipeline_actions.js.es6
+2
-2
app/assets/javascripts/vue_pipelines_index/store.js.es6
app/assets/javascripts/vue_pipelines_index/store.js.es6
+5
-3
app/views/projects/pipelines/index.html.haml
app/views/projects/pipelines/index.html.haml
+2
-1
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+1
-8
未找到文件。
app/assets/javascripts/commit/pipelines/pipelines_store.js.es6
浏览文件 @
035cb734
/* eslint-disable no-underscore-dangle*/
/**
* Pipelines' Store for commits view.
*
...
...
@@ -20,7 +21,34 @@
store(pipelines = []) {
this.state.pipelines = pipelines;
return pipelines;
},
/**
* Once the data is received we will start the time ago loops.
*
* Everytime a request is made like retry or cancel a pipeline, every 10 seconds we
* update the time to show how long as passed.
*
*/
startTimeAgoLoops() {
const startTimeLoops = () => {
this.timeLoopInterval = setInterval(() => {
this.$children[0].$children.reduce((acc, component) => {
const timeAgoComponent = component.$children.filter(el => el.$options._componentTag === 'time-ago')[0];
acc.push(timeAgoComponent);
return acc;
}, []).forEach(e => e.changeTime());
}, 10000);
};
startTimeLoops();
const removeIntervals = () => clearInterval(this.timeLoopInterval);
const startIntervals = () => startTimeLoops();
gl.VueRealtimeListener(removeIntervals, startIntervals);
},
};
})();
app/assets/javascripts/commit/pipelines/pipelines_table.js.es6
浏览文件 @
035cb734
...
...
@@ -5,6 +5,7 @@
//= require vue-resource
//= require vue_shared/vue_resource_interceptor
//= require vue_shared/components/pipelines_table
//= require vue_realtime_listener/index
/**
*
...
...
@@ -71,10 +72,12 @@
.then(response => response.json())
.then((json) => {
this.store.store(json);
this.store.startTimeAgoLoops.call(this, Vue);
this.isLoading = false;
}).catch(() => {
})
.catch(() => {
this.isLoading = false;
new Flash('An error occurred while fetching the pipelines.', 'alert');
new Flash('An error occurred while fetching the pipelines
, please reload the page again
.', 'alert');
});
},
...
...
app/assets/javascripts/vue_pipelines_index/pipeline_actions.js.es6
浏览文件 @
035cb734
...
...
@@ -70,7 +70,7 @@
</div>
</div>
<div class="cancel-retry-btns inline">
<
button
<
a
v-if='pipeline.flags.retryable'
class="btn has-tooltip"
title="Retry"
...
...
@@ -82,7 +82,7 @@
aria-label="Retry">
<i class="fa fa-repeat" aria-hidden="true"></i>
</a>
<
button
<
a
v-if='pipeline.flags.cancelable'
class="btn btn-remove has-tooltip"
title="Cancel"
...
...
app/assets/javascripts/vue_pipelines_index/store.js.es6
浏览文件 @
035cb734
...
...
@@ -48,9 +48,11 @@
const startTimeLoops = () => {
this.timeLoopInterval = setInterval(() => {
this.$children
.filter(e => e.$options._componentTag === 'time-ago')
.forEach(e => e.changeTime());
this.$children[0].$children.reduce((acc, component) => {
const timeAgoComponent = component.$children.filter(el => el.$options._componentTag === 'time-ago')[0];
acc.push(timeAgoComponent);
return acc;
}, []).forEach(e => e.changeTime());
}, 10000);
};
...
...
app/views/projects/pipelines/index.html.haml
浏览文件 @
035cb734
...
...
@@ -64,4 +64,5 @@
.vue-pipelines-index
=
page_specific_javascript_tag
(
'vue_pipelines_index/index.js'
)
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_tag
(
'vue_pipelines_index/index.js'
)
spec/controllers/projects/merge_requests_controller_spec.rb
浏览文件 @
035cb734
...
...
@@ -701,15 +701,8 @@ describe Projects::MergeRequestsController do
format: :json
end
it
'responds with a rendered HTML partial'
do
expect
(
response
)
.
to
render_template
(
'projects/merge_requests/show/_pipelines'
)
expect
(
json_response
).
to
have_key
'html'
end
it
'responds with serialized pipelines'
do
expect
(
json_response
).
to
have_key
'pipelines'
expect
(
json_response
[
'pipelines'
]).
not_to
be_empty
expect
(
json_response
).
not_to
be_empty
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录