mirror of
https://github.com/lensapp/lens.git
synced 2024-09-11 09:25:26 +03:00
Revert "chore: Convert sidebarItemInjectionToken to use InjectWithMetadata instead of duplicating the IDs"
This reverts commit 81293304a7
.
This commit is contained in:
parent
9276df0592
commit
93bc41f9a3
@ -1,21 +1,26 @@
|
||||
import { getInjectable, InjectionInstanceWithMeta } from "@ogre-tools/injectable";
|
||||
/* eslint-disable prettier/prettier */
|
||||
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
import { SidebarItemDeclaration, sidebarItemInjectionToken, SidebarItemRegistration } from "./tokens";
|
||||
import { HierarchicalSidebarItem, sidebarItemInjectionToken, SidebarItemRegistration } from "./tokens";
|
||||
import { computed } from "mobx";
|
||||
import { byOrderNumber } from "@k8slens/utilities";
|
||||
|
||||
const getSidebarItemsHierarchy = (
|
||||
registrations: InjectionInstanceWithMeta<SidebarItemRegistration>[],
|
||||
registrations: SidebarItemRegistration[],
|
||||
parentId: string | null,
|
||||
): SidebarItemDeclaration[] =>
|
||||
): HierarchicalSidebarItem[] => (
|
||||
registrations
|
||||
.filter(({ instance }) => instance.parentId === parentId)
|
||||
.map(({ instance: { isActive, isVisible, ...registration }, meta: { id } }) => {
|
||||
const children = getSidebarItemsHierarchy(registrations, id);
|
||||
.filter((item) => item.parentId === parentId)
|
||||
.map(({
|
||||
isActive,
|
||||
isVisible,
|
||||
...registration
|
||||
}) => {
|
||||
const children = getSidebarItemsHierarchy(registrations, registration.id);
|
||||
|
||||
return {
|
||||
...registration,
|
||||
id,
|
||||
children,
|
||||
isVisible: computed(() => {
|
||||
if (children.length === 0) {
|
||||
@ -41,7 +46,8 @@ const getSidebarItemsHierarchy = (
|
||||
}),
|
||||
};
|
||||
})
|
||||
.sort(byOrderNumber);
|
||||
.sort(byOrderNumber)
|
||||
);
|
||||
|
||||
const sidebarItemsInjectable = getInjectable({
|
||||
id: "sidebar-items",
|
||||
@ -49,11 +55,7 @@ const sidebarItemsInjectable = getInjectable({
|
||||
const computedInjectMany = di.inject(computedInjectManyInjectable);
|
||||
const sidebarItemRegistrations = computedInjectMany(sidebarItemInjectionToken);
|
||||
|
||||
return computed(() => {
|
||||
void sidebarItemRegistrations.get();
|
||||
|
||||
return getSidebarItemsHierarchy(di.injectManyWithMeta(sidebarItemInjectionToken), null);
|
||||
});
|
||||
return computed(() => getSidebarItemsHierarchy(sidebarItemRegistrations.get(), null));
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -8,7 +8,7 @@ import type { IComputedValue } from "mobx";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
export interface SidebarItemRegistration {
|
||||
id?: undefined;
|
||||
id: string;
|
||||
parentId: string | null;
|
||||
title: StrictReactNode;
|
||||
onClick: () => void;
|
||||
@ -18,7 +18,7 @@ export interface SidebarItemRegistration {
|
||||
orderNumber: number;
|
||||
}
|
||||
|
||||
export interface SidebarItemDeclaration {
|
||||
export interface SidebarItem {
|
||||
id: string;
|
||||
parentId: string | null;
|
||||
title: StrictReactNode;
|
||||
@ -26,7 +26,10 @@ export interface SidebarItemDeclaration {
|
||||
getIcon?: () => StrictReactNode;
|
||||
isActive: IComputedValue<boolean>;
|
||||
isVisible: IComputedValue<boolean>;
|
||||
children: SidebarItemDeclaration[];
|
||||
}
|
||||
|
||||
export interface HierarchicalSidebarItem extends SidebarItem {
|
||||
children: HierarchicalSidebarItem[];
|
||||
}
|
||||
|
||||
export const sidebarItemInjectionToken = getInjectionToken<SidebarItemRegistration>({
|
||||
|
@ -37,7 +37,7 @@ describe("disable sidebar items when cluster is not relevant", () => {
|
||||
|
||||
clusterPageMenus: [
|
||||
{
|
||||
id: "sidebar-item-some",
|
||||
id: "some-sidebar-item",
|
||||
title: "Some sidebar item",
|
||||
|
||||
components: {
|
||||
@ -60,7 +60,7 @@ describe("disable sidebar items when cluster is not relevant", () => {
|
||||
|
||||
it("does not show the sidebar item", () => {
|
||||
const actual = rendered.queryByTestId(
|
||||
"sidebar-item-sidebar-item-some-extension-name-some",
|
||||
"sidebar-item-some-extension-name-some-sidebar-item",
|
||||
);
|
||||
|
||||
expect(actual).not.toBeInTheDocument();
|
||||
@ -78,7 +78,7 @@ describe("disable sidebar items when cluster is not relevant", () => {
|
||||
|
||||
it("does not show the sidebar item", () => {
|
||||
const actual = rendered.queryByTestId(
|
||||
"sidebar-item-sidebar-item-some-extension-name-some",
|
||||
"sidebar-item-some-extension-name-some-sidebar-item",
|
||||
);
|
||||
|
||||
expect(actual).not.toBeInTheDocument();
|
||||
@ -96,7 +96,7 @@ describe("disable sidebar items when cluster is not relevant", () => {
|
||||
|
||||
it("shows the sidebar item", () => {
|
||||
const actual = rendered.getByTestId(
|
||||
"sidebar-item-sidebar-item-test-extension-some",
|
||||
"sidebar-item-test-extension-some-sidebar-item",
|
||||
);
|
||||
|
||||
expect(actual).toBeInTheDocument();
|
||||
|
@ -85,8 +85,9 @@ describe("cluster - order of sidebar items", () => {
|
||||
});
|
||||
|
||||
const someParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-parent",
|
||||
id: "some-parent-sidebar-item",
|
||||
instantiate: () => ({
|
||||
id: "some-parent-id",
|
||||
parentId: null,
|
||||
title: "Some parent",
|
||||
onClick: noop,
|
||||
@ -96,8 +97,9 @@ const someParentSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someOtherParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-other-parent",
|
||||
id: "some-other-parent-sidebar-item",
|
||||
instantiate: () => ({
|
||||
id: "some-other-parent-id",
|
||||
parentId: null,
|
||||
title: "Some other parent",
|
||||
onClick: noop,
|
||||
@ -107,8 +109,9 @@ const someOtherParentSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someAnotherParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-another-parent",
|
||||
id: "some-another-parent-sidebar-item",
|
||||
instantiate: () => ({
|
||||
id: "some-another-parent-id",
|
||||
parentId: null,
|
||||
title: "Some another parent",
|
||||
onClick: noop,
|
||||
@ -118,9 +121,10 @@ const someAnotherParentSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someChildSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-child",
|
||||
instantiate: () => ({
|
||||
parentId: someParentSidebarItemInjectable.id,
|
||||
id: "some-child-sidebar-item",
|
||||
instantiate: (di) => ({
|
||||
id: "some-child-id",
|
||||
parentId: di.inject(someParentSidebarItemInjectable).id,
|
||||
title: "Some child",
|
||||
onClick: noop,
|
||||
orderNumber: 168,
|
||||
@ -129,9 +133,10 @@ const someChildSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someOtherChildSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-other-child",
|
||||
instantiate: () => ({
|
||||
parentId: someParentSidebarItemInjectable.id,
|
||||
id: "some-other-child-sidebar-item",
|
||||
instantiate: (di) => ({
|
||||
id: "some-other-child-id",
|
||||
parentId: di.inject(someParentSidebarItemInjectable).id,
|
||||
title: "Some other child",
|
||||
onClick: noop,
|
||||
orderNumber: 252,
|
||||
@ -140,9 +145,10 @@ const someOtherChildSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someAnotherChildSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-another-child",
|
||||
instantiate: () => ({
|
||||
parentId: someParentSidebarItemInjectable.id,
|
||||
id: "some-another-child-sidebar-item",
|
||||
instantiate: (di) => ({
|
||||
id: "some-another-child-id",
|
||||
parentId: di.inject(someParentSidebarItemInjectable).id,
|
||||
title: "Some another child",
|
||||
onClick: noop,
|
||||
orderNumber: 210,
|
||||
|
@ -295,8 +295,9 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
});
|
||||
|
||||
const someParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-parent",
|
||||
id: "some-parent-sidebar-item",
|
||||
instantiate: () => ({
|
||||
id: "some-parent-id",
|
||||
parentId: null,
|
||||
title: "Some parent",
|
||||
onClick: noop,
|
||||
@ -307,14 +308,15 @@ const someParentSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someChildSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-child",
|
||||
id: "some-child-sidebar-item",
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(testRouteInjectable);
|
||||
const navigateToRoute = di.inject(navigateToRouteInjectionToken);
|
||||
const routeIsActive = di.inject(routeIsActiveInjectable, route);
|
||||
|
||||
return {
|
||||
parentId: someParentSidebarItemInjectable.id,
|
||||
id: "some-child-id",
|
||||
parentId: di.inject(someParentSidebarItemInjectable).id,
|
||||
title: "Some child",
|
||||
onClick: () => navigateToRoute(route),
|
||||
isActive: routeIsActive,
|
||||
|
@ -27,7 +27,7 @@ describe("cluster - visibility of sidebar items", () => {
|
||||
runInAction(() => {
|
||||
windowDi.register(testRouteInjectable);
|
||||
windowDi.register(testRouteComponentInjectable);
|
||||
windowDi.register(testSidebarItemInjectable);
|
||||
windowDi.register(testSidebarItemsInjectable);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -94,14 +94,15 @@ const testRouteComponentInjectable = getInjectable({
|
||||
injectionToken: routeSpecificComponentInjectionToken,
|
||||
});
|
||||
|
||||
const testSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-test",
|
||||
const testSidebarItemsInjectable = getInjectable({
|
||||
id: "some-sidebar-item-injectable",
|
||||
|
||||
instantiate: (di) => {
|
||||
const testRoute = di.inject(testRouteInjectable);
|
||||
const navigateToRoute = di.inject(navigateToRouteInjectionToken);
|
||||
|
||||
return {
|
||||
id: "some-item-id",
|
||||
parentId: null,
|
||||
title: "Some item",
|
||||
onClick: () => navigateToRoute(testRoute),
|
||||
|
@ -11,12 +11,13 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToClusterOverviewInjectable from "../../../common/front-end-routing/routes/cluster/overview/navigate-to-cluster-overview.injectable";
|
||||
|
||||
const clusterOverviewSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-cluster-overview",
|
||||
id: "cluster-overview-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(clusterOverviewRouteInjectable);
|
||||
|
||||
return {
|
||||
id: "cluster-overview",
|
||||
parentId: null,
|
||||
title: "Cluster",
|
||||
getIcon: () => <Icon svg="kube" />,
|
||||
|
@ -10,13 +10,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToHorizontalPodAutoscalersInjectable from "../../../common/front-end-routing/routes/cluster/config/horizontal-pod-autoscalers/navigate-to-horizontal-pod-autoscalers.injectable";
|
||||
|
||||
const horizontalPodAutoScalersSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-horizontal-pod-auto-scalers",
|
||||
id: "horizontal-pod-auto-scalers-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(horizontalPodAutoscalersRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "horizontal-pod-auto-scalers",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "HPA",
|
||||
onClick: di.inject(navigateToHorizontalPodAutoscalersInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToLeasesInjectable from "../../../common/front-end-routing/routes/cluster/config/leases/navigate-to-leases.injectable";
|
||||
|
||||
const leasesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-leases",
|
||||
id: "leases-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(leasesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "leases",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "Leases",
|
||||
onClick: di.inject(navigateToLeasesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToLimitRangesInjectable from "../../../common/front-end-routing/routes/cluster/config/limit-ranges/navigate-to-limit-ranges.injectable";
|
||||
|
||||
const limitRangesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-limit-ranges",
|
||||
id: "limit-ranges-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(limitRangesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "limit-ranges",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "Limit Ranges",
|
||||
onClick: di.inject(navigateToLimitRangesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToConfigMapsInjectable from "../../../common/front-end-routing/routes/cluster/config/config-maps/navigate-to-config-maps.injectable";
|
||||
|
||||
const configMapsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-config-maps",
|
||||
id: "config-maps-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(configMapsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "config-maps",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "ConfigMaps",
|
||||
onClick: di.inject(navigateToConfigMapsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -10,13 +10,14 @@ import navigateToMutatingWebhookConfigurationsInjectable from "../../../common/f
|
||||
import configSidebarItemInjectable from "../config/config-sidebar-item.injectable";
|
||||
|
||||
const mutatingWebhookConfigurationsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-mutating-webhook-configurations",
|
||||
id: "mutating-webhook-configurations-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(mutatingWebhookConfigurationsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "mutating-webhook-configurations",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "Mutating Webhook Configs",
|
||||
onClick: di.inject(navigateToMutatingWebhookConfigurationsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToPodDisruptionBudgetsInjectable from "../../../common/front-end-routing/routes/cluster/config/pod-disruption-budgets/navigate-to-pod-disruption-budgets.injectable";
|
||||
|
||||
const podDisruptionBudgetsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-pod-disruption-budgets",
|
||||
id: "pod-disruption-budgets-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(podDisruptionBudgetsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "pod-disruption-budgets",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "Pod Disruption Budgets",
|
||||
onClick: di.inject(navigateToPodDisruptionBudgetsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToPriorityClassesInjectable from "../../../common/front-end-routing/routes/cluster/config/priority-classes/navigate-to-priority-classes.injectable";
|
||||
|
||||
const priorityClassesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-priority-classes",
|
||||
id: "priority-classes-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(priorityClassesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "priority-classes",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "Priority Classes",
|
||||
onClick: di.inject(navigateToPriorityClassesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToResourceQuotasInjectable from "../../../common/front-end-routing/routes/cluster/config/resource-quotas/navigate-to-resource-quotas.injectable";
|
||||
|
||||
const resourceQuotasSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-resource-quotas",
|
||||
id: "resource-quotas-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(resourceQuotasRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "resource-quotas",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "Resource Quotas",
|
||||
onClick: di.inject(navigateToResourceQuotasInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToRuntimeClassesInjectable from "../../../common/front-end-routing/routes/cluster/config/runtime-classes/navigate-to-runtime-classes.injectable";
|
||||
|
||||
const runtimeClassesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-runtime-classes",
|
||||
id: "runtime-classes-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(runtimeClassesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "runtime-classes",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "Runtime Classes",
|
||||
onClick: di.inject(navigateToRuntimeClassesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToSecretsInjectable from "../../../common/front-end-routing/routes/cluster/config/secrets/navigate-to-secrets.injectable";
|
||||
|
||||
const secretsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-secrets",
|
||||
id: "secrets-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(secretsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "secrets",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "Secrets",
|
||||
onClick: di.inject(navigateToSecretsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -10,13 +10,14 @@ import navigateToValidatingWebhookConfigurationsInjectable from "../../../common
|
||||
import configSidebarItemInjectable from "../config/config-sidebar-item.injectable";
|
||||
|
||||
const validatingWebhookConfigurationsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-validating-webhook-configurations",
|
||||
id: "validating-webhook-configurations-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(validatingWebhookConfigurationsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "validating-webhook-configurations",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "Validating Webhook Configs",
|
||||
onClick: di.inject(navigateToValidatingWebhookConfigurationsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -10,13 +10,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToVerticalPodAutoscalersInjectable from "../../../common/front-end-routing/routes/cluster/config/vertical-pod-autoscalers/navigate-to-vertical-pod-autoscalers.injectable";
|
||||
|
||||
const verticalPodAutoScalersSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-vertical-pod-auto-scalers",
|
||||
id: "vertical-pod-auto-scalers-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(verticalPodAutoscalersRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: configSidebarItemInjectable.id,
|
||||
id: "vertical-pod-auto-scalers",
|
||||
parentId: di.inject(configSidebarItemInjectable).id,
|
||||
title: "VPA",
|
||||
onClick: di.inject(navigateToVerticalPodAutoscalersInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -9,9 +9,10 @@ import { sidebarItemInjectionToken } from "@k8slens/cluster-sidebar";
|
||||
import { noop } from "lodash/fp";
|
||||
|
||||
const configSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-config",
|
||||
id: "config-sidebar-item",
|
||||
|
||||
instantiate: () => ({
|
||||
id: "config",
|
||||
parentId: null,
|
||||
title: "Config",
|
||||
getIcon: () => <Icon material="list" />,
|
||||
|
@ -27,9 +27,10 @@ const customResourceDefinitionGroupsSidebarItemsComputedInjectable = getInjectab
|
||||
|
||||
const toCustomResourceGroupToSidebarItems = ([group, definitions]: [string, CustomResourceDefinition[]], index: number) => {
|
||||
const customResourceGroupSidebarItem = getInjectable({
|
||||
id: `sidebar-item-custom-resource-group-${group}`,
|
||||
instantiate: (): SidebarItemRegistration => ({
|
||||
parentId: customResourcesSidebarItemInjectable.id,
|
||||
id: `custom-resource-group-${group}-sidebar-item`,
|
||||
instantiate: (di): SidebarItemRegistration => ({
|
||||
id: `custom-resource-group-${group}`,
|
||||
parentId: di.inject(customResourcesSidebarItemInjectable).id,
|
||||
onClick: noop,
|
||||
title: group,
|
||||
orderNumber: 10 * index,
|
||||
@ -43,9 +44,10 @@ const customResourceDefinitionGroupsSidebarItemsComputedInjectable = getInjectab
|
||||
};
|
||||
|
||||
return getInjectable({
|
||||
id: `sidebar-item-custom-resource-group-${group}/${definition.getPluralName()}`,
|
||||
id: `custom-resource-group-${group}/${definition.getPluralName()}-sidebar-item`,
|
||||
instantiate: (di): SidebarItemRegistration => ({
|
||||
parentId: customResourceGroupSidebarItem.id,
|
||||
id: `custom-resource-group-${group}/${definition.getPluralName()}`,
|
||||
parentId: di.inject(customResourceGroupSidebarItem).id,
|
||||
onClick: () => navigateToCustomResources(parameters),
|
||||
title: definition.getResourceKind(),
|
||||
isActive: computedAnd(
|
||||
|
@ -10,12 +10,13 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import customResourcesSidebarItemInjectable from "./custom-resources-sidebar-item.injectable";
|
||||
|
||||
const customResourceDefinitionsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-custom-resource-definitions",
|
||||
id: "custom-resource-definitions-sidebar-item",
|
||||
instantiate: (di) => {
|
||||
const customResourceDefinitionsRoute = di.inject(customResourceDefinitionsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: customResourcesSidebarItemInjectable.id,
|
||||
id: "custom-resource-definitions",
|
||||
parentId: di.inject(customResourcesSidebarItemInjectable).id,
|
||||
title: "Definitions",
|
||||
onClick: di.inject(navigateToCustomResourcesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, customResourceDefinitionsRoute),
|
||||
|
@ -9,8 +9,9 @@ import React from "react";
|
||||
import { Icon } from "../icon";
|
||||
|
||||
const customResourcesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-custom-resources",
|
||||
id: "custom-resources-sidebar-item",
|
||||
instantiate: () => ({
|
||||
id: "custom-resources",
|
||||
parentId: null,
|
||||
title: "Custom Resources",
|
||||
getIcon: () => <Icon material="extension" />,
|
||||
|
@ -13,12 +13,13 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToEventsInjectable from "../../../common/front-end-routing/routes/cluster/events/navigate-to-events.injectable";
|
||||
|
||||
const eventsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-events",
|
||||
id: "events-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(eventsRouteInjectable);
|
||||
|
||||
return {
|
||||
id: "events",
|
||||
parentId: null,
|
||||
getIcon: () => <Icon material="access_time" />,
|
||||
title: "Events",
|
||||
|
@ -10,13 +10,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToHelmChartsInjectable from "../../../common/front-end-routing/routes/cluster/helm/charts/navigate-to-helm-charts.injectable";
|
||||
|
||||
const helmChartsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-helm-charts",
|
||||
id: "helm-charts-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(helmChartsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: helmSidebarItemInjectable.id,
|
||||
id: "charts",
|
||||
parentId: di.inject(helmSidebarItemInjectable).id,
|
||||
title: "Charts",
|
||||
onClick: di.inject(navigateToHelmChartsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToHelmReleasesInjectable from "../../../common/front-end-routing/routes/cluster/helm/releases/navigate-to-helm-releases.injectable";
|
||||
|
||||
const helmReleasesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-helm-releases",
|
||||
id: "helm-releases-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(helmReleasesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: helmSidebarItemInjectable.id,
|
||||
id: "releases",
|
||||
parentId: di.inject(helmSidebarItemInjectable).id,
|
||||
title: "Releases",
|
||||
onClick: di.inject(navigateToHelmReleasesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -9,9 +9,10 @@ import { Icon } from "../icon";
|
||||
import { noop } from "lodash/fp";
|
||||
|
||||
const helmSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-helm",
|
||||
id: "helm-sidebar-item",
|
||||
|
||||
instantiate: () => ({
|
||||
id: "helm",
|
||||
parentId: null,
|
||||
getIcon: () => <Icon svg="helm" />,
|
||||
title: "Helm",
|
||||
|
@ -54,8 +54,9 @@ const extensionSidebarItemRegistratorInjectable = getInjectable({
|
||||
: extension.sanitizedExtensionId;
|
||||
|
||||
return getInjectable({
|
||||
id: `sidebar-item-${id}`,
|
||||
id: `${id}-sidebar-item`,
|
||||
instantiate: () => ({
|
||||
id,
|
||||
orderNumber: registration.orderNumber ?? 9999,
|
||||
|
||||
parentId: registration.parentId
|
||||
|
@ -8,7 +8,7 @@ import { observer } from "mobx-react";
|
||||
import React from "react";
|
||||
import siblingTabsInjectable from "../../routes/sibling-tabs.injectable";
|
||||
import { TabLayout } from "./tab-layout-2";
|
||||
import type { SidebarItemDeclaration } from "@k8slens/cluster-sidebar";
|
||||
import type { HierarchicalSidebarItem } from "@k8slens/cluster-sidebar";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
interface SiblingTabLayoutProps {
|
||||
@ -17,7 +17,7 @@ interface SiblingTabLayoutProps {
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
tabs: IComputedValue<SidebarItemDeclaration[]>;
|
||||
tabs: IComputedValue<HierarchicalSidebarItem[]>;
|
||||
}
|
||||
|
||||
const NonInjectedSiblingsInTabLayout = observer(
|
||||
|
@ -12,7 +12,7 @@ import { Icon } from "../icon";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import type { SidebarStorageState } from "./sidebar-storage/sidebar-storage.injectable";
|
||||
import sidebarStorageInjectable from "./sidebar-storage/sidebar-storage.injectable";
|
||||
import type { SidebarItemDeclaration } from "@k8slens/cluster-sidebar";
|
||||
import type { HierarchicalSidebarItem } from "@k8slens/cluster-sidebar";
|
||||
import type { StorageLayer } from "../../utils/storage-helper";
|
||||
|
||||
interface Dependencies {
|
||||
@ -20,7 +20,7 @@ interface Dependencies {
|
||||
}
|
||||
|
||||
export interface SidebarItemProps {
|
||||
item: SidebarItemDeclaration;
|
||||
item: HierarchicalSidebarItem;
|
||||
}
|
||||
|
||||
const NonInjectedSidebarItem = observer((props: SidebarItemProps & Dependencies) => {
|
||||
@ -56,7 +56,7 @@ const NonInjectedSidebarItem = observer((props: SidebarItemProps & Dependencies)
|
||||
return (
|
||||
<div
|
||||
className={styles.SidebarItem}
|
||||
data-testid={id}
|
||||
data-testid={`sidebar-item-${id}`}
|
||||
data-is-active-test={isActive}
|
||||
data-parent-id-test={item.parentId}
|
||||
>
|
||||
@ -74,7 +74,7 @@ const NonInjectedSidebarItem = observer((props: SidebarItemProps & Dependencies)
|
||||
item.onClick();
|
||||
}
|
||||
}}
|
||||
data-testid={`link-for-${id}`}
|
||||
data-testid={`sidebar-item-link-for-${id}`}
|
||||
>
|
||||
{item.getIcon?.()}
|
||||
<span>{item.title}</span>
|
||||
@ -82,7 +82,7 @@ const NonInjectedSidebarItem = observer((props: SidebarItemProps & Dependencies)
|
||||
<Icon
|
||||
className={styles.expandIcon}
|
||||
material={expanded ? "keyboard_arrow_up" : "keyboard_arrow_down"}
|
||||
data-testid={`expand-icon-for-${id}`}
|
||||
data-testid={`sidebar-item-expand-icon-for-${id}`}
|
||||
/>
|
||||
)}
|
||||
</NavLink>
|
||||
|
@ -12,13 +12,13 @@ import { SidebarItem } from "./sidebar-item";
|
||||
import type { CatalogEntityRegistry } from "../../api/catalog/entity/registry";
|
||||
import { SidebarCluster } from "./sidebar-cluster";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import type { SidebarItemDeclaration } from "@k8slens/cluster-sidebar";
|
||||
import type { HierarchicalSidebarItem } from "@k8slens/cluster-sidebar";
|
||||
import { sidebarItemsInjectable } from "@k8slens/cluster-sidebar";
|
||||
import type { IComputedValue } from "mobx";
|
||||
import catalogEntityRegistryInjectable from "../../api/catalog/entity/registry.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
sidebarItems: IComputedValue<SidebarItemDeclaration[]>;
|
||||
sidebarItems: IComputedValue<HierarchicalSidebarItem[]>;
|
||||
entityRegistry: CatalogEntityRegistry;
|
||||
}
|
||||
|
||||
|
@ -11,10 +11,10 @@ import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { Tab, Tabs } from "../tabs";
|
||||
import { ErrorBoundary } from "@k8slens/error-boundary";
|
||||
import type { SidebarItemDeclaration } from "@k8slens/cluster-sidebar";
|
||||
import type { HierarchicalSidebarItem } from "@k8slens/cluster-sidebar";
|
||||
|
||||
export interface TabLayoutProps {
|
||||
tabs?: SidebarItemDeclaration[];
|
||||
tabs?: HierarchicalSidebarItem[];
|
||||
children?: StrictReactNode;
|
||||
scrollable?: boolean;
|
||||
}
|
||||
|
@ -11,12 +11,13 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToNamespacesInjectable from "../../../common/front-end-routing/routes/cluster/namespaces/navigate-to-namespaces.injectable";
|
||||
|
||||
const namespacesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-namespaces",
|
||||
id: "namespaces-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(namespacesRouteInjectable);
|
||||
|
||||
return {
|
||||
id: "namespaces",
|
||||
parentId: null,
|
||||
getIcon: () => <Icon material="layers" />,
|
||||
title: "Namespaces",
|
||||
|
@ -10,13 +10,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToEndpointsInjectable from "../../../common/front-end-routing/routes/cluster/network/endpoints/navigate-to-endpoints.injectable";
|
||||
|
||||
const endpointsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-endpoints",
|
||||
id: "endpoints-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(endpointsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: networkSidebarItemInjectable.id,
|
||||
id: "endpoints",
|
||||
parentId: di.inject(networkSidebarItemInjectable).id,
|
||||
title: "Endpoints",
|
||||
onClick: di.inject(navigateToEndpointsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -10,12 +10,13 @@ import navigateToIngressClassesInjectable from "../../../common/front-end-routin
|
||||
import ingressClassesRouteInjectable from "../../../common/front-end-routing/routes/cluster/network/ingress-class/ingress-classes-route.injectable";
|
||||
|
||||
const ingressClassesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-ingress-classes",
|
||||
id: "ingress-classes-sidebar-item",
|
||||
instantiate: (di) => {
|
||||
const ingressClassRoute = di.inject(ingressClassesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: networkSidebarItemInjectable.id,
|
||||
id: "ingressclasses",
|
||||
parentId: di.inject(networkSidebarItemInjectable).id,
|
||||
title: "Ingress Classes",
|
||||
onClick: di.inject(navigateToIngressClassesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, ingressClassRoute),
|
||||
|
@ -10,12 +10,13 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import networkSidebarItemInjectable from "../network/network-sidebar-item.injectable";
|
||||
|
||||
const ingressesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-ingresses",
|
||||
id: "ingresses-sidebar-item",
|
||||
instantiate: (di) => {
|
||||
const ingressRoute = di.inject(ingressesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: networkSidebarItemInjectable.id,
|
||||
id: "ingresses",
|
||||
parentId: di.inject(networkSidebarItemInjectable).id,
|
||||
title: "Ingresses",
|
||||
onClick: di.inject(navigateToIngressesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, ingressRoute),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToNetworkPoliciesInjectable from "../../../common/front-end-routing/routes/cluster/network/network-policies/navigate-to-network-policies.injectable";
|
||||
|
||||
const networkPoliciesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-network-policies",
|
||||
id: "network-policies-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(networkPoliciesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: networkSidebarItemInjectable.id,
|
||||
id: "network-policies",
|
||||
parentId: di.inject(networkSidebarItemInjectable).id,
|
||||
title: "Network Policies",
|
||||
onClick: di.inject(navigateToNetworkPoliciesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToPortForwardsInjectable from "../../../common/front-end-routing/routes/cluster/network/port-forwards/navigate-to-port-forwards.injectable";
|
||||
|
||||
const portForwardsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-port-forwards",
|
||||
id: "port-forwards-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(portForwardsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: networkSidebarItemInjectable.id,
|
||||
id: "port-forwards",
|
||||
parentId: di.inject(networkSidebarItemInjectable).id,
|
||||
title: "Port Forwarding",
|
||||
onClick: di.inject(navigateToPortForwardsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToServicesInjectable from "../../../common/front-end-routing/routes/cluster/network/services/navigate-to-services.injectable";
|
||||
|
||||
const servicesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-services",
|
||||
id: "services-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(servicesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: networkSidebarItemInjectable.id,
|
||||
id: "services",
|
||||
parentId: di.inject(networkSidebarItemInjectable).id,
|
||||
title: "Services",
|
||||
onClick: di.inject(navigateToServicesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -9,9 +9,10 @@ import React from "react";
|
||||
import { noop } from "lodash/fp";
|
||||
|
||||
const networkSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-network",
|
||||
id: "network-sidebar-item",
|
||||
|
||||
instantiate: () => ({
|
||||
id: "network",
|
||||
parentId: null,
|
||||
getIcon: () => <Icon material="device_hub" />,
|
||||
title: "Network",
|
||||
|
@ -15,12 +15,13 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToNodesInjectable from "../../../common/front-end-routing/routes/cluster/nodes/navigate-to-nodes.injectable";
|
||||
|
||||
const nodesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-nodes",
|
||||
id: "nodes-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(nodesRouteInjectable);
|
||||
|
||||
return {
|
||||
id: "nodes",
|
||||
parentId: null,
|
||||
getIcon: () => <Icon svg="nodes" />,
|
||||
title: "Nodes",
|
||||
|
@ -11,13 +11,14 @@ import navigateToPodSecurityPoliciesInjectable from "../../../common/front-end-r
|
||||
import userManagementSidebarItemInjectable from "../user-management/user-management-sidebar-item.injectable";
|
||||
|
||||
const podSecurityPoliciesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-pod-security-policies",
|
||||
id: "pod-security-policies-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(podSecurityPoliciesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: userManagementSidebarItemInjectable.id,
|
||||
id: "pod-security-policies",
|
||||
parentId: di.inject(userManagementSidebarItemInjectable).id,
|
||||
title: "Pod Security Policies",
|
||||
onClick: di.inject(navigateToPodSecurityPoliciesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToStorageClassesInjectable from "../../../common/front-end-routing/routes/cluster/storage/storage-classes/navigate-to-storage-classes.injectable";
|
||||
|
||||
const storageClassesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-storage-classes",
|
||||
id: "storage-classes-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(storageClassesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: storageSidebarItemInjectable.id,
|
||||
id: "storage-classes",
|
||||
parentId: di.inject(storageSidebarItemInjectable).id,
|
||||
title: "Storage Classes",
|
||||
onClick: di.inject(navigateToStorageClassesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToPersistentVolumeClaimsInjectable from "../../../common/front-end-routing/routes/cluster/storage/persistent-volume-claims/navigate-to-persistent-volume-claims.injectable";
|
||||
|
||||
const persistentVolumeClaimsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-persistent-volume-claims",
|
||||
id: "persistent-volume-claims-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(persistentVolumeClaimsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: storageSidebarItemInjectable.id,
|
||||
id: "persistent-volume-claims",
|
||||
parentId: di.inject(storageSidebarItemInjectable).id,
|
||||
title: "Persistent Volume Claims",
|
||||
onClick: di.inject(navigateToPersistentVolumeClaimsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToPersistentVolumesInjectable from "../../../common/front-end-routing/routes/cluster/storage/persistent-volumes/navigate-to-persistent-volumes.injectable";
|
||||
|
||||
const persistentVolumesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-persistent-volumes",
|
||||
id: "persistent-volumes-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(persistentVolumesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: storageSidebarItemInjectable.id,
|
||||
id: "persistent-volumes",
|
||||
parentId: di.inject(storageSidebarItemInjectable).id,
|
||||
title: "Persistent Volumes",
|
||||
onClick: di.inject(navigateToPersistentVolumesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -9,9 +9,10 @@ import React from "react";
|
||||
import { noop } from "lodash/fp";
|
||||
|
||||
const storageSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-storage",
|
||||
id: "storage-sidebar-item",
|
||||
|
||||
instantiate: () => ({
|
||||
id: "storage",
|
||||
parentId: null,
|
||||
getIcon: () => <Icon material="storage" />,
|
||||
title: "Storage",
|
||||
|
@ -11,13 +11,14 @@ import navigateToClusterRoleBindingsInjectable from "../../../../common/front-en
|
||||
import userManagementSidebarItemInjectable from "../user-management-sidebar-item.injectable";
|
||||
|
||||
const clusterRoleBindingsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-cluster-role-bindings",
|
||||
id: "cluster-role-bindings-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(clusterRoleBindingsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: userManagementSidebarItemInjectable.id,
|
||||
id: "cluster-role-bindings",
|
||||
parentId: di.inject(userManagementSidebarItemInjectable).id,
|
||||
title: "Cluster Role Bindings",
|
||||
onClick: di.inject(navigateToClusterRoleBindingsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../../routes/route-is-active.injectable"
|
||||
import navigateToClusterRolesInjectable from "../../../../common/front-end-routing/routes/cluster/user-management/cluster-roles/navigate-to-cluster-roles.injectable";
|
||||
|
||||
const clusterRolesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-cluster-roles",
|
||||
id: "cluster-roles-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(clusterRolesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: userManagementSidebarItemInjectable.id,
|
||||
id: "cluster-roles",
|
||||
parentId: di.inject(userManagementSidebarItemInjectable).id,
|
||||
title: "Cluster Roles",
|
||||
onClick: di.inject(navigateToClusterRolesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../../routes/route-is-active.injectable"
|
||||
import navigateToRoleBindingsInjectable from "../../../../common/front-end-routing/routes/cluster/user-management/role-bindings/navigate-to-role-bindings.injectable";
|
||||
|
||||
const roleBindingsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-role-bindings",
|
||||
id: "role-bindings-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(roleBindingsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: userManagementSidebarItemInjectable.id,
|
||||
id: "role-bindings",
|
||||
parentId: di.inject(userManagementSidebarItemInjectable).id,
|
||||
title: "Role Bindings",
|
||||
onClick: di.inject(navigateToRoleBindingsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -10,13 +10,14 @@ import routeIsActiveInjectable from "../../../routes/route-is-active.injectable"
|
||||
import navigateToRolesInjectable from "../../../../common/front-end-routing/routes/cluster/user-management/roles/navigate-to-roles.injectable";
|
||||
|
||||
const rolesSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-roles",
|
||||
id: "roles-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(rolesRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: userManagementSidebarItemInjectable.id,
|
||||
id: "roles",
|
||||
parentId: di.inject(userManagementSidebarItemInjectable).id,
|
||||
title: "Roles",
|
||||
onClick: di.inject(navigateToRolesInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../../routes/route-is-active.injectable"
|
||||
import navigateToServiceAccountsInjectable from "../../../../common/front-end-routing/routes/cluster/user-management/service-accounts/navigate-to-service-accounts.injectable";
|
||||
|
||||
const serviceAccountsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-service-accounts",
|
||||
id: "service-accounts-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(serviceAccountsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: userManagementSidebarItemInjectable.id,
|
||||
id: "service-accounts",
|
||||
parentId: di.inject(userManagementSidebarItemInjectable).id,
|
||||
title: "Service Accounts",
|
||||
onClick: di.inject(navigateToServiceAccountsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -9,9 +9,10 @@ import React from "react";
|
||||
import { noop } from "lodash/fp";
|
||||
|
||||
const userManagementSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-user-management",
|
||||
id: "user-management-sidebar-item",
|
||||
|
||||
instantiate: () => ({
|
||||
id: "user-management",
|
||||
parentId: null,
|
||||
getIcon: () => <Icon material="security" />,
|
||||
title: "Access Control",
|
||||
|
@ -10,13 +10,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToCronJobsInjectable from "../../../common/front-end-routing/routes/cluster/workloads/cron-jobs/navigate-to-cron-jobs.injectable";
|
||||
|
||||
const cronJobsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-cron-jobs",
|
||||
id: "cron-jobs-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(cronJobsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: workloadsSidebarItemInjectable.id,
|
||||
id: "cron-jobs",
|
||||
parentId: di.inject(workloadsSidebarItemInjectable).id,
|
||||
title: "CronJobs",
|
||||
onClick: di.inject(navigateToCronJobsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToDaemonsetsInjectable from "../../../common/front-end-routing/routes/cluster/workloads/daemonsets/navigate-to-daemonsets.injectable";
|
||||
|
||||
const daemonsetsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-daemonsets",
|
||||
id: "daemonsets-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(daemonsetsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: workloadsSidebarItemInjectable.id,
|
||||
id: "daemon-sets",
|
||||
parentId: di.inject(workloadsSidebarItemInjectable).id,
|
||||
title: "DaemonSets",
|
||||
onClick: di.inject(navigateToDaemonsetsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToDeploymentsInjectable from "../../../common/front-end-routing/routes/cluster/workloads/deployments/navigate-to-deployments.injectable";
|
||||
|
||||
const deploymentsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-deployments",
|
||||
id: "deployments-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(deploymentsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: workloadsSidebarItemInjectable.id,
|
||||
id: "deployments",
|
||||
parentId: di.inject(workloadsSidebarItemInjectable).id,
|
||||
title: "Deployments",
|
||||
onClick: di.inject(navigateToDeploymentsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToJobsInjectable from "../../../common/front-end-routing/routes/cluster/workloads/jobs/navigate-to-jobs.injectable";
|
||||
|
||||
const jobsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-jobs",
|
||||
id: "jobs-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(jobsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: workloadsSidebarItemInjectable.id,
|
||||
id: "jobs",
|
||||
parentId: di.inject(workloadsSidebarItemInjectable).id,
|
||||
title: "Jobs",
|
||||
onClick: di.inject(navigateToJobsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToWorkloadsOverviewInjectable from "../../../common/front-end-routing/routes/cluster/workloads/overview/navigate-to-workloads-overview.injectable";
|
||||
|
||||
const workloadsOverviewSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-workloads-overview",
|
||||
id: "workloads-overview-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(workloadsOverviewRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: workloadsSidebarItemInjectable.id,
|
||||
id: "overview",
|
||||
parentId: di.inject(workloadsSidebarItemInjectable).id,
|
||||
title: "Overview",
|
||||
onClick: di.inject(navigateToWorkloadsOverviewInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToPodsInjectable from "../../../common/front-end-routing/routes/cluster/workloads/pods/navigate-to-pods.injectable";
|
||||
|
||||
const podsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-pods",
|
||||
id: "pods-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(podsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: workloadsSidebarItemInjectable.id,
|
||||
id: "pods",
|
||||
parentId: di.inject(workloadsSidebarItemInjectable).id,
|
||||
title: "Pods",
|
||||
onClick: di.inject(navigateToPodsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToReplicasetsInjectable from "../../../common/front-end-routing/routes/cluster/workloads/replicasets/navigate-to-replicasets.injectable";
|
||||
|
||||
const replicasetsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-replicasets",
|
||||
id: "replicasets-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(replicasetsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: workloadsSidebarItemInjectable.id,
|
||||
id: "replica-sets",
|
||||
parentId: di.inject(workloadsSidebarItemInjectable).id,
|
||||
title: "ReplicaSets",
|
||||
onClick: di.inject(navigateToReplicasetsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -10,13 +10,14 @@ import replicationControllersRouteInjectable from "../../../common/front-end-rou
|
||||
import navigateToReplicationControllersInjectable from "../../../common/front-end-routing/routes/cluster/workloads/replication-controllers/navigate-to.injectable";
|
||||
|
||||
const replicationControllerSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-replication-controller",
|
||||
id: "replication-controller-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(replicationControllersRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: workloadsSidebarItemInjectable.id,
|
||||
id: "replication-controllers",
|
||||
parentId: di.inject(workloadsSidebarItemInjectable).id,
|
||||
title: "Replication Controllers",
|
||||
onClick: di.inject(navigateToReplicationControllersInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -11,13 +11,14 @@ import routeIsActiveInjectable from "../../routes/route-is-active.injectable";
|
||||
import navigateToStatefulsetsInjectable from "../../../common/front-end-routing/routes/cluster/workloads/statefulsets/navigate-to-statefulsets.injectable";
|
||||
|
||||
const statefulsetsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-statefulsets",
|
||||
id: "statefulsets-sidebar-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(statefulsetsRouteInjectable);
|
||||
|
||||
return {
|
||||
parentId: workloadsSidebarItemInjectable.id,
|
||||
id: "stateful-sets",
|
||||
parentId: di.inject(workloadsSidebarItemInjectable).id,
|
||||
title: "StatefulSets",
|
||||
onClick: di.inject(navigateToStatefulsetsInjectable),
|
||||
isActive: di.inject(routeIsActiveInjectable, route),
|
||||
|
@ -9,9 +9,10 @@ import React from "react";
|
||||
import { noop } from "lodash/fp";
|
||||
|
||||
const workloadsSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-workloads",
|
||||
id: "workloads-sidebar-item",
|
||||
|
||||
instantiate: () => ({
|
||||
id: "workloads",
|
||||
parentId: null,
|
||||
title: "Workloads",
|
||||
getIcon: () => <Icon svg="workloads" />,
|
||||
|
Loading…
Reference in New Issue
Block a user