Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2016-11-14 18:38:41 +0300
committerFilipa Lacerda <filipa@gitlab.com>2016-11-16 14:58:19 +0300
commit09c4542946fb5ba8f7ac12bd8952f5669156a27e (patch)
tree5e9f4cb4b8d35ff1919403a425326936247d7c74 /app/assets/javascripts/environments/stores
parenta7a13ed3ef281f36dcd0c15540437aaf9aac39dc (diff)
Refactor to work with vue 2 with just one root element
Diffstat (limited to 'app/assets/javascripts/environments/stores')
-rw-r--r--app/assets/javascripts/environments/stores/environments_store.js.es624
1 files changed, 24 insertions, 0 deletions
diff --git a/app/assets/javascripts/environments/stores/environments_store.js.es6 b/app/assets/javascripts/environments/stores/environments_store.js.es6
index b8fe25ef313..928786f0741 100644
--- a/app/assets/javascripts/environments/stores/environments_store.js.es6
+++ b/app/assets/javascripts/environments/stores/environments_store.js.es6
@@ -64,6 +64,8 @@
acc.push({
name: environment.environment_type,
children: [environment],
+ isOpen: false,
+ 'vue-isChildren': environment['vue-isChildren'],
});
}
} else {
@@ -79,6 +81,28 @@
},
/**
+ * Toggles folder open property given the environment type.
+ *
+ * @param {String} envType
+ * @return {Array}
+ */
+ toggleFolder(envType) {
+ const environments = this.state.environments;
+
+ const environmnetsCopy = environments.map((env) => {
+ if (env['vue-isChildren'] === true && env.name === envType) {
+ env.isOpen = !env.isOpen;
+ }
+
+ return env;
+ });
+
+ this.state.environments = environmnetsCopy;
+
+ return environmnetsCopy;
+ },
+
+ /**
* Given an array of environments, returns the number of environments
* that have the given state.
*