diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2016-10-24 14:42:01 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2016-11-16 14:57:57 +0300 |
commit | d697b9c86d76603a6eda906572e37ccb049e78cd (patch) | |
tree | 81d9192f16c79a0747aab351eb82ac32f67742f0 /app/assets/javascripts/environments/stores | |
parent | a265826e01dec5341521deb029d6d3aa93ffa6d4 (diff) |
Adds link to actions. Cleans spaces
Diffstat (limited to 'app/assets/javascripts/environments/stores')
-rw-r--r-- | app/assets/javascripts/environments/stores/environmnets_store.js.es6 | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/app/assets/javascripts/environments/stores/environmnets_store.js.es6 b/app/assets/javascripts/environments/stores/environmnets_store.js.es6 index 8b5cb67ed37..35563b0d7fa 100644 --- a/app/assets/javascripts/environments/stores/environmnets_store.js.es6 +++ b/app/assets/javascripts/environments/stores/environmnets_store.js.es6 @@ -1,14 +1,14 @@ (() => { window.gl = window.gl || {}; window.gl.environmentsList = window.gl.environmentsList || {}; - + gl.environmentsList.EnvironmentsStore = { state: {}, - + create () { this.state.environments = []; }, - + /** * In order to display a tree view we need to modify the received * data in to a tree structure based on `environment_type` @@ -87,15 +87,22 @@ return environmentsTree; }, - - sortByName (a,b) { + + /** + * Sorts the two objects provided by their name. + * + * @param {Object} a + * @param {Object} b + * @returns {Number} + */ + sortByName (a, b) { const nameA = a.name.toUpperCase(); const nameB = b.name.toUpperCase(); - + if (nameA < nameB) { return -1; } - + if (nameA > nameB) { return 1; } |