1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Do not filter contexts when adding new clusters (#969)

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala 2020-09-25 12:58:38 +03:00 committed by GitHub
parent 51b21347da
commit d0f1d7b74b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 15 deletions

View File

@ -129,10 +129,6 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
return this.clusters.size > 0;
}
hasContextInWorkspace(name: string, workspaceId: string) {
return this.clustersList.some(cluster => cluster.contextName === name && cluster.workspace === workspaceId);
}
getById(id: ClusterId): Cluster {
return this.clusters.get(id);
}

View File

@ -198,13 +198,6 @@ describe("config with existing clusters", () => {
expect(storedClusters[1].preferences.terminalCWD).toBe('/foo2')
expect(storedClusters[2].id).toBe('cluster3')
})
it("allows to test if store already has context in workspace", async () => {
const existingContext = clusterStore.hasContextInWorkspace('foo', 'default');
expect(existingContext).toBeTruthy
const nonExistingContext = clusterStore.hasContextInWorkspace('foo2', 'foo');
expect(existingContext).toBeFalsy
})
})
describe("pre 2.0 config with an existing cluster", () => {

View File

@ -99,10 +99,7 @@ export class AddCluster extends React.Component {
getContexts(config: KubeConfig): Map<string, KubeConfig> {
const contexts = new Map();
splitConfig(config).forEach(config => {
const isExists = clusterStore.hasContextInWorkspace(config.currentContext, workspaceStore.currentWorkspaceId);
if (!isExists) {
contexts.set(config.currentContext, config);
}
})
return contexts
}