mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Passing columns in the context
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
11d708d9c7
commit
3362b3d405
@ -31,6 +31,7 @@ import type { ClusterContext } from "../../cluster-frame-context/cluster-frame-c
|
|||||||
import type { GeneralKubeObjectListLayoutColumn, SpecificKubeListLayoutColumn } from "@k8slens/list-layout";
|
import type { GeneralKubeObjectListLayoutColumn, SpecificKubeListLayoutColumn } from "@k8slens/list-layout";
|
||||||
import { kubeObjectListLayoutColumnInjectionToken } from "@k8slens/list-layout";
|
import { kubeObjectListLayoutColumnInjectionToken } from "@k8slens/list-layout";
|
||||||
import { sortBy } from "lodash";
|
import { sortBy } from "lodash";
|
||||||
|
import { TableDataContext } from "@k8slens/table-tokens";
|
||||||
|
|
||||||
export type KubeItemListStore<K extends KubeObject> = ItemListStore<K, false> & SubscribableStore & {
|
export type KubeItemListStore<K extends KubeObject> = ItemListStore<K, false> & SubscribableStore & {
|
||||||
getByPath: (path: string) => K | undefined;
|
getByPath: (path: string) => K | undefined;
|
||||||
@ -186,7 +187,7 @@ class NonInjectedKubeObjectListLayout<
|
|||||||
...targetColumns,
|
...targetColumns,
|
||||||
], (v) => -v.priority).map((col) => col.header);
|
], (v) => -v.priority).map((col) => col.header);
|
||||||
|
|
||||||
return (
|
const itemsListLayout = (
|
||||||
<ItemListLayout<K, false>
|
<ItemListLayout<K, false>
|
||||||
className={cssNames("KubeObjectListLayout", className)}
|
className={cssNames("KubeObjectListLayout", className)}
|
||||||
store={store}
|
store={store}
|
||||||
@ -233,6 +234,15 @@ class NonInjectedKubeObjectListLayout<
|
|||||||
{...layoutProps}
|
{...layoutProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableDataContext.Provider
|
||||||
|
value={{
|
||||||
|
columns: targetColumns as GeneralKubeObjectListLayoutColumn[],
|
||||||
|
}}>
|
||||||
|
{itemsListLayout}
|
||||||
|
</TableDataContext.Provider>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user