diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-10-24 07:56:39 +0300 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-11-03 11:28:57 -0500 |
commit | 797e758beb882d67f32b87db6453cad41c0b931f (patch) | |
tree | 7e3a35aa71b0d484f727a29f88f16f3b3d0ffa29 /app/assets/javascripts/clusters/stores/clusters_store.js | |
parent | e6616e0468deaf1e37ddddc9332cc3e677567410 (diff) | |
download | gitlab-ce-797e758beb882d67f32b87db6453cad41c0b931f.tar.gz |
Add applications section to GKE clusters page
Diffstat (limited to 'app/assets/javascripts/clusters/stores/clusters_store.js')
-rw-r--r-- | app/assets/javascripts/clusters/stores/clusters_store.js | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/app/assets/javascripts/clusters/stores/clusters_store.js b/app/assets/javascripts/clusters/stores/clusters_store.js new file mode 100644 index 00000000000..e731cdc3042 --- /dev/null +++ b/app/assets/javascripts/clusters/stores/clusters_store.js @@ -0,0 +1,68 @@ +import { s__ } from '../../locale'; + +export default class ClusterStore { + constructor() { + this.state = { + helpPath: null, + status: null, + statusReason: null, + applications: { + helm: { + title: s__('ClusterIntegration|Helm Tiller'), + status: null, + statusReason: null, + requestStatus: null, + requestReason: null, + }, + ingress: { + title: s__('ClusterIntegration|Ingress'), + status: null, + statusReason: null, + requestStatus: null, + requestReason: null, + }, + runner: { + title: s__('ClusterIntegration|GitLab Runner'), + status: null, + statusReason: null, + requestStatus: null, + requestReason: null, + }, + }, + }; + } + + setHelpPath(helpPath) { + this.state.helpPath = helpPath; + } + + updateStatus(status) { + this.state.status = status; + } + + updateStatusReason(reason) { + this.state.statusReason = reason; + } + + updateAppProperty(appId, prop, value) { + this.state.applications[appId][prop] = value; + } + + updateStateFromServer(serverState = {}) { + this.state.status = serverState.status; + this.state.statusReason = serverState.status_reason; + serverState.applications.forEach((serverAppEntry) => { + const { + name: appId, + status, + status_reason: statusReason, + } = serverAppEntry; + + this.state.applications[appId] = { + ...(this.state.applications[appId] || {}), + status, + statusReason, + }; + }); + } +} |