-
Notifications
You must be signed in to change notification settings - Fork 898
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
Make created filters in Datastores visible and fix commiting filters #13140
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,13 @@ def x_get_tree_roots(count_only, _options) | |
end | ||
|
||
def x_get_tree_custom_kids(object, count_only, options) | ||
return count_only ? 0 : [] if object[:id] != "global" | ||
objects = MiqSearch.where(:db => options[:leaf]).visible_to_all | ||
objects = MiqSearch.where(:db => options[:leaf]) | ||
objects = case object[:id] | ||
when "global" # Global filters | ||
objects.visible_to_all | ||
when "my" # My filters | ||
objects.where(:search_type => "user", :search_key => User.current_user.userid) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about to move this to model a method ( |
||
end | ||
count_only_or_objects(count_only, objects, "description") | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,25 +23,24 @@ | |
%fieldset | ||
.toolbar-pf-actions | ||
.form-group | ||
%button | ||
- t = _('Commit expression element changes') | ||
= link_to(image_tag(image_path('toolbars/commit.png'), :alt => t), | ||
{:action => 'exp_button', :pressed => 'commit'}, | ||
"data-miq_sparkle_on" => true, | ||
"data-miq_sparkle_off" => true, | ||
:remote => true, | ||
"data-method" => :post, | ||
:title => t) | ||
%button | ||
- t = _("Discard expression element changes") | ||
= link_to(image_tag(image_path('toolbars/discard.png'), :alt => t), | ||
{:action => 'exp_button', :pressed => 'discard'}, | ||
"data-miq_sparkle_on" => true, | ||
"data-miq_sparkle_off" => true, | ||
:remote => true, | ||
"data-method" => :post, | ||
:title => t) | ||
|
||
- t = _('Commit expression element changes') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @epwinchell can you review this change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hstastna Can you replace the link_to(image_tag for each as I have below? That will give us the styling we need. %button %button There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @epwinchell could you please test it and give me an exact and working example? Originally, the problem was There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hstastna Here's a working example. If you get stuck with these in the future, please ping me or @h-kataria for help.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you very much! |
||
= link_to(image_tag(image_path('toolbars/commit.png'), :alt => t), | ||
{:action => 'exp_button', :pressed => 'commit'}, | ||
"data-miq_sparkle_on" => true, | ||
"data-miq_sparkle_off" => true, | ||
:remote => true, | ||
"data-method" => :post, | ||
:title => t, | ||
:class => "btn btn-default") | ||
- t = _("Discard expression element changes") | ||
= link_to(image_tag(image_path('toolbars/discard.png'), :alt => t), | ||
{:action => 'exp_button', :pressed => 'discard'}, | ||
"data-miq_sparkle_on" => true, | ||
"data-miq_sparkle_off" => true, | ||
:remote => true, | ||
"data-method" => :post, | ||
:title => t, | ||
:class => "btn btn-default") | ||
- if @edit[@expkey][:exp_key] == "NOT" | ||
%font{:color => "black"} | ||
= _('NOT') | ||
|
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.
and you can use
objects = object[:id] == 'global' ? objects.visible_to_all : objects.your_new_method_from_comment_below
what do you think ?
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 changed app/presenters/tree_builder_storage.rb like that because it needs the same functionality as in https://github.com/ManageIQ/manageiq/blob/master/app/presenters/tree_builder_vms_filter.rb#L28
which works well and it is well understandable what's going on there.
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.
nice, then you can move this code to method in
app/models/miq_search.rb
to avoid duplicating code.and you can do it in follow up PR for
tree_builder_vms_filter.rb
what do you think ?