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

fix: The command pallet command for navigating to Custom Resource Definitions should navigate to the correct route

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-05-15 14:32:01 -04:00
parent bedd7a25bb
commit 147be22db3

View File

@ -34,13 +34,13 @@ import navigateToDaemonsetsInjectable from "../../../../common/front-end-routing
import navigateToStatefulsetsInjectable from "../../../../common/front-end-routing/routes/cluster/workloads/statefulsets/navigate-to-statefulsets.injectable"; import navigateToStatefulsetsInjectable from "../../../../common/front-end-routing/routes/cluster/workloads/statefulsets/navigate-to-statefulsets.injectable";
import navigateToJobsInjectable from "../../../../common/front-end-routing/routes/cluster/workloads/jobs/navigate-to-jobs.injectable"; import navigateToJobsInjectable from "../../../../common/front-end-routing/routes/cluster/workloads/jobs/navigate-to-jobs.injectable";
import navigateToCronJobsInjectable from "../../../../common/front-end-routing/routes/cluster/workloads/cron-jobs/navigate-to-cron-jobs.injectable"; import navigateToCronJobsInjectable from "../../../../common/front-end-routing/routes/cluster/workloads/cron-jobs/navigate-to-cron-jobs.injectable";
import navigateToCustomResourcesInjectable from "../../../../common/front-end-routing/routes/cluster/custom-resources/navigate-to-custom-resources.injectable";
import navigateToEntitySettingsInjectable from "../../../../common/front-end-routing/routes/entity-settings/navigate-to-entity-settings.injectable"; import navigateToEntitySettingsInjectable from "../../../../common/front-end-routing/routes/entity-settings/navigate-to-entity-settings.injectable";
// TODO: Importing from features is not OK. Make commands to comply with Open Closed Principle to allow moving implementation under a feature // TODO: Importing from features is not OK. Make commands to comply with Open Closed Principle to allow moving implementation under a feature
import navigateToPreferencesInjectable from "../../../../features/preferences/common/navigate-to-preferences.injectable"; import navigateToPreferencesInjectable from "../../../../features/preferences/common/navigate-to-preferences.injectable";
import type { HasCatalogEntitySettingItems } from "../../entity-settings/has-settings.injectable"; import type { HasCatalogEntitySettingItems } from "../../entity-settings/has-settings.injectable";
import hasCatalogEntitySettingItemsInjectable from "../../entity-settings/has-settings.injectable"; import hasCatalogEntitySettingItemsInjectable from "../../entity-settings/has-settings.injectable";
import navigateToCustomResourceDefinitionsInjectable from "../../../../common/front-end-routing/routes/cluster/custom-resources/navigate-to-custom-resource-definitions.injectable";
export function isKubernetesClusterActive(context: CommandContext): boolean { export function isKubernetesClusterActive(context: CommandContext): boolean {
return context.entity?.kind === "KubernetesCluster"; return context.entity?.kind === "KubernetesCluster";
@ -71,7 +71,7 @@ interface Dependencies {
navigateToStatefulsets: () => void; navigateToStatefulsets: () => void;
navigateToJobs: () => void; navigateToJobs: () => void;
navigateToCronJobs: () => void; navigateToCronJobs: () => void;
navigateToCustomResources: () => void; navigateToCustomResourceDefinitions: () => void;
navigateToEntitySettings: (entityId: string) => void; navigateToEntitySettings: (entityId: string) => void;
} }
@ -206,7 +206,7 @@ function getInternalCommands(dependencies: Dependencies): CommandRegistration[]
id: "cluster.viewCustomResourceDefinitions", id: "cluster.viewCustomResourceDefinitions",
title: "Cluster: View Custom Resource Definitions", title: "Cluster: View Custom Resource Definitions",
isActive: isKubernetesClusterActive, isActive: isKubernetesClusterActive,
action: () => dependencies.navigateToCustomResources(), action: () => dependencies.navigateToCustomResourceDefinitions(),
}, },
{ {
id: "entity.viewSettings", id: "entity.viewSettings",
@ -278,7 +278,7 @@ const internalCommandsInjectable = getInjectable({
navigateToStatefulsets: di.inject(navigateToStatefulsetsInjectable), navigateToStatefulsets: di.inject(navigateToStatefulsetsInjectable),
navigateToJobs: di.inject(navigateToJobsInjectable), navigateToJobs: di.inject(navigateToJobsInjectable),
navigateToCronJobs: di.inject(navigateToCronJobsInjectable), navigateToCronJobs: di.inject(navigateToCronJobsInjectable),
navigateToCustomResources: di.inject(navigateToCustomResourcesInjectable), navigateToCustomResourceDefinitions: di.inject(navigateToCustomResourceDefinitionsInjectable),
navigateToEntitySettings: di.inject(navigateToEntitySettingsInjectable), navigateToEntitySettings: di.inject(navigateToEntitySettingsInjectable),
}), }),
}); });