Skip to content

Commit 0056f9d

Browse files
authored
Merge pull request #31 from org-arl/mission-planner
Mission planner
2 parents 61fec95 + 9d8bc0e commit 0056f9d

File tree

6 files changed

+280
-173
lines changed

6 files changed

+280
-173
lines changed

experiments/WebUI/src/assets/App.css

+3
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@
150150

151151
.dropdown_styles:hover .dropdown_content {display: block;}
152152

153+
.mission_options{
154+
margin-left: 15px;
155+
}
153156
/******* DrawGeoFence styles *******/
154157
.drawGeoFence_styles{
155158
position: relative;

experiments/WebUI/src/assets/MissionPlanner.css

+24-1
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,22 @@ ul {
4545
cursor: pointer;
4646
}
4747

48+
.saveChangesBtn{
49+
cursor: pointer;
50+
margin-left: 10px;
51+
color: green;
52+
}
53+
54+
.discardChangesBtn{
55+
cursor: pointer;
56+
margin-left: 10px;
57+
color: orange;
58+
}
59+
4860
.deleteMissionBtn{
4961
cursor: pointer;
50-
margin-left: 20px;
62+
margin-left: 10px;
63+
color: red;
5164
}
5265

5366
.cancelAddMissionBtn{
@@ -63,3 +76,13 @@ ul {
6376
color: green;
6477
font-size: 1.3em;
6578
}
79+
80+
.AddMissionPointComment{
81+
font-size: 0.75em;
82+
color: #666;
83+
}
84+
85+
.editedMission{
86+
color: red;
87+
font-size: 1.5em;
88+
}

experiments/WebUI/src/components/content/MLegInfoComponent.js

+13-28
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,30 @@ const styles = StyleSheet.create({
1818
class MLegInfoComponent extends React.Component {
1919
constructor(props, context) {
2020
super(props, context);
21-
// // Make deep copy of missionLeg object so that changes dont get saved instantly.
22-
// var missionLeg = JSON.parse(JSON.stringify(this.props.missionLeg));
21+
2322
this.state = {
2423
missionLeg: this.props.missionLeg,
25-
editMode: this.props.editMode
24+
editedMissions: this.props.editedMissions
2625
}
2726
}
2827

2928
componentDidUpdate(prevProps) {
3029
if (prevProps.missionLeg !== this.props.missionLeg) {
31-
// console.log(this.state.missionLeg);
3230

33-
// // Make deep copy of missionLeg object so that changes dont get saved instantly.
34-
// var missionLeg = JSON.parse(JSON.stringify(this.props.missionLeg));
3531
this.setState({
3632
missionLeg: this.props.missionLeg,
37-
editMode: this.props.editMode
3833
});
3934
}
4035
}
4136

37+
modifyEditedMissionsArr(){
38+
var editedMissions = this.state.editedMissions;
39+
editedMissions[this.props.missionIndex - 1] = 1;
40+
this.setState({
41+
editedMissions: editedMissions
42+
});
43+
}
44+
4245
onPropertyChange(e) {
4346
var missionLeg = this.state.missionLeg;
4447
// console.log(e.target.value);
@@ -51,6 +54,7 @@ class MLegInfoComponent extends React.Component {
5154
missionLeg: missionLeg
5255
});
5356

57+
this.modifyEditedMissionsArr();
5458
this.props.refreshMissionMarkersFunc(this.props.missionIndex-1);
5559
}
5660

@@ -60,6 +64,7 @@ class MLegInfoComponent extends React.Component {
6064
this.setState({
6165
missionLeg: missionLeg
6266
});
67+
this.modifyEditedMissionsArr();
6368
}
6469

6570
onPayloadChange(e) {
@@ -68,23 +73,9 @@ class MLegInfoComponent extends React.Component {
6873
this.setState({
6974
missionLeg: missionLeg
7075
});
76+
this.modifyEditedMissionsArr();
7177
}
7278

73-
// saveChanges() {
74-
// // creating a copy of the state.missionLeg and then assigning it to props.missionLeg to prevent further direct modification to props.missionLeg which would have pointed to state.missionLeg due to assign.
75-
// Object.assign(this.props.missionLeg, JSON.parse(JSON.stringify(this.state.missionLeg)));
76-
// // console.log(this.props.missionIndex);
77-
// this.props.refreshMissionMarkersFunc(this.props.missionIndex-1);
78-
// }
79-
//
80-
// discardChanges() {
81-
// var missionLeg = JSON.parse(JSON.stringify(this.props.missionLeg));
82-
// this.setState({
83-
// missionLeg: missionLeg,
84-
// editMode: this.props.editMode
85-
// });
86-
// }
87-
8879
render() {
8980
var propertyTableRows = [];
9081
var paramTableRows = [];
@@ -120,19 +111,13 @@ class MLegInfoComponent extends React.Component {
120111
(
121112
<tr key={key}>
122113
<td>{key}</td>
123-
{/* <td><div contentEditable={this.props.editMode}>{params[key]}</div></td> */}
124114
<td><FormControl name={key} onChange={(e) => this.onParamChange(e)} value={params[key]}></FormControl></td>
125115
</tr>
126116
);
127117
}
128118
}
129119

130120
payloadObject = this.state.missionLeg.payload;
131-
132-
// actionButtons = <div>
133-
// <Button variant="success" onClick={() => this.saveChanges()}>Save Changes</Button>
134-
// <Button variant="danger" onClick={() => this.discardChanges()}>Discard Changes</Button>
135-
// </div>;
136121
}
137122

138123
const Properties =

0 commit comments

Comments
 (0)