diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2016-10-21 12:06:33 +0100 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2016-11-16 11:57:55 +0000 |
commit | ea91d9cc970883e0de5dfb35894d52a60f258d3b (patch) | |
tree | a47b2de977b926493feafcc62fc28b49ddd817ca /app/assets | |
parent | 9c1e5649a59ec21dbd5eb47e2bbc8c903bd8b18a (diff) | |
download | gitlab-ce-ea91d9cc970883e0de5dfb35894d52a60f258d3b.tar.gz |
Adds attribute in store
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/environments/stores/environmnets_store.js.es6 | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/app/assets/javascripts/environments/stores/environmnets_store.js.es6 b/app/assets/javascripts/environments/stores/environmnets_store.js.es6 index 564b33607d7..dbf1bee05bb 100644 --- a/app/assets/javascripts/environments/stores/environmnets_store.js.es6 +++ b/app/assets/javascripts/environments/stores/environmnets_store.js.es6 @@ -13,6 +13,11 @@ * 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 + * needed because the children row is a fragment instance and therfore does + * not accept non-prop attributes. + * * * @example * it will transform this: @@ -25,8 +30,8 @@ * [ * { name: "review", children: * [ - * { name: "environment", environment_type: "review"}, - * { name: "environment_2", environment_type: "review"} + * { name: "environment", environment_type: "review", vue-isChildren: true}, + * { name: "environment_2", environment_type: "review", vue-isChildren: true} * ] * }, * {name: "environment_1", environment_type: null} @@ -44,12 +49,15 @@ }); if (occurs !== undefined) { - acc[acc.indexOf(occurs)].children.push(environment); + acc[acc.indexOf(occurs)].children.push( + Object.assign({}, environment, {"vue-isChildren": true})); acc[acc.indexOf(occurs)].children.sort(); } else { acc.push({ name: environment.environment_type, - children: [environment] + children: [ + Object.assign({}, environment, {"vue-isChildren": true}) + ] }); } } else { |