Skip to content

Commit d65bd87

Browse files
committed
Integrate selected timeout to graph run
1 parent 74f6558 commit d65bd87

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Graph {
1414
this.nodes = nodes;
1515
this.edges = edges;
1616
this.logs = initialLogs;
17-
this.timeout = 60000; //ms
17+
this.timeout = useCanvasStore.getState().timeout;
1818
this.startTime = startTime;
1919
this.graphRunNodeOutput = {};
2020
this.auth = undefined;

src/components/molecules/flow/utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,11 @@ export const initFlowData = {
116116
},
117117
],
118118
};
119+
120+
export const timeoutForGraphRun = [
121+
{ value: '60000', label: '1 minute' },
122+
{ value: '300000', label: '5 minutes' },
123+
{ value: '600000', label: '10 minutes' },
124+
{ value: '900000', label: '15 minutes' },
125+
{ value: '1800000', label: '30 minutes' },
126+
];

src/components/molecules/headers/TabPanelHeader.js

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ import useCanvasStore from 'stores/CanvasStore';
1717
import SlidingPane from 'react-sliding-pane';
1818
import 'react-sliding-pane/dist/react-sliding-pane.css';
1919
import TimeSelector from 'components/atoms/common/TimeSelector';
20+
import { timeoutForGraphRun } from '../flow/utils';
2021

2122
const TabPanelHeader = () => {
2223
const focusTabId = useTabStore((state) => state.focusTabId);
2324
const tabs = useTabStore((state) => state.tabs);
2425
const focusTab = tabs.find((t) => t.id === focusTabId);
2526

2627
const graphRunLogs = useCanvasStore((state) => state.logs);
28+
const setTimeout = useCanvasStore((state) => state.setTimeout);
2729

2830
const [slidingPaneState, setSlidingPaneState] = useState({
2931
isPaneOpen: false,
@@ -34,28 +36,21 @@ const TabPanelHeader = () => {
3436

3537
const [generateFlowTestModalOpen, setGenerateFlowTestModalOpen] = useState(false);
3638

37-
const sampleArrayForOptionsData = [
38-
{ value: '1', label: '5 seconds' },
39-
{ value: '2', label: '10 seconds' },
40-
{ value: '3', label: '15 seconds' },
41-
{ value: '4', label: '20 seconds' },
42-
{ value: '5', label: '25 seconds' },
43-
];
4439
return (
4540
<div className='flex items-center justify-between gap-4 px-6 py-2 border-b border-neutral-300'>
4641
{focusTab ? (
4742
<>
4843
<div className='text-base tracking-[0.15em]'>{focusTab.name}</div>
4944
<div className='flex items-center justify-between gap-4 border-l border-neutral-300'>
50-
<TimeSelector
51-
defaultOptionData={{ value: 'select_timer', label: 'Select Timer' }}
52-
optionsData={sampleArrayForOptionsData}
53-
onSelectHandler={(event) => {
54-
console.log(`\n \n onselectHandler`);
55-
console.log(event.target?.value);
56-
console.log(`\n \n`);
57-
}}
58-
/>
45+
{focusTab.type === OBJ_TYPES.flowtest && (
46+
<TimeSelector
47+
defaultOptionData={{ value: 'select_timer', label: 'Select Timer' }}
48+
optionsData={timeoutForGraphRun}
49+
onSelectHandler={(event) => {
50+
setTimeout(event.target?.value);
51+
}}
52+
/>
53+
)}
5954

6055
<SaveFlowModal tab={focusTab} />
6156
{focusTab.type === OBJ_TYPES.flowtest && graphRunLogs.length != 0 ? (

src/stores/CanvasStore.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const useCanvasStore = create((set, get) => ({
99
edges: [],
1010
logs: [],
1111
collectionId: '',
12+
timeout: '60000',
1213
onNodesChange: (changes) => {
1314
set({
1415
nodes: applyNodeChanges(changes, get().nodes),
@@ -45,6 +46,9 @@ const useCanvasStore = create((set, get) => ({
4546
setCollectionId: (collectionId) => {
4647
set({ collectionId });
4748
},
49+
setTimeout: (timeout) => {
50+
set({ timeout });
51+
},
4852
setAuthNodeType: (nodeId, authType) => {
4953
set({
5054
nodes: get().nodes.map((node) => {

0 commit comments

Comments
 (0)