BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
035cb734
Commit
035cb734
authored
Feb 02, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add time ago auto-update to the 2 newest tables
parent
afa92914
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
16 deletions
+43
-16
pipelines_store.js.es6
...ssets/javascripts/commit/pipelines/pipelines_store.js.es6
+28
-0
pipelines_table.js.es6
...ssets/javascripts/commit/pipelines/pipelines_table.js.es6
+5
-2
pipeline_actions.js.es6
...s/javascripts/vue_pipelines_index/pipeline_actions.js.es6
+2
-2
store.js.es6
app/assets/javascripts/vue_pipelines_index/store.js.es6
+5
-3
index.html.haml
app/views/projects/pipelines/index.html.haml
+2
-1
merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+1
-8
No files found.
app/assets/javascripts/commit/pipelines/pipelines_store.js.es6
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment