-
Notifications
You must be signed in to change notification settings - Fork 358
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 #98
Make created filters in Datastores visible and fix commiting filters #98
Conversation
fixing https://bugzilla.redhat.com/show_bug.cgi?id=1398748 https://bugzilla.redhat.com/show_bug.cgi?id=1382768 Make created filters (not global) in Compute -> Infrastructure -> -> Datastores visible under My Filters in accordion.
fixing https://bugzilla.redhat.com/show_bug.cgi?id=1398748 https://bugzilla.redhat.com/show_bug.cgi?id=1382768 Display a new filter (not global) 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.
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.
Checked commits hstastna/manageiq-ui-classic@952f11c~...1c2806c with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 app/controllers/application_controller/filter.rb
|
@miq-bot remove_label wip |
depends on ManageIQ#98 Refactoring code of x_get_tree_custom_kids method as the same code needs to be in the method in tree_builder_vms_filter.rb and in tree_builder_storage.rb; moving the code to new methods in miq_search.rb.
@hstastna is this ready for review/test, or you working on removing Advanced search from Datastore Clusters accordion? |
@h-kataria This is ready to merge. |
fixing ManageIQ/manageiq#13219 (comment) depends on ManageIQ#98 Fix adding advanced search expression element by clicking on commit button (or okay button) in Compute -> Clouds -> Providers.
depends on ManageIQ/manageiq-ui-classic#98 Refactoring code of x_get_tree_custom_kids method as the same code needs to be in the method in tree_builder_vms_filter.rb and in tree_builder_storage.rb; moving the code to new methods in miq_search.rb.
Euwe backport conflict:
$ git diff
diff --cc app/controllers/application_controller/filter.rb
index d7e4124,5b862ef..0000000
--- a/app/controllers/application_controller/filter.rb
+++ b/app/controllers/application_controller/filter.rb
@@@ -656,10 -306,8 +656,15 @@@ module ApplicationController::Filte
add_flash(_("%{model} search \"%{name}\" was saved") %
{:model => ui_lookup(:model => @edit[@expkey][:exp_model]),
:name => @edit[:new_search_name]})
++<<<<<<< HEAD
+ 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[@expkey].select_filter(s)
+ @edit[:new_search_name] = @edit[:adv_search_name] = @edit[@expkey][:exp_last_loaded][:description] unless @edit[@expkey][:exp_model] == "Storage"
++>>>>>>> cbeea57... Merge pull request #98 from hstastna/Filters_in_datastores_page_refreshed2
@edit[@expkey][:expression] = copy_hash(@edit[:new][@expkey])
# Build the expression table
@edit[@expkey][:exp_table] = exp_build_table(@edit[@expkey][:expression])
diff --cc app/views/layouts/exp_atom/_editor.html.haml
index 22aa074,b153cf1..0000000
--- a/app/views/layouts/exp_atom/_editor.html.haml
+++ b/app/views/layouts/exp_atom/_editor.html.haml
@@@ -20,62 -20,59 +20,98 @@@
- unless MiqExpression.miq_adv_search_lists(exp_model, :exp_available_finds).length > 0
- exptypes -= [[_(EXP_FIND_TYPE[0]), EXP_FIND_TYPE[1]]]
#exp_atom_editor_div
++<<<<<<< HEAD
+ %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)
+ %div{:style => "padding: 10px;"}
+ - if @edit[@expkey][:exp_key] == "NOT"
+ %font{:color => "black"}
+ = _('NOT')
++=======
+ %fieldset
+ .toolbar-pf-actions
+ .form-group
+ - 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
+
+ - if @edit[@expkey][:exp_key] == "NOT"
+ %font{:color => "black"}
+ = _('NOT')
+ - else
+ - opts = ["<#{_('Choose')}>"]
+ - case exp_model
+ - when 'Vm'
+ - opts += exptypes + VM_EXP_TYPES.map { |x| [_(x[0]), x[1]] }
+ - when 'AuditEvent'
+ - opts += [[_('Field'), 'field']]
+ - when '_display_filter_'
+ - unless @edit[@expkey][:exp_available_fields].empty?
+ - opts.push([_('Field'), 'field'])
+ - unless @edit[@expkey][:exp_available_tags] && @edit[@expkey][:exp_available_tags].empty? || exp_available_tags(exp_model, @edit[@expkey][:use_mytags]).empty?
+ - opts.push([_('Tag'), 'tag'])
++>>>>>>> cbeea57... Merge pull request #98 from hstastna/Filters_in_datastores_page_refreshed2
- else
- - opts += exptypes
+ - opts = ["<#{_('Choose')}>"]
+ - case exp_model
+ - when 'Vm'
+ - opts += exptypes + VM_EXP_TYPES.map { |x| [_(x[0]), x[1]] }
+ - when 'AuditEvent'
+ - opts += [[_('Field'), 'field']]
+ - when '_display_filter_'
+ - unless @edit[@expkey][:exp_available_fields].empty?
+ - opts.push([_('Field'), 'field'])
+ - unless @edit[@expkey][:exp_available_tags] && @edit[@expkey][:exp_available_tags].empty? || exp_available_tags(exp_model, @edit[@expkey][:use_mytags]).empty?
+ - opts.push([_('Tag'), 'tag'])
+ - else
+ - opts += exptypes
- = select_tag('chosen_typ', options_for_select(opts, @edit[@expkey][:exp_typ]),
- :multiple => false,
- :class => 'selectpicker',
- 'data-miq_sparkle_on' => true,
- 'data-miq_sparkle_off' => true,
- 'data-miq_observe' => {:url => url}.to_json)
+ = select_tag('chosen_typ', options_for_select(opts, @edit[@expkey][:exp_typ]),
+ :multiple => false,
+ :class => 'selectpicker',
+ 'data-miq_sparkle_on' => true,
+ 'data-miq_sparkle_off' => true,
+ 'data-miq_observe' => {:url => url}.to_json)
- %br
- - if @edit[@expkey][:exp_typ]
- = render :partial => "layouts/exp_atom/edit_#{@edit[@expkey][:exp_typ]}", :locals => {:exp_model => exp_model}
- - if qs_show_user_input_checkbox?
- = check_box_tag("user_input", "1", @edit[@expkey][:exp_value] == :user_input,
- :style => "width: 20px",
- "data-miq_sparkle_on" => true,
- "data-miq_sparkle_off" => true,
- "data-miq_observe_checkbox" => {:url => url}.to_json)
- = _('User will input the value')
+ %br
+ - if @edit[@expkey][:exp_typ]
+ = render :partial => "layouts/exp_atom/edit_#{@edit[@expkey][:exp_typ]}", :locals => {:exp_model => exp_model}
+ - if qs_show_user_input_checkbox?
+ = check_box_tag("user_input", "1", @edit[@expkey][:exp_value] == :user_input,
+ :style => "width: 20px",
+ "data-miq_sparkle_on" => true,
+ "data-miq_sparkle_off" => true,
+ "data-miq_observe_checkbox" => {:url => url}.to_json)
+ = _('User will input the value')
%script{:type => "text/javascript"}
-# Set the expression value prefill images and hover text
miqExpressionPrefill(ManageIQ.expEditor, true); |
@hstastna Please resolve conflict and make Euwe-specific PR (referencing this one) or suggest other PRs to backport. |
Backported to Euwe via ManageIQ/manageiq#13621 |
depends on ManageIQ#98 Refactoring code of x_get_tree_custom_kids method as the same code needs to be in the method in tree_builder_vms_filter.rb and in tree_builder_storage.rb; moving the code to new methods in miq_search.rb.
depends on ManageIQ#98 Refactoring code of x_get_tree_custom_kids method as the same code needs to be in the method in tree_builder_vms_filter.rb and in tree_builder_storage.rb; moving the code to new methods in miq_search.rb.
depends on ManageIQ#98 Refactoring code of x_get_tree_custom_kids method as the same code needs to be in the method in tree_builder_vms_filter.rb and in tree_builder_storage.rb; moving the code to new methods in miq_search.rb.
fixing
https://bugzilla.redhat.com/show_bug.cgi?id=1398748
https://bugzilla.redhat.com/show_bug.cgi?id=1382768
Make created filters (not global) in Compute -> Infrastructure -> Datastores
visible under My Filters in accordion, no need to refresh the page
after creating a new filter.
Fix commiting a new filter which is related to its creating and saving.
Commiting filters was broken by
ManageIQ/manageiq#12998
Before:
After: