Created attachment 1265407 [details] CopyOpenSCAP policy Description of problem: There's a built in OpenSCAP Container Image Compliance Policy. It cannot be copied in GUI Version-Release number of selected component (if applicable): 5.7.0.8 How reproducible: Always Steps to Reproduce: 1. Go to Control --> Explorer 2. Go to Policies --> Container Image Compliance Policies 3. Select the OpenSCAP policy and press Configuration Actual results: The OpenSCAP policy options are all greyed out, hence denying ability to copy the policy which should be available for the user Expected results: At least the copying option should bee available for the user. Not sure about the other options in Configuration menu Additional info: Screenshot attached
This is not part of the Service UI, this is the Ops UI. Sending to them.
I see that all of the policy toolbar buttons in the system including the Copy button are defined as ReadOnly buttons, meaning that they are disabled for a read-only policy. Do we want to change that?
Mooli any specific reason for not being able to copy the OOTB OpenSCAP policy?
This is due to a change[1] that made all policy buttons readonly (while copy should not be readonly). Robin can you please take a look? I'm not sure what the fix would be due to inheritance, maybe we should replace that with mixins? PS I think there is another potential problem: you can delete policies if they do not belong to a profile but that can allow deleting a readonly policy (should be cannot delete if belong to policy OR is read only))[2] [1] https://github.com/manageiq/manageiq-ui-classic/commit/cf71d7d43bf9a2589f20bc07f6ee31516947c350#diff-abbe3a37fb8d3ef2e0ec7869dda7eff5R1 The policy button was first introduced in https://github.com/manageiq/manageiq-ui-classic/commit/f1c580b79283bb677cd61ca5537b9a52f6d18a6c#diff-f27ddda7803ce55e5da6a7711c51d419L15 [2] https://github.com/manageiq/manageiq-ui-classic/commit/f1c580b79283bb677cd61ca5537b9a52f6d18a6c#diff-d60ef6310f95c62767cef5969da88b86R4
Hey, because of other refactoring these classes look now little bit different, but i think that both of your points are still valid. When i look at it, this class hierarchy for policy buttons could be little bit confusing and I am open to changes. 1. This could be fixed by adding this into class ApplicationHelper::Button::PolicyButton: def disabled? false end It's not pretty but it should work. 2. This also could be an issue and could be fixed by changing disabled method in ApplicationHelper::Button::PolicyDelete def disabled? @error_message = super @error_message ||= _('Policies that belong to Profiles can not be deleted') unless @policy.memberof.empty? @error_message.present? end This is how changes could look if you don't want to change class hierarchy, but if you want to change it, please do it. I hope, hat i answered your questions, but if you have more questions fell free to ask.
https://github.com/ManageIQ/manageiq-ui-classic/pull/1048
New commit detected on ManageIQ/manageiq-ui-classic/master: https://github.com/ManageIQ/manageiq-ui-classic/commit/5713886f19409111a6302ab6989e7560a22adc48 commit 5713886f19409111a6302ab6989e7560a22adc48 Author: PanSpagetka <rknaur> AuthorDate: Tue Apr 18 11:20:13 2017 +0200 Commit: PanSpagetka <rknaur> CommitDate: Fri Apr 21 13:28:36 2017 +0200 Fix policy delete/copy buttons https://bugzilla.redhat.com/show_bug.cgi?id=1434865 app/helpers/application_helper/button/policy_copy.rb | 3 ++- app/helpers/application_helper/button/policy_delete.rb | 3 ++- app/helpers/application_helper/toolbar/miq_policy_center.rb | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-)
Robin thanks for the fix. Should this be on POST?
Verified