openhab / openhab-webui

Web UIs of openHAB
Eclipse Public License 2.0
218 stars 238 forks source link

[MainUI] Hide equipment header and any card whose Points are not visible #857

Open rkoshak opened 3 years ago

rkoshak commented 3 years ago

The problem

One may have some Items that they want to be a part of the model for some reason but not want to show, or even better only optionally show in the automatically generated cards on Locations/Equipment/Properties tabs.

When defining the Item's default list widget, one already has the ability to control the visibility of the elements either through an expression or through setting the value to false. This works great!

However, if there is an Equipment that is in a Location, for example, and all the points for that Equipment have visibility set to false, there will still be the gray header with the equipment name shown in the card, just with nothing under it.

Given

image

where "cerberos Network" and "cerberos sensor_reporter Online status" are configure to only be shown when either one is OFF:

value: oh-label-item
config:
  badgeColor: '=(items.vCerberos_Status.state === "ON") ? "green" : "red"'
  badge: '=(items.vCerberos_Status.state === "ON") ? "ONLINE" : "OFFLINE"'
  visible: =items.vCerberos_Status.state != "ON"
  icon: oh:network
  title: cerberos Network
  iconUseState: true
value: oh-label-item
config:
  badgeColor: '=(items.Cerberossensorreporter_Onlinestatus.state === "ON") ?
    "green" : "red"'
  badge: '=(items.Cerberossensorreporter_Onlinestatus.state === "ON") ? "ONLINE" :
    "OFFLINE"'
  visible: =items.Cerberossensorreporter_Onlinestatus.state != "ON"
  icon: oh:network
  title: cerberos sensor_reporter
  iconUseState: true

The Location card appears as

image

It appears the same in the Equipment card. The equipment isn't shown for this on the Properties page anyway so there is no problem there.

However, if the Equipment is a subequipment, and I set visibility on the default list widget for the subequipment it is hidden as expected.

image

value: " "
config:
  visible: =items.vCerberos_Status.state != "ON" ||
    items.Cerberossensorreporter_Onlinestatus.state != "ON"

image

image

Similarly, if a card has an equipment but all of the Points are hidden, the Card should not be shown.

image

image

Your suggestion

I can see a couple of options here.

  1. If an Equipment doesn't have any visible Points, don't show the header for it in the Location and Equipment cards.
  2. Allow the user to define the visibility for the Equipment itself with an expression and only show if the Equipment Item itself is visible.

For the cards I can see a couple of options as well:

  1. If there are no Points to display in a card, don't show the card.
  2. Allow the user to set an expression to control the visibility of the card in the Overview settings page.

Your environment

runtimeInfo:
  version: 3.1.0
  buildString: "Build #2166"
locale: en_US
systemInfo:
  configFolder: /openhab/conf
  userdataFolder: /openhab/userdata
  logFolder: /openhab/userdata/logs
  javaVersion: 11.0.9
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.43+21-CA
  osName: Linux
  osVersion: 5.4.0-64-generic
  osArchitecture: amd64
  availableProcessors: 4
  freeMemory: 128334936
  totalMemory: 423624704
bindings:
  - astro
  - chromecast
  - mail
  - mqtt
  - network
  - networkupstools
  - openweathermap
  - remoteopenhab
  - roku
  - shelly
  - zigbee
  - zwave
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: true
    windows: false
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: macos
    pixelRatio: 2
    prefersColorScheme: light
  isSecureContext: true
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: 8
    hardwareConcurrency: 2
    language: en-US
    languages:
      - en-US
      - en
    onLine: true
    platform: MacIntel
  screen:
    width: 1920
    height: 1080
    colorDepth: 24
  support:
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: light
    filled: true
    pageTransitionAnimation: default
    bars: filled
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36
    (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36
timestamp: 2021-01-28T15:38:26.759Z

Additional information

erhapp commented 2 years ago

I would like to second this enhancement request. Either hiding equipment without visible points or being able to control the visibility of the equipment group would allow to hide for example seasonal equipment. This could really make the UI a lot cleaner.