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

[GAPRINDASHVILI] - Custom button thru relationships #4893

Merged

Conversation

h-kataria
Copy link
Contributor

@himdel please review this is resolve conflict with a backport of #4775 , tested in Gaprindashvili.

The code displays the custom buttons if the previous screen was a
provider screen ('@record') and displayed item ('@ display') is from the list
of classes supported by custom buttons ('APPLIES_TO_CLASS_BASE_MODELS')

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1635738

(cherry picked from commit 828a7de)
(cherry picked from commit f2dae08)
'@record' is set while rendering the page, but after button click, the
instance is not present anymore

(cherry picked from commit fb95c03)
'params[:id]' is providers id

(cherry picked from commit c100b2a)
(cherry picked from commit e6a4069)
having an id in `record_id` was causing to not send miq_grid_checks along in params when custom button was pressed from a list thru relationships

(cherry picked from commit d8c3cb2)
@h-kataria h-kataria force-pushed the custom_button_thru_relationships branch from 7c94f3b to 3dc4077 Compare November 7, 2018 22:24
@h-kataria
Copy link
Contributor Author

h-kataria commented Nov 7, 2018

@himdel removed

if record_id == 'LIST' ||
       (@display.present? &&
        custom_button_appliable_class?(@display.camelize.singularize))
      button[:send_checked] = true
    end

since we don't need to set send_checked in button hash for Gaprindashvili, so needed to set value of record_id to LIST in above lines using part of the check that i removed. Setting/using of send_checked key in button hash is only being used on master/hammer codebase
https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/assets/javascripts/miq_application.js#L1418

@@ -255,7 +256,9 @@ def cb_enabled_value_for_nested
def create_custom_button(input, model, record)
button_id = input[:id]
button_name = input[:name].to_s
record_id = if cb_send_checked_list
record_id = if cb_send_checked_list ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you replace this change with what's been done in #4887 please?

(It should be equivalent, but no point in not doing the same thing as on master.)

@h-kataria
Copy link
Contributor Author

h-kataria commented Nov 12, 2018

@himdel applied changes from suggested PR #4887 to make code consistent, please re-review

@@ -273,7 +270,8 @@ def create_custom_button(input, model, record)
:url_parms => "?id=#{record_id}&button_id=#{button_id}&cls=#{model}&pressed=custom_button&desc=#{button_name}"
}
button[:text] = button_name if input[:text_display]
button[:onwhen] = '1+' if cb_enabled_for_nested
button[:onwhen] = '1+' if cb_send_checked_list
button[:send_checked] = true if record_id == 'LIST'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line does nothing in gaprindashvili. (The equivalent functionality happens when record_id == "LIST", based on the value of url_parms.)

(No harm though.)

Copy link
Contributor

@himdel himdel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to drop the send_checked line to prevent confusion,
but I'm good with this either way 👍

@simaishi
Copy link
Contributor

@h-kataria let me know if you want to drop the line or if I should merge this as is..

Response to ManageIQ#4775 (comment)

corrects the login in master, and should make it possible to backport to gaprindashvili

(cherry picked from commit a54bcc0)
@h-kataria h-kataria force-pushed the custom_button_thru_relationships branch from d8dcc5a to 0780f6d Compare November 14, 2018 15:12
@h-kataria
Copy link
Contributor Author

@himdel @simaishi dropped that line, ready to merge once tests are green

@miq-bot
Copy link
Member

miq-bot commented Nov 14, 2018

Checked commits h-kataria/manageiq-ui-classic@2d06c24~...0780f6d with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
11 files checked, 3 offenses detected

spec/controllers/ems_infra_controller_spec.rb

  • 💣 💥 🔥 🚒 - Line 304, Col 23 - Lint/Syntax - unexpected token error
    (Using Ruby 2.2 parser; configure using TargetRubyVersion parameter, under AllCops)
  • 💣 💥 🔥 🚒 - Line 306, Col 14 - Lint/Syntax - unexpected token error
    (Using Ruby 2.2 parser; configure using TargetRubyVersion parameter, under AllCops)
  • 💣 💥 🔥 🚒 - Line 787, Col 1 - Lint/Syntax - unexpected token kEND
    (Using Ruby 2.2 parser; configure using TargetRubyVersion parameter, under AllCops)

@simaishi simaishi merged commit 63ba731 into ManageIQ:gaprindashvili Nov 14, 2018
@simaishi simaishi added this to the Sprint 99 Ending Nov 19, 2018 milestone Nov 14, 2018
@h-kataria h-kataria deleted the custom_button_thru_relationships branch April 9, 2019 22:05
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