mirror of https://github.com/rancher/ui.git
Watch for cluster readiness
This commit is contained in:
parent
f3bd6d6171
commit
866a829477
|
|
@ -1,6 +1,17 @@
|
||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
|
import { get, set, observer } from '@ember/object';
|
||||||
|
|
||||||
export default Controller.extend({
|
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');
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,17 @@ export default Route.extend(Preload, {
|
||||||
globalStore: service(),
|
globalStore: service(),
|
||||||
clusterStore: service(),
|
clusterStore: service(),
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
becameReady() {
|
||||||
|
get(this,'clusterStore').reset();
|
||||||
|
this.refresh();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
model(params, transition) {
|
model(params, transition) {
|
||||||
return get(this, 'globalStore').find('cluster', params.cluster_id).then((cluster) => {
|
return get(this, 'globalStore').find('cluster', params.cluster_id).then((cluster) => {
|
||||||
return get(this, 'scope').startSwitchToCluster(cluster).then(() => {
|
return get(this, 'scope').startSwitchToCluster(cluster).then(() => {
|
||||||
|
if ( get(cluster,'isReady') ) {
|
||||||
return this.loadSchemas('clusterStore').then(() => {
|
return this.loadSchemas('clusterStore').then(() => {
|
||||||
return PromiseAll([
|
return PromiseAll([
|
||||||
this.preload('namespace','clusterStore'),
|
this.preload('namespace','clusterStore'),
|
||||||
|
|
@ -21,6 +29,9 @@ export default Route.extend(Preload, {
|
||||||
return cluster;
|
return cluster;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
return cluster;
|
||||||
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
// @TODO-2.0 right now the API can't return schemas for a not-active cluster
|
// @TODO-2.0 right now the API can't return schemas for a not-active cluster
|
||||||
if ( err.status === 404 ) {
|
if ( err.status === 404 ) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{{#unless model.isActive}}
|
{{#unless model.isReady}}
|
||||||
{{#banner-message color='bg-error m-0'}}
|
{{#banner-message color='bg-error m-0'}}
|
||||||
<p>{{t 'clusterDashboard.notActive' state=model.displayState htmlSafe=true}}</p>
|
<p>{{t 'clusterDashboard.notReady' state=model.displayState htmlSafe=true}}</p>
|
||||||
{{#if model.showTransitioningMessage}}
|
{{#if model.showTransitioningMessage}}
|
||||||
<p class="{{model.stateColor}}">{{uc-first model.transitioningMessage}}</p>
|
<p class="{{model.stateColor}}">{{uc-first model.transitioningMessage}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,10 @@ export default Resource.extend(ResourceUsage, {
|
||||||
return null;
|
return null;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
isReady: computed('conditions.@each.status', function() {
|
||||||
|
return this.hasCondition('Ready');
|
||||||
|
}),
|
||||||
|
|
||||||
isRKE: computed('configName', function() {
|
isRKE: computed('configName', function() {
|
||||||
return get(this, 'configName') === 'rancherKubernetesEngineConfig';
|
return get(this, 'configName') === 'rancherKubernetesEngineConfig';
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,9 @@ export default Controller.extend({
|
||||||
var pass = $('.login-pass')[0];
|
var pass = $('.login-pass')[0];
|
||||||
|
|
||||||
if ( reload ) {
|
if ( reload ) {
|
||||||
|
setTimeout(() => {
|
||||||
reload.focus();
|
reload.focus();
|
||||||
|
}, 250);
|
||||||
} else if ( user ) {
|
} else if ( user ) {
|
||||||
if ( user.value ) {
|
if ( user.value ) {
|
||||||
pass.focus();
|
pass.focus();
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ export default Component.extend(ClusterDriver, {
|
||||||
diskSizeGb: 100,
|
diskSizeGb: 100,
|
||||||
enableAlphaFeature: false,
|
enableAlphaFeature: false,
|
||||||
nodeCount: 3,
|
nodeCount: 3,
|
||||||
machineType: 'n1-standard-1',
|
machineType: 'g1-small',
|
||||||
zone: 'us-central1-f',
|
zone: 'us-central1-f',
|
||||||
clusterIpv4Cidr: '',
|
clusterIpv4Cidr: '',
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -695,7 +695,7 @@ clusterDashboard:
|
||||||
scheduler: Scheduler
|
scheduler: Scheduler
|
||||||
controllerManager: Controller Manager
|
controllerManager: Controller Manager
|
||||||
value: Value
|
value: Value
|
||||||
notActive: This cluster is currently in <b>{state}</b> state. Areas that require communicating with the cluster will be unavailable until it becomes Active.
|
notReady: This cluster is currently <b>{state}</b>; areas that interact directly with the it will not be available until the API becomes ready to communicate with.
|
||||||
noNodes: There are no nodes.
|
noNodes: There are no nodes.
|
||||||
alert:
|
alert:
|
||||||
node: "Alert: Node {node} is not active."
|
node: "Alert: Node {node} is not active."
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue