diff --git a/app/assets/javascripts/miq_application.js b/app/assets/javascripts/miq_application.js index ffa6e53dff8..2f58069654a 100644 --- a/app/assets/javascripts/miq_application.js +++ b/app/assets/javascripts/miq_application.js @@ -1482,13 +1482,7 @@ function miqToolbarOnClick(_e) { } } - var collect_log_buttons = [ - 'server_collect_logs_choice__collect_logs', - 'server_collect_logs_choice__collect_current_logs', - 'zone_collect_logs_choice__zone_collect_logs', - 'zone_collect_logs_choice__zone_collect_current_logs' - ]; - if (jQuery.inArray(button.attr('name'), collect_log_buttons) >= 0 && button.data('prompt')) { + if (button.data('prompt')) { tb_url = miqSupportCasePrompt(tb_url); if (!tb_url) { return false; diff --git a/app/helpers/application_helper/button/basic.rb b/app/helpers/application_helper/button/basic.rb index 2b91608dbb5..701ba54000b 100644 --- a/app/helpers/application_helper/button/basic.rb +++ b/app/helpers/application_helper/button/basic.rb @@ -22,6 +22,12 @@ def localized(key) end end + # Sets the attributes for the button: + # self[:enabled] -- displayed button is enabled + # self[:title] -- button has the title on hover + # self[:prompt] -- the user has to confirm the action + # self[:hidden] -- the button is not displayed in the toolbar + # self[:text] -- text for the button def calculate_properties self[:enabled] = !disabled? if self[:enabled].nil? end @@ -32,10 +38,14 @@ def skipped? skip? end + # Tells whether the button should displayed in the toolbar or not: + # false => button will be displayed + # true => button will be hidden def skip? false end + # Tells whether the displayed button should be disabled or not def disabled? false end @@ -44,6 +54,8 @@ def disabled? class << self attr_reader :record_needed + # Used to avoid rendering buttons dependent on `@record` instance variable + # if the variable is not set def needs_record @record_needed = true end diff --git a/app/helpers/application_helper/button/generic_feature_button.rb b/app/helpers/application_helper/button/generic_feature_button.rb index 63264602fdf..b7a8fc6e7d7 100644 --- a/app/helpers/application_helper/button/generic_feature_button.rb +++ b/app/helpers/application_helper/button/generic_feature_button.rb @@ -9,7 +9,7 @@ def initialize(view_context, view_binding, instance_data, props) def skip? begin return !@record.send("supports_#{@feature}?") - rescue NoMethodError + rescue NoMethodError # TODO: remove with deleting AvailabilityMixin module return !@record.is_available?(@feature) end end