Closed ghost closed 1 year ago
@kavyanekkalapu, would you maybe know why the button mentioned above does not consider SuportFeature
-s and still lets the user click on both Recommission
and Decommission
fields?
app/models/manageiq/providers/cisco_intersight/physical_infra_manager/physical_server.rb
@jeffibm can you help @tjazsch with getting the buttons mentioned above to use supports feature? Thanks!
And @tjazsch you'll want to add supports_not :decommission
to the base class (https://github.com/ManageIQ/manageiq/blob/master/app/models/physical_server.rb) so that we can ask supports?(:decommission)
of any type of physical_server
@tjazsch , For buttons I found something like this -
For example, in manageiq-ui-classic - app/helpers/application_helper/toolbar/service_center.rb
, we have a helper method specified in :Klass
which also decides to enable/disable this button based on its return value.
Its definitions can be found in app/helpers/application_helper/button/service_retire_now.rb
button(
:service_retire_now,
'fa fa-clock-o fa-lg',
t = N_('Retire this Service'),
t,
:confirm => N_("Retire this Service?"),
:klass => ApplicationHelper::Button::ServiceRetireNow
),
@jeffibm I don't think that button class is right for this case
@tjazsch take a look at https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/helpers/application_helper/button/volume_attach.rb as an example of a button using supports?(:feature)
As i understand, to check if decommission / recommission methods are supported, we need to use like below in corresponding classes. I am also not sure if this is related to db/fixtures/miq_product_features.yml
in manageiq(core).
def disabled?
if !@record.supports?(:decommission)
@error_message = _("Error message")
end
@error_message.present?
end
This pull request has been automatically marked as stale because it has not been updated for at least 3 months.
If these changes are still valid, please remove the stale
label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s)
Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation.
This pull request has been automatically closed because it has not been updated for at least 3 months.
Feel free to reopen this pull request if these changes are still valid.
Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation.
This PR is going to add SupportFeatures functionality for
Decommission
andRecommission
buttons when viewing a specific physical server; meaning: If a server doesn't fulfill a criteria for either being decommissioned or recommissioned, the user should not have the ability to press it (it shouldn't be enabled).With the current changes of this PR, the button still looks like this:
as you can see,
Recommission
as well asDecommission
buttons may be pressed, which is not what I want.I've written the "
supports
" sentences for server's recommission and decommission (with the first commit in this PR: https://github.com/ManageIQ/manageiq-providers-cisco_intersight/commit/2bbb626adaefc8aef716bacf0c81111f40c91244) but got stuck at actually using this functionality in the actual button - I want to use this changes in this file; more specifically, in this file, changes should most likely come in the following two places:more precisely, I assume buttons' values
:enabled
and:options
should have been changes, but I don't know how.Any help would be greatly appreciated. Thanks.