Skip to content

Commit

Permalink
fix(vendor.roborock): Fix segment rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypfer committed Mar 24, 2021
1 parent 306b8ba commit 0bed81a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion client/segment-edit-map.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<ons-fab ripple id="segment-edit-join">
<ons-icon icon="fa-object-group"></ons-icon>
</ons-fab>
<ons-fab ripple id="segment-rename" onclick="handleSegmentRenameButton()">
<ons-fab ripple id="segment-rename">
<ons-icon icon="fa-i-cursor"></ons-icon>
</ons-fab>
</div>
Expand Down
2 changes: 2 additions & 0 deletions client/segment-edit-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ function segmentConfigInit() {
segmentId = locations.selectedSegments[0].id;
segmentRenameDialogNameInput.value = locations.selectedSegments[0].name;
segmentRenameDialog.show();
} else {
ons.notification.toast("You need to select exactly one segment to rename it.",{buttonLabel: "Dismiss", timeout: window.fn.toastErrorTimeout});
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RoborockMapSegmentRenameCapability extends MapSegmentRenameCapability {
];

Object.keys(this.segmentNames).forEach(k => {
if (k !== segment.id) {
if (parseInt(k) !== parseInt(segment.id)) {
payload.push({
miRoomId: this.segmentNames[k],
robotRoomId: parseInt(k)
Expand Down
13 changes: 1 addition & 12 deletions lib/robots/viomi/ViomiValetudoRobot.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,18 +451,7 @@ class ViomiValetudoRobot extends MiioValetudoRobot {
try {
// noinspection UnnecessaryLocalVariableJS
const map = new ViomiMapParser(data).parse();
// TODO: reimplement zones
// const zones = this.configuration.getZones();
// zones.forEach((v, k) => v.user || zones.delete(k));
// // TODO: Remove this once Valetudo supports named rooms in the zone clean menu.
// map.layers.forEach(layer => {
// if (layer.type !== MapLayer.TYPE.SEGMENT) {
// return;
// }
// const id = layer.metaData.segmentId;
// zones.set(id, {id: id, name: layer.metaData.name, user: false});
// });
// this.configuration.setZones(zones);

this.state.map = map;

this.emitMapUpdated();
Expand Down

0 comments on commit 0bed81a

Please sign in to comment.