Skip to content

Commit

Permalink
fix(ui): Hide defunct zones button
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypfer committed Jun 20, 2021
1 parent f7cee31 commit ae7c059
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/lib/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<ons-button id="find-robot-button" disabled="disabled" class="button-margin" onclick="handleControlButton('find')" style="width:40%"><ons-icon icon="fa-map-marker"></ons-icon> Find</ons-button>
<br>
<ons-button id="go-to-button" disabled="disabled" class="button-margin" onclick="handleGoToButton()" disabled style="width:40%"><ons-icon icon="fa-map-signs"></ons-icon> Go to </ons-button>
<ons-button id="area-button" disabled="disabled" class="button-margin" onclick="handleZonesButton()" disabled style="width:40%"><ons-icon icon="fa-map"></ons-icon> Zones </ons-button>
<!--<ons-button id="area-button" disabled="disabled" class="button-margin" onclick="handleZonesButton()" disabled style="width:40%"><ons-icon icon="fa-map"></ons-icon> Zones </ons-button>-->
<ons-button id="segments-button" disabled="disabled" class="button-margin" onclick="handleSegmentsButton()" disabled style="width:40%"><ons-icon icon="fa-object-ungroup"></ons-icon> Segments </ons-button>
<br>
<ons-button id="fanspeed-button" disabled="disabled" class="button-margin" onclick="handleFanspeedButton()" disabled style="width:40%"><ons-icon icon="fa-superpowers"></ons-icon> Unknown power</ons-button>
Expand Down
13 changes: 8 additions & 5 deletions frontend/lib/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var pauseButton = document.getElementById("pause-button");
var stopButton = document.getElementById("stop-button");
var spotButton = document.getElementById("spot-button");
var goToButton = document.getElementById("go-to-button");
var areaButton = document.getElementById("area-button");
//var areaButton = document.getElementById("area-button");
var segmentsButton = document.getElementById("segments-button");
var fanspeedButton = document.getElementById("fanspeed-button");
var watergradeButton = document.getElementById("watergrade-button");
Expand Down Expand Up @@ -342,7 +342,7 @@ async function updateHomePage() {
spot: spotButton,
find: findRobotButton,
go_to: goToButton,
zones: areaButton,
//zones: areaButton,
segments: segmentsButton
};

Expand All @@ -354,7 +354,7 @@ async function updateHomePage() {
spot: false, // not ported to capability, discussed @Hypfer to disable it for now
find: robotCapabilities.includes("LocateCapability"),
go_to: robotCapabilities.includes("GoToLocationCapability"),
zones: robotCapabilities.includes("ZoneCleaningCapability"),
//zones: robotCapabilities.includes("ZoneCleaningCapability"),
segments: robotCapabilities.includes("MapSegmentationCapability")
};

Expand Down Expand Up @@ -400,15 +400,15 @@ async function updateHomePage() {
buttonStateMap.start = false;
buttonStateMap.home = false;
buttonStateMap.go_to = false;
buttonStateMap.zones = false;
//buttonStateMap.zones = false;
buttonStateMap.segments = false;
break;
case "cleaning":
buttonStateMap.start = false;
buttonStateMap.home = false;
buttonStateMap.spot = false;
buttonStateMap.go_to = false;
buttonStateMap.zones = false;
//buttonStateMap.zones = false;
buttonStateMap.segments = false;
break;
case "paused":
Expand Down Expand Up @@ -498,6 +498,7 @@ async function homeInit() {
}
}

/*
try {
zones = await ApiService.getZones();
} catch (e) {
Expand All @@ -508,6 +509,8 @@ async function homeInit() {
areaButton.removeAttribute("disabled");
}
*/

try {
segments = await ApiService.getSegments().then((res) => res.filter((segment) => !!segment.name));
} catch (e) {
Expand Down

0 comments on commit ae7c059

Please sign in to comment.