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

Allow sub-directories for icons #2946

Merged
merged 2 commits into from
May 16, 2022
Merged

Conversation

J-N-K
Copy link
Member

@J-N-K J-N-K commented May 1, 2022

Closes #2896

This immediately works in Main UI, but needs an adjustment in Basic UI.

Signed-off-by: Jan N. Klug github@klug.nrw

Signed-off-by: Jan N. Klug <github@klug.nrw>
@J-N-K J-N-K added the enhancement An enhancement or new feature of the Core label May 1, 2022
@J-N-K J-N-K requested a review from a team as a code owner May 1, 2022 16:02
Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kaikreuzer
Copy link
Member

If I understand the code right, this now also requires the http request to contain the folder names next to the icon name (i.e. the relative path). My understanding of the issue was that it is desired to be able to structure icons into subfolders in the file system, but that they should all still be served the very same way to the outside - i.e. hiding their storage path. Wdyt?

@J-N-K
Copy link
Member Author

J-N-K commented May 8, 2022

Yes, you have to include the folder. After re-reading the issue I beliebe that both interpretations (supporting sub-folders and present them with or without folder-name) are possible. IMO the solution here is better, because we will run into unpredictable behavior if an icon with the same name in different folders (which is perfectly possible in a file system). Taking first/last discovered item would be non-deterministic since it depends on the order in which the folders are processed.

@kaikreuzer
Copy link
Member

I'm not feeling well about that change as it changes the semantic of how icons are handled throughout openHAB. The "category" used to be a plain string so far - now it would be a path. Note that icon categories are used at many places: In the general IconProvider interface, within DSL item definitions, in sitemaps, etc. I don't see the benefit that would justify such a huge change.
Wrt duplicate files in the folder structure, we could probably define a simple rule like saying the first one found when traversing the tree is chosen.

@J-N-K
Copy link
Member Author

J-N-K commented May 8, 2022

I'm fine with that, too. I'll check how to implement it. Do you know here to document that?

@kaikreuzer
Copy link
Member

Thank you!

Signed-off-by: Jan N. Klug <github@klug.nrw>
Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I like this much more and it also looks pretty straight forward.

@kaikreuzer kaikreuzer merged commit d8ebbb5 into openhab:main May 16, 2022
@kaikreuzer kaikreuzer added this to the 3.3 milestone May 16, 2022
@J-N-K J-N-K deleted the feature-iconsubdir branch May 16, 2022 20:33
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/custom-icons-disappears-in-openhab-3-3/136957/1

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/custom-icons-in-habpanel-not-working-anymore-since-oh3-3/137357/1

splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 12, 2023
* Allow sub-directories for icons

Signed-off-by: Jan N. Klug <github@klug.nrw>
GitOrigin-RevId: d8ebbb5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subfolders for custom icons
4 participants