Skip to content
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

Merged

Conversation

hstastna
Copy link

@hstastna hstastna commented Jan 9, 2017

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:
datastores2
datastores4

After:
datastores1
datastores3
datastores5

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.
Hilda Stastna added 2 commits January 9, 2017 13:39
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.
@hstastna hstastna changed the title [WIP] Make created filters in Datastores visible and fix commiting filters Make created filters in Datastores visible and fix commiting filters Jan 9, 2017
@miq-bot
Copy link
Member

miq-bot commented Jan 9, 2017

Checked commits hstastna/manageiq-ui-classic@952f11c~...1c2806c with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
3 files checked, 2 offenses detected

app/controllers/application_controller/filter.rb

@hstastna
Copy link
Author

hstastna commented Jan 9, 2017

@miq-bot remove_label wip

@miq-bot miq-bot removed the wip label Jan 9, 2017
hstastna pushed a commit to hstastna/manageiq-ui-classic that referenced this pull request Jan 9, 2017
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.
@h-kataria
Copy link
Contributor

@hstastna is this ready for review/test, or you working on removing Advanced search from Datastore Clusters accordion?

@hstastna
Copy link
Author

hstastna commented Jan 12, 2017

@h-kataria This is ready to merge.
I created other PR for removing Advanced search from Datastore Clusters accordion, which can be merged separately, doesn't depend on anything: #129 You can look at it, too, if you have time :)

hstastna pushed a commit to hstastna/manageiq-ui-classic that referenced this pull request Jan 12, 2017
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.
@mzazrivec mzazrivec self-assigned this Jan 16, 2017
@mzazrivec mzazrivec added this to the Sprint 52 Ending Jan 16, 2017 milestone Jan 16, 2017
@mzazrivec mzazrivec merged commit cbeea57 into ManageIQ:master Jan 16, 2017
hstastna pushed a commit to hstastna/manageiq that referenced this pull request Jan 16, 2017
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.
@simaishi
Copy link
Contributor

Euwe backport conflict:

$ git cherry-pick -x -e -m 1 -Xsubtree=/ cbeea57
error: could not apply cbeea57... Merge pull request #98 from hstastna/Filters_in_datastores_page_refreshed2
$ 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);

@simaishi
Copy link
Contributor

@hstastna Please resolve conflict and make Euwe-specific PR (referencing this one) or suggest other PRs to backport.

@simaishi
Copy link
Contributor

Backported to Euwe via ManageIQ/manageiq#13621

hstastna pushed a commit to hstastna/manageiq-ui-classic that referenced this pull request Feb 14, 2017
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 pushed a commit to hstastna/manageiq-ui-classic that referenced this pull request Feb 21, 2017
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.
TomasKohoutek pushed a commit to TomasKohoutek/manageiq-ui-classic that referenced this pull request Apr 7, 2017
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants