refactor: change node to component on FE constants (#2545)

This commit is contained in:
Igor Carvalho 2024-07-05 09:34:24 -03:00 • committed by GitHub
commit 6443354720
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 11 additions and 11 deletions

View file

@ -87,7 +87,7 @@ export default function NodeToolbarComponent({
} }
setNoticeData({ setNoticeData({
title: title:
"Minimization are only available for nodes with one handle or fewer.", "Minimization are only available for components with one handle or fewer.",
}); });
return; return;
} }
@ -762,7 +762,7 @@ export default function NodeToolbarComponent({
onClose={setShowOverrideModal} onClose={setShowOverrideModal}
onCancel={() => { onCancel={() => {
saveComponent(cloneDeep(data), false); saveComponent(cloneDeep(data), false);
setSuccessData({ title: "New node successfully saved!" }); setSuccessData({ title: "New component successfully saved!" });
}} }}
> >
<ConfirmationModal.Content> <ConfirmationModal.Content>

View file

@ -476,7 +476,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
const ids = errorsObjs.map((obj) => obj.id).flat(); const ids = errorsObjs.map((obj) => obj.id).flat();
get().updateBuildStatus(ids, BuildStatus.ERROR); get().updateBuildStatus(ids, BuildStatus.ERROR);
throw new Error("Invalid nodes"); throw new Error("Invalid components");
} }
} }
function handleBuildUpdate( function handleBuildUpdate(

View file

@ -86,7 +86,7 @@ export async function updateVerticesOrder(
}); });
useFlowStore.getState().setIsBuilding(false); useFlowStore.getState().setIsBuilding(false);
setLockChat && setLockChat(false); setLockChat && setLockChat(false);
throw new Error("Invalid nodes"); throw new Error("Invalid components");
} }
// orderResponse.data.ids, // orderResponse.data.ids,
// for each id we need to build the VertexLayerElementType object as // for each id we need to build the VertexLayerElementType object as

View file

@ -12,7 +12,7 @@ export const handleUpdateValues = async (name: string, data: NodeDataType) => {
const template = data.node?.template; const template = data.node?.template;
if (!template) { if (!template) {
console.error("No template found in the node."); console.error("No template found in the component.");
return; return;
} }
@ -27,7 +27,7 @@ export const handleUpdateValues = async (name: string, data: NodeDataType) => {
return res.data.template; return res.data.template;
} }
} catch (error) { } catch (error) {
console.error("Error occurred while updating the node:", error); console.error("Error occurred while updating the component:", error);
throw error; throw error;
} }
}; };

View file

@ -348,7 +348,7 @@ Array<{ id: string; errors: Array<string> }> {
{ {
id: "", id: "",
errors: [ 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.",
], ],
}, },
]; ];
@ -848,7 +848,7 @@ export function validateSelection(
let errorsArray: Array<string> = []; let errorsArray: Array<string> = [];
// check if there is more than one node // check if there is more than one node
if (clonedSelection.nodes.length < 2) { if (clonedSelection.nodes.length < 2) {
errorsArray.push("Please select more than one node"); errorsArray.push("Please select more than one component");
} }
if ( if (
clonedSelection.nodes.some( clonedSelection.nodes.some(
@ -857,7 +857,7 @@ export function validateSelection(
isOutputNode(node.data as NodeDataType), 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 //check if there are two or more nodes with free outputs
if ( if (
@ -865,7 +865,7 @@ export function validateSelection(
(n) => !clonedSelection.edges.some((e) => e.source === n.id), (n) => !clonedSelection.edges.some((e) => e.source === n.id),
).length > 1 ).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 // check if there is any node that does not have any connection
@ -876,7 +876,7 @@ export function validateSelection(
!clonedSelection.edges.some((edge) => edge.source === node.id), !clonedSelection.edges.some((edge) => edge.source === node.id),
) )
) { ) {
errorsArray.push("Select only connected nodes"); errorsArray.push("Select only connected components");
} }
return errorsArray; return errorsArray;
} }