Skip to content

Commit 5198f36

Browse files
committed
Options passed in clear API
1 parent d4c4204 commit 5198f36

6 files changed

Lines changed: 77 additions & 12 deletions

File tree

src/component/modals/NodeDetails.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const NodeDetails = ({
3232
mdmap = mdCont;
3333
const fr = new FileReader();
3434
fr.onload = (x) => {
35-
const strCont = ' : ';
35+
const strCont = ' DESC: ';
3636
mdmap.set(ele, strCont.concat(x.target.result.slice(0, 50).replace('#', '')));
3737
setMdCont(mdmap);
3838
};
@@ -124,7 +124,7 @@ const NodeDetails = ({
124124
placeholder="Select file"
125125
value={data.label.split(':')[1]}
126126
onChange={(e) => {
127-
setLabelFile(e.target.value.split('/').pop().split(' : ')[0]);
127+
setLabelFile(e.target.value.split('/').pop().split(' DESC: ')[0]);
128128
if (labelName) {
129129
let lname = labelName;
130130
if (labelName.slice(-1) !== ':') {
@@ -134,13 +134,13 @@ const NodeDetails = ({
134134
setData({
135135
...data,
136136
// eslint-disable-next-line max-len
137-
label: lname + e.target.value.split('/').pop().split(' : ')[0],
137+
label: lname + e.target.value.split('/').pop().split(' DESC: ')[0],
138138
});
139139
} else {
140140
setData({
141141
...data,
142142
// eslint-disable-next-line max-len
143-
label: `:${e.target.value.split('/').pop().split(' : ')[0]}`,
143+
label: `:${e.target.value.split('/').pop().split(' DESC: ')[0]}`,
144144
});
145145
}
146146
}}
@@ -174,7 +174,6 @@ const NodeDetails = ({
174174
return (
175175
<>
176176
<label htmlFor="dropdown">
177-
Hi
178177
<option value={list} key={index} />
179178
</label>
180179
</>

src/component/modals/OptionsModal.jsx

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,79 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import ParentModal from './ParentModal';
33
import { actionType as T } from '../../reducer';
44
import './optionsModal.css';
55

66
const OptionsModal = ({ superState, dispatcher }) => {
7+
const [unlock, setUnlock] = useState(false);
8+
const [docker, setDocker] = useState(false);
9+
const [param, setParam] = useState('');
10+
const [maxT, setmaxT] = useState('');
711
const close = () => {
812
dispatcher({ type: T.SET_OPTIONS_MODAL, payload: false });
13+
dispatcher(
14+
{
15+
type: T.SET_OPTIONS,
16+
payload: {
17+
unlock,
18+
docker,
19+
maxT,
20+
param,
21+
},
22+
},
23+
);
924
};
25+
26+
const handleDockerChange = () => {
27+
setDocker(!docker);
28+
};
29+
30+
const handleUnlockChange = () => {
31+
setUnlock(!unlock);
32+
};
33+
const handleParamsChange = (e) => {
34+
setParam(e.target.value);
35+
};
36+
const handleMaxtimeChange = (e) => {
37+
setmaxT(e.target.value);
38+
};
39+
1040
const Options = 'Options';
1141
return (
1242
<ParentModal closeModal={close} ModelOpen={superState.optionsModal} title={Options}>
1343
<div className="main-div">
1444
<label htmlFor="Docker">
1545
Docker
16-
<input type="checkbox" />
46+
<input type="checkbox" checked={docker} onChange={handleDockerChange} />
1747
</label>
1848
<label htmlFor="Unlock" className="main-div-comp">
1949
Unlock
20-
<input type="checkbox" />
50+
<input type="checkbox" checked={unlock} onChange={handleUnlockChange} />
2151
</label>
2252
<label htmlFor="Maxtime" className="main-div-comp">
2353
Max Time&nbsp;
24-
<input type="text" />
54+
<input
55+
type="text"
56+
value={maxT}
57+
placeholder="Enter Maximum Time"
58+
onChange={(e) => {
59+
handleMaxtimeChange(e);
60+
}}
61+
/>
2562
</label>
2663
<br />
2764
<br />
2865
<br />
2966
<span>Params:</span>
3067
<br />
31-
<textarea name="" id="" cols="80" rows="10" />
68+
<textarea
69+
cols="80"
70+
rows="10"
71+
value={param}
72+
placeholder="//Write Script"
73+
onChange={(e) => {
74+
handleParamsChange(e);
75+
}}
76+
/>
3277
</div>
3378
</ParentModal>
3479
);

src/graph-builder/graph-core/6-server.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,15 @@ class GraphServer extends GraphLoadSave {
101101

102102
clear() {
103103
// TODO
104-
Axios.post(`http://127.0.0.1:5000/clear/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}`)
104+
Axios.post(`http://127.0.0.1:5000/clear/${this.superState.graphs[this.superState.curGraphIndex].fileName.split('.')[0]}
105+
?unlock=${this.superState.unlockCheck}&docker=${this.superState.dockerCheck}&maxtime=${this.superState.maxTime}&
106+
params=${this.superState.params}&`)
105107
.then((res) => { // eslint-disable-next-line
106-
toast.success(res.data['message'])
108+
toast.success(res.data['message']);
109+
// console.log(this.superState.dockerCheck);
110+
// console.log(this.superState.unlockCheck);
111+
// console.log(this.superState.maxTime);
112+
// console.log(this.superState.params);
107113
}).catch((err) => { // eslint-disable-next-line
108114
toast.success(err);
109115
});

src/reducer/actionType.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const actionType = {
3838
SET_DIR_NAME: 'SET_DIR_NAME',
3939
SET_FILE_STATE: 'SET_FILE_STATE',
4040
SET_INPUT_FILE: 'SET_INPUT_FILE',
41+
SET_OPTIONS: 'SET_OPTIONS',
4142
};
4243

4344
export default zealit(actionType);

src/reducer/initialState.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ const initialState = {
2929
resetEnabled: false,
3030
fileState: [],
3131
inputFile: '',
32+
params: '',
33+
maxTime: '',
34+
dockerCheck: false,
35+
unlockCheck: false,
3236
};
3337

3438
const initialGraphState = {

src/reducer/reducer.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,16 @@ const reducer = (state, action) => {
158158
return { ...state, fileRef: action.payload };
159159
}
160160

161+
case T.SET_OPTIONS: {
162+
return {
163+
...state,
164+
dockerCheck: action.payload.docker,
165+
unlockCheck: action.payload.unlock,
166+
params: action.payload.param,
167+
maxTime: action.payload.maxT,
168+
};
169+
}
170+
161171
case T.SET_FILE_HANDLE: {
162172
const newState = { ...state };
163173
newState.graphs = newState.graphs.map((g, index) => (

0 commit comments

Comments
 (0)