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

Unconditionally seed all standard reports and widgets #16062

Merged
merged 2 commits into from
Oct 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/miq_report/seeding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def sync_from_file(filename, dir, typ)
rec = find_by_filename(rpt[:filename])

if rec
if rec.filename && (rec.file_mtime.nil? || rec.file_mtime.utc < rpt[:file_mtime])
_log.info("#{typ.titleize}: [#{rec.name}] file has been updated on disk, synchronizing with model")
if rec.filename
_log.info("#{typ.titleize}: [#{rec.name}] file exists, synchronizing with model")
Copy link
Member

Choose a reason for hiding this comment

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

Ok, so I'm fine with these changes but I don't know if anything will be changed when we're constantly touching the report objects. For example, do we have report definitions sorted in the UI by updated on?

I don't think so but it might be worth running this through several server boots and verifying the report pages show the reports in the same order in some screens.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorting does changes slightly between server reboots

Copy link
Member

Choose a reason for hiding this comment

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

@yrudman How is the sorting changing? Can you tell f that is a result of this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think changing sorting is result of change, since before change reports record on DB was not touched.
Note: there is different sorting on left part (in tree) and on right part (in table)

before: (on master):
screen shot 2017-09-29 at 9 23 42 am

after (on this branch):
reboot 1 (red marks difference between rebootes):
branch1

reboot 2)
branch2

Copy link
Member

Choose a reason for hiding this comment

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

@yrudman can you find how they're sorting these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jrafanie I think there is no explicit sorting, also it does look inconsistent now when on the same screen there are same lists side by side, and those list have different order.
I think it make sense to sort those list of reports in the same way alphabetically.
Are you thinking of changing sorting in this PR ?

Copy link
Contributor Author

@yrudman yrudman Sep 29, 2017

Choose a reason for hiding this comment

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

I am still debugging to find-out how exactly sorting done on UI side. At this point I can say how right side sorted - it is sorted by yaml file name (SELECT "miq_reports".* FROM "miq_reports" ORDER BY "miq_reports"."rpt_type" ASC, "miq_reports"."filename" ASC, "miq_reports"."name" ASC) and report with filename 005_VMs with Free Space _ 50% by Department will be first (which is shown in right side of screenshots.

It looks like the left side in report tree formed by using this SQL: SELECT "miq_reports".* FROM "miq_reports" WHERE "miq_reports"."name" IN ('VMs with Free Space > 50% by Department', 'VMs w/Free Space > 75% by Function', 'VMs w/Free Space > 75% by LOB', 'VM Disk Usage', 'Hardware Information for VMs', 'Vendor and Type', 'Vendor and Guest OS', 'VM Location and Size', 'VM UUIDs', 'VMs with no UUID', 'VMs with Volume Free Space <= 20%', 'VMs with Volume Free Space >= 80%', 'VMs by MAC Address', 'Unregistered VMs', 'Orphaned VMs', 'VMs Snapshot Summary', 'User Accounts - Windows', 'User Accounts - Linux', 'Account Groups - Windows', 'Account Groups - Linux', 'Guest OS Information - any OS', 'Guest OS Information - Windows', 'Guest OS Information - Linux', 'Guest OS Password Information - Windows', 'Guest OS HKLM Registry Information')
and this SQL do not have any explicit sorting. I did not find (yet) any sorting on UI side

Copy link
Member

Choose a reason for hiding this comment

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

@yrudman Can you confirm the order of these reports change on master without your changes? Based on your findings of the sql queries, I'd guess this would happen without your changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure, i've tried couple time and master still the same. I think the order without explicit ordering is not guaranteed, but since data was not changed with reboot it is the same, will try more on master ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jrafanie I was wrong in above comment - sorting slightly changing on master too

rec.update_attributes(rpt)
rec.save
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/miq_widget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def self.sync_from_hash(attrs)

widget = find_by(:description => attrs["description"])
if widget
if filename && widget.updated_at.utc < File.mtime(filename).utc
if filename
Copy link
Member

Choose a reason for hiding this comment

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

Same as above. I don't think this will break anything but it's been a while since I looked at how we query reports and widgets to know if we ever sort by updated_on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like list of widget sorted alphabetically and not changing between server reboots

$log.info("Widget: [#{widget.description}] file has been updated on disk, synchronizing with model")
["enabled", "visibility"].each { |a| attrs.delete(a) } # Don't updates these because they may have been modofoed by the end user.
widget.updated_at = Time.now.utc
Expand Down