-
Notifications
You must be signed in to change notification settings - Fork 7
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 class #30
Conversation
Hmm, instead of creating a completely different dialog. Wouldn't it be better to simply modify the existing So you have all the features (like real-time "grepping" or redefining the criteria) without having to maintain two different dialogs. |
@ancorgs to be honest I am not sure as basically mean change from trivial log reader to quite complex table with many attributes. Does it have at least reasonable help text? |
If the help text if not enough we can improve it and have a win-win situation. A more powerful log reader and a better help for the standalone yast-journal. :-) |
def initialize | ||
super | ||
# @param query [QueryPresenter] optional initial query | ||
def initialize(query: nil) |
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.
This is something that was probably a little bit weird already in the original implementation, receiving a QueryPresenter
instead of a Query
as argument.
It probably makes more sense to receive a Query
and create the QueryPresenter
to wrap it as part of EntriesDialog#initialize
(which probably means touching the QueryPresenter
API, as well, I know).
example/log_viewer.rb
Outdated
params = Yast::WFM.Args | ||
raise "missing param for log entries" if params.empty? | ||
|
||
query = SystemdJournal::QueryPresenter.new(interval: "0", filters: { "unit" => params }) |
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.
See below. I would change the QueryPresenter
API a bit to make possible to do something like this:
query = SystemdJournal::Query.new(interval: "0", filters: { "unit" => params })
SystemdJournal::EntriesDialog.new(query: query).run
Because having to provide a presenter object instead of the real thing to the dialog feels very weird.
|
||
This directory allows to check how some UI will look into various circumstances. | ||
|
||
As it use real systemd journal it have to be run as root. It is also recommended |
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.
Strictly speaking, journalctl can also be run as normal user, although it will show very limited records.
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.
In general, it looks quite good.
But I guess we need to do something to avoid the test coverage drop.
dates = { | ||
since: Yast::Builtins.strftime(interval[:since], TIME_FORMAT), | ||
until: Yast::Builtins.strftime(interval[:until], TIME_FORMAT) | ||
} | ||
_("Between %{since} and %{until}") % dates | ||
when nil |
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.
The possibility of passing nil if not so clear in the yardoc documentation of SystemdJournal::Query#initialize
. We should likely take the opportunity to improve it.
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.
@ancorgs well, issue is that it is default value. So it is a bit strange situation.
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
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
related to https://bugzilla.suse.com/show_bug.cgi?id=1008493
how looks example on TW: