Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • graphpolaris/frontend-v2
  • rijkheere/frontend-v-2-reordering-paoh
2 results
Show changes
Commits on Source (5)
Showing
with 42 additions and 103 deletions
...@@ -88,7 +88,7 @@ export const Navbar = () => { ...@@ -88,7 +88,7 @@ export const Navbar = () => {
</div> </div>
</PopoverTrigger> </PopoverTrigger>
<PopoverContent className="w-56 z-30 bg-white rounded-sm border-[1px] outline-none"> <PopoverContent className="w-56 z-30 bg-light rounded-sm border-[1px] outline-none">
<div className="p-2 text-sm border-b"> <div className="p-2 text-sm border-b">
<h2 className="font-bold">user: {authCache.username}</h2> <h2 className="font-bold">user: {authCache.username}</h2>
<h3 className="text-xs break-words">session: {authCache.sessionID}</h3> <h3 className="text-xs break-words">session: {authCache.sessionID}</h3>
......
...@@ -9,7 +9,7 @@ export type VisualizationTooltipProps = { ...@@ -9,7 +9,7 @@ export type VisualizationTooltipProps = {
export const VisualizationTooltip: React.FC<VisualizationTooltipProps> = ({ name, colorHeader, children }) => { export const VisualizationTooltip: React.FC<VisualizationTooltipProps> = ({ name, colorHeader, children }) => {
return ( return (
<div className="border-1 border-sec-200 bg-white w-[12rem] -mx-2 -my-2"> <div className="border-1 border-sec-200 bg-light w-[12rem] -mx-2 -my-2">
<div className="flex m-0 justify-start items-stretch border-b border-sec-200 relative"> <div className="flex m-0 justify-start items-stretch border-b border-sec-200 relative">
<div className="left-0 top-0 h-auto w-1.5" style={{ backgroundColor: colorHeader }}></div> <div className="left-0 top-0 h-auto w-1.5" style={{ backgroundColor: colorHeader }}></div>
<div className="px-2.5 py-1 truncate flex"> <div className="px-2.5 py-1 truncate flex">
......
...@@ -15,9 +15,6 @@ export const ColorLegendSeqDiv = ({ colors, data, tickCount = 5, name }: ColorLe ...@@ -15,9 +15,6 @@ export const ColorLegendSeqDiv = ({ colors, data, tickCount = 5, name }: ColorLe
useEffect(() => { useEffect(() => {
if (!svgRef.current) return; if (!svgRef.current) return;
console.log(colors);
//console.log(divergenceColors.blueRed);
const widthSVG: number = +svgRef.current.clientWidth; const widthSVG: number = +svgRef.current.clientWidth;
const heightSVG: number = +svgRef.current.clientHeight; const heightSVG: number = +svgRef.current.clientHeight;
......
...@@ -69,7 +69,6 @@ const Scatterplot: React.FC<ScatterplotProps> = ({ data, visualConfig, xScale, o ...@@ -69,7 +69,6 @@ const Scatterplot: React.FC<ScatterplotProps> = ({ data, visualConfig, xScale, o
const yScale = d3.scaleLinear().domain([-1, 1]).range([visualConfig.heightMargin, 0]); const yScale = d3.scaleLinear().domain([-1, 1]).range([visualConfig.heightMargin, 0]);
console.log(visualConfig);
// PIXI // PIXI
const app = new PIXI.Application({ const app = new PIXI.Application({
width: visualConfig.width, width: visualConfig.width,
...@@ -103,8 +102,6 @@ const Scatterplot: React.FC<ScatterplotProps> = ({ data, visualConfig, xScale, o ...@@ -103,8 +102,6 @@ const Scatterplot: React.FC<ScatterplotProps> = ({ data, visualConfig, xScale, o
d.gfx = graphics; d.gfx = graphics;
}); });
console.log('DONE SIMULATION');
const svg = d3 const svg = d3
.select(svgRef.current) .select(svgRef.current)
.attr('width', visualConfig.width) .attr('width', visualConfig.width)
......
...@@ -78,6 +78,11 @@ type BooleanProps = { ...@@ -78,6 +78,11 @@ type BooleanProps = {
value: boolean; value: boolean;
tooltip?: string; tooltip?: string;
onChange?: (value: boolean) => void; onChange?: (value: boolean) => void;
size?: 'xs' | 'sm' | 'md' | 'xl';
info?: string;
required?: boolean;
className?: string;
inline?: boolean;
}; };
type RadioProps = { type RadioProps = {
...@@ -417,23 +422,31 @@ export const CheckboxInput = ({ label, value, options, onChange, tooltip }: Chec ...@@ -417,23 +422,31 @@ export const CheckboxInput = ({ label, value, options, onChange, tooltip }: Chec
); );
}; };
export const BooleanInput = ({ label, value, onChange, tooltip }: BooleanProps) => { export const BooleanInput = ({ label, value, onChange, tooltip, info, size, required, className }: BooleanProps) => {
return ( return (
<Tooltip> <Tooltip>
<TooltipTrigger> <TooltipTrigger className={className + 'w-full flex justify-between'}>
<label className={`label cursor-pointer w-fit gap-2 px-0 py-1`}> {label && (
<span className="text-sm">{label}</span> <label className="label p-0">
<input <span
type="checkbox" className={`text-${size} text-left truncate font-medium text-secondary-700 ${required && "after:content-['*'] after:ml-0.5 after:text-danger-500"}`}
checked={value} >
onChange={(event) => { {label}
if (onChange) { </span>
onChange(event.target.checked); {info && <Info tooltip={info} />}
} </label>
}} )}
className="checkbox checkbox-xs" <input
/> type="checkbox"
</label> checked={value}
onChange={(event) => {
if (onChange) {
onChange(event.target.checked);
}
}}
className="checkbox checkbox-xs"
aria-label={`Toggle ${label}`}
/>
</TooltipTrigger> </TooltipTrigger>
{tooltip && <TooltipContent>{tooltip}</TooltipContent>} {tooltip && <TooltipContent>{tooltip}</TooltipContent>}
</Tooltip> </Tooltip>
......
...@@ -147,7 +147,6 @@ export function wsTestSaveStateConnectionSubscription(callback: TestSaveStateCon ...@@ -147,7 +147,6 @@ export function wsTestSaveStateConnectionSubscription(callback: TestSaveStateCon
} }
export function wsUpdateState(request: SaveStateI, callback?: GetStateResponse) { export function wsUpdateState(request: SaveStateI, callback?: GetStateResponse) {
//console.log('wsUpdateState', request);
Broker.instance().sendMessage( Broker.instance().sendMessage(
{ {
key: 'state', key: 'state',
......
...@@ -80,11 +80,8 @@ export abstract class CytoscapeLayout extends Layout<CytoscapeProvider> { ...@@ -80,11 +80,8 @@ export abstract class CytoscapeLayout extends Layout<CytoscapeProvider> {
protected defaultLayoutSettings = { protected defaultLayoutSettings = {
animate: false, animate: false,
animationDuration: 5000, animationDuration: 5000,
ready: function () { ready: function () {}, // on layoutready
// console.info('Layout.ready');
}, // on layoutready
stop: () => { stop: () => {
// console.log('Layout.stop');
this.updateNodePositions(); this.updateNodePositions();
}, // on layoutstop }, // on layoutstop
}; };
...@@ -412,7 +409,6 @@ class CytoscapeCoseBilkent extends CytoscapeLayout { ...@@ -412,7 +409,6 @@ class CytoscapeCoseBilkent extends CytoscapeLayout {
// const node = event.target; // const node = event.target;
// // The node's position has changed // // The node's position has changed
// // You can access the new position with node.position() // // You can access the new position with node.position()
// console.log(node, event.target.position());
// this.updateNodePositions(); // this.updateNodePositions();
// }); // });
} }
...@@ -585,7 +581,7 @@ class CytoscapeBreathFirst extends CytoscapeLayout { ...@@ -585,7 +581,7 @@ class CytoscapeBreathFirst extends CytoscapeLayout {
name: 'breadthfirst', name: 'breadthfirst',
} as any); } as any);
// console.log('CytoscapeBreathFirst.layout', layout);
layout.run(); layout.run();
this.updateNodePositions(); this.updateNodePositions();
......
...@@ -55,7 +55,6 @@ export abstract class GraphologyLayout extends Layout<GraphologyProvider> { ...@@ -55,7 +55,6 @@ export abstract class GraphologyLayout extends Layout<GraphologyProvider> {
throw new Error('The graph is not set.'); throw new Error('The graph is not set.');
} }
// console.log('Getting position for node:', nodeId, this.graph.getNodeAttributes(nodeId));
return this.graph.getNodeAttributes(nodeId); return this.graph.getNodeAttributes(nodeId);
} }
} }
...@@ -207,7 +206,7 @@ export class GraphologyForceAtlas2Webworker extends GraphologyLayout { ...@@ -207,7 +206,7 @@ export class GraphologyForceAtlas2Webworker extends GraphologyLayout {
let settings = { let settings = {
...this.defaultLayoutSettings, ...this.defaultLayoutSettings,
...sensibleSettings, ...sensibleSettings,
adjustSizes: graph.order < 300 ? true : false adjustSizes: graph.order < 300 ? true : false,
}; };
if (graph.order > 5000) { if (graph.order > 5000) {
...@@ -215,7 +214,7 @@ export class GraphologyForceAtlas2Webworker extends GraphologyLayout { ...@@ -215,7 +214,7 @@ export class GraphologyForceAtlas2Webworker extends GraphologyLayout {
...settings, ...settings,
barnesHutOptimize: true, barnesHutOptimize: true,
barnesHutTheta: 0.75, barnesHutTheta: 0.75,
slowDown: 0.75 slowDown: 0.75,
}; };
} }
......
...@@ -23,7 +23,6 @@ export abstract class Layout<provider extends Providers> { ...@@ -23,7 +23,6 @@ export abstract class Layout<provider extends Providers> {
if (boundingBox !== undefined) { if (boundingBox !== undefined) {
this.boundingBox = boundingBox; this.boundingBox = boundingBox;
// console.log(`Setting bounding box to ${JSON.stringify(this.boundingBox)}`);
} }
if (this.verbose) { if (this.verbose) {
......
...@@ -232,8 +232,6 @@ export class QueryMultiGraphology extends Graph<QueryGraphNodes, QueryGraphEdges ...@@ -232,8 +232,6 @@ export class QueryMultiGraphology extends Graph<QueryGraphNodes, QueryGraphEdges
handleType: targetHandleType, handleType: targetHandleType,
}; };
// console.log('newEdge', attributes, source, target);
// Add/edit an edge to the graphology object // Add/edit an edge to the graphology object
const edgeResult = this.mergeEdge(source.id, target.id, attributes as QueryGraphEdges); const edgeResult = this.mergeEdge(source.id, target.id, attributes as QueryGraphEdges);
......
...@@ -143,9 +143,7 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => { ...@@ -143,9 +143,7 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => {
* TODO? * TODO?
*/ */
function onNodesChange(nodes: NodeChange[]) { function onNodesChange(nodes: NodeChange[]) {
// console.log(nodes);
nodes.forEach((n) => { nodes.forEach((n) => {
// console.log(graphologyGraph.findNode((gn) => gn === n?.id));
if (n.type !== 'position') { if (n.type !== 'position') {
// updated = true; // updated = true;
// graphologyGraph.updateAttributes(n.id, n.data); // graphologyGraph.updateAttributes(n.id, n.data);
...@@ -269,7 +267,6 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => { ...@@ -269,7 +267,6 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => {
switch (dragData.type) { switch (dragData.type) {
case QueryElementTypes.Entity: case QueryElementTypes.Entity:
// console.log('entity drop', dragData, schema.getNodeAttribute(dragData.name, 'attributes'));
graphologyGraph.addPill2Graphology( graphologyGraph.addPill2Graphology(
{ {
type: QueryElementTypes.Entity, type: QueryElementTypes.Entity,
...@@ -376,20 +373,15 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => { ...@@ -376,20 +373,15 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => {
}; };
const onNodeMouseEnter = (event: React.MouseEvent, node: Node) => { const onNodeMouseEnter = (event: React.MouseEvent, node: Node) => {
// console.log(node);
// console.log(schema.getNodeAttribute(node.type, 'attributes'));
setAllowZoom(false); setAllowZoom(false);
}; };
const onNodeMouseLeave = (event: React.MouseEvent, node: Node) => { const onNodeMouseLeave = (event: React.MouseEvent, node: Node) => {
// console.log(node);
setAllowZoom(true); setAllowZoom(true);
}; };
const onConnect = useCallback( const onConnect = useCallback(
(connection: Connection) => { (connection: Connection) => {
console.log(connection);
if (!isEdgeUpdating.current) { if (!isEdgeUpdating.current) {
isOnConnect.current = true; isOnConnect.current = true;
if (!connection.sourceHandle || !connection.targetHandle) throw new Error('Connection has no source or target'); if (!connection.sourceHandle || !connection.targetHandle) throw new Error('Connection has no source or target');
...@@ -409,7 +401,6 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => { ...@@ -409,7 +401,6 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => {
const onConnectStart = useCallback( const onConnectStart = useCallback(
(event: React.MouseEvent | React.TouchEvent, params: OnConnectStartParams) => { (event: React.MouseEvent | React.TouchEvent, params: OnConnectStartParams) => {
// console.log('onConnectStart', params);
if (!params?.handleId) return; if (!params?.handleId) return;
let node = graphologyGraph.getNodeAttributes(params.nodeId); let node = graphologyGraph.getNodeAttributes(params.nodeId);
...@@ -485,10 +476,6 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => { ...@@ -485,10 +476,6 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => {
[graph], [graph],
); );
const onEdgesChange = (params: OnEdgesChange) => {
console.log('edges change', params);
};
const onEdgeUpdateEnd = useCallback( const onEdgeUpdateEnd = useCallback(
(event: MouseEvent | TouchEvent, edge: Edge, handleType: HandleType) => { (event: MouseEvent | TouchEvent, edge: Edge, handleType: HandleType) => {
if (isEdgeUpdating.current) { if (isEdgeUpdating.current) {
......
...@@ -137,7 +137,6 @@ export const Simple = { ...@@ -137,7 +137,6 @@ export const Simple = {
// ); // );
graph.addEdge2Graphology(entity1, relation1); graph.addEdge2Graphology(entity1, relation1);
graph.addEdge2Graphology(relation1, entity2); graph.addEdge2Graphology(relation1, entity2);
// console.log(graph.getNodeAttributes('2'));
// graph.addEdge('2', '1', { type: 'attribute_connection' }); // graph.addEdge('2', '1', { type: 'attribute_connection' });
// graph.addEdge('3', '1', { type: 'attribute_connection' }); // graph.addEdge('3', '1', { type: 'attribute_connection' });
// graph.addEdge('4', '0', { type: 'attribute_connection' }); // graph.addEdge('4', '0', { type: 'attribute_connection' });
......
...@@ -235,7 +235,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -235,7 +235,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -277,7 +276,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -277,7 +276,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -329,7 +327,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -329,7 +327,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -365,7 +362,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -365,7 +362,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -399,7 +395,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -399,7 +395,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -458,7 +453,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -458,7 +453,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -495,7 +489,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -495,7 +489,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -547,7 +540,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -547,7 +540,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -594,7 +586,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -594,7 +586,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -620,7 +611,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -620,7 +611,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -668,7 +658,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -668,7 +658,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -703,7 +692,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -703,7 +692,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -724,7 +712,6 @@ describe('QueryUtils Entity and Relations', () => { ...@@ -724,7 +712,6 @@ describe('QueryUtils Entity and Relations', () => {
], ],
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
}); });
...@@ -761,7 +748,6 @@ describe('QueryUtils calculateQueryLogic', () => { ...@@ -761,7 +748,6 @@ describe('QueryUtils calculateQueryLogic', () => {
let logics = graphExport.nodes.filter((n) => n?.attributes?.type === QueryElementTypes.Logic) as SerializedNode<LogicNodeAttributes>[]; let logics = graphExport.nodes.filter((n) => n?.attributes?.type === QueryElementTypes.Logic) as SerializedNode<LogicNodeAttributes>[];
const ret = calculateQueryLogic(logics[0], graphExport, logics); const ret = calculateQueryLogic(logics[0], graphExport, logics);
// console.log(ret);
}); });
}); });
...@@ -811,7 +797,6 @@ describe('QueryUtils with Logic', () => { ...@@ -811,7 +797,6 @@ describe('QueryUtils with Logic', () => {
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -893,7 +878,6 @@ describe('QueryUtils with Logic', () => { ...@@ -893,7 +878,6 @@ describe('QueryUtils with Logic', () => {
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -954,7 +938,6 @@ describe('QueryUtils with Logic', () => { ...@@ -954,7 +938,6 @@ describe('QueryUtils with Logic', () => {
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
...@@ -1006,7 +989,6 @@ describe('QueryUtils with Logic', () => { ...@@ -1006,7 +989,6 @@ describe('QueryUtils with Logic', () => {
}; };
let ret = Query2BackendQuery('database', graph.export(), defaultSettings); let ret = Query2BackendQuery('database', graph.export(), defaultSettings);
// console.log(JSON.stringify(ret, null, 2));
expect(ret).toMatchObject(expected); expect(ret).toMatchObject(expected);
}); });
}); });
......
...@@ -25,10 +25,8 @@ const traverseEntityRelationPaths = ( ...@@ -25,10 +25,8 @@ const traverseEntityRelationPaths = (
settings: QueryBuilderSettings, settings: QueryBuilderSettings,
): number => { ): number => {
if (!node?.attributes) throw Error('Malformed Graph! Node has no attributes'); if (!node?.attributes) throw Error('Malformed Graph! Node has no attributes');
// console.log(paths);
if (!paths?.[currentIdx]) { if (!paths?.[currentIdx]) {
// console.log('new path');
paths.push([]); paths.push([]);
if (node.attributes.type === QueryElementTypes.Relation) { if (node.attributes.type === QueryElementTypes.Relation) {
paths[currentIdx].push({ type: QueryElementTypes.Entity, x: node.attributes.x, y: node.attributes.y, attributes: [] }); paths[currentIdx].push({ type: QueryElementTypes.Entity, x: node.attributes.x, y: node.attributes.y, attributes: [] });
...@@ -65,15 +63,12 @@ const traverseEntityRelationPaths = ( ...@@ -65,15 +63,12 @@ const traverseEntityRelationPaths = (
} }
return 0; return 0;
} }
// console.log('connections', connections);
const nodesToRight = connections const nodesToRight = connections
.map((c, i) => { .map((c, i) => {
const rightNodeHandleData = c.attributes?.targetHandleData; const rightNodeHandleData = c.attributes?.targetHandleData;
if (!rightNodeHandleData) throw Error('Malformed Graph! One or more edges of a relation node do not exist'); if (!rightNodeHandleData) throw Error('Malformed Graph! One or more edges of a relation node do not exist');
// console.log('nodesToRight', c);
// console.log('entities', entities);
if (paths[currentIdx].length > 10 || currentIdx > 10) if (paths[currentIdx].length > 10 || currentIdx > 10)
throw Error('Malformed Graph! One or more edges of a relation node do not exist'); throw Error('Malformed Graph! One or more edges of a relation node do not exist');
const rightNode = const rightNode =
...@@ -130,7 +125,6 @@ export function calculateQueryLogic( ...@@ -130,7 +125,6 @@ export function calculateQueryLogic(
val = `\".*\"`; // Empty means allow anything val = `\".*\"`; // Empty means allow anything
} }
} }
// console.log('val', val, inputRef, node);
return val; return val;
} else if (connectionToInputRef.attributes?.sourceHandleData.nodeType === QueryElementTypes.Logic) { } else if (connectionToInputRef.attributes?.sourceHandleData.nodeType === QueryElementTypes.Logic) {
// Is connected to another logic node // Is connected to another logic node
...@@ -249,16 +243,6 @@ export function Query2BackendQuery( ...@@ -249,16 +243,6 @@ export function Query2BackendQuery(
let graphLogicChunks = logicsRightHandleFinal.map((node) => calculateQueryLogic(node, graph, logics)); let graphLogicChunks = logicsRightHandleFinal.map((node) => calculateQueryLogic(node, graph, logics));
query.logic = queryLogicUnion(graphLogicChunks); query.logic = queryLogicUnion(graphLogicChunks);
// Logic pathways extraction: now traverse the graph again though the logic components to construct the logic chunks
// console.log('logics', logics);
// console.log('entitiesEmptyLeftHandle', entitiesEmptyLeftHandle);
// console.log('relationsEmptyLeftHandle', relationsEmptyLeftHandle);
// console.log('graphSequenceChunks', graphSequenceChunks);
// console.log('graphLogicChunks', graphLogicChunks);
// console.log('logicsRightHandleConnectedOutside', logicsRightHandleConnectedOutside);
// console.log('logicsRightHandleFinal', logicsRightHandleFinal);
// console.log('graphSequenceChunksIdMap', graphSequenceChunksIdMap);
if (!graphSequenceChunks || graphSequenceChunks.length === 0 || graphSequenceChunks?.[0].length === 0) return query; if (!graphSequenceChunks || graphSequenceChunks.length === 0 || graphSequenceChunks?.[0].length === 0) return query;
const processConnection = (chunk: QueryGraphNodes[], position: number): RelationStruct | NodeStruct => { const processConnection = (chunk: QueryGraphNodes[], position: number): RelationStruct | NodeStruct => {
......
...@@ -98,6 +98,9 @@ export const Schema = (props: Props) => { ...@@ -98,6 +98,9 @@ export const Schema = (props: Props) => {
await layout.current?.layout(expandedSchema, xy); await layout.current?.layout(expandedSchema, xy);
const schemaFlow = schemaGraphology2Reactflow(expandedSchema, settings.connectionType, settings.animatedEdges); const schemaFlow = schemaGraphology2Reactflow(expandedSchema, settings.connectionType, settings.animatedEdges);
schemaFlow.nodes = schemaFlow.nodes.filter((node) => !node.id.toLowerCase().includes('bloom'));
schemaFlow.edges = schemaFlow.edges.filter((edge) => !edge.id.toLowerCase().includes('bloom'));
let nodesWithRef, edgesWithRef; let nodesWithRef, edgesWithRef;
if (!hasLayoutBeenRun) { if (!hasLayoutBeenRun) {
nodesWithRef = schemaFlow.nodes.map((node) => { nodesWithRef = schemaFlow.nodes.map((node) => {
...@@ -263,10 +266,7 @@ export const Schema = (props: Props) => { ...@@ -263,10 +266,7 @@ export const Schema = (props: Props) => {
</> </>
} }
> >
<div <div className="schema-panel w-full h-full flex flex-col justify-between" ref={reactFlowRef}>
className="schema-panel w-full h-full flex flex-col justify-between"
ref={reactFlowRef}
>
{nodes.length === 0 ? ( {nodes.length === 0 ? (
<p className="m-3 text-xl font-bold">No Elements</p> <p className="m-3 text-xl font-bold">No Elements</p>
) : ( ) : (
......
...@@ -27,7 +27,6 @@ export const SchemaRelationshipPopup = (props: SchemaRelationshipPopupProps) => ...@@ -27,7 +27,6 @@ export const SchemaRelationshipPopup = (props: SchemaRelationshipPopupProps) =>
// dispatch(setSchemaSettings(state)); // dispatch(setSchemaSettings(state));
} }
console.log('data relation popup', props);
return ( return (
<> <>
<FormCard> <FormCard>
...@@ -37,10 +36,7 @@ export const SchemaRelationshipPopup = (props: SchemaRelationshipPopupProps) => ...@@ -37,10 +36,7 @@ export const SchemaRelationshipPopup = (props: SchemaRelationshipPopupProps) =>
submit(); submit();
}} }}
> >
<FormTitle <FormTitle title="Edge Statistics" onClose={props.onClose} />
title="Edge Statistics"
onClose={props.onClose}
/>
<FormHBar /> <FormHBar />
<span className="px-5"> <span className="px-5">
......
...@@ -7,8 +7,6 @@ describe('SchemaUsecases', () => { ...@@ -7,8 +7,6 @@ describe('SchemaUsecases', () => {
test.each([{ data: simpleSchemaRaw }, { data: movieSchemaRaw }, { data: northwindSchemaRaw }, { data: twitterSchemaRaw }])( test.each([{ data: simpleSchemaRaw }, { data: movieSchemaRaw }, { data: northwindSchemaRaw }, { data: twitterSchemaRaw }])(
'parseSchemaFromBackend parsing should work', 'parseSchemaFromBackend parsing should work',
({ data }: any) => { ({ data }: any) => {
// console.log('testinput', input);
const parsed = SchemaUtils.schemaBackend2Graphology(data as SchemaFromBackend); const parsed = SchemaUtils.schemaBackend2Graphology(data as SchemaFromBackend);
expect(parsed).toBeDefined(); expect(parsed).toBeDefined();
}, },
......
...@@ -12,14 +12,12 @@ export function schemaExpandRelation(graph: SchemaGraphology): SchemaGraphology ...@@ -12,14 +12,12 @@ export function schemaExpandRelation(graph: SchemaGraphology): SchemaGraphology
const newGraph = graph.copy(); const newGraph = graph.copy();
newGraph.forEachNode((node, attributes) => { newGraph.forEachNode((node, attributes) => {
// console.log(node, attributes);
newGraph.mergeNodeAttributes(node, { type: QueryElementTypes.Entity }); newGraph.mergeNodeAttributes(node, { type: QueryElementTypes.Entity });
}); });
//makeNewRelationNodes //makeNewRelationNodes
graph.forEachEdge((edge, attributes, source, target): void => { graph.forEachEdge((edge, attributes, source, target): void => {
const newID = 'RelationNode:' + edge; const newID = 'RelationNode:' + edge;
// console.log('making relationnode', edge, attributes, source, target, newID);
newGraph.addNode(newID, { newGraph.addNode(newID, {
...attributes, ...attributes,
name: edge, name: edge,
...@@ -36,7 +34,6 @@ export function schemaExpandRelation(graph: SchemaGraphology): SchemaGraphology ...@@ -36,7 +34,6 @@ export function schemaExpandRelation(graph: SchemaGraphology): SchemaGraphology
}); });
const id2 = 'RelationEdge' + newID + '->' + target; const id2 = 'RelationEdge' + newID + '->' + target;
// console.log('making newEdgeOutgoing', edge, attributes, source, target, id);
newGraph.addDirectedEdgeWithKey(id2, newID, target, {}); newGraph.addDirectedEdgeWithKey(id2, newID, target, {});
newGraph.dropEdge(edge); newGraph.dropEdge(edge);
...@@ -49,7 +46,7 @@ export function schemaExpandRelation(graph: SchemaGraphology): SchemaGraphology ...@@ -49,7 +46,7 @@ export function schemaExpandRelation(graph: SchemaGraphology): SchemaGraphology
export function schemaGraphology2Reactflow( export function schemaGraphology2Reactflow(
graph: Graph, graph: Graph,
defaultEdgeType: string, defaultEdgeType: string,
animatedEdges = false animatedEdges = false,
): { ): {
nodes: Array<Node<SchemaReactflowNodeWithFunctions | SchemaReactflowRelationWithFunctions>>; nodes: Array<Node<SchemaReactflowNodeWithFunctions | SchemaReactflowRelationWithFunctions>>;
edges: Array<Edge>; edges: Array<Edge>;
...@@ -86,7 +83,6 @@ export function createReactFlowEdges(graph: Graph, defaultEdgeType: string, anim ...@@ -86,7 +83,6 @@ export function createReactFlowEdges(graph: Graph, defaultEdgeType: string, anim
const edgeElements: Array<Edge> = []; const edgeElements: Array<Edge> = [];
graph.forEachEdge((edge, attributes, source, target): void => { graph.forEachEdge((edge, attributes, source, target): void => {
// console.log('edges', attributes, edge);
const newEdge: Edge = { const newEdge: Edge = {
id: edge, id: edge,
source: source, source: source,
......
...@@ -14,7 +14,6 @@ export class SchemaUtils { ...@@ -14,7 +14,6 @@ export class SchemaUtils {
// Instantiate a directed graph that allows self loops and parallel edges // Instantiate a directed graph that allows self loops and parallel edges
const schemaGraphology = new SchemaGraphology({ allowSelfLoops: true }); const schemaGraphology = new SchemaGraphology({ allowSelfLoops: true });
// console.log('parsing schema');
// The graph schema needs a node for each node AND edge. These need then be connected // The graph schema needs a node for each node AND edge. These need then be connected
if (!nodes || !edges) return schemaGraphology; if (!nodes || !edges) return schemaGraphology;
......
...@@ -15,10 +15,10 @@ export function ActionBar({ isSearching, setIsSearching, setSearchResult, setSel ...@@ -15,10 +15,10 @@ export function ActionBar({ isSearching, setIsSearching, setSearchResult, setSel
return ( return (
<div> <div>
<div className="absolute left-0 top-0 m-1"> <div className="absolute left-0 top-0 m-1">
<div className="cursor-pointer p-1 pb-0 bg-white shadow-md rounded" onClick={() => setSelectingRectangle(true)}> <div className="cursor-pointer p-1 pb-0 bg-light shadow-md rounded" onClick={() => setSelectingRectangle(true)}>
<Icon component="icon-[ic--baseline-highlight-alt]" /> <Icon component="icon-[ic--baseline-highlight-alt]" />
</div> </div>
<div className="cursor-pointer p-1 mt-1 pb-0 bg-white shadow-md rounded" onClick={() => setIsSearching(!isSearching)}> <div className="cursor-pointer p-1 mt-1 pb-0 bg-light shadow-md rounded" onClick={() => setIsSearching(!isSearching)}>
<Icon component="icon-[ic--outline-search]" /> <Icon component="icon-[ic--outline-search]" />
</div> </div>
</div> </div>
......