Fixed success alert not appearing at front, and removed alert displayed at playground

This commit is contained in:
Lucas Oliveira 2024-06-05 09:45:17 -03:00
commit 9bafb1f5dd
4 changed files with 29 additions and 28 deletions

View file

@ -222,12 +222,19 @@ export default function App() {
id={alert.id} id={alert.id}
removeAlert={removeAlert} removeAlert={removeAlert}
/> />
) : alert.type === "notice" ? (
<NoticeAlert
key={alert.id}
title={alert.title}
link={alert.link}
id={alert.id}
removeAlert={removeAlert}
/>
) : ( ) : (
alert.type === "notice" && ( alert.type === "success" && (
<NoticeAlert <SuccessAlert
key={alert.id} key={alert.id}
title={alert.title} title={alert.title}
link={alert.link}
id={alert.id} id={alert.id}
removeAlert={removeAlert} removeAlert={removeAlert}
/> />
@ -236,20 +243,6 @@ export default function App() {
</div> </div>
))} ))}
</div> </div>
<div className="z-40 flex flex-col-reverse">
{tempNotificationList.map((alert) => (
<div key={alert.id}>
{alert.type === "success" && (
<SuccessAlert
key={alert.id}
title={alert.title}
id={alert.id}
removeAlert={removeAlert}
/>
)}
</div>
))}
</div>
</div> </div>
</div> </div>
); );

View file

@ -91,6 +91,7 @@ export default function IOModal({
await buildFlow({ await buildFlow({
input_value: chatValue, input_value: chatValue,
startNodeId: chatInput?.id, startNodeId: chatInput?.id,
silent: true,
}).catch((err) => { }).catch((err) => {
console.error(err); console.error(err);
setLockChat(false); setLockChat(false);

View file

@ -430,10 +430,12 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
startNodeId, startNodeId,
stopNodeId, stopNodeId,
input_value, input_value,
silent,
}: { }: {
startNodeId?: string; startNodeId?: string;
stopNodeId?: string; stopNodeId?: string;
input_value?: string; input_value?: string;
silent?: boolean;
}) => { }) => {
get().setIsBuilding(true); get().setIsBuilding(true);
const currentFlow = useFlowsManagerStore.getState().currentFlow; const currentFlow = useFlowsManagerStore.getState().currentFlow;
@ -536,19 +538,23 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
startNodeId, startNodeId,
stopNodeId, stopNodeId,
onGetOrderSuccess: () => { onGetOrderSuccess: () => {
setNoticeData({ title: "Running components" }); if (!silent) {
setNoticeData({ title: "Running components" });
}
}, },
onBuildComplete: (allNodesValid) => { onBuildComplete: (allNodesValid) => {
const nodeId = startNodeId || stopNodeId; const nodeId = startNodeId || stopNodeId;
if (nodeId && allNodesValid) { if (!silent) {
setSuccessData({ if (nodeId && allNodesValid) {
title: `${ setSuccessData({
get().nodes.find((node) => node.id === nodeId)?.data.node title: `${
?.display_name get().nodes.find((node) => node.id === nodeId)?.data.node
} built successfully`, ?.display_name
}); } built successfully`,
} else { });
setSuccessData({ title: FLOW_BUILD_SUCCESS_ALERT }); } else {
setSuccessData({ title: FLOW_BUILD_SUCCESS_ALERT });
}
} }
get().setIsBuilding(false); get().setIsBuilding(false);
}, },

View file

@ -106,11 +106,12 @@ export type FlowStoreType = {
startNodeId, startNodeId,
stopNodeId, stopNodeId,
input_value, input_value,
silent,
}: { }: {
nodeId?: string;
startNodeId?: string; startNodeId?: string;
stopNodeId?: string; stopNodeId?: string;
input_value?: string; input_value?: string;
silent?: boolean;
}) => Promise<void>; }) => Promise<void>;
getFlow: () => { nodes: Node[]; edges: Edge[]; viewport: Viewport }; getFlow: () => { nodes: Node[]; edges: Edge[]; viewport: Viewport };
updateVerticesBuild: ( updateVerticesBuild: (