Add experiment logs to the monitoring page #48
@@ -1,6 +1,7 @@
|
|||||||
import {getConnectedEdges, type Node, type NodeProps, Position} from '@xyflow/react';
|
import {getConnectedEdges, type Node, type NodeProps, Position, useNodeConnections} from '@xyflow/react';
|
||||||
import {useState} from "react";
|
import {useEffect, useState} from "react";
|
||||||
import styles from '../../VisProg.module.css';
|
import styles from '../../VisProg.module.css';
|
||||||
|
import type {EditorWarning} from "../components/EditorWarnings.tsx";
|
||||||
import {Toolbar} from '../components/NodeComponents.tsx';
|
import {Toolbar} from '../components/NodeComponents.tsx';
|
||||||
import {MultiConnectionHandle, SingleConnectionHandle} from "../components/RuleBasedHandle.tsx";
|
import {MultiConnectionHandle, SingleConnectionHandle} from "../components/RuleBasedHandle.tsx";
|
||||||
import {allowOnlyConnectionsFromType} from "../HandleRules.ts";
|
import {allowOnlyConnectionsFromType} from "../HandleRules.ts";
|
||||||
@@ -91,7 +92,7 @@ export const InferredBeliefTooltip = `
|
|||||||
*/
|
*/
|
||||||
export default function InferredBeliefNode(props: NodeProps<InferredBeliefNode>) {
|
export default function InferredBeliefNode(props: NodeProps<InferredBeliefNode>) {
|
||||||
const data = props.data;
|
const data = props.data;
|
||||||
const { updateNodeData } = useFlowStore();
|
const { updateNodeData, registerWarning, unregisterWarning } = useFlowStore();
|
||||||
// start of as an AND operator, true: "AND", false: "OR"
|
// start of as an AND operator, true: "AND", false: "OR"
|
||||||
const [enforceAllBeliefs, setEnforceAllBeliefs] = useState(true);
|
const [enforceAllBeliefs, setEnforceAllBeliefs] = useState(true);
|
||||||
|
|
||||||
@@ -109,6 +110,29 @@ export default function InferredBeliefNode(props: NodeProps<InferredBeliefNode>)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const beliefConnections = useNodeConnections({
|
||||||
|
id: props.id,
|
||||||
|
handleType: "target",
|
||||||
|
})
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const noBeliefsWarning : EditorWarning = {
|
||||||
|
scope: {
|
||||||
|
id: props.id,
|
||||||
|
handleId: undefined
|
||||||
|
},
|
||||||
|
type: 'MISSING_INPUT',
|
||||||
|
severity: 'ERROR',
|
||||||
|
description: `This AND/OR node is missing one or more beliefs,
|
||||||
|
please make sure to use both inputs of an AND/OR node`
|
||||||
|
};
|
||||||
|
|
||||||
|
if (beliefConnections.length < 2){
|
||||||
|
registerWarning(noBeliefsWarning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
unregisterWarning(props.id, noBeliefsWarning.type);
|
||||||
|
},[beliefConnections.length, props.id, registerWarning, unregisterWarning])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Toolbar nodeId={props.id} allowDelete={true}/>
|
<Toolbar nodeId={props.id} allowDelete={true}/>
|
||||||
|
|||||||
Reference in New Issue
Block a user