openhab / openhab-webui

Web UIs of openHAB
Eclipse Public License 2.0
214 stars 235 forks source link

[Sitemap] Missing chart labels #1367

Closed ghost closed 10 months ago

ghost commented 3 years ago

@Boby71 commented on Jan 9, 2021, 4:14 PM UTC:

The problem

When using a chart in a sitemap (no matter if created in the UI or .sitemap file), the title won't be displayed anymore: UI: image

Code:

    Group label="Corona Statistik AT" {
        Text item=CoronaStatisticsAT_NewCases label="Neue Fälle"
        Text item=CoronaStatisticsAT_NewDeaths label="Neue Tote"
        Text item=CoronaStatisticsAT_Updated label="Daten vom [%1$td.%1$tm.%1$tY, %1$tH:%1$tm]"
        Chart icon="chart" item=CoronaStatisticsAT_NewCases refresh=60000 service="rrd4j" period="W" label="Neue Fälle"
    }

Result: Chart is being displayed, but without given title: image

Expected behavior

When label= is being used, the label should be displayed as well

Steps to reproduce

  1. Create a chart with a lable
  2. Check page in basicUI

Your environment

runtimeInfo:
  version: 3.1.0
  buildString: "Build openhab/openhab-core#2127"
locale: de_AT
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.9
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.43+88-CA
  osName: Linux
  osVersion: 5.4.83-v7+
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 84129568
  totalMemory: 194772992
bindings:
  - amazonechocontrol
  - coronastats
  - daikin
  - denonmarantz
  - enigma2
  - exec
  - harmonyhub
  - http
  - ipcamera
  - mqtt
  - netatmo
  - network
  - ntp
  - systeminfo
  - unifi
  - wled
  - worxlandroid
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: true
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: windows
    pixelRatio: 1
    prefersColorScheme: dark
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 8
    language: de
    languages:
      - de
      - de-DE
      - en
      - en-US
      - en-AU
    onLine: true
    platform: Win32
  screen:
    width: 1920
    height: 1080
    colorDepth: 24
  support:
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: dark
    filled: true
    pageTransitionAnimation: default
    bars: filled
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
    like Gecko) Chrome/87.0.4280.141 Safari/537.36
timestamp: 2021-01-09T16:11:12.238Z

Browser console

image

Browser network traffic

image

Additional information

This issue was moved by ghys from openhab/openhab-webui#781.

ghost commented 3 years ago

@Boby71 commented on Jan 9, 2021, 4:30 PM UTC:

Just noticed, it's the same for frames:

        Frame label="Neue Faelle" {
            Chart icon="chart" item=CoronaStatisticsAT_NewCases refresh=60000 service="rrd4j" period="W" label="Neue Fälle"
        }

Not a singe label is being displayed here

bigbasec commented 3 years ago

I looked into this a bit and it seems as though that was never intended to have a label. Although not a hard problem to solve if it needed to be added as the data is there.

There are a few items that seem to intentionally not have a label because they are intended to be full row items that would be otherwise described in a frame or group of some sort.

The frame label seems to work fine in snapshot, though I couldn't find any history of when they were broken or changes that would have fixed them.

Anyway, some of the items do have the option to hide the label if the label text is blank, and some straight up don't have a label that will be displayed at all. Those are : Image Chart Video

Boby71 commented 3 years ago

I looked into this a bit and it seems as though that was never intended to have a label. Although not a hard problem to solve if it needed to be added as the data is there.

There are a few items that seem to intentionally not have a label because they are intended to be full row items that would be otherwise described in a frame or group of some sort.

The frame label seems to work fine in snapshot, though I couldn't find any history of when they were broken or changes that would have fixed them.

Anyway, some of the items do have the option to hide the label if the label text is blank, and some straight up don't have a label that will be displayed at all. Those are : Image Chart Video

But frame labels aren’t shown as well. So I have no option to put a level above these elements at all? It worked differently in OH2.5...

bigbasec commented 3 years ago

I'm on build 2159 and they work as expected. I can fix them all if the developers want, the change is in basic-ui and it's not a big one, but I think it's how they intended it.

I personally think that if the label is filled it then it should be displayed and if it's not then it's just the "content"(image, web, or video). Currently in basic ui the images don't work anyway, so I think we'd need to wait for that to get resolved(not sure about videos).

If any of the dev's want to chime in I can fix these up fairly quick so they will display a label(and icon) if they are set. Currently they will not.

Boby71 commented 3 years ago

@ghys, what do you think about this offer?

ghys commented 3 years ago

Sure, I don't maintain Basic UI but every initiative to fix things up is welcome.

bigbasec commented 3 years ago

Is what is currently in place the intended result though, or should there be the ability to show an icon and label for the 3 item types that are missing that?

I've got this mostly fixed already here(although both Image and Video won't display due to what would seem to be a core issue), but don't want to waste anyone's time reviewing if it's not the way things are supposed to be.

Boby71 commented 3 years ago

Who is taking this decision, @bigbasec mentioned above, @kaikreuzer ?

kaikreuzer commented 3 years ago

There seem to be a few different cases being discussed here, but from what I understand from a quick glance, I'd say we talk about bugs here, so there's no need for any decision and @bigbasec's PRs for the Basic UI are welcome. FTR: If a widget has a label= attribute, we can safely assume that if some value is provided for it, it is expected to be displayed. If this is not the case, we can call it a bug, unless there are very clear reasons for it not to be shown (because of constrained display sizes like on the PebbleUI or whatever).

bigbasec commented 3 years ago

I think there are 3 that don't display a label at all, Image, Video and Chart. I had that all done, but I think I blew away that branch since it wasn't getting any traction. I'll work on those changes here shortly, shouldn't take too long.

lolodomo commented 3 years ago

Frame label is correctly displayed by Basic UI (or Android app).

image

    Frame label="Maison" {
        Group item=xxx
        Group item=yyy
        Group item=zzz
    }
mueller-ma commented 11 months ago

I haven't checked again, but a few years ago charts always had a label called Chart when nothing was defined: https://github.com/openhab/openhab-core/issues/1351 Maybe that should be fixed first before all UIs start displaying "Chart" as label.