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 class #30

Merged
merged 15 commits into from
Jun 18, 2018
Merged

add log viewer class #30

merged 15 commits into from
Jun 18, 2018

Conversation

jreidinger
Copy link
Member

@jreidinger jreidinger commented Jun 12, 2018

related to https://bugzilla.suse.com/show_bug.cgi?id=1008493

how looks example on TW:

snimek obrazovky_2018-06-15_10-12-35

@ancorgs
Copy link
Contributor

ancorgs commented Jun 12, 2018

Hmm, instead of creating a completely different dialog. Wouldn't it be better to simply modify the existing SystemdJournal::EntriesDialog so it can receive a given query as starting point?

So you have all the features (like real-time "grepping" or redefining the criteria) without having to maintain two different dialogs.

@jreidinger
Copy link
Member Author

@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?

@ancorgs
Copy link
Contributor

ancorgs commented Jun 14, 2018

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. :-)

@coveralls
Copy link

coveralls commented Jun 15, 2018

Coverage Status

Coverage increased (+1.4%) to 65.537% when pulling f8365b5 on reusable_log_viewer into f1ad47f on master.

def initialize
super
# @param query [QueryPresenter] optional initial query
def initialize(query: nil)
Copy link
Contributor

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).

params = Yast::WFM.Args
raise "missing param for log entries" if params.empty?

query = SystemdJournal::QueryPresenter.new(interval: "0", filters: { "unit" => params })
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor

@ancorgs ancorgs left a 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
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

@ancorgs ancorgs left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@ancorgs ancorgs left a comment

Choose a reason for hiding this comment

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

LGTM

@jreidinger jreidinger merged commit 959be9f into master Jun 18, 2018
@jreidinger jreidinger deleted the reusable_log_viewer branch June 18, 2018 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants