/** * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ import React from "react"; import type { LensProtocolRouterRenderer } from "../lens-protocol-router-renderer/lens-protocol-router-renderer"; import type { CatalogEntityRegistry } from "../../api/catalog/entity/registry"; import { EXTENSION_NAME_MATCH, EXTENSION_PUBLISHER_MATCH, LensProtocolRouter, } from "../../../common/protocol-handler"; import type { ShowNotification } from "../../components/notifications"; import type { NavigateToCatalog } from "../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable"; import type { NavigateToEntitySettings } from "../../../common/front-end-routing/routes/entity-settings/navigate-to-entity-settings.injectable"; import type { NavigateToClusterView } from "../../../common/front-end-routing/routes/cluster-view/navigate-to-cluster-view.injectable"; import assert from "assert"; import type { AttemptInstallByInfo } from "../../components/+extensions/attempt-install-by-info.injectable"; import type { GetClusterById } from "../../../common/cluster-store/get-by-id.injectable"; interface Dependencies { attemptInstallByInfo: AttemptInstallByInfo; lensProtocolRouterRenderer: LensProtocolRouterRenderer; navigateToCatalog: NavigateToCatalog; navigateToAddCluster: () => void; navigateToExtensions: () => void; navigateToEntitySettings: NavigateToEntitySettings; navigateToClusterView: NavigateToClusterView; navigateToPreferences: (tabId: string) => void; entityRegistry: CatalogEntityRegistry; getClusterById: GetClusterById; showShortInfoNotification: ShowNotification; } export const bindProtocolAddRouteHandlers = ({ attemptInstallByInfo, lensProtocolRouterRenderer, navigateToCatalog, navigateToAddCluster, navigateToExtensions, navigateToEntitySettings, navigateToClusterView, navigateToPreferences, entityRegistry, getClusterById, showShortInfoNotification, }: Dependencies) => () => { lensProtocolRouterRenderer .addInternalHandler("/preferences", ({ search: { highlight: tabId }}) => { if (tabId) { navigateToPreferences(tabId); } }) .addInternalHandler("/", ({ tail }) => { if (tail) { showShortInfoNotification(
{"Unknown Action for "}
lens://app/
{tail}
. Are you on the latest version?
{"Unknown catalog entity "}
{entityId}
.
{"Unknown catalog entity "}
{clusterId}
.
{"Unknown catalog entity "}
{clusterId}
.