From bdee7e6bc77e361ca9ee30e78d3944c2368437e3 Mon Sep 17 00:00:00 2001 From: Hilda Stastna Date: Mon, 23 Jan 2017 15:22:05 +0100 Subject: [PATCH 1/3] Display new filter in Datastores right after creating it fixing https://bugzilla.redhat.com/show_bug.cgi?id=1414876 Display a new filter in Compute -> Infrastructure -> Datastores in My Filters in accordion right after creating it, no need to refresh the page to see the new filter there. --- app/controllers/application_controller/filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller/filter.rb b/app/controllers/application_controller/filter.rb index d7e41247533..597ab2a0b37 100644 --- a/app/controllers/application_controller/filter.rb +++ b/app/controllers/application_controller/filter.rb @@ -659,7 +659,7 @@ def adv_search_button adv_search_build_lists # Save the last search loaded (saved) @edit[@expkey][:exp_last_loaded] = {:id => s.id, :name => s.name, :description => s.description, :typ => s.search_type} - @edit[:new_search_name] = @edit[:adv_search_name] = @edit[@expkey][:exp_last_loaded][:description] + @edit[:new_search_name] = @edit[:adv_search_name] = @edit[@expkey][:exp_last_loaded][:description] unless @edit[@expkey][:exp_last_loaded].nil? @edit[@expkey][:expression] = copy_hash(@edit[:new][@expkey]) # Build the expression table @edit[@expkey][:exp_table] = exp_build_table(@edit[@expkey][:expression]) From b7ab2138025790a817e916479146b6ef625c6b7f Mon Sep 17 00:00:00 2001 From: Hilda Stastna Date: Mon, 23 Jan 2017 15:34:04 +0100 Subject: [PATCH 2/3] Make visible My Filters in Datastores fixing https://bugzilla.redhat.com/show_bug.cgi?id=1414876 Make created filters in Compute -> Infrastructure -> -> Datastores visible under My Filters in accordion. --- app/presenters/tree_builder_storage.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/presenters/tree_builder_storage.rb b/app/presenters/tree_builder_storage.rb index 4575a27ece6..d2bdae17f5f 100644 --- a/app/presenters/tree_builder_storage.rb +++ b/app/presenters/tree_builder_storage.rb @@ -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) + end count_only_or_objects(count_only, objects, "description") end end From edcebc46d29a60b5bbe92550640cdf0c1d27a51a Mon Sep 17 00:00:00 2001 From: Hilda Stastna Date: Mon, 23 Jan 2017 15:40:22 +0100 Subject: [PATCH 3/3] Fix commiting a new filter in advanced search panel Fix commiting a new filter in advanced search panel which is related to its creating and saving because it did not work, button to 'Commit expression element changes' did not work properly. Also make button for discarding expression element changes work. Both buttons have the styling we need. --- app/views/layouts/exp_atom/_editor.html.haml | 33 +++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/app/views/layouts/exp_atom/_editor.html.haml b/app/views/layouts/exp_atom/_editor.html.haml index 22aa0749019..3a80b442a4b 100644 --- a/app/views/layouts/exp_atom/_editor.html.haml +++ b/app/views/layouts/exp_atom/_editor.html.haml @@ -21,25 +21,20 @@ - exptypes -= [[_(EXP_FIND_TYPE[0]), EXP_FIND_TYPE[1]]] #exp_atom_editor_div %fieldset{:style => "width:auto; padding-left: 6px; padding-top: 6px;"} - %ul.searchtoolbar - %li - - 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) - %li - - 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') + %button.btn.btn-default{"data-method" => :post, + "data-miq_sparkle_on" => true, + :onclick => "miqAjaxButton('#{url_for(:action => 'exp_button', :pressed => 'commit')}');", + :remote => true, + :title => t} + %i.fa.fa-lg.fa-check + - t = _("Discard expression element changes") + %button.btn.btn-default{"data-method" => :post, + "data-miq_sparkle_on" => true, + :onclick => "miqAjaxButton('#{url_for(:action => 'exp_button', :pressed => 'discard')}');", + :remote => true, + :title => t} + %i.fa-lg.pficon.pficon-close %div{:style => "padding: 10px;"} - if @edit[@expkey][:exp_key] == "NOT" %font{:color => "black"}