summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/clusters/clusters_bundle.js
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2017-11-06 10:07:19 -0600
committerEric Eastwood <contact@ericeastwood.com>2017-11-06 10:07:19 -0600
commitf4fb0340094508106113c0c7c22c865fa7c73f7f (patch)
treea0efd5829901b6b73f3d6a6625a74a67bc497b0e /app/assets/javascripts/clusters/clusters_bundle.js
parent895b6e5d80397fdd6cb5e1727a410a08f8a5b332 (diff)
downloadgitlab-ce-f4fb0340094508106113c0c7c22c865fa7c73f7f.tar.gz
Add FE tests for not_installable/scheduled and cluster banner rules36629-35958-add-cluster-application-section
Diffstat (limited to 'app/assets/javascripts/clusters/clusters_bundle.js')
-rw-r--r--app/assets/javascripts/clusters/clusters_bundle.js48
1 files changed, 28 insertions, 20 deletions
diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js
index 4d4c90460d2..c486208175f 100644
--- a/app/assets/javascripts/clusters/clusters_bundle.js
+++ b/app/assets/javascripts/clusters/clusters_bundle.js
@@ -28,6 +28,8 @@ export default class Clusters {
const {
statusPath,
installHelmPath,
+ installIngressPath,
+ installRunnerPath,
clusterStatus,
clusterStatusReason,
helpPath,
@@ -40,6 +42,8 @@ export default class Clusters {
this.service = new ClustersService({
endpoint: statusPath,
installHelmEndpoint: installHelmPath,
+ installIngresEndpoint: installIngressPath,
+ installRunnerEndpoint: installRunnerPath,
});
this.toggle = this.toggle.bind(this);
@@ -57,7 +61,7 @@ export default class Clusters {
this.initApplications();
if (this.store.state.status !== 'created') {
- this.updateContainer(this.store.state.status, this.store.state.statusReason);
+ this.updateContainer(null, this.store.state.status, this.store.state.statusReason);
}
this.addListeners();
@@ -131,13 +135,13 @@ export default class Clusters {
}
handleSuccess(data) {
- const prevApplicationMap = Object.assign({}, this.store.state.applications);
const prevStatus = this.store.state.status;
+ const prevApplicationMap = Object.assign({}, this.store.state.applications);
+
this.store.updateStateFromServer(data.data);
+
this.checkForNewInstalls(prevApplicationMap, this.store.state.applications);
- if (prevStatus.length == 0 || prevStatus !== this.store.state.status) {
- this.updateContainer(this.store.state.status, this.store.state.statusReason);
- }
+ this.updateContainer(prevStatus, this.store.state.status, this.store.state.statusReason);
}
toggle() {
@@ -168,22 +172,26 @@ export default class Clusters {
}
}
- updateContainer(status, error) {
+ updateContainer(prevStatus, status, error) {
this.hideAll();
- switch (status) {
- case 'created':
- this.successContainer.classList.remove('hidden');
- break;
- case 'errored':
- this.errorContainer.classList.remove('hidden');
- this.errorReasonContainer.textContent = error;
- break;
- case 'scheduled':
- case 'creating':
- this.creatingContainer.classList.remove('hidden');
- break;
- default:
- this.hideAll();
+
+ // We poll all the time but only want the `created` banner to show when newly created
+ if (this.store.state.status !== 'created' || prevStatus !== this.store.state.status) {
+ switch (status) {
+ case 'created':
+ this.successContainer.classList.remove('hidden');
+ break;
+ case 'errored':
+ this.errorContainer.classList.remove('hidden');
+ this.errorReasonContainer.textContent = error;
+ break;
+ case 'scheduled':
+ case 'creating':
+ this.creatingContainer.classList.remove('hidden');
+ break;
+ default:
+ this.hideAll();
+ }
}
}