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

Fix not being able to add new Kubeconfig syncs (#6938)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-01-16 04:52:44 -08:00 committed by GitHub
parent 90c8e8e70c
commit 096715915c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View File

@ -16,7 +16,6 @@ const setupKubernetesClusterCatalogAddMenuListenerInjectable = getInjectable({
instantiate: (di) => ({ instantiate: (di) => ({
id: "setup-kubernetes-cluster-catalog-add-menu-listener", id: "setup-kubernetes-cluster-catalog-add-menu-listener",
run: () => { run: () => {
// NOTE: these have to be here so that they are initialized only after the `runAfter` is ran
const navigateToAddCluster = di.inject(navigateToAddClusterInjectable); const navigateToAddCluster = di.inject(navigateToAddClusterInjectable);
const addSyncEntries = di.inject(addSyncEntriesInjectable); const addSyncEntries = di.inject(addSyncEntriesInjectable);
const kubernetesClusterCategory = di.inject(kubernetesClusterCategoryInjectable); const kubernetesClusterCategory = di.inject(kubernetesClusterCategoryInjectable);

View File

@ -6,8 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable";
import userStoreInjectable from "../../common/user-store/user-store.injectable"; import userStoreInjectable from "../../common/user-store/user-store.injectable";
import React from "react"; import React from "react";
import navigateToKubernetesPreferencesInjectable from "../../features/preferences/common/navigate-to-kubernetes-preferences.injectable"; import navigateToKubernetesPreferencesInjectable from "../../features/preferences/common/navigate-to-kubernetes-preferences.injectable";
import discoverAllKubeconfigSyncKindsInjectable from "../../features/preferences/renderer/preference-items/kubernetes/kubeconfig-sync/discover-all-sync-kinds.injectable"; import { runInAction } from "mobx";
import { action } from "mobx";
import showSuccessNotificationInjectable from "../components/notifications/show-success-notification.injectable"; import showSuccessNotificationInjectable from "../components/notifications/show-success-notification.injectable";
const addSyncEntriesInjectable = getInjectable({ const addSyncEntriesInjectable = getInjectable({
@ -16,14 +15,11 @@ const addSyncEntriesInjectable = getInjectable({
instantiate: (di) => { instantiate: (di) => {
const userStore = di.inject(userStoreInjectable); const userStore = di.inject(userStoreInjectable);
const navigateToKubernetesPreferences = di.inject(navigateToKubernetesPreferencesInjectable); const navigateToKubernetesPreferences = di.inject(navigateToKubernetesPreferencesInjectable);
const discoverAllKubeconfigSyncKinds = di.inject(discoverAllKubeconfigSyncKindsInjectable);
const showSuccessNotification = di.inject(showSuccessNotificationInjectable); const showSuccessNotification = di.inject(showSuccessNotificationInjectable);
return async (filePaths: string[]) => { return async (paths: string[]) => {
const kinds = await discoverAllKubeconfigSyncKinds(filePaths); runInAction(() => {
for (const path of paths) {
action(() => {
for (const [path] of kinds) {
userStore.syncKubeconfigEntries.set(path, {}); userStore.syncKubeconfigEntries.set(path, {});
} }
}); });