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
fc5eb253
Commit
fc5eb253
authored
Nov 17, 2016
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor store
parent
46898c40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
store.js.es6
app/assets/javascripts/vue_pipelines_index/store.js.es6
+11
-5
No files found.
app/assets/javascripts/vue_pipelines_index/store.js.es6
View file @
fc5eb253
...
@@ -34,7 +34,13 @@
...
@@ -34,7 +34,13 @@
gl.PipelineStore = class {
gl.PipelineStore = class {
fetchDataLoop(Vue, pageNum, url) {
fetchDataLoop(Vue, pageNum, url) {
Vue.activeResources = 0;
const setVueResources = () => { Vue.activeResources = 1; };
const resetVueResources = () => { Vue.activeResources = 0; };
const addToVueResources = () => { Vue.activeResources += 1; };
const subtractFromVueResources = () => { Vue.activeResources -= 1; };
resetVueResources(); // set Vue.resources to 0
const updatePipelineNums = (total, running) => {
const updatePipelineNums = (total, running) => {
document.querySelector('.js-totalbuilds-count').innerHTML = total;
document.querySelector('.js-totalbuilds-count').innerHTML = total;
document.querySelector('.js-running-count').innerHTML = running;
document.querySelector('.js-running-count').innerHTML = running;
...
@@ -42,9 +48,9 @@
...
@@ -42,9 +48,9 @@
const resourceChecker = () => {
const resourceChecker = () => {
if (Vue.activeResources === 0) {
if (Vue.activeResources === 0) {
Vue.activeResources = 1
;
setVueResources()
;
} else {
} else {
Vue.activeResources += 1
;
addToVueResources()
;
}
}
};
};
...
@@ -57,7 +63,7 @@
...
@@ -57,7 +63,7 @@
Vue.set(this, 'count', res.count);
Vue.set(this, 'count', res.count);
updatePipelineNums(this.count.all, this.count.running_or_pending);
updatePipelineNums(this.count.all, this.count.running_or_pending);
this.pageRequest = false;
this.pageRequest = false;
Vue.activeResources -= 1
;
subtractFromVueResources()
;
}, () => new Flash(
}, () => new Flash(
'Something went wrong on our end.'
'Something went wrong on our end.'
));
));
...
@@ -71,7 +77,7 @@
...
@@ -71,7 +77,7 @@
Vue.set(this, 'pipelines', p.updatePipelines(res));
Vue.set(this, 'pipelines', p.updatePipelines(res));
Vue.set(this, 'count', res.count);
Vue.set(this, 'count', res.count);
updatePipelineNums(this.count.all, this.count.running_or_pending);
updatePipelineNums(this.count.all, this.count.running_or_pending);
Vue.activeResources -= 1
;
subtractFromVueResources()
;
}, () => new Flash(
}, () => new Flash(
'Something went wrong on our end.'
'Something went wrong on our 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