mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
removed isSystem page-param's init field exposed to extensions-api
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
8ce222ecec
commit
936bdb051b
@ -1,4 +1,12 @@
|
|||||||
export { PageParamInit, PageParam } from "../../renderer/navigation/page-param";
|
import { PageParam, PageParamInit } from "../../renderer/navigation/page-param";
|
||||||
export { navigate, isActiveRoute, createPageParam } from "../../renderer/navigation/helpers";
|
import { navigation } from "../../renderer/navigation";
|
||||||
|
|
||||||
|
export type { PageParamInit, PageParam } from "../../renderer/navigation/page-param";
|
||||||
|
export { navigate, isActiveRoute } from "../../renderer/navigation/helpers";
|
||||||
export { hideDetails, showDetails, getDetailsUrl } from "../../renderer/components/kube-object/kube-object-details";
|
export { hideDetails, showDetails, getDetailsUrl } from "../../renderer/components/kube-object/kube-object-details";
|
||||||
export { IURLParams } from "../../common/utils/buildUrl";
|
export { IURLParams } from "../../common/utils/buildUrl";
|
||||||
|
|
||||||
|
// exporting to extensions-api version of helper without `isSystem` flag
|
||||||
|
export function createPageParam<V = string>(init: PageParamInit<V>) {
|
||||||
|
return new PageParam<V>(init, navigation);
|
||||||
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { LocationDescriptor } from "history";
|
import type { LocationDescriptor } from "history";
|
||||||
import { matchPath, RouteProps } from "react-router";
|
import { matchPath, RouteProps } from "react-router";
|
||||||
import { PageParam, PageParamInit } from "./page-param";
|
import { PageParam, PageSystemParamInit } from "./page-param";
|
||||||
import { clusterViewRoute, IClusterViewRouteParams } from "../components/cluster-manager/cluster-view.route";
|
import { clusterViewRoute, IClusterViewRouteParams } from "../components/cluster-manager/cluster-view.route";
|
||||||
import { navigation } from "./history";
|
import { navigation } from "./history";
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ export function navigate(location: LocationDescriptor) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createPageParam<V = string>(init: PageParamInit<V>) {
|
export function createPageParam<V = string>(init: PageSystemParamInit<V>) {
|
||||||
return new PageParam<V>(init, navigation);
|
return new PageParam<V>(init, navigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import { IObservableHistory } from "mobx-observable-history";
|
|||||||
|
|
||||||
export interface PageParamInit<V = any> {
|
export interface PageParamInit<V = any> {
|
||||||
name: string;
|
name: string;
|
||||||
isSystem?: boolean;
|
|
||||||
defaultValue?: V;
|
defaultValue?: V;
|
||||||
defaultValueStringified?: string | string[]; // serialized version of "defaultValue"
|
defaultValueStringified?: string | string[]; // serialized version of "defaultValue"
|
||||||
multiValues?: boolean; // false == by default
|
multiValues?: boolean; // false == by default
|
||||||
@ -13,14 +12,18 @@ export interface PageParamInit<V = any> {
|
|||||||
stringify?(value: V): string | string[]; // serialize params to URL
|
stringify?(value: V): string | string[]; // serialize params to URL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface PageSystemParamInit<V = any> extends PageParamInit<V> {
|
||||||
|
isSystem?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export class PageParam<V = any> {
|
export class PageParam<V = any> {
|
||||||
static SYSTEM_PREFIX = "lens-";
|
static SYSTEM_PREFIX = "lens-";
|
||||||
|
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
protected urlName: string;
|
protected urlName: string;
|
||||||
|
|
||||||
constructor(readonly init: PageParamInit<V>, protected history: IObservableHistory) {
|
constructor(readonly init: PageParamInit<V> | PageSystemParamInit<V>, protected history: IObservableHistory) {
|
||||||
const { isSystem, name } = init;
|
const { isSystem, name } = init as PageSystemParamInit;
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.init.skipEmpty ??= true;
|
this.init.skipEmpty ??= true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user