From 033f283a7b89ae761b2eed64bd92502044d34ea3 Mon Sep 17 00:00:00 2001 From: 2427021 <s.a.vink@students.uu.nl> Date: Thu, 28 Mar 2024 09:10:23 +0100 Subject: [PATCH] feat(visManager): table settings --- .../vis/visualizations/tablevis/tablevis.tsx | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libs/shared/lib/vis/visualizations/tablevis/tablevis.tsx b/libs/shared/lib/vis/visualizations/tablevis/tablevis.tsx index 710ee0ff0..b6b54b945 100644 --- a/libs/shared/lib/vis/visualizations/tablevis/tablevis.tsx +++ b/libs/shared/lib/vis/visualizations/tablevis/tablevis.tsx @@ -9,11 +9,13 @@ import { SettingsContainer, SettingsHeader } from '@graphpolaris/shared/lib/vis/ export type TableProps = { showBarplot: boolean; itemsPerPage: number; + displayAttributes: string[]; }; const configuration: TableProps = { itemsPerPage: 10, showBarplot: false, + displayAttributes: [], }; export const TableVis = ({ data, schema, configuration }: VisualizationPropTypes) => { @@ -53,6 +55,14 @@ const TableSettings = ({ graph: GraphMetaData; updateSettings: (val: any) => void; }) => { + const uniqueAttributes = new Set(); + Object.keys(graph.nodes.types).forEach((label) => { + Object.keys(graph.nodes.types[label].attributes).forEach((attr: string) => { + uniqueAttributes.add(attr); + }); + }); + const attributes: string[] = Array.from(uniqueAttributes) as string[]; + return ( <SettingsContainer> <Input @@ -68,6 +78,21 @@ const TableSettings = ({ value={configuration.showBarplot} onChange={(val) => updateSettings({ showBarplot: val })} /> + + <div> + <span className="text-sm">Attributes to display</span> + <div className="h-44 overflow-y-auto"> + <Input + type="checkbox" + value={configuration.displayAttributes} + options={attributes} + onChange={(val: string[] | string) => { + const updatedVal = Array.isArray(val) ? val : [val]; + updateSettings({ displayAttributes: updatedVal }); + }} + /> + </div> + </div> </SettingsContainer> ); }; -- GitLab