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
71899e10
Commit
71899e10
authored
Feb 03, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjustments for the new response with counters
a
parent
2aeb45bd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
environment.js.es6
...ts/javascripts/environments/components/environment.js.es6
+6
-2
environments_store.js.es6
...javascripts/environments/stores/environments_store.js.es6
+20
-2
environments_store_spec.js.es6
spec/javascripts/environments/environments_store_spec.js.es6
+1
-1
No files found.
app/assets/javascripts/environments/components/environment.js.es6
View file @
71899e10
...
@@ -7,6 +7,7 @@ window.Vue = require('vue');
...
@@ -7,6 +7,7 @@ window.Vue = require('vue');
window.Vue.use(require('vue-resource'));
window.Vue.use(require('vue-resource'));
require('../services/environments_service');
require('../services/environments_service');
require('./environment_item');
require('./environment_item');
require('../../vue_pagination/index');
(() => {
(() => {
window.gl = window.gl || {};
window.gl = window.gl || {};
...
@@ -79,7 +80,9 @@ require('./environment_item');
...
@@ -79,7 +80,9 @@ require('./environment_item');
return gl.environmentsService.all()
return gl.environmentsService.all()
.then(resp => resp.json())
.then(resp => resp.json())
.then((json) => {
.then((json) => {
this.store.storeEnvironments(json);
this.store.storeAvailableCount(json.available_count);
this.store.storeStoppedCount(json.stopped_count);
this.store.storeEnvironments(json.environments);
})
})
.then(() => {
.then(() => {
this.isLoading = false;
this.isLoading = false;
...
@@ -131,7 +134,8 @@ require('./environment_item');
...
@@ -131,7 +134,8 @@ require('./environment_item');
{{state.availableCounter}}
{{state.availableCounter}}
</span>
</span>
</a>
</a>
</li><li v-bind:class="{ 'active' : scope === 'stopped' }">
</li>
<li v-bind:class="{ 'active' : scope === 'stopped' }">
<a :href="projectStoppedEnvironmentsPath">
<a :href="projectStoppedEnvironmentsPath">
Stopped
Stopped
<span class="badge js-stopped-environments-count">
<span class="badge js-stopped-environments-count">
...
...
app/assets/javascripts/environments/stores/environments_store.js.es6
View file @
71899e10
...
@@ -42,8 +42,26 @@
...
@@ -42,8 +42,26 @@
return filteredEnvironments;
return filteredEnvironments;
},
},
storeCounts() {
/**
//TODO
* Stores the number of available environments.
*
* @param {Number} count = 0
* @return {Number}
*/
storeAvailableCount(count = 0) {
this.state.availableCounter = count;
return count;
},
/**
* Stores the number of closed environments.
*
* @param {Number} count = 0
* @return {Number}
*/
storeStoppedCount(count = 0) {
this.state.stoppedCounter = count;
return count;
},
},
};
};
...
...
spec/javascripts/environments/environments_store_spec.js.es6
View file @
71899e10
...
@@ -22,7 +22,7 @@ require('./mock_data');
...
@@ -22,7 +22,7 @@ require('./mock_data');
it('should store environments', () => {
it('should store environments', () => {
expect(
expect(
gl.environmentsList.EnvironmentsStore.state.environments.length
gl.environmentsList.EnvironmentsStore.state.environments.length
,
).toBe(environmentsList.length);
).toBe(environmentsList.length);
});
});
});
});
...
...
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