Skip to content

Commit 5cd540d

Browse files
committed
changes after reviews
1 parent 3f55a6e commit 5cd540d

8 files changed

Lines changed: 22 additions & 19 deletions

File tree

cypress/e2e/blueprints/nav/fake-cluster.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2577,7 +2577,7 @@ export function generateFakeClusterDataAndIntercepts({
25772577
statusCode: 200,
25782578
body: fakeNavClusterData.mgmtClusterObj,
25792579
});
2580-
}).as('provCluster');
2580+
}).as('mgmtCluster');
25812581

25822582
// intercept counts for fake cluster https://github.com/rancher/dashboard/issues/10452
25832583
cy.intercept('GET', `/k8s/clusters/${ fakeMgmtClusterId }/v1/counts?*`, (req) => {

cypress/e2e/po/pages/cluster-manager/cluster-manager-list.po.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ export default class ClusterManagerListPagePo extends BaseListPagePo {
4242
});
4343
}).as('mgmtCluster');
4444

45-
// Covers both side bar and cluster list
46-
cy.intercept('GET', '/v1/management.cattle.io.clusters?page=1&pagesize=10*', (req) => {
45+
// Covers both side bar and any standard cluster list
46+
cy.intercept({
47+
method: 'GET',
48+
pathname: '/v1/management.cattle.io.clusters',
49+
query: { pagesize: '*' }
50+
}, (req) => {
4751
req.reply({
4852
statusCode: 200,
4953
body: mgmtClusterList,

shell/edit/provisioning.cattle.io.cluster/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default {
8787
await this.$store.dispatch('management/watch', { type: MANAGEMENT.CLUSTER, registerType: true });
8888
await this.$store.dispatch('management/watch', { type: CAPI.RANCHER_CLUSTER, registerType: true });
8989
} else {
90-
hash.mgmtClusters = this.$store.dispatch('management/find', { type: MANAGEMENT.CLUSTER, id: this.value.mgmtClusterId });
90+
hash.mgmtClusters = this.value.waitForMgmt();
9191
}
9292
9393
// No need to fetch charts when editing an RKE1 cluster

shell/models/cluster.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ export default class NormanCluster extends NormanModel {
6565
}
6666

6767
waitForProvisioning(timeout = 60000, interval) {
68-
const id = this.provisioningClusterId;
69-
7068
return this.waitForTestFn(() => {
69+
const id = this.provisioningClusterId;
70+
7171
return id && !!this.$rootGetters['management/byId'](CAPI.RANCHER_CLUSTER, id);
72-
}, this.$rootGetters['i18n/t']('cluster.managementTimeout', { type: CAPI.RANCHER_CLUSTER, name: id }), timeout, interval);
72+
}, this.$rootGetters['i18n/t']('cluster.managementTimeout', { type: CAPI.RANCHER_CLUSTER, name: this.provisioningClusterId }), timeout, interval);
7373
}
7474
}

shell/models/management.cattle.io.node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default class MgmtNode extends HybridModel {
103103
}
104104

105105
get provisioningCluster() {
106-
return this.mgmtCluster.provCluster;
106+
return this.mgmtCluster?.provCluster;
107107
}
108108

109109
get doneOverride() {

shell/models/provisioning.cattle.io.cluster.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -357,22 +357,19 @@ export default class ProvCluster extends SteveModel {
357357

358358
waitForMgmt(timeout = 60000, interval) {
359359
return this.waitForTestFn(() => {
360-
// `this` instance isn't getting updated with `status.clusterName`
361-
// Workaround - Get fresh copy from the store
362-
const pCluster = this.$rootGetters['management/byId'](CAPI.RANCHER_CLUSTER, this.id);
363-
const name = this.status?.clusterName || pCluster?.status?.clusterName;
360+
const mgmtId = this.mgmtClusterId;
364361

365362
try {
366-
if (name) {
363+
if (mgmtId) {
367364
// Just in case we're not generically watching all mgmt clusters and...
368365
// thus won't receive new mgmt cluster over socket...
369366
// fire and forget a request to fetch it (this won't make multiple requests if one is already running)
370-
this.$dispatch('find', { type: MANAGEMENT.CLUSTER, id: name });
367+
this.$dispatch('find', { type: MANAGEMENT.CLUSTER, id: mgmtId });
371368
}
372369
} catch {}
373370

374-
return name && !!this.$rootGetters['management/byId'](MANAGEMENT.CLUSTER, name);
375-
}, this.$rootGetters['i18n/t']('cluster.managementTimeout', { type: MANAGEMENT.CLUSTER, name }), timeout, interval);
371+
return mgmtId && !!this.$rootGetters['management/byId'](MANAGEMENT.CLUSTER, mgmtId);
372+
}, this.$rootGetters['i18n/t']('cluster.managementTimeout', { type: MANAGEMENT.CLUSTER, name: this.mgmtClusterId }), timeout, interval);
376373
}
377374

378375
get provisioner() {

shell/pages/diagnostic.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default {
2424
clusterForCounts.forEach((mgmtCluster, i) => {
2525
finalCounts.push({
2626
id: mgmtCluster.id,
27-
name: mgmtCluster.spec.displayName,
27+
name: mgmtCluster.spec.displayName || mgmtCluster.metadata?.name,
2828
namespace: mgmtCluster.provClusterNamespace,
2929
counts: null,
3030
isTableVisible: !!(i === 0 && clusterForCounts.length === 1)

shell/plugins/steve/subscribe.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,11 @@ const sharedActions = {
570570
} else if (mode !== STEVE_WATCH_MODE.RESOURCE_CHANGES) {
571571
// - If we continue and open up a watch whenever we receive a `resource.` notification we go to queueChanges (bar resource.changes mode).
572572
// - queueChanges ignores any change that's for a type that hasn't been registered
573-
// - So here we're just existing early, avoiding the watch --> queueChanges --> ignore loop
573+
// - So here we're just exiting early, avoiding the watch --> queueChanges --> ignore loop
574574
//
575-
// Interestingly this is hit quite a few times (on cluster create screens theres token, cluster, project, projectRoleTemplateBinding, etc)
575+
// Interestingly this is hit quite a few times (on cluster create screens there's token, cluster, project, projectRoleTemplateBinding, etc)
576+
state.debugSocket && console.info('Will not Watch (type is not registered)', JSON.stringify(params)); // eslint-disable-line no-console
577+
576578
return;
577579
}
578580
}

0 commit comments

Comments
 (0)