mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
modified welcome page injectables to allow for the page component to come from an extension
Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
parent
23cb231c8f
commit
a7121d2cbe
@ -56,7 +56,8 @@
|
|||||||
"bundledKubectlVersion": "1.23.3",
|
"bundledKubectlVersion": "1.23.3",
|
||||||
"bundledHelmVersion": "3.7.2",
|
"bundledHelmVersion": "3.7.2",
|
||||||
"sentryDsn": "",
|
"sentryDsn": "",
|
||||||
"contentSecurityPolicy": "script-src 'unsafe-eval' 'self'; frame-src http://*.localhost:*/; img-src * data:"
|
"contentSecurityPolicy": "script-src 'unsafe-eval' 'self'; frame-src http://*.localhost:*/; img-src * data:",
|
||||||
|
"welcomeRoute": "/welcome"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16 <17"
|
"node": ">=16 <17"
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* 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 { computed } from "mobx";
|
||||||
|
import packageJsonInjectable from "../../../vars/package-json.injectable";
|
||||||
|
import { frontEndRouteInjectionToken } from "../../front-end-route-injection-token";
|
||||||
|
|
||||||
|
const defaultWelcomeRouteInjectable = getInjectable({
|
||||||
|
id: "default-welcome-route",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const packageJson = di.inject(packageJsonInjectable);
|
||||||
|
|
||||||
|
return {
|
||||||
|
path: "/welcome",
|
||||||
|
clusterFrame: false,
|
||||||
|
isEnabled: computed(() => packageJson.config.welcomeRoute === "/welcome"),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
injectionToken: frontEndRouteInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default defaultWelcomeRouteInjectable;
|
||||||
@ -4,16 +4,21 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { computed } from "mobx";
|
import { computed } from "mobx";
|
||||||
|
import packageJsonInjectable from "../../../vars/package-json.injectable";
|
||||||
import { frontEndRouteInjectionToken } from "../../front-end-route-injection-token";
|
import { frontEndRouteInjectionToken } from "../../front-end-route-injection-token";
|
||||||
|
|
||||||
const welcomeRouteInjectable = getInjectable({
|
const welcomeRouteInjectable = getInjectable({
|
||||||
id: "welcome-route",
|
id: "welcome-route",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: (di) => {
|
||||||
path: "/welcome",
|
const packageJson = di.inject(packageJsonInjectable);
|
||||||
clusterFrame: false,
|
|
||||||
isEnabled: computed(() => true),
|
return {
|
||||||
}),
|
path: packageJson.config.welcomeRoute,
|
||||||
|
clusterFrame: false,
|
||||||
|
isEnabled: computed(() => true),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
injectionToken: frontEndRouteInjectionToken,
|
injectionToken: frontEndRouteInjectionToken,
|
||||||
});
|
});
|
||||||
|
|||||||
28
src/features/welcome/setting-welcome-page.test.ts
Normal file
28
src/features/welcome/setting-welcome-page.test.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export {};
|
||||||
|
|
||||||
|
describe("setting the welcome page", () => {
|
||||||
|
describe("given no extension sets the welcome page", () => {
|
||||||
|
it("sets the default welcome page", () => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it("navigates to the default welcome page", () => {
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("given an extension sets a custom welcome page", () => {
|
||||||
|
it("sets the custom welcome page", () => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it("navigates to the custom welcome page", () => {
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -4,18 +4,18 @@
|
|||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { Welcome } from "./welcome";
|
import { Welcome } from "./welcome";
|
||||||
import welcomeRouteInjectable from "../../../common/front-end-routing/routes/welcome/welcome-route.injectable";
|
import defaultWelcomeRouteInjectable from "../../../common/front-end-routing/routes/welcome/default-welcome-route.injectable";
|
||||||
import { routeSpecificComponentInjectionToken } from "../../routes/route-specific-component-injection-token";
|
import { routeSpecificComponentInjectionToken } from "../../routes/route-specific-component-injection-token";
|
||||||
|
|
||||||
const welcomeRouteComponentInjectable = getInjectable({
|
const defaultWelcomeRouteComponentInjectable = getInjectable({
|
||||||
id: "welcome-route-component",
|
id: "default-welcome-route-component",
|
||||||
|
|
||||||
instantiate: (di) => ({
|
instantiate: (di) => ({
|
||||||
route: di.inject(welcomeRouteInjectable),
|
route: di.inject(defaultWelcomeRouteInjectable),
|
||||||
Component: Welcome,
|
Component: Welcome,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
injectionToken: routeSpecificComponentInjectionToken,
|
injectionToken: routeSpecificComponentInjectionToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default welcomeRouteComponentInjectable;
|
export default defaultWelcomeRouteComponentInjectable;
|
||||||
Loading…
Reference in New Issue
Block a user