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,8 +222,7 @@ export default function App() {
id={alert.id} id={alert.id}
removeAlert={removeAlert} removeAlert={removeAlert}
/> />
) : ( ) : alert.type === "notice" ? (
alert.type === "notice" && (
<NoticeAlert <NoticeAlert
key={alert.id} key={alert.id}
title={alert.title} title={alert.title}
@ -231,25 +230,19 @@ export default function App() {
id={alert.id} id={alert.id}
removeAlert={removeAlert} removeAlert={removeAlert}
/> />
) : (
alert.type === "success" && (
<SuccessAlert
key={alert.id}
title={alert.title}
id={alert.id}
removeAlert={removeAlert}
/>
) )
)} )}
</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,10 +538,13 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
startNodeId, startNodeId,
stopNodeId, stopNodeId,
onGetOrderSuccess: () => { onGetOrderSuccess: () => {
if (!silent) {
setNoticeData({ title: "Running components" }); setNoticeData({ title: "Running components" });
}
}, },
onBuildComplete: (allNodesValid) => { onBuildComplete: (allNodesValid) => {
const nodeId = startNodeId || stopNodeId; const nodeId = startNodeId || stopNodeId;
if (!silent) {
if (nodeId && allNodesValid) { if (nodeId && allNodesValid) {
setSuccessData({ setSuccessData({
title: `${ title: `${
@ -550,6 +555,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
} else { } else {
setSuccessData({ title: FLOW_BUILD_SUCCESS_ALERT }); setSuccessData({ title: FLOW_BUILD_SUCCESS_ALERT });
} }
}
get().setIsBuilding(false); get().setIsBuilding(false);
}, },
onBuildUpdate: handleBuildUpdate, onBuildUpdate: handleBuildUpdate,

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: (