diff --git a/app/authenticated/cluster/controller.js b/app/authenticated/cluster/controller.js index 571040e15..6fc2991f5 100644 --- a/app/authenticated/cluster/controller.js +++ b/app/authenticated/cluster/controller.js @@ -1,6 +1,17 @@ import Controller from '@ember/controller'; +import { get, set, observer } from '@ember/object'; export default Controller.extend({ - // might be an ember bug but if we dont have an empty controller here the transtion from the cluster managemnt page - // via launchOnCluster and useKubernetes fails because of a missing lookup. + + wasReady: true, + watchReady: observer('model.isReady', function() { + const wasReady = get(this,'wasReady'); + const isReady = get(this,'model.isReady'); + + set(this,'wasReady', isReady); + + if ( isReady && !wasReady ) { + this.send('becameReady'); + } + }) }); diff --git a/app/authenticated/cluster/route.js b/app/authenticated/cluster/route.js index 0a0b6e6ab..bccc2ae82 100644 --- a/app/authenticated/cluster/route.js +++ b/app/authenticated/cluster/route.js @@ -9,18 +9,29 @@ export default Route.extend(Preload, { globalStore: service(), clusterStore: service(), + actions: { + becameReady() { + get(this,'clusterStore').reset(); + this.refresh(); + }, + }, + model(params, transition) { return get(this, 'globalStore').find('cluster', params.cluster_id).then((cluster) => { return get(this, 'scope').startSwitchToCluster(cluster).then(() => { - return this.loadSchemas('clusterStore').then(() => { - return PromiseAll([ - this.preload('namespace','clusterStore'), - this.preload('storageClass','clusterStore'), - this.preload('persistentVolume','clusterStore'), - ]).then(() => { - return cluster; + if ( get(cluster,'isReady') ) { + return this.loadSchemas('clusterStore').then(() => { + return PromiseAll([ + this.preload('namespace','clusterStore'), + this.preload('storageClass','clusterStore'), + this.preload('persistentVolume','clusterStore'), + ]).then(() => { + return cluster; + }); }); - }); + } else { + return cluster; + } }).catch((err) => { // @TODO-2.0 right now the API can't return schemas for a not-active cluster if ( err.status === 404 ) { diff --git a/app/authenticated/cluster/template.hbs b/app/authenticated/cluster/template.hbs index 51075946f..4cd2fa269 100644 --- a/app/authenticated/cluster/template.hbs +++ b/app/authenticated/cluster/template.hbs @@ -1,6 +1,6 @@ -{{#unless model.isActive}} +{{#unless model.isReady}} {{#banner-message color='bg-error m-0'}} -

{{t 'clusterDashboard.notActive' state=model.displayState htmlSafe=true}}

+

{{t 'clusterDashboard.notReady' state=model.displayState htmlSafe=true}}

{{#if model.showTransitioningMessage}}

{{uc-first model.transitioningMessage}}

{{/if}} diff --git a/app/models/cluster.js b/app/models/cluster.js index b335c07a0..50885c10d 100644 --- a/app/models/cluster.js +++ b/app/models/cluster.js @@ -53,6 +53,10 @@ export default Resource.extend(ResourceUsage, { return null; }), + isReady: computed('conditions.@each.status', function() { + return this.hasCondition('Ready'); + }), + isRKE: computed('configName', function() { return get(this, 'configName') === 'rancherKubernetesEngineConfig'; }), diff --git a/lib/login/addon/login/controller.js b/lib/login/addon/login/controller.js index a4d61ca89..55c865d4b 100644 --- a/lib/login/addon/login/controller.js +++ b/lib/login/addon/login/controller.js @@ -149,7 +149,9 @@ export default Controller.extend({ var pass = $('.login-pass')[0]; if ( reload ) { - reload.focus(); + setTimeout(() => { + reload.focus(); + }, 250); } else if ( user ) { if ( user.value ) { pass.focus(); diff --git a/lib/shared/addon/components/cluster-driver/driver-googlegke/component.js b/lib/shared/addon/components/cluster-driver/driver-googlegke/component.js index c5fe2fdd5..4ca96e6ae 100644 --- a/lib/shared/addon/components/cluster-driver/driver-googlegke/component.js +++ b/lib/shared/addon/components/cluster-driver/driver-googlegke/component.js @@ -28,7 +28,7 @@ export default Component.extend(ClusterDriver, { diskSizeGb: 100, enableAlphaFeature: false, nodeCount: 3, - machineType: 'n1-standard-1', + machineType: 'g1-small', zone: 'us-central1-f', clusterIpv4Cidr: '', }); diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 4c2c3037c..04178dadd 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -695,7 +695,7 @@ clusterDashboard: scheduler: Scheduler controllerManager: Controller Manager value: Value - notActive: This cluster is currently in {state} state. Areas that require communicating with the cluster will be unavailable until it becomes Active. + notReady: This cluster is currently {state}; areas that interact directly with the it will not be available until the API becomes ready to communicate with. noNodes: There are no nodes. alert: node: "Alert: Node {node} is not active."