show robot errors

This commit is contained in:
Michael Zanetti 2021-04-11 22:45:49 +02:00
parent baa26f85f9
commit bfa2d4fba3

View File

@ -38,9 +38,11 @@ import "../customviews"
ThingPageBase { ThingPageBase {
id: root id: root
showBrowserButton: false
readonly property State robotState: thing.stateByName("robotState") readonly property State robotState: thing.stateByName("robotState")
showBrowserButton: false readonly property State errorMessageState: thing.stateByName("errorMessage")
GridLayout { GridLayout {
anchors.fill: parent anchors.fill: parent
@ -48,7 +50,7 @@ ThingPageBase {
Item { Item {
Layout.preferredWidth: app.landscape ? Layout.preferredWidth: app.landscape ?
Math.min(parent.width, parent.height) Math.min(parent.width - controlsContainer.minimumWidth, parent.height)
: Math.min(Math.min(500, parent.width), parent.height) : Math.min(Math.min(500, parent.width), parent.height)
Layout.preferredHeight: width Layout.preferredHeight: width
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
@ -80,7 +82,11 @@ ThingPageBase {
name: "../images/cleaning-robot.svg" name: "../images/cleaning-robot.svg"
x: robotArea.robotX - (width / 2) x: robotArea.robotX - (width / 2)
y: robotArea.robotY - (height / 2) y: robotArea.robotY - (height / 2)
color: root.robotState.value == "cleaning" ? Style.accentColor : Style.iconColor color: root.robotState.value == "cleaning"
? Style.accentColor
: root.robotState.value === "error"
? Style.red
: Style.iconColor
property int pixelsPerSecond: 30 property int pixelsPerSecond: 30
@ -220,11 +226,21 @@ ThingPageBase {
} }
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Label {
Layout.fillWidth: true
Layout.margins: Style.margins
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
visible: root.errorMessageState != null && root.robotState.value === "error"
text: root.errorMessageState ? root.errorMessageState.value : ""
}
RowLayout { RowLayout {
id: controlsContainer id: controlsContainer
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: app.margins * 2 Layout.margins: app.margins * 2
property int minimumWidth: Style.iconSize * 2.7 * 3 property int minimumWidth: Style.iconSize * 2.7 * 3
property int minimumHeight: Style.iconSize * 4.5 property int minimumHeight: Style.iconSize * 4.5
@ -279,6 +295,8 @@ ThingPageBase {
} }
} }
}
Component { Component {
id: mapPageComponent id: mapPageComponent
Page { Page {
@ -429,15 +447,7 @@ ThingPageBase {
y: center.y - height / 2 y: center.y - height / 2
onClicked: { onClicked: {
var params = [] engine.thingManager.executeBrowserItem(root.thing.id, boundary.id)
var zoneParam = {}
var actionType = root.thing.thingClass.actionTypes.findByName("startCleaning")
var paramType = actionType.paramTypes.findByName("zone");
print("boundary:", boundary, actionType, paramType)
zoneParam["paramTypeId"] = paramType.id
zoneParam["value"] = boundary.id
params.push(zoneParam)
engine.thingManager.executeAction(root.thing.id, root.thing.thingClass.actionTypes.findByName("startCleaning").id, params)
} }
} }
} }