mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
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>
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
/**
|
|
* 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 { generalCatalogEntityInjectionToken } from "../general-catalog-entity-injection-token";
|
|
import { GeneralEntity } from "../../index";
|
|
import { buildURL } from "../../../utils/buildUrl";
|
|
import welcomeRouteInjectable from "../../../front-end-routing/routes/welcome/welcome-route.injectable";
|
|
|
|
const welcomeCatalogEntityInjectable = getInjectable({
|
|
id: "general-catalog-entity-for-welcome",
|
|
|
|
instantiate: (di) => {
|
|
const route = di.inject(welcomeRouteInjectable);
|
|
const url = buildURL(route.path);
|
|
|
|
return new GeneralEntity({
|
|
metadata: {
|
|
uid: "welcome-page-entity",
|
|
name: "Welcome Page",
|
|
source: "app",
|
|
labels: {},
|
|
},
|
|
spec: {
|
|
path: url,
|
|
icon: {
|
|
material: "meeting_room",
|
|
background: "#3d90ce",
|
|
},
|
|
},
|
|
status: {
|
|
phase: "active",
|
|
},
|
|
});
|
|
},
|
|
|
|
injectionToken: generalCatalogEntityInjectionToken,
|
|
});
|
|
|
|
export default welcomeCatalogEntityInjectable;
|