Skip to content

Commit

Permalink
Merge pull request ManageIQ#16062 from yrudman/allow-to-change-report…
Browse files Browse the repository at this point in the history
…-name

Unconditionally seed all standard reports and widgets
  • Loading branch information
gtanzillo authored Oct 2, 2017
2 parents 99eaef8 + ce79a8a commit 9653a69
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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")
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
$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

0 comments on commit 9653a69

Please sign in to comment.