Skip to content
Snippets Groups Projects
Commit 8c5478f8 authored by Vink, S.A. (Sjoerd)'s avatar Vink, S.A. (Sjoerd)
Browse files

feat(visManager): json settings

parent fe627744
No related branches found
No related tags found
2 merge requests!135geo intergation,!129Feat/visManager
Pipeline #131543 passed
...@@ -227,7 +227,7 @@ export const BooleanInput = ({ label, value, onChange, tooltip }: BooleanProps) ...@@ -227,7 +227,7 @@ export const BooleanInput = ({ label, value, onChange, tooltip }: BooleanProps)
return ( return (
<div data-tip={tooltip || null} className={tooltip ? 'tooltip' : ''}> <div data-tip={tooltip || null} className={tooltip ? 'tooltip' : ''}>
<label className={`label cursor-pointer w-fit gap-2 px-0 py-1`}> <label className={`label cursor-pointer w-fit gap-2 px-0 py-1`}>
<span className="label-text">{label}</span> <span className="text-sm">{label}</span>
<input <input
type="checkbox" type="checkbox"
checked={value} checked={value}
......
...@@ -62,7 +62,9 @@ export const EntityFlowElement = React.memo((node: SchemaReactflowEntityNode) => ...@@ -62,7 +62,9 @@ export const EntityFlowElement = React.memo((node: SchemaReactflowEntityNode) =>
position={Position.Right} position={Position.Right}
className={'!top-8 !right-2 !bg-accent-700 !rounded-none'} className={'!top-8 !right-2 !bg-accent-700 !rounded-none'}
/> />
<div className="text-center py-1">{data.name}</div> <div className="">
<div className="text-center py-1">{data.name}</div>
</div>
{data?.attributes && ( {data?.attributes && (
<PillDropdown <PillDropdown
node={node} node={node}
......
...@@ -13,8 +13,6 @@ type Props = { ...@@ -13,8 +13,6 @@ type Props = {
export function ConfigPanel({ manager }: Props) { export function ConfigPanel({ manager }: Props) {
const session = useSessionCache(); const session = useSessionCache();
console.log(session);
return ( return (
<div className="w-full h-full flex flex-col border"> <div className="w-full h-full flex flex-col border">
{manager.active ? ( {manager.active ? (
......
...@@ -2,26 +2,39 @@ import React, { useEffect } from 'react'; ...@@ -2,26 +2,39 @@ import React, { useEffect } from 'react';
import ReactJSONView from 'react-json-view'; import ReactJSONView from 'react-json-view';
import { VisualizationPropTypes, VISComponentType } from '../../types'; import { VisualizationPropTypes, VISComponentType } from '../../types';
import { GraphMetaData } from '@graphpolaris/shared/lib/data-access/statistics'; import { GraphMetaData } from '@graphpolaris/shared/lib/data-access/statistics';
import { SettingsContainer, SettingsHeader } from '@graphpolaris/shared/lib/vis/configuration'; import { SettingsContainer } from '@graphpolaris/shared/lib/vis/configuration';
import Input from '@graphpolaris/shared/lib/components/inputs';
export interface RawJSONVisProps {} export interface RawJSONVisProps {
showDataTypes: boolean;
showObjectSize: boolean;
enableClipboard: boolean;
theme: string;
iconStyle: string;
}
const configuration: RawJSONVisProps = {}; const configuration: RawJSONVisProps = {
showDataTypes: false,
showObjectSize: false,
enableClipboard: false,
theme: 'bright:inverted',
iconStyle: 'circle',
};
export const RawJSONVis = React.memo(({ data }: VisualizationPropTypes) => { export const RawJSONVis = React.memo(({ data, configuration }: VisualizationPropTypes) => {
return ( return (
<div> <div className="overflow-y-auto">
<div style={{ overflowY: 'auto' }}> <ReactJSONView
<div src={data}
style={{ collapsed={1}
marginTop: '50px', quotesOnKeys={false}
paddingLeft: '30px', style={{ padding: '20px' }}
}} theme={configuration.theme}
className="font-mono text-sm" iconStyle={configuration.iconStyle}
> displayDataTypes={configuration.displayDataTypes}
<ReactJSONView src={data} collapsed={1} quotesOnKeys={false} displayDataTypes={false} /> displayObjectSize={configuration.displayObjectSize}
</div> enableClipboard={configuration.enableClipboard}
</div> />
</div> </div>
); );
}); });
...@@ -35,7 +48,42 @@ const RawJSONSettings = ({ ...@@ -35,7 +48,42 @@ const RawJSONSettings = ({
graph: GraphMetaData; graph: GraphMetaData;
updateSettings: (val: any) => void; updateSettings: (val: any) => void;
}) => { }) => {
return <SettingsContainer>To be implemented</SettingsContainer>; return (
<SettingsContainer>
<Input
type="dropdown"
label="Select a theme"
value={configuration.theme}
options={['bright:inverted', 'monokai', 'ocean']}
onChange={(val) => updateSettings({ theme: val })}
/>
<Input
type="dropdown"
label="Icon style"
value={configuration.iconStyle}
options={['circle', 'square', 'triangle']}
onChange={(val) => updateSettings({ iconStyle: val })}
/>
<Input
type="boolean"
label="Show data types"
value={configuration.showDataTypes}
onChange={(val) => updateSettings({ showDataTypes: val })}
/>
<Input
type="boolean"
label="Show object size"
value={configuration.showObjectSize}
onChange={(val) => updateSettings({ showObjectSize: val })}
/>
<Input
type="boolean"
label="Enable clipboard"
value={configuration.enableClipboard}
onChange={(val) => updateSettings({ enableClipboard: val })}
/>
</SettingsContainer>
);
}; };
export const RawJSONComponent: VISComponentType = { export const RawJSONComponent: VISComponentType = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment