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
Fixes #11674 - Bookmarks for task states #133
Conversation
| @@ -0,0 +1,25 @@ | |||
| class AddForemanTasksBookmarks < ActiveRecord::Migration | |||
| def up | |||
| Bookmark.where(:name => "pending", | |||
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.
I would recude the number of different bookmarks: this states often don't tell anything to the end user. I would suggest two bookmars:
- running: state = running
- failed: state = paused OR result = error OR result = warning
667f9a2
to
996a03f
Compare
|
Number of bookmarks reduced to 2 and file moved from migrations to seeds.d |
| end | ||
|
|
||
| def down | ||
| Bookmark.where(:controller => "foreman_tasks_tasks").map(&:destroy) |
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 would destroy user-created bookmarks too, are we ok with it?
Wouldn't #each be more suited here, since we don't want to keep the results?
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 seeds are not migrations: so just moving the file to different place is not enough. I guess inspiring more form the way we seed the bookmarks in foreman is the best thing we can do https://github.com/theforeman/foreman/blob/develop/db/seeds.d/15-bookmarks.rb
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.
Also, it seems and and or operations are somehow preferred over && and ||
996a03f
to
db66cc3
Compare
|
I changed it into the same format as we have in Foreman. |
|
|
||
| ].each do |item| | ||
| next if Bookmark.find_by_name(input[:name]) | ||
| next if audit_modified? Bookmark, input[:name] |
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.
s/input/item/
db66cc3
to
6050bf5
Compare
|
Works well, merging! |
Fixes #11674 - Bookmarks for task states
I've added sortable column
ended_atand bookmarks that should point to potentially problematic tasks requiring user's attention.