Changed to use ClusterModel when adding clusters

This commit is contained in:
Steve Richards committed 2020-09-24 10:03:19 +01:00
1 parent ba5a860fe7
commit 1f36e06cc8
2 files changed
+23 -3

No files matched your search

+2
View File
@@ -127,6 +127,8 @@ export class Cluster implements ClusterModel {
async activate(init = false) {
const clusterActivatedAt = new Date();
logger.info(`[CLUSTER]: activate@${clusterActivatedAt.toString()}`, this.getMeta());
logger.info(`[CLUSTER]: activate eventDisposers length: ${this.eventDisposers.length}`);
logger.info(`[CLUSTER]: activate eventDisposers: ${this.eventDisposers}`);
await this.whenInitialized;
logger.info("[CLUSTER]: activate now initialized")
logger.info(`[CLUSTER]: activate eventDisposers length: ${this.eventDisposers.length}`);
+21 -3
View File
@@ -138,7 +138,8 @@ export class DECCManager {
//console.log(`Generated kubeconfig: ${YAML.stringify(jsConfig)}`)
let newClusters: ClusterModel[] = [];
let newCluster = new Cluster({
let newCluster: ClusterModel = {
id: deccCluster.metadata.uid,
contextName: `${username}@${clusterPrefix}-${deccCluster.metadata.name}`,
preferences: {
@@ -147,11 +148,28 @@ export class DECCManager {
},
kubeConfigPath: ClusterStore.embedCustomKubeConfig(deccCluster.metadata.uid, YAML.stringify(jsConfig)),
workspace: workspace.id,
});
};
// let newCluster = new Cluster({
// id: deccCluster.metadata.uid,
// contextName: `${username}@${clusterPrefix}-${deccCluster.metadata.name}`,
// preferences: {
// clusterName: `${username}@${clusterPrefix}-${deccCluster.metadata.name}`,
// httpsProxy: undefined,
// },
// kubeConfigPath: ClusterStore.embedCustomKubeConfig(deccCluster.metadata.uid, YAML.stringify(jsConfig)),
// workspace: workspace.id,
// });
newClusters.push(newCluster);
clusterStore.addCluster(...newClusters);
logger.info(`addLensClusterToDECCWorkspace: Created Cluster Name: ${username}@${clusterPrefix}-${deccCluster.metadata.name}, Cluster UCP Dashboard URL: ${ucpDashboard}`)
let createdCluster = clusterStore.getById(newCluster.id);
createdCluster.pushState();
clusterStore.load();
// clusterStore.setActive(newCluster.id);
logger.info(`addLensClusterToDECCWorkspace: Created Cluster Name: ${createdCluster.preferences.clusterName}, Cluster UCP Dashboard URL: ${ucpDashboard}`);
};
}