diff options
Diffstat (limited to 'app')
4 files changed, 42 insertions, 43 deletions
diff --git a/app/assets/javascripts/environments/components/environment_item.js.es6 b/app/assets/javascripts/environments/components/environment_item.js.es6 index df9f28b1c59..ab58e1cc4c0 100644 --- a/app/assets/javascripts/environments/components/environment_item.js.es6 +++ b/app/assets/javascripts/environments/components/environment_item.js.es6 @@ -1,23 +1,23 @@ (() => { - + /** * Envrionment Item Component - * + * * Used in a hierarchical structure to show folders with children * in a table. - * Recursive component based on [Tree View](https://vuejs.org/examples/tree-view.html) - * - * See this [issue](https://gitlab.com/gitlab-org/gitlab-ce/issues/22539) + * Recursive component based on [Tree View](https://vuejs.org/examples/tree-view.html) + * + * See this [issue](https://gitlab.com/gitlab-org/gitlab-ce/issues/22539) * for more information. */ - + const Store = gl.environmentsList.EnvironmentsStore; window.gl = window.gl || {}; window.gl.environmentsList = window.gl.environmentsList || {}; - + gl.environmentsList.EnvironmentItem = Vue.component('environment-item', { - + template: '#environment-item-template', props: { @@ -31,11 +31,11 @@ }, computed: { - + /** * If an item has a `children` entry it means it is a folder. * Folder items have different behaviours - it is possible to toggle - * them and show their children. + * them and show their children. * * @returns {Boolean} */ diff --git a/app/assets/javascripts/environments/environments_bundle.js.es6 b/app/assets/javascripts/environments/environments_bundle.js.es6 index 8e13e7e20a7..286d81bab7f 100644 --- a/app/assets/javascripts/environments/environments_bundle.js.es6 +++ b/app/assets/javascripts/environments/environments_bundle.js.es6 @@ -6,30 +6,29 @@ //= require ../boards/vue_resource_interceptor $(() => { - + const environmentsListApp = document.getElementById('environments-list-view'); const Store = gl.environmentsList.EnvironmentsStore; - + window.gl = window.gl || {}; - + if (gl.EnvironmentsListApp) { gl.EnvironmentsListApp.$destroy(true); } - - + const filterState = (state) => (environment) => environment.state === state && environment; - - // recursiveMap :: (Function, Array) -> Array + + // recursiveMap :: (Function, Array) -> Array const recursiveMap = (fn, arr) => { return arr.map((item) => { if (!item.children) { return fn(item); } - + const filteredChildren = recursiveMap(fn, item.children).filter(Boolean); if (filteredChildren.length) { item.children = filteredChildren; return item; } - + }).filter(Boolean); }; @@ -47,18 +46,18 @@ $(() => { loading: true, visibility: 'available' }, - + computed: { filteredEnvironments () { return recursiveMap(filterState(this.visibility), this.state.environments); } }, - + init: Store.create.bind(Store), - + created() { gl.environmentsService = new EnvironmentsService(this.endpoint); - + const scope = this.$options.getQueryParameter('scope'); if (scope) { this.visibility = scope; @@ -67,7 +66,7 @@ $(() => { /** * Fetches all the environmnets and stores them. - * Toggles loading property. + * Toggles loading property. */ ready() { gl.environmentsService.all().then((resp) => { @@ -75,11 +74,11 @@ $(() => { this.loading = false; }); }, - + /** * Transforms the url parameter into an object and * returns the one requested. - * + * * @param {String} param * @returns {String} The value of the requested parameter. */ diff --git a/app/assets/javascripts/environments/services/environments_service.js.es6 b/app/assets/javascripts/environments/services/environments_service.js.es6 index 5cc194ac034..6e0f5b431e3 100644 --- a/app/assets/javascripts/environments/services/environments_service.js.es6 +++ b/app/assets/javascripts/environments/services/environments_service.js.es6 @@ -1,16 +1,16 @@ class EnvironmentsService { - + constructor (root) { Vue.http.options.root = root; - + this.environments = Vue.resource(root); - + Vue.http.interceptors.push((request, next) => { request.headers['X-CSRF-Token'] = $.rails.csrfToken(); next(); }); } - + all () { return this.environments.get(); } diff --git a/app/assets/javascripts/environments/stores/environmnets_store.js.es6 b/app/assets/javascripts/environments/stores/environmnets_store.js.es6 index de51d94d2b5..c0e97413636 100644 --- a/app/assets/javascripts/environments/stores/environmnets_store.js.es6 +++ b/app/assets/javascripts/environments/stores/environmnets_store.js.es6 @@ -12,15 +12,15 @@ }, /** - * In order to display a tree view we need to modify the received - * data in to a tree structure based on `environment_type` + * In order to display a tree view we need to modify the received + * data in to a tree structure based on `environment_type` * sorted alphabetically. * In each children a `vue-` property will be added. This property will be - * used to know if an item is a children mostly for css purposes. This is + * used to know if an item is a children mostly for css purposes. This is * needed because the children row is a fragment instance and therfore does * not accept non-prop attributes. - * - * + * + * * @example * it will transform this: * [ @@ -30,7 +30,7 @@ * ] * into this: * [ - * { name: "review", children: + * { name: "review", children: * [ * { name: "environment", environment_type: "review", vue-isChildren: true}, * { name: "environment_2", environment_type: "review", vue-isChildren: true} @@ -38,8 +38,8 @@ * }, * {name: "environment_1", environment_type: null} * ] - * - * + * + * * @param {Array} environments List of environments. * @returns {Array} Tree structured array with the received environments. */ @@ -56,13 +56,13 @@ if (environment.last_deployment.manual_actions) { environment.last_deployment.manual_actions = environment.last_deployment.manual_actions.map((action) => Object.assign({}, action, {name: gl.text.humanize(action.name)})); } - + //transforms created date for deployment in a human readable format if (environment.last_deployment.created_at) { // TODO - how to do this without jquery } } - + if (environment.environment_type !== null) { const occurs = acc.find((element, index, array) => { return element.children && element.name === environment.environment_type; @@ -89,15 +89,15 @@ }, []).sort(this.sortByName); this.state.environments = environmentsTree; - + return environmentsTree; }, /** - * Given an array of environments, returns the number of environments + * Given an array of environments, returns the number of environments * that have the given state. * - * @param {Array} environments + * @param {Array} environments * @param {String} state * @returns {Number} */ |