Skip to content

Commit 2f1088d

Browse files
committed
update tab store based on tab id and initialize edges anmiation based on tab prop
1 parent a61dac6 commit 2f1088d

6 files changed

Lines changed: 96 additions & 96 deletions

File tree

packages/flowtest-electron/src/ipc/collection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ const registerRendererEventHandlers = (mainWindow, watcher) => {
317317
headers: request.headers,
318318
// form data obj gets serialized here so that it can be sent over wire
319319
// otherwise ipc communication errors out
320-
data: JSON.parse(JSON.stringify(request.data)),
320+
data: request.data ? JSON.parse(JSON.stringify(request.data)) : request.data,
321321
};
322322

323323
const result = await axios({

src/components/molecules/flow/graph/Graph.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Graph {
8686

8787
return nd;
8888
});
89-
useTabStore.getState().updateFlowTestNodes(updatedNodes);
89+
useTabStore.getState().updateFlowTestNodes(this.tab.id, updatedNodes);
9090
}
9191
result = {
9292
status: 'Success',
@@ -254,7 +254,7 @@ class Graph {
254254

255255
return node;
256256
});
257-
useTabStore.getState().updateFlowTestNodes(updatedNodes);
257+
useTabStore.getState().updateFlowTestNodes(this.tab.id, updatedNodes);
258258
}
259259

260260
this.graphRunNodeOutput = {};

src/components/molecules/flow/index.js

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -113,27 +113,27 @@ const Flow = ({ tab, collectionId }) => {
113113
[],
114114
);
115115

116-
useMemo(() => {
117-
if (reactFlowInstance) {
118-
const updatedEdges = reactFlowInstance.getEdges().map((edge) => {
119-
return {
120-
...edge,
121-
animated: tab.running,
122-
};
123-
});
124-
setEdges(updatedEdges);
125-
}
126-
}, [tab.running]);
127-
128-
const runnableEdges = (runnable) => {
129-
const updatedEdges = reactFlowInstance.getEdges().map((edge) => {
130-
return {
131-
...edge,
132-
animated: runnable,
133-
};
134-
});
135-
setEdges(updatedEdges);
136-
};
116+
// useMemo(() => {
117+
// if (reactFlowInstance) {
118+
// const updatedEdges = reactFlowInstance.getEdges().map((edge) => {
119+
// return {
120+
// ...edge,
121+
// animated: tab.running,
122+
// };
123+
// });
124+
// setEdges(updatedEdges);
125+
// }
126+
// }, [reactFlowInstance, tab.running]);
127+
128+
// const runnableEdges = (runnable) => {
129+
// const updatedEdges = reactFlowInstance.getEdges().map((edge) => {
130+
// return {
131+
// ...edge,
132+
// animated: runnable,
133+
// };
134+
// });
135+
// setEdges(updatedEdges);
136+
// };
137137

138138
const onDragOver = useCallback((event) => {
139139
event.preventDefault();
@@ -207,17 +207,17 @@ const Flow = ({ tab, collectionId }) => {
207207
return true;
208208
};
209209

210-
const onGraphComplete = async (status, time, logs) => {
211-
const response = await uploadGraphRunLogs(tab.name, status, time, logs);
212-
//console.log(response);
213-
setLogs(tab.id, status, logs, response);
214-
if (status == 'Success') {
215-
toast.success(`FlowTest Run Success!`);
216-
} else if (status == 'Failed') {
217-
toast.error(`FlowTest Run Failed!`);
218-
}
219-
runnableEdges(false);
220-
};
210+
// const onGraphComplete = async (status, time, logs) => {
211+
// const response = await uploadGraphRunLogs(tab.name, status, time, logs);
212+
// //console.log(response);
213+
// setLogs(tab.id, status, logs, response);
214+
// if (status == 'Success') {
215+
// toast.success(`FlowTest Run Success!`);
216+
// } else if (status == 'Failed') {
217+
// toast.error(`FlowTest Run Failed!`);
218+
// }
219+
// runnableEdges(false);
220+
// };
221221

222222
reactFlowInstance?.setViewport(viewport);
223223

@@ -234,7 +234,10 @@ const Flow = ({ tab, collectionId }) => {
234234
<ReactFlow
235235
key={tab.id}
236236
nodes={nodes}
237-
edges={edges}
237+
edges={edges.map((edge) => ({
238+
...edge,
239+
animated: tab.running,
240+
}))}
238241
onNodesChange={onNodesChange}
239242
onEdgesChange={onEdgesChange}
240243
onConnect={onConnect}

src/components/molecules/sideSheets/FlowLogs.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const FlowLogs = ({ logsData }) => {
2121
const renderFlowScan = (flowScan) => {
2222
if (flowScan.upload === 'disabled') {
2323
return (
24-
<div className='w-full p-4 my-2 border rounded border-sky-600 bg-sky-50 text-sky-600'>
25-
<div className='flex items-center justify-between w-full'>
26-
<div className='flex items-center justify-start w-full gap-4'>
24+
<div className='my-2 w-full rounded border border-sky-600 bg-sky-50 p-4 text-sky-600'>
25+
<div className='flex w-full items-center justify-between'>
26+
<div className='flex w-full items-center justify-start gap-4'>
2727
<BarsArrowUpIcon className='h-7 w-7' />
2828
<div className='w-full'>
2929
<div className='flex items-center justify-start gap-2 text-lg font-semibold'>
@@ -45,15 +45,15 @@ const FlowLogs = ({ logsData }) => {
4545
);
4646
} else if (flowScan.upload === 'success') {
4747
return (
48-
<div className='w-full p-4 my-2 text-green-600 border border-green-600 rounded bg-green-50'>
49-
<div className='flex items-center justify-start w-full gap-4'>
48+
<div className='my-2 w-full rounded border border-green-600 bg-green-50 p-4 text-green-600'>
49+
<div className='flex w-full items-center justify-start gap-4'>
5050
<ShieldCheckIcon className='h-7 w-7' />
5151
<div className='w-full'>
52-
<div className='flex items-center justify-start gap-2 mb-4 text-lg font-semibold'>
52+
<div className='mb-4 flex items-center justify-start gap-2 text-lg font-semibold'>
5353
<h2>Successfully published the scan</h2>
5454
</div>
5555
<HorizontalDivider themeColor={'bg-green-600'} />
56-
<p className='pt-4 pb-2 font'>
56+
<p className='font pb-2 pt-4'>
5757
<span className='font-semibold'>URL: </span>
5858
<a href={flowScan.url} target='_blank' rel='noreferrer' className='hover:underline'>
5959
{flowScan.url}
@@ -65,7 +65,7 @@ const FlowLogs = ({ logsData }) => {
6565
);
6666
} else if (flowScan.upload === 'fail') {
6767
return (
68-
<div className='flex items-center w-full gap-4 p-4 my-2 border rounded border-amber-600 bg-amber-50 text-amber-600'>
68+
<div className='my-2 flex w-full items-center gap-4 rounded border border-amber-600 bg-amber-50 p-4 text-amber-600'>
6969
<div className='flex items-center'>
7070
<ExclamationTriangleIcon className='h-7 w-7' />
7171
</div>
@@ -78,7 +78,7 @@ const FlowLogs = ({ logsData }) => {
7878
{flowScan?.reason ? (
7979
<>
8080
<HorizontalDivider themeColor={'bg-amber-600'} />
81-
<p className='pt-4 pb-2'>{flowScan?.reason}</p>
81+
<p className='pb-2 pt-4'>{flowScan?.reason}</p>
8282
</>
8383
) : (
8484
<></>
@@ -92,14 +92,14 @@ const FlowLogs = ({ logsData }) => {
9292
return (
9393
<div className='overflow-auto'>
9494
<div>{renderFlowScan(logsData.run.scan)}</div>
95-
<div className='flex flex-col mt-4 border-2 rounded-md shadow-sm border-slate-300 bg-background-light text-cyan-900'>
96-
<h2 className='px-4 py-2 text-2xl font-medium border-b-2 border-slate-300'>
95+
<div className='mt-4 flex flex-col rounded-md border-2 border-slate-300 bg-background-light text-cyan-900 shadow-sm'>
96+
<h2 className='border-b-2 border-slate-300 px-4 py-2 text-2xl font-medium'>
9797
<div className='flex flex-row'>
9898
Logs
9999
{logsData.run.status === 'Success' ? (
100-
<CheckCircleIcon className='w-5 h-5' />
100+
<CheckCircleIcon className='h-5 w-5' />
101101
) : (
102-
<XCircleIcon className='w-5 h-5' />
102+
<XCircleIcon className='h-5 w-5' />
103103
)}
104104
</div>
105105
</h2>
@@ -138,25 +138,25 @@ const FlowLogs = ({ logsData }) => {
138138
}
139139

140140
if (type === 'requestNode') {
141-
message = `${data.request.type.toUpperCase()} ${data.request.url}`;
141+
message = `${data.request.method.toUpperCase()} ${data.request.url}`;
142142
json = data;
143143
}
144144
}
145145

146146
return (
147147
<>
148-
<ul className='w-full p-0 menu' key={index}>
148+
<ul className='menu w-full p-0' key={index}>
149149
<li>
150-
<div className='flex items-center justify-between gap-2 p-0 transition duration-200 ease-out rounded text-balance text-start'>
150+
<div className='flex items-center justify-between gap-2 text-balance rounded p-0 text-start transition duration-200 ease-out'>
151151
<div className='flex items-center justify-start gap-2 px-2 py-1'>
152-
<ClockIcon className='w-6 h-6' />
152+
<ClockIcon className='h-6 w-6' />
153153
<span className='text-lg'>{`${log.timestamp} : ${message}`}</span>
154154
</div>
155155
</div>
156156
<ul className='flow-logs-menu before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-background-dark before:opacity-100'>
157157
<li className='pl-4 pr-2'>
158158
{json != undefined ? (
159-
<div className='w-full px-2 py-4 my-4 overflow-auto border json-view-container border-slate-700'>
159+
<div className='json-view-container my-4 w-full overflow-auto border border-slate-700 px-2 py-4'>
160160
<React.Fragment>
161161
<JsonView data={json} shouldExpandNode={collapseAllNested} style={defaultStyles} />
162162
</React.Fragment>
@@ -173,18 +173,18 @@ const FlowLogs = ({ logsData }) => {
173173
} else {
174174
return (
175175
<>
176-
<ul className='w-full p-0 menu' key={index}>
176+
<ul className='menu w-full p-0' key={index}>
177177
<li>
178-
<div className='flex items-center justify-between gap-2 p-0 transition duration-200 ease-out rounded text-balance text-start'>
178+
<div className='flex items-center justify-between gap-2 text-balance rounded p-0 text-start transition duration-200 ease-out'>
179179
<div className='flex items-center justify-start gap-2 px-2 py-1 text-red-500'>
180-
<ClockIcon className='w-6 h-6' />
180+
<ClockIcon className='h-6 w-6' />
181181
<span className='text-lg'>{`${log.timestamp} : ${log.message}`}</span>
182182
</div>
183183
</div>
184184
<ul className='flow-logs-menu before:absolute before:bottom-0 before:top-0 before:w-[1px] before:bg-background-dark before:opacity-100'>
185185
<li className='pl-4 pr-2'>
186186
{log.node != undefined ? (
187-
<div className='px-2 py-4 my-4 overflow-auto border json-view-container border-slate-700'>
187+
<div className='json-view-container my-4 overflow-auto border border-slate-700 px-2 py-4'>
188188
<React.Fragment>
189189
<JsonView
190190
data={log.node.data}

0 commit comments

Comments
 (0)