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

Add log viewer directly to the main UI #2883

Closed
cdjackson opened this issue Nov 21, 2024 · 6 comments · Fixed by #2884
Closed

Add log viewer directly to the main UI #2883

cdjackson opened this issue Nov 21, 2024 · 6 comments · Fixed by #2884
Labels
enhancement New feature or request main ui Main UI

Comments

@cdjackson
Copy link
Contributor

Currently frontail is available as an addon in openhabian. I just moved my main system to a new server that's not openhabian - Frontail requires a lot of dependencies so I wanted to avoid loading it - it also seems to be no longer developed, and it would be nice(r) IMHO to have a log viewer directly embedded within the Developer Tools menu in the main UI. I guess given there is a websocket /logs endpoint in the core, this was also considered as the way forward...

I just wanted to raise this issue for visibility / comment. Is anyone working on such a viewer? I've not found anything from a quick search other than these closed issues.

#1185
#1109

I very quickly hacked something together last week as an initial concept to display the logs and manipulate logging levels - it needs a LOT more work to make it what I'd personally like to see. If someone is already working on a viewer or has plans, or has a minimum product etc, then I won't spend too much time on it, but if not I might look to put together a minimum solution. Conversely, if someone does have something running, maybe they'd like to share...

image
@cdjackson cdjackson added enhancement New feature or request main ui Main UI labels Nov 21, 2024
@ghys
Copy link
Member

ghys commented Nov 22, 2024

@cdjackson I had planned to do this once with a SSE source:

openhab/openhab-core#3345

but as I thought openHAB's future was to move from SSEs to WebSockets I abandoned the idea.
Perhaps your solution uses openhab/openhab-core#3859?

@cdjackson
Copy link
Contributor Author

Thanks @ghys

Yes, I'm using the websocket interface you reference - it's working quite well in my testing.

Since it looks like there's nothing currently being worked on, I'll try and get a draft (and rough) PR out in the next week or so. Currently I'm fighting some CSS issues (I'dd forgotten how much I hate CSS!). I've got a few different ways to filter / highlight the logs to try and make them a bit easier to view (one of my main drivers).

I have a question that maybe you can point me in the right direction - currently I've hard coded a token to access websockets - is there some way that this can be done automatically? Can you point me at some code?

Thanks.

@ghys
Copy link
Member

ghys commented Nov 22, 2024

This is normally handled in https://github.com/openhab/openhab-webui/blob/main/bundles/org.openhab.ui/web/src/components/auth-mixin.js and https://github.com/openhab/openhab-webui/blob/main/bundles/org.openhab.ui/web/src/js/openhab/auth.js.

You're not supposed to have a way to get the current access_token which is refreshed regularly every hour or so before it expires - but instead use APIs and abstraction layers which will use it for you, refresh it when necessary, but not expose it.
(but there's a trick where you can force a refresh and get a new one - I could expand but this is not the ideal way.)

Since there's no current WebSocket client implementation yet it's a blank state how to deal with the access token in a new WebSocket API...

As for the presentation this is definitely a developer tool so it belongs there, but we could also have it part of the "developer sidebar", eventually opening a bottom drawer (https://v5.framework7.io/docs/sheet-modal) so you can see the logs while working on other stuff.

@lsiepel
Copy link

lsiepel commented Dec 21, 2024

milestone is not set, i guess this was allready available in 4.3 ?

@florian-h05
Copy link
Contributor

We don’t set milestones on issues … but the linked PR has the 4.3 milestone.

@lsiepel
Copy link

lsiepel commented Dec 21, 2024

We don’t set milestones on issues … but the linked PR has the 4.3 milestone.

sorry, somehow missed this was the issue not the PR. Got to leave my computer for some time.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request main ui Main UI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants