Skip to content

Commit

Permalink
eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmadigan committed Aug 21, 2024
1 parent fab863d commit f85c19d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/PolicyTopology.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ const PolicyTopology = ({ dotString }) => {
const [dropdownItems, setDropdownItems] = useState([]);
const [selectedLabel, setSelectedLabel] = useState('');

useEffect(() => {
const g = dot.read(dotString);
graphRef.current = g;
setFilteredDot(dotString);

const items = [
<DropdownItem key="reset" component="button" onClick={() => handleNodeSelection(null)}>
-
</DropdownItem>,
...g.nodes().map(node => (
<DropdownItem key={node} component="button" onClick={() => handleNodeSelection(node)}>
{g.node(node).label}
</DropdownItem>
)),
];
setDropdownItems(items);
}, [dotString]);

const handleNodeSelection = useCallback((nodeId) => {
const graph = graphRef.current;
if (!graph) {
Expand Down

0 comments on commit f85c19d

Please sign in to comment.