openhab / openhab-webui

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

Items icons not displayed in all pages #1839

Closed lolodomo closed 1 year ago

lolodomo commented 1 year ago

The problem

The syntax for item icon has been extended in core framework with PR openhab/openhab-core#3539.

The icon value can now contain until 3 segments separated by a colon (":"). First segment is the icon source. Example: oh, if, iconify, material, f7, ... Second segment is the icon set. Example: classic Third segment is the icon name (and can contain hyphen). Example: temperature In case only two segments are provided, the first segment is the icon source and the second the icon name. "classic" icon set is assumed. In case only one segment is provided, the icon source is assumed to be the openHAB server and its classic icon set and the value is then the icon name.

MainUI already supports this new syntax in certain pages but not all.

Here are examples of item icon values that should work everywhere in MainUI:

  1. temperature
  2. oh:humidity
  3. oh:classic:pressure
  4. material:arrow_drop_down
  5. material:favorite
  6. iconify:wi:day-sunny-overcast
  7. if:wi:day-thunderstorm

Only "temperature" icon is displayed in the equipment tab of MainUI (opening the "Web services" pop-up). The others should be displayed too. image

Icon "oh:classic:pressure" is shown nowhere, neither in the items page, nor the item page, nor the edit item page and nor the model page.

Icon "material:favorite" is not shown in the item page (but OK in the items page, the edit item page and the model page): image

Icons "iconify:wi:day-sunny-overcast" and "if:wi:day-thunderstorm" are not shown in the item page (but OK in the items page, the edit item page and the model page): image

Expected behavior

MainUI should support the new icon syntax with 3 possible segments in all places. It includes:

  1. the support of "oh:classic:value" as icon value
  2. the display of the icon in the item page for iconify and material icons
  3. the display of the icon in the equipment tab when an icon source is part of the icon value

Steps to reproduce

Here are example items I used for my tests:

Group GTest2 "Test items group 2" [ "WebService" ]

Number:Temperature CurrentTemp2 "Current Temp [%.1f °C]" <temperature> (GTest2) [ "Measurement", "Temperature" ]
Number CurrentHumidity2 "Humidity [%.0f %%]" <oh:humidity> (GTest2) [ "Measurement", "Humidity" ]
Number CurrentPressure2 "Pressure [%.0f hPa]" <oh:classic:pressure> (GTest2) [ "Measurement", "Pressure" ]
String CurrentPressureTrend2 "Pressure Trend [%s]" <material:arrow_drop_down> (GTest2) [ "Measurement", "Pressure" ]
Number:Temperature SetpointTemp2 "Setpoint Temp [%.1f °C]" <iconify:wi:day-sunny-overcast> (GTest2) [ "Setpoint", "Temperature" ]
Number:Temperature SetpointTemp3 "Setpoint Temp [%.1f °C]" <if:wi:day-thunderstorm> (GTest2) [ "Setpoint", "Temperature" ]
String TestString2 "Test string [%s]" <material:favorite> (GTest2) [ "Status" ]

Browser console

Browser network traffic

lolodomo commented 1 year ago

Here is a capture of network traffic when opening the equipment tab containing my items. We can see that there is no particular handling of icon values, they are passed to the OH icon server directly without considering the icon source and without considering the icon set: image

It is apparently just not yet implemented at this place.

lolodomo commented 1 year ago

In the admin pages (list of items, item page or edit item page), the problem is different, it is the icon set that it is not handled at all. Here is when the icon is "oh:classic:pressure": image

The icon source ("oh") is correctly removed but the icon set is not extracted and not provided to the request through the iconset parameter.

lolodomo commented 1 year ago

Regarding the item page when the icon source is material or iconify, I don't see any call to the OH icon server so I guess that it is properly detected a non OH icon source but the icon is not displayed. Probably something not properly handled in that specific page.

lolodomo commented 1 year ago

This is a little my fault, I was convinced that icon source was already fully supported by Main UI, I now understand it is probably only partially supported, meaning only at certain places. I hope it can be easily enhanced to get a full support.

lolodomo commented 1 year ago

I can also mention the problems are the same in the property tab as in the equipment tab. Not tested the Location tab but I guess it should be the same.