mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* PageRegistration & PageMenuRegistration fixes & more simplification, fix #1383 Signed-off-by: Roman <ixrock@gmail.com> * clean up test, deprecate page.routePath Signed-off-by: Roman <ixrock@gmail.com> * fix: proper `isActive` state matching for page-menu-target to page considering current document location Signed-off-by: Roman <ixrock@gmail.com>
28 lines
1.4 KiB
TypeScript
28 lines
1.4 KiB
TypeScript
import type { AppPreferenceRegistration, ClusterFeatureRegistration, KubeObjectDetailRegistration, KubeObjectMenuRegistration, KubeObjectStatusRegistration, PageMenuRegistration, PageRegistration, StatusBarRegistration, } from "./registries"
|
|
import { observable } from "mobx";
|
|
import { LensExtension } from "./lens-extension"
|
|
import { getExtensionPageUrl } from "./registries/page-registry"
|
|
|
|
export class LensRendererExtension extends LensExtension {
|
|
@observable.shallow globalPages: PageRegistration[] = []
|
|
@observable.shallow clusterPages: PageRegistration[] = []
|
|
@observable.shallow globalPageMenus: PageMenuRegistration[] = []
|
|
@observable.shallow clusterPageMenus: PageMenuRegistration[] = []
|
|
@observable.shallow kubeObjectStatusTexts: KubeObjectStatusRegistration[] = []
|
|
@observable.shallow appPreferences: AppPreferenceRegistration[] = []
|
|
@observable.shallow clusterFeatures: ClusterFeatureRegistration[] = []
|
|
@observable.shallow statusBarItems: StatusBarRegistration[] = []
|
|
@observable.shallow kubeObjectDetailItems: KubeObjectDetailRegistration[] = []
|
|
@observable.shallow kubeObjectMenuItems: KubeObjectMenuRegistration[] = []
|
|
|
|
async navigate<P extends object>(pageId?: string, params?: P) {
|
|
const { navigate } = await import("../renderer/navigation");
|
|
const pageUrl = getExtensionPageUrl({
|
|
extensionId: this.name,
|
|
pageId: pageId,
|
|
params: params ?? {}, // compile to url with params
|
|
});
|
|
navigate(pageUrl);
|
|
}
|
|
}
|