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 { 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');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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 ) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{{#unless model.isActive}}
|
||||
{{#unless model.isReady}}
|
||||
{{#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}}
|
||||
<p class="{{model.stateColor}}">{{uc-first model.transitioningMessage}}</p>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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: '',
|
||||
});
|
||||
|
|
|
|||
|
|
@ -695,7 +695,7 @@ clusterDashboard:
|
|||
scheduler: Scheduler
|
||||
controllerManager: Controller Manager
|
||||
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.
|
||||
alert:
|
||||
node: "Alert: Node {node} is not active."
|
||||
|
|
|
|||
Loading…
Reference in New Issue