Skip to content

Commit dd77741

Browse files
Dmitry ZelenkovskyDmitry Zelenkovsky
authored andcommitted
Move Interactive checkbox to the top of the form.
1 parent fee7c7b commit dd77741

File tree

5 files changed

+43
-28
lines changed

5 files changed

+43
-28
lines changed

Docs/docs/simulations-tab.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ A `Simulation` can be in the following states.
1919
[![](images/web-simulation-general.png)](images/full_size_images/web-simulation-general.png)
2020

2121
2. `Map & Vehicles`
22+
- `Interactive Mode`: Check this to enable Simulation controls
2223
- `Select Map`: From the dropdown, choose the map that will be used
2324
- `Select Vehicle`: From the dropdown, choose the vehicle that will be spawned
2425
- `Bridge Connection String`: If the chosen vehicle has a Bridge Type, an IP:port must be provided to the bridge host
2526
- `+`: Adds an additional vehicle. Vehicles will spawn in `Spawn Info` positions of the map in order
26-
- `Interactive Mode`: Check this to enable Simulation controls
2727

2828
[![](images/web-simulation-mapVehicle.png)](images/full_size_images/web-simulation-mapVehicle.png)
2929

WebUI/src/components/SimulationManager/FormGeneral.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function FormGeneral() {
102102
</p>
103103
<Checkbox
104104
checked={apiOnly}
105-
label={apiOnly ? "Use API to control simulation" : "Not using API to control simulation"}
105+
label="Use API to control simulation"
106106
name={'apiOnly'}
107107
onChange={changeApiOnly}/>
108108
<br />
@@ -114,11 +114,12 @@ function FormGeneral() {
114114
</p>
115115
<Checkbox
116116
checked={headless}
117-
label={headless ? "Runing in Headless Mode" : "Running in Normal Mode"}
117+
label="Run simulation in Headless Mode"
118118
name={'headless'}
119119
disabled={interactive}
120120
onChange={changeHeadless} />
121-
</div>)
121+
</div>
122+
)
122123
}
123124

124125
export default FormGeneral;

WebUI/src/components/SimulationManager/FormMapVehicles.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,19 @@ function FormMapVehicles() {
149149
</Alert>
150150
}
151151
<div>
152+
<h4 className={appCss.inputLabel}>
153+
Interactive Mode
154+
</h4>
155+
<p className={appCss.inputDescription}>
156+
Running simulation in interactive mode allows to control time flow, create snapshots interact with environment and control vehicles manually.
157+
</p>
158+
<Checkbox
159+
checked={interactive}
160+
label="Run simulation in interactive mode"
161+
name={'interactive'}
162+
disabled={apiOnly || headless}
163+
onChange={changeInteractive} />
164+
<br />
152165
<h4 className={appCss.inputLabel}>
153166
Select Map
154167
</h4>
@@ -166,7 +179,6 @@ function FormMapVehicles() {
166179
disabled={apiOnly}
167180
/>
168181
<br />
169-
<br />
170182
<h4 className={appCss.inputLabel}>
171183
Select Vehicles
172184
</h4>
@@ -223,19 +235,6 @@ function FormMapVehicles() {
223235
</div>
224236
}
225237
<IoIosAdd className={css.formIcons} onClick={addVehicleField}/><br />
226-
<br />
227-
<h4 className={appCss.inputLabel}>
228-
Interactive Mode
229-
</h4>
230-
<p className={appCss.inputDescription}>
231-
Running simulation in interactive mode allows to control time flow, create snapshots interact with environment and control vehicles manually.
232-
</p>
233-
<Checkbox
234-
checked={interactive}
235-
label={interactive ? "Simulation will run using Interactive Mode" : "Simulation will not run using Interactive Mode"}
236-
name={'interactive'}
237-
disabled={apiOnly || headless}
238-
onChange={changeInteractive} />
239238
</div>
240239
<span className={appCss.formWarning}>{formWarning}</span>
241240
</div>)

WebUI/src/components/SimulationManager/FormTraffic.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,25 @@ function FormTraffic() {
4040
name={'hasSeed'}
4141
checked={hasSeed}
4242
onChange={changeHasSeed}
43-
label={hasSeed ? "Use predefiend seed" : "Use different random seed everytime"} />
43+
label="Use predefiend random seed"
44+
disabled={apiOnly} />
4445
{hasSeed && <input
4546
name={'seed'}
4647
value={seed || ''}
47-
onChange={changeSeed} />}
48+
onChange={changeSeed}
49+
disabled={apiOnly} />}
50+
<br />
4851
<br />
4952
<h4 className={appCss.inputLabel}>
50-
Enable NPC
53+
Random Traffic
5154
</h4>
55+
<p className={appCss.inputDescription}>
56+
When enabled other vehicles start to roam around randomly across the map during the simulation.
57+
</p>
5258
<Checkbox
5359
name={'enableNpc'}
5460
checked={useTraffic}
55-
label={useTraffic ? "NPC is enabled" : "NPC is disabled"}
61+
label="Enabled random traffic"
5662
disabled={apiOnly}
5763
onChange={changeUseTraffic} />
5864
<br />
@@ -65,7 +71,7 @@ function FormTraffic() {
6571
<Checkbox
6672
name={'usePedestrians'}
6773
checked={usePedestrians}
68-
label={usePedestrians ? "Pedestrians are enabled" : "Pedestrians are disabled"}
74+
label="Enable random pedestrians"
6975
disabled={apiOnly}
7076
onChange={changeusePedestrians} />
7177
</div>)

WebUI/src/components/SimulationManager/FormWeather.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import "react-datepicker/dist/react-datepicker.css";
1414

1515
function FormWeather() {
1616
const [simulation, setSimulation] = useContext(SimulationContext);
17-
const {weather} = simulation;
17+
const {weather, apiOnly} = simulation;
1818
let {rain, wetness, fog, cloudiness} = weather || {};
1919
const [formWarning, setFormWarning] = useState('');
2020
function validNumberInput(val, min, max, ) {
@@ -84,6 +84,7 @@ function FormWeather() {
8484
timeIntervals={30}
8585
dateFormat="HH:mm"
8686
timeCaption="Time"
87+
disabled={apiOnly}
8788
/>
8889
</div>
8990
<div className={css.weatherInput}>
@@ -101,7 +102,9 @@ function FormWeather() {
101102
min="0"
102103
max="1"
103104
step="0.01"
104-
placeholder="rain"/>
105+
placeholder="rain"
106+
disabled={apiOnly}
107+
/>
105108
</div>
106109
<div className={css.weatherInput}>
107110
<h4 className={appCss.inputLabel}>
@@ -118,7 +121,9 @@ function FormWeather() {
118121
min="0"
119122
max="1"
120123
step="0.01"
121-
placeholder="wetness"/>
124+
placeholder="wetness"
125+
disabled={apiOnly}
126+
/>
122127
</div>
123128
<div className={css.weatherInput}>
124129
<h4 className={appCss.inputLabel}>
@@ -135,7 +140,9 @@ function FormWeather() {
135140
min="0"
136141
max="1"
137142
step="0.01"
138-
placeholder="fog"/>
143+
placeholder="fog"
144+
disabled={apiOnly}
145+
/>
139146
</div>
140147
<div className={css.weatherInput}>
141148
<h4 className={appCss.inputLabel}>
@@ -152,7 +159,9 @@ function FormWeather() {
152159
min="0"
153160
max="1"
154161
step="0.01"
155-
placeholder="cloudiness"/>
162+
placeholder="cloudiness"
163+
disabled={apiOnly}
164+
/>
156165
</div>
157166
<span className={appCss.formWarning}>{formWarning}</span>
158167
</div>)

0 commit comments

Comments
 (0)