1
0
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:
Alex Andreev 2023-05-23 13:48:59 +03:00
parent 11d708d9c7
commit 3362b3d405

View File

@ -31,6 +31,7 @@ import type { ClusterContext } from "../../cluster-frame-context/cluster-frame-c
import type { GeneralKubeObjectListLayoutColumn, SpecificKubeListLayoutColumn } from "@k8slens/list-layout";
import { kubeObjectListLayoutColumnInjectionToken } from "@k8slens/list-layout";
import { sortBy } from "lodash";
import { TableDataContext } from "@k8slens/table-tokens";
export type KubeItemListStore<K extends KubeObject> = ItemListStore<K, false> & SubscribableStore & {
getByPath: (path: string) => K | undefined;
@ -186,7 +187,7 @@ class NonInjectedKubeObjectListLayout<
...targetColumns,
], (v) => -v.priority).map((col) => col.header);
return (
const itemsListLayout = (
<ItemListLayout<K, false>
className={cssNames("KubeObjectListLayout", className)}
store={store}
@ -233,6 +234,15 @@ class NonInjectedKubeObjectListLayout<
{...layoutProps}
/>
);
return (
<TableDataContext.Provider
value={{
columns: targetColumns as GeneralKubeObjectListLayoutColumn[],
}}>
{itemsListLayout}
</TableDataContext.Provider>
);
}
}