Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sitemap Label Colour not working #2082

Closed
1 of 4 tasks
Dash opened this issue Sep 21, 2023 · 5 comments · Fixed by openhab/openhab-core#3812
Closed
1 of 4 tasks

Sitemap Label Colour not working #2082

Dash opened this issue Sep 21, 2023 · 5 comments · Fixed by openhab/openhab-core#3812
Labels
bug Something isn't working

Comments

@Dash
Copy link

Dash commented Sep 21, 2023

Which UI are you reporting an issue for?

  • Basic UI
  • HABPanel
  • HABot
  • CometVisu

The problem

Conditional Label colours no longer work on Sitemaps, though simply specifying a colour does work. I'm not sure at which point this regressed.

This setup
image

Produces:
image

The UI generates this code:

sitemap page_c6c037636f label="New Sitemap" {
    Text item=KitchenLights labelcolor=[KitchenLights == ON =" red"] label="Lights are: [%s]"
}

I have checked in Firefox, Chrome, and through the Android App.

Expected behavior

I'm expecting the above example to show the text "Kitchen Lights" in red on sitemap.

Steps to reproduce

  1. Build a new site map
  2. Add a label to a switch
  3. Add a conditional colour based on the switch status

Your environment

runtimeInfo:
  version: 4.1.0.M1
  buildString: Milestone Build
locale: en-GB
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 17.0.8
  javaVendor: N/A
  osName: Linux
  osVersion: 5.14.21-150400.24.81-default
  osArchitecture: amd64
  availableProcessors: 2
  freeMemory: 332692888
  totalMemory: 778043392
  uptime: 353815
  startLevel: 100
addons:
  - automation-jsscripting
  - binding-astro
  - binding-exec
  - binding-gpstracker
  - binding-http
  - binding-icalendar
  - binding-mqtt
  - binding-network
  - binding-snmp
  - binding-systeminfo
  - binding-xmppclient
  - persistence-rrd4j
  - transformation-jsonpath
  - transformation-map
  - transformation-regex
  - ui-basic
  - ui-habpanel
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: true
    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: true
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 12
    language: en-GB
    languages:
      - en-GB
      - en
    onLine: true
    platform: Win32
  screen:
    width: 3840
    height: 2160
    colorDepth: 24
  support:
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: dark
    filled: true
    pageTransitionAnimation: default
    bars: light
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101
    Firefox/117.0
timestamp: 2023-09-21T17:37:20.326Z

Browser console

Browser network traffic

image

Additional information

@Dash Dash added the bug Something isn't working label Sep 21, 2023
@lolodomo
Copy link
Contributor

lolodomo commented Sep 21, 2023

In your exemple, I see an unexpected space before the color. Try replacing " red" by "red".

@Dash
Copy link
Author

Dash commented Sep 21, 2023

In your exemple, I ser an unexpected space before the color. Try replacing " red" by "red".

You'll note that this is done through the sitemap builder, where there are no quotes. But I tried stripping out just the space between the = and red, and that didn't make a difference, but taking it a step further, I stripped out all the whitespace:
image

And that has worked:
image

I'd classify that this is a workaround, as this wasn't the behaviour before.

@lolodomo
Copy link
Contributor

Maybe a regression with recently merged PR #2045 ? I see something changed about spaces in the description.
@mherwege

@mherwege
Copy link
Contributor

Maybe a regression with recently merged PR #2045 ? I see something changed about spaces in the description.
@mherwege

Unlikely, as this only touched the parser to convert from the sitemap code to the internal representation. The space appears when converting from the UI presentation to the internal and text representation. I will have a look at it.

@mherwege
Copy link
Contributor

mherwege commented Sep 25, 2023

It is probably a regression from openhab/openhab-core#3769, in itself created to solve #1487 (comment).

florian-h05 pushed a commit that referenced this issue Sep 25, 2023
When generating the sitemap DSL from a UI configured sitemap with color
conditions, if the color in the condition has a leading space, it will
be included in the color string.
While this does not have an impact on the sitemap functionality (it
works), it is an issue if one would copy this sitemap to a sitemap file.
This PR strips the blanks from the color.

See #2082 and the example provided there.

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants