mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Technical requirements for behavioural unit tests (#5084)
* Implement a lot of technical requirements for behavioural unit tests Note: the crux of this was to make routing env-agnostic, and not based on URLs as magic strings, but instead something type-enforced. Note: extension-based routes comply to same exact interface by "late-registering" their routes when installed. Routes are just injectables. Note: another chunk of global shared state is no more. Note: a lot of explicit side effects have been cornered to injectables. Note: a lot of stuff has become reactive as part if this. Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make a directory commonly available Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Require id for <Select /> to prevent non-deterministic renders This was caused by global state in a 3rd party lib: "react-select". Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Specify id for all <Select /> to satisfy previous commit Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Prevent explicit side effect in component by using existing dependency instead Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Extract instantiation of "conf" as injectables for causing side effects Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Introduce a legacy-helper to make gradual refactoring of inheritors of Singleton easier Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Make legacy unit tests for hotbar green and more simple by using the new legacy helper Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Temporarily kludge all unit tests green with a disclaimer about allowing side-effects Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Remove kludge in previous commit by explicitly permitting specific side effects where old unit tests require it Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Prevent old unit test with side effects from accessing file system Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Migrate to actual typing for di.permitSideEffects Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Prevent unit tests from failing because of non-standard method of HTML-element not present in js-dom Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Adapt integration tests to recent changes Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Fix code style Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Fix artifact from bad rebase Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Add a deprecation from a review comment Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Remove change that is not required Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove redundant comment Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Fix code style Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove redundant file Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Fix bad merge Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Improve variable name Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Tweak logger interface to be more descriptive Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make injecting legacy singleton always provide new instance Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove conditional typing when not needed Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Improve naming of variable Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove unnecessary code style changes Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove flag for causing side effects from too broad scope Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Override side-effects in unit test using injectable instead of monkey patching Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Flag some side-effects and add general overrides Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Fix unit tests in CI by removing explicit side-effect Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Remove explicit side-effect from getting default shell Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Introduce abstraction for getting absolute paths Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Switch to using abstraction for getting absolute path to control explicit side effect Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Introduce abstraction for joining paths Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Switch to using abstraction for joining paths to control explicit side effect Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Fix fake implementation for join paths Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Fix test after removing explicit side effect Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove explicit side effects from kubeconfig-syncs Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Fix arguments after removing explicit side effect Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make registrators not async for not being needed anymore Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make generalCatalogEntities non-observable, as there is no requirement Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Remove redundant code Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Simplify logic for registering general catalog entity sources Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Add TODO Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Replace function for getting application menu items with reactive solution Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Fix typo in interface name Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove global shared state usages of hot bar store Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove redundant enum Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
1 parent
ab2cd27a27
commit
a277cfcf02
583 files changed
+13073
-6556
No files matched your search
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { preferenceNavigationItemInjectionToken } from "./preference-navigation-items.injectable";
|
||||
import appPreferencesRouteInjectable from "../../../../common/front-end-routing/routes/preferences/app/app-preferences-route.injectable";
|
||||
import routeIsActiveInjectable from "../../../routes/route-is-active.injectable";
|
||||
import { computed } from "mobx";
|
||||
import navigateToPreferenceTabInjectable from "./navigate-to-preference-tab.injectable";
|
||||
|
||||
const applicationPreferencesNavigationItemInjectable = getInjectable({
|
||||
id: "application-preferences-navigation-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(appPreferencesRouteInjectable);
|
||||
const navigateToPreferenceTab = di.inject(navigateToPreferenceTabInjectable);
|
||||
|
||||
const routeIsActive = di.inject(
|
||||
routeIsActiveInjectable,
|
||||
route,
|
||||
);
|
||||
|
||||
return {
|
||||
id: "application",
|
||||
label: "App",
|
||||
navigate: navigateToPreferenceTab(route),
|
||||
isActive: routeIsActive,
|
||||
isVisible: computed(() => true),
|
||||
orderNumber: 10,
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: preferenceNavigationItemInjectionToken,
|
||||
});
|
||||
|
||||
export default applicationPreferencesNavigationItemInjectable;
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { preferenceNavigationItemInjectionToken } from "./preference-navigation-items.injectable";
|
||||
import routeIsActiveInjectable from "../../../routes/route-is-active.injectable";
|
||||
import { computed } from "mobx";
|
||||
import editorPreferencesRouteInjectable from "../../../../common/front-end-routing/routes/preferences/editor/editor-preferences-route.injectable";
|
||||
import navigateToPreferenceTabInjectable from "./navigate-to-preference-tab.injectable";
|
||||
|
||||
const editorPreferencesNavigationItemInjectable = getInjectable({
|
||||
id: "editor-preferences-navigation-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(editorPreferencesRouteInjectable);
|
||||
const navigateToPreferenceTab = di.inject(navigateToPreferenceTabInjectable);
|
||||
|
||||
const routeIsActive = di.inject(
|
||||
routeIsActiveInjectable,
|
||||
route,
|
||||
);
|
||||
|
||||
return {
|
||||
id: "editor",
|
||||
label: "Editor",
|
||||
navigate: navigateToPreferenceTab(route),
|
||||
isActive: routeIsActive,
|
||||
isVisible: computed(() => true),
|
||||
orderNumber: 40,
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: preferenceNavigationItemInjectionToken,
|
||||
});
|
||||
|
||||
export default editorPreferencesNavigationItemInjectable;
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { preferenceNavigationItemInjectionToken } from "./preference-navigation-items.injectable";
|
||||
import routeIsActiveInjectable from "../../../routes/route-is-active.injectable";
|
||||
import { computed } from "mobx";
|
||||
import extensionsPreferenceItemsInjectable from "../extension-preference-items.injectable";
|
||||
import extensionPreferencesRouteInjectable from "../../../../common/front-end-routing/routes/preferences/extension/extension-preferences-route.injectable";
|
||||
import navigateToPreferenceTabInjectable from "./navigate-to-preference-tab.injectable";
|
||||
|
||||
const extensionsPreferencesNavigationItemInjectable = getInjectable({
|
||||
id: "extension-preferences-navigation-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const preferenceItems = di.inject(
|
||||
extensionsPreferenceItemsInjectable,
|
||||
);
|
||||
|
||||
const navigateToPreferenceTab = di.inject(
|
||||
navigateToPreferenceTabInjectable,
|
||||
);
|
||||
|
||||
const route = di.inject(
|
||||
extensionPreferencesRouteInjectable,
|
||||
);
|
||||
|
||||
const routeIsActive = di.inject(
|
||||
routeIsActiveInjectable,
|
||||
route,
|
||||
);
|
||||
|
||||
return {
|
||||
id: "extensions",
|
||||
label: "Extensions",
|
||||
navigate: navigateToPreferenceTab(route),
|
||||
isActive: routeIsActive,
|
||||
|
||||
isVisible: computed(
|
||||
() => preferenceItems.get().length > 0,
|
||||
),
|
||||
|
||||
orderNumber: 70,
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: preferenceNavigationItemInjectionToken,
|
||||
});
|
||||
|
||||
export default extensionsPreferencesNavigationItemInjectable;
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { preferenceNavigationItemInjectionToken } from "./preference-navigation-items.injectable";
|
||||
import routeIsActiveInjectable from "../../../routes/route-is-active.injectable";
|
||||
import { computed } from "mobx";
|
||||
import kubernetesPreferencesRouteInjectable from "../../../../common/front-end-routing/routes/preferences/kubernetes/kubernetes-preferences-route.injectable";
|
||||
import navigateToPreferenceTabInjectable from "./navigate-to-preference-tab.injectable";
|
||||
|
||||
const kubernetesPreferencesNavigationItemInjectable = getInjectable({
|
||||
id: "kubernetes-preferences-navigation-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const navigateToPreferenceTab = di.inject(navigateToPreferenceTabInjectable);
|
||||
|
||||
const route = di.inject(
|
||||
kubernetesPreferencesRouteInjectable,
|
||||
);
|
||||
|
||||
const routeIsActive = di.inject(
|
||||
routeIsActiveInjectable,
|
||||
route,
|
||||
);
|
||||
|
||||
return {
|
||||
id: "kubernetes",
|
||||
label: "Kubernetes",
|
||||
navigate: navigateToPreferenceTab(route),
|
||||
isActive: routeIsActive,
|
||||
isVisible: computed(() => true),
|
||||
orderNumber: 30,
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: preferenceNavigationItemInjectionToken,
|
||||
});
|
||||
|
||||
export default kubernetesPreferencesNavigationItemInjectable;
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { Route } from "../../../../common/front-end-routing/route-injection-token";
|
||||
import { navigateToRouteInjectionToken } from "../../../../common/front-end-routing/navigate-to-route-injection-token";
|
||||
|
||||
const navigateToPreferenceTabInjectable = getInjectable({
|
||||
id: "navigate-to-preference-tab",
|
||||
|
||||
instantiate: (di) => {
|
||||
const navigateToRoute = di.inject(navigateToRouteInjectionToken);
|
||||
|
||||
return (route: Route) => () => {
|
||||
navigateToRoute(route, { withoutAffectingBackButton: true });
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export default navigateToPreferenceTabInjectable;
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { pipeline } from "@ogre-tools/fp";
|
||||
import { getInjectable, getInjectionToken } from "@ogre-tools/injectable";
|
||||
import { filter, orderBy } from "lodash/fp";
|
||||
import { computed, IComputedValue } from "mobx";
|
||||
|
||||
export const preferenceNavigationItemInjectionToken =
|
||||
getInjectionToken<PreferenceNavigationItem>({
|
||||
id: "preference-navigation-item-injection-token",
|
||||
});
|
||||
|
||||
export interface PreferenceNavigationItem {
|
||||
id: string;
|
||||
label: string;
|
||||
isActive: IComputedValue<boolean>;
|
||||
isVisible: IComputedValue<boolean>;
|
||||
navigate: () => void;
|
||||
orderNumber: number;
|
||||
}
|
||||
|
||||
const preferenceNavigationItemsInjectable = getInjectable({
|
||||
id: "preference-navigation-items",
|
||||
|
||||
instantiate: (di) =>
|
||||
computed((): PreferenceNavigationItem[] =>
|
||||
pipeline(
|
||||
di.injectMany(preferenceNavigationItemInjectionToken),
|
||||
filter((item) => !!item.isVisible.get()),
|
||||
(items) => orderBy([(item) => item.orderNumber], ["asc"], items),
|
||||
),
|
||||
),
|
||||
});
|
||||
|
||||
export default preferenceNavigationItemsInjectable;
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { Tab, Tabs } from "../../tabs";
|
||||
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import type { IComputedValue } from "mobx";
|
||||
import React from "react";
|
||||
import preferenceNavigationItemsInjectable, {
|
||||
PreferenceNavigationItem,
|
||||
} from "./preference-navigation-items.injectable";
|
||||
|
||||
import { observer } from "mobx-react";
|
||||
|
||||
interface Dependencies {
|
||||
navigationItems: IComputedValue<PreferenceNavigationItem[]>;
|
||||
}
|
||||
|
||||
const NonInjectedPreferencesNavigation = ({
|
||||
navigationItems,
|
||||
}: Dependencies) => (
|
||||
<Tabs
|
||||
className="flex column"
|
||||
scrollable={false}
|
||||
onChange={(item: PreferenceNavigationItem) => item.navigate()}
|
||||
>
|
||||
<div className="header">Preferences</div>
|
||||
|
||||
{navigationItems.get().map((item) => (
|
||||
<PreferencesNavigationTab
|
||||
key={item.id}
|
||||
item={item}
|
||||
data-testid={`tab-link-for-${item.id}`}
|
||||
/>
|
||||
))}
|
||||
</Tabs>
|
||||
);
|
||||
|
||||
interface PreferenceNavigationTabProps extends React.DOMAttributes<HTMLElement> {
|
||||
item: PreferenceNavigationItem;
|
||||
}
|
||||
|
||||
const PreferencesNavigationTab = observer(({ item }: PreferenceNavigationTabProps) => (
|
||||
<Tab
|
||||
value={item}
|
||||
label={item.label}
|
||||
data-testid={`tab-link-for-${item.id}`}
|
||||
active={item.isActive.get()}
|
||||
/>
|
||||
));
|
||||
|
||||
export const PreferencesNavigation = withInjectables<Dependencies>(
|
||||
NonInjectedPreferencesNavigation,
|
||||
|
||||
{
|
||||
getProps: (di) => ({
|
||||
navigationItems: di.inject(preferenceNavigationItemsInjectable),
|
||||
}),
|
||||
},
|
||||
);
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { preferenceNavigationItemInjectionToken } from "./preference-navigation-items.injectable";
|
||||
import routeIsActiveInjectable from "../../../routes/route-is-active.injectable";
|
||||
import { computed } from "mobx";
|
||||
import proxyPreferencesRouteInjectable from "../../../../common/front-end-routing/routes/preferences/proxy/proxy-preferences-route.injectable";
|
||||
import navigateToPreferenceTabInjectable from "./navigate-to-preference-tab.injectable";
|
||||
|
||||
const proxyPreferencesNavigationItemInjectable = getInjectable({
|
||||
id: "proxy-preferences-navigation-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(proxyPreferencesRouteInjectable);
|
||||
|
||||
const navigateToPreferenceTab = di.inject(
|
||||
navigateToPreferenceTabInjectable,
|
||||
);
|
||||
|
||||
const routeIsActive = di.inject(routeIsActiveInjectable, route);
|
||||
|
||||
return {
|
||||
id: "proxy",
|
||||
label: "Proxy",
|
||||
navigate: navigateToPreferenceTab(route),
|
||||
isActive: routeIsActive,
|
||||
isVisible: computed(() => true),
|
||||
orderNumber: 20,
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: preferenceNavigationItemInjectionToken,
|
||||
});
|
||||
|
||||
export default proxyPreferencesNavigationItemInjectable;
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { preferenceNavigationItemInjectionToken } from "./preference-navigation-items.injectable";
|
||||
import routeIsActiveInjectable from "../../../routes/route-is-active.injectable";
|
||||
import { computed } from "mobx";
|
||||
import telemetryPreferenceItemsInjectable from "../telemetry-preference-items.injectable";
|
||||
import telemetryPreferencesRouteInjectable from "../../../../common/front-end-routing/routes/preferences/telemetry/telemetry-preferences-route.injectable";
|
||||
import sentryDnsUrlInjectable from "../sentry-dns-url.injectable";
|
||||
import navigateToPreferenceTabInjectable from "./navigate-to-preference-tab.injectable";
|
||||
|
||||
const terminalPreferencesNavigationItemInjectable = getInjectable({
|
||||
id: "telemetry-preferences-navigation-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const sentryDnsUrl = di.inject(sentryDnsUrlInjectable);
|
||||
|
||||
const telemetryPreferenceItems = di.inject(
|
||||
telemetryPreferenceItemsInjectable,
|
||||
);
|
||||
|
||||
const navigateToPreferenceTab = di.inject(
|
||||
navigateToPreferenceTabInjectable,
|
||||
);
|
||||
|
||||
const route = di.inject(telemetryPreferencesRouteInjectable);
|
||||
|
||||
const routeIsActive = di.inject(routeIsActiveInjectable, route);
|
||||
|
||||
return {
|
||||
id: "telemetry",
|
||||
label: "Telemetry",
|
||||
navigate: navigateToPreferenceTab(route),
|
||||
isActive: routeIsActive,
|
||||
|
||||
isVisible: computed(
|
||||
() => !!sentryDnsUrl || telemetryPreferenceItems.get().length > 0,
|
||||
),
|
||||
|
||||
orderNumber: 60,
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: preferenceNavigationItemInjectionToken,
|
||||
});
|
||||
|
||||
export default terminalPreferencesNavigationItemInjectable;
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { preferenceNavigationItemInjectionToken } from "./preference-navigation-items.injectable";
|
||||
import routeIsActiveInjectable from "../../../routes/route-is-active.injectable";
|
||||
import { computed } from "mobx";
|
||||
import terminalPreferencesRouteInjectable from "../../../../common/front-end-routing/routes/preferences/terminal/terminal-preferences-route.injectable";
|
||||
import navigateToPreferenceTabInjectable from "./navigate-to-preference-tab.injectable";
|
||||
|
||||
const terminalPreferencesNavigationItemInjectable = getInjectable({
|
||||
id: "terminal-preferences-navigation-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const navigateToPreferenceTab = di.inject(
|
||||
navigateToPreferenceTabInjectable,
|
||||
);
|
||||
|
||||
const route = di.inject(terminalPreferencesRouteInjectable);
|
||||
|
||||
const routeIsActive = di.inject(routeIsActiveInjectable, route);
|
||||
|
||||
return {
|
||||
id: "terminal",
|
||||
label: "Terminal",
|
||||
navigate: navigateToPreferenceTab(route),
|
||||
isActive: routeIsActive,
|
||||
isVisible: computed(() => true),
|
||||
orderNumber: 50,
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: preferenceNavigationItemInjectionToken,
|
||||
});
|
||||
|
||||
export default terminalPreferencesNavigationItemInjectable;
|
||||
Reference in new issue
Block a user