Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
f41c3c02
Commit
f41c3c02
authored
Nov 10, 2016
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add update pipelines endpoint checker
parent
38bb3488
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
+1
-1
app/assets/javascripts/vue_pipelines_index/store.js.es6
app/assets/javascripts/vue_pipelines_index/store.js.es6
+37
-1
No files found.
app/assets/javascripts/vue_pipelines_index/pipelines.js.es6
View file @
f41c3c02
...
...
@@ -17,8 +17,8 @@
data() {
return {
pipelines: [],
currentPage: '',
intervalId: '',
updatedAt: '',
pagenum: 1,
count: {
all: 0,
...
...
app/assets/javascripts/vue_pipelines_index/store.js.es6
View file @
f41c3c02
...
...
@@ -2,22 +2,58 @@
/* eslint-disable no-param-reassign */
((gl) => {
class PipelineUpdater {
constructor(pipelines) {
this.pipelines = pipelines;
this.updateClone = (update, newPipe) => {
update.forEach((pipe) => {
if (pipe.id === newPipe.id) pipe = Object.assign(pipe, newPipe);
});
};
}
updatePipelines(apiResponse) {
const update = this.pipelines.map(e => e);
apiResponse.pipelines.forEach((newPipe) => {
if (Object.keys(newPipe).length <= 2) return;
if (Object.keys(newPipe).length > 3) {
update.unshift(newPipe);
} else {
this.updateClone(update, newPipe);
}
});
this.pipelines = update;
return this.pipelines;
}
}
gl.PipelineStore = class {
fetchDataLoop(Vue, pageNum, url) {
const goFetch = () =>
this.$http.get(`${url}?page=${pageNum}`)
.then((response) => {
const res = JSON.parse(response.body);
Vue.set(this, 'updatedAt', res.updated_at);
Vue.set(this, 'pipelines', res.pipelines);
Vue.set(this, 'count', res.count);
}, () => new Flash(
'Something went wrong on our end.'
));
const goUpdate = () =>
this.$http.get(`${url}?page=${pageNum}&updated_at=${this.updatedAt}`)
.then((response) => {
const res = JSON.parse(response.body);
const p = new PipelineUpdater(this.pipelines);
Vue.set(this, 'pipelines', p.updatePipelines(res));
}, () => new Flash(
'Something went wrong on our end.'
));
goFetch();
this.intervalId = setInterval(() => {
go
Fetch
();
go
Update
();
}, 3000);
}
};
...
...
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