-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
Extend sitemap syntax for icon #3378
Conversation
I encounter difficulties to define the right syntax. Current PR is not working as expected. ID cannot be used as icon segment as "-" should be accepted. |
How about creating a new terminal ICON_ID:
That also avoids the variants in each input type (provided the quotes are handled properly elsewhere, but it should as it worked with STRING terminals). Keep the valueConverter and put |
I tried yesterday to create a new terminal id but my attempt leaded to an error when building. I will try again with your proposal. |
1eec2ae
to
389a76a
Compare
@mherwege : did you get some difficulties when you updated the sitemap syntax ?
I have no syntax error displayed, that is a good point. |
@mhilbush : I have only a problem with my sitemap files.
I am wondering if this is required or not that I recompile and deploy a new version of the bundles org.openhab.core.model.sitemap.ide and org.openhab.core.model.sitemap.runtime ? |
Ok, then I guess unrelated to what was reported on the forum. I opened an issue for that problem. |
When I recompile from main (with my changes) and deploy the bundle, it works again, so this is certainly something more in link with my changes. |
@lolodomo I have been testing this in the Eclipse IDE. I did an mvn install on core.model.sitemap, didn’t touch the ide or runtime projects. I did have all three open (+ the basicui project) so they where picked up when resolving the launch bnd file. And that worked for testing. I did not try to move the file into an install of OH and test outside of the IDE. |
Unfortunately, I have still an old Eclipse not fully compatible with Java 17. I can edit and compile code but I can't run OH inside Eclipse. |
0115ca0
to
7134bd5
Compare
7134bd5
to
f3c60dc
Compare
Here is an example of sitemap showing the different cases:
|
f3c60dc
to
527ad75
Compare
I found a way to change the syntax that works as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It seems the build succeeded but with the now so famous final "Finished: UNSTABLE". |
The icon value can now contain until 3 segments separated by a semi-column. First segment is the icon source. Example: oh, if, iconify, material, f7, ... Second segment is the icon set (and can be empty). 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 if icon source is "oh". 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. Ability to surround the value with simple or double quotes is kept for better backward compatibility. Signed-off-by: Laurent Garnier <[email protected]> Fix
527ad75
to
aebe73d
Compare
I finally changed the expectation when the icon value contains only 2 segments to be more compliant with Main UI syntax.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@mherwege : do you think it requires a change in the sitemap generator of MainUI? |
@lolodomo Yes, it does. It generates it with quotes around the icon name. |
@mherwege Do we need to revert this for M2? |
The quotes are still an available option in sitemap. |
@lolodomo It is OK when writing out the code for the sitemap. But I tested your example sitemap above. The variant without quotes now makes the sitemap code interpretation fail. The parser needs to be in sync with the xtext parser. I will see what I can do. |
Next milestone is scheduled for sunday, that‘s why I‘m asking. |
@lolodomo @J-N-K I created openhab/openhab-webui#1843 that includes fixes for this, tested with the examples provided. |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/openhab4-m1-earlybird/145193/25 |
- Adapt sitemap and item lexers to changes in icon name syntax - Restrict the elements that can be added to a sitemap - Added extra sitemap validations (in line with xtext validation in core) - Added test for sitemap parser and validation This solves the issue in main UI created by openhab/openhab-core#3539 and openhab/openhab-core#3378. Signed-off-by: Mark Herwege <[email protected]>
The icon value can now contain until 3 segments separated by a semi-column.
First segment is the icon source. Example: oh, if, iconify, material, f7, ...
Second segment is the icon set (and can be empty). 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.
Ability to surround the value with simple or double quotes is kept for better backward compatibility.
Signed-off-by: Laurent Garnier [email protected]