Skip to content

Commit

Permalink
refactor: change node to component on FE constants (langflow-ai#2545)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorrCarvalho authored and ogabrielluiz committed Jul 9, 2024
1 parent e81bc68 commit 4b5876c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function NodeToolbarComponent({
}
setNoticeData({
title:
"Minimization are only available for nodes with one handle or fewer.",
"Minimization are only available for components with one handle or fewer.",
});
return;
}
Expand Down Expand Up @@ -762,7 +762,7 @@ export default function NodeToolbarComponent({
onClose={setShowOverrideModal}
onCancel={() => {
saveComponent(cloneDeep(data), false);
setSuccessData({ title: "New node successfully saved!" });
setSuccessData({ title: "New component successfully saved!" });
}}
>
<ConfirmationModal.Content>
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/stores/flowStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
const ids = errorsObjs.map((obj) => obj.id).flat();

get().updateBuildStatus(ids, BuildStatus.ERROR);
throw new Error("Invalid nodes");
throw new Error("Invalid components");
}
}
function handleBuildUpdate(
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/utils/buildUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function updateVerticesOrder(
});
useFlowStore.getState().setIsBuilding(false);
setLockChat && setLockChat(false);
throw new Error("Invalid nodes");
throw new Error("Invalid components");
}
// orderResponse.data.ids,
// for each id we need to build the VertexLayerElementType object as
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/utils/parameterUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const handleUpdateValues = async (name: string, data: NodeDataType) => {

const template = data.node?.template;
if (!template) {
console.error("No template found in the node.");
console.error("No template found in the component.");
return;
}

Expand All @@ -27,7 +27,7 @@ export const handleUpdateValues = async (name: string, data: NodeDataType) => {
return res.data.template;
}
} catch (error) {
console.error("Error occurred while updating the node:", error);
console.error("Error occurred while updating the component:", error);
throw error;
}
};
Expand Down
10 changes: 5 additions & 5 deletions src/frontend/src/utils/reactflowUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ Array<{ id: string; errors: Array<string> }> {
{
id: "",
errors: [
"No nodes found in the flow. Please add at least one node to the flow.",
"No components found in the flow. Please add at least one component to the flow.",
],
},
];
Expand Down Expand Up @@ -848,7 +848,7 @@ export function validateSelection(
let errorsArray: Array<string> = [];
// check if there is more than one node
if (clonedSelection.nodes.length < 2) {
errorsArray.push("Please select more than one node");
errorsArray.push("Please select more than one component");
}
if (
clonedSelection.nodes.some(
Expand All @@ -857,15 +857,15 @@ export function validateSelection(
isOutputNode(node.data as NodeDataType),
)
) {
errorsArray.push("Select non-input/output nodes only");
errorsArray.push("Select non-input/output components only");
}
//check if there are two or more nodes with free outputs
if (
clonedSelection.nodes.filter(
(n) => !clonedSelection.edges.some((e) => e.source === n.id),
).length > 1
) {
errorsArray.push("Select only one node with free outputs");
errorsArray.push("Select only one component with free outputs");
}

// check if there is any node that does not have any connection
Expand All @@ -876,7 +876,7 @@ export function validateSelection(
!clonedSelection.edges.some((edge) => edge.source === node.id),
)
) {
errorsArray.push("Select only connected nodes");
errorsArray.push("Select only connected components");
}
return errorsArray;
}
Expand Down

0 comments on commit 4b5876c

Please sign in to comment.