diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx
index 0f66daaf3..adb7f5023 100644
--- a/src/frontend/src/CustomNodes/GenericNode/index.tsx
+++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx
@@ -31,7 +31,7 @@ export default function GenericNode({
});
showError.current = false;
}
- deleteNode(data.id)
+ deleteNode(data.id);
return;
}
return (
@@ -74,7 +74,12 @@ export default function GenericNode({
!key.startsWith('_') && data.node.template[key].show).length === 0?"hidden":""
+ Object.keys(data.node.template).filter(
+ (key) =>
+ !key.startsWith("_") && data.node.template[key].show
+ ).length === 0
+ ? "hidden"
+ : ""
)}
>
Inputs
@@ -89,7 +94,13 @@ export default function GenericNode({
nodeColors[types[data.node.template[t].type]] ??
nodeColors.unknown
}
- title={snakeToNormalCase(t)}
+ title={
+ data.node.template[t].display_name
+ ? snakeToNormalCase(data.node.template[t].display_name)
+ : data.node.template[t].name
+ ? snakeToNormalCase(data.node.template[t].name)
+ : snakeToNormalCase(t)
+ }
name={t}
tooltipTitle={
"Type: " +
diff --git a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx
index 2e9d2f23d..0eb3876f1 100644
--- a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx
+++ b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx
@@ -1,86 +1,93 @@
import { Bars2Icon } from "@heroicons/react/24/outline";
import DisclosureComponent from "../DisclosureComponent";
-import {
- nodeColors,
- nodeIcons,
- nodeNames,
-} from "../../../../utils";
+import { nodeColors, nodeIcons, nodeNames } from "../../../../utils";
import { useContext, useEffect, useState } from "react";
import { getAll } from "../../../../controllers/API";
import { typesContext } from "../../../../contexts/typesContext";
-import { APIClassType, APIKindType, APIObjectType } from "../../../../types/api";
+import {
+ APIClassType,
+ APIKindType,
+ APIObjectType,
+} from "../../../../types/api";
export default function ExtraSidebar() {
- const [data, setData] = useState({});
- const { setTypes} = useContext(typesContext);
+ const [data, setData] = useState({});
+ const { setTypes } = useContext(typesContext);
- useEffect(() => {
- async function getTypes():Promise
{
-
- // Make an asynchronous API call to retrieve all data.
- let result = await getAll();
-
- // Update the state of the component with the retrieved data.
- setData(result.data);
-
- // Set the types by reducing over the keys of the result data and updating the accumulator.
- setTypes(
- Object.keys(result.data).reduce(
- (acc, curr) => {
- Object.keys(result.data[curr]).forEach((c:keyof APIKindType) => {
- acc[c] = curr;
- // Add the base classes to the accumulator as well.
- result.data[curr][c].base_classes?.forEach((b) => {
- acc[b] = curr;
- });
- });
- return acc;
- },{}
- )
- );
- }
- // Call the getTypes function.
- getTypes();
- }, [setTypes]);
+ useEffect(() => {
+ async function getTypes(): Promise {
+ // Make an asynchronous API call to retrieve all data.
+ let result = await getAll();
+ // Update the state of the component with the retrieved data.
+ setData(result.data);
- function onDragStart(event: React.DragEvent, data:{type:string,node?:APIClassType}) {
- //start drag event
- event.dataTransfer.effectAllowed = "move";
- event.dataTransfer.setData("json", JSON.stringify(data));
- }
+ // Set the types by reducing over the keys of the result data and updating the accumulator.
+ setTypes(
+ Object.keys(result.data).reduce((acc, curr) => {
+ Object.keys(result.data[curr]).forEach((c: keyof APIKindType) => {
+ acc[c] = curr;
+ // Add the base classes to the accumulator as well.
+ result.data[curr][c].base_classes?.forEach((b) => {
+ acc[b] = curr;
+ });
+ });
+ return acc;
+ }, {})
+ );
+ }
+ // Call the getTypes function.
+ getTypes();
+ }, [setTypes]);
- return (
-
- {Object.keys(data).map((d:keyof APIObjectType, i) => (
-
-
- {Object.keys(data[d]).map((t: string, k) => (
-
-
- onDragStart(event, {
- type: t,
- node: data[d][t],
- })
- }
- >
-
- {t}
-
-
-
-
- ))}
-
-
- ))}
-
- );
+ function onDragStart(
+ event: React.DragEvent,
+ data: { type: string; node?: APIClassType }
+ ) {
+ //start drag event
+ event.dataTransfer.effectAllowed = "move";
+ event.dataTransfer.setData("json", JSON.stringify(data));
+ }
+
+ return (
+
+ {Object.keys(data).map((d: keyof APIObjectType, i) => (
+
+
+ {Object.keys(data[d]).map((t: string, k) => (
+
+
+ onDragStart(event, {
+ type: t,
+ node: data[d][t],
+ })
+ }
+ >
+
+
+ {t}
+
+
+
+
+
+ ))}
+ {Object.keys(data[d]).length===0 &&
Coming soon
}
+
+
+ ))}
+
+ );
}