Closed mr-manuel closed 1 month ago
Can be tested with https://github.com/victronenergy/gui-v2/commit/8510285ff4dad6a484fdca35df217168bf5b6f04.
I solved it now in another way. Can be closed, if this is not relevant.
@mr-manuel The problem is that when you set enabled
, it overwrites the binding that controls whether the control is read-only. So when you set enabled
, include userHasWriteAccess
in the binding, like this:
ListSwitch {
writeAccessLevel: VenusOS.User_AccessType_Installer
enabled: isRunning && userHasWriteAccess
}
Similarly, when you set allowed
, it overwrites the binding that controls whether the button is visible. Do this instead:
ListButton {
allowed: defaultAllowed && isConnected
showAccessLevel: VenusOS.User_AccessType_Installer
}
I can see this is confusing, and ideally, it wouldn't be possible to overwrite these enabled
and allowed
so easily and lose the default behavior. But, this is the API we have for now, and it can be improved later on.
As discussed, this is not a bug, just an issue with how the enabled/allowed state can be overwritten in the API. Closing.
I was just documenting this, but you were faster. Thanks.
Change the access level to
User
.ListSwitch
The user can modify the switch, but it should be read-only by setting
writeAccessLevel
.The
showAccessLevel
is working correctly.ListTextField
The user can modify the text box, but it should be read-only by setting
writeAccessLevel
.The
showAccessLevel
is working correctly.ListButton
The button is shown, but it should not be shown by setting
showAccessLevel
.The
writeAccessLevel
is hiding the element. It seems thatshowAccessLevel
andwriteAccessLevel
are swapped.