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

Fixes #11458 - Override inline for class parameters #2858

Closed
wants to merge 1 commit into from

Conversation

tbrisker
Copy link
Member

This implements override inline for smart class parameters and smart
variables in host and hostgroup edit forms.
Global variable override inline will be done in a seperate PR.

Authors:
Ori Rabin orrabin@redhat.com
Tomer Brisker tbrisker@redhat.com

diagnostic_helper = popover('', _("Optional parameter without value.<br/><i>Won\'t be given to Puppet.</i> <br><br><b>Description:</b> %s") % key.description, :icon => "warning-sign")
end
else
diagnostic_helper = popover('', _("<b>Description:</b> %{desc}<br><b>Type:</b> %{type}<br> <b>Matcher:</b> %{matcher}") % { :desc => key.description, :type => key.key_type, :matcher => matcher}, :data => { :placement => 'top' })
diagnostic_helper = popover('', _("<b>Description:</b> %{desc}<br/><b>Type:</b> %{type}<br/> <b>Matcher:</b> %{matcher} <br/><b>Value:</b> %{original_value}") % { :desc => key.description, :type => key.key_type, :matcher => matcher, :original_value => original_value }, :data => { :placement => 'top' }, :title => _("Original value info"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth calling this the inherited or original value, rather than value?

Copy link
Member Author

Choose a reason for hiding this comment

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

Note that the popover title states this is all info related to the original value, do you think this needs more clarificaion?

@domcleal
Copy link
Contributor

domcleal commented Nov 2, 2015

  1. When editing a host, global parameters inherited from a host group etc. no longer are readonly - they have editable text boxes.

  2. Moving the use_puppet_default help text to the top instead of next to every checkbox is good, but consider adding a tooltip to the checkbox just so you know what it is. It doesn't need the full explanation, just the title.

  3. The value fields are a lot more narrow than the previous overridden value fields, and slightly narrower than the inherited value fields used to be. I think this will be OK because of the full screen button, but can you see if we can reclaim any more horizontal space?

Perhaps from the Use Puppet default column or even going back to icons instead of override/remove buttons?

  1. It would be good to highlight overridden fields more, as this was a benefit for some users of the old layout. The background colour of the text field and presence of the checkbox are the main visual clues right now, but I'd suggest also changing the border colour of the value text boxes (perhaps to blue?) or making the parameter name bold.

Else probably something for a future PR, some links/buttons at the top to filter/only view overridden parameters.

  1. Can the remove/override buttons be the same width?

  2. I don't think the PR makes it any worse than it currently is, but FYI I'm bumping into this nasty issue when overriding YAML lookup keys inherited from host groups: http://projects.theforeman.org/issues/12284

Looks really good, I'm impressed!

@tbrisker
Copy link
Member Author

tbrisker commented Nov 3, 2015

@domcleal I have updated to original commit to address your first comment, and added the corrections for the rest of the comments to a separate commit which can be squashed later if accepted, just to allow simple reversion if we decide to leave it as is and address those issues in the future.

@dLobatog
Copy link
Member

dLobatog commented Nov 5, 2015

@tbrisker I've taken a look - not properly reviewed it at all, but from the UI/UX point of view.

  • Every time I select an environment, a new header Puppet class parameters is added. See it in action

demo gif parameters duplicate environment

  • The yellow background color for overrides is doesn't fit very well I would say. Also for parameters without value, it shows the warning in yellow by default (when it's not overridden), and the border in red?

yellow override.

What @domcleal suggested seems to look better, I would also suggest to display a small popover 'Overridden' when you hover the mouse on that table row:

screenshot from 2015-11-05 13-39-50

  • The override button looks very out of place, and it shows up on the Name cell. Why not adding it to the value textarea? Or even the actions column is better than this one I'd say.

    override button

  • Long Puppet class names are truncated but it'd be nice to see the whole name on mouse hover.

  • 'Use puppet default' doesn't work at all? It doesn't show checkboxes.

Let me know what you think 👌

@tbrisker
Copy link
Member Author

tbrisker commented Nov 5, 2015

@dLobatog I addressed most of your comments.
For the values that have an empty default - if they are not required they show a yellow warning and the border is yellow, if they are required the border is red. I have changed it now so that clicking on override will remove the border.
Long class names should show whole name on hover, however the tooltip is attached to the <td> so it might appear higher if the class has multiple parameters.
'Use puppet default' checkbox is only displayed for smart class parameters, not smart variables as they have no puppet default.

@dLobatog
Copy link
Member

dLobatog commented Nov 6, 2015

@tbrisker Thanks! A few more:

  • I don't see any tooltips on hover
  • Top left and bottom left border-radius of the override button should be 0px to blend in with the full screen button.
  • Is this the way required empty values are supposed to look? It looks a bit strange in my opinion, the warning sign is enough in my opinion. I can't see any guidelines for highlighting elements in a table on Patternfly @kybaker any hints?

This doesn't have a lot to do with the PR, but what do you think about softening the borders of the input-group-addon and the textarea? I might do it on a PR after this unless you want to include it here, it's fairly easy.

screenshot from 2015-11-06 19-20-21

@dLobatog
Copy link
Member

I tried to fix a bit issues with key_with_diagnostic and _class_parameters on tbrisker#2 , I'll comment in line there

value_for_key = value.try(:[], lookup_key.key)
if value_for_key.present?
[value_for_key[:value],
"#{value_for_key[:element]} (#{value_for_key[:element_name]})"]
Copy link
Member

Choose a reason for hiding this comment

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

Indentation's off 1 space here, rubocop's unhappy

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@dLobatog
Copy link
Member

@tbrisker @orrabin Aside from the class checking on value_matcher I see this buggy behavior:

  • It clears the original value if I decide to override it and then I change my mind

Sorry for holding this one up, but I think it's important we keep this part of the code as clear as possible since 'it needs refactoring' but it may take a long time before someone actually goes ahead and does it. Right now aside from the 2 issues above I say 👍 to the rest of the PR, thanks !

This implements override inline for smart class parameters and smart
variables in host and hostgroup edit forms.
Global variable override inline will be done in a seperate PR.

Authors:
	Ori Rabin <orrabin@redhat.com>
	Tomer Brisker <tbrisker@redhat.com>
@tbrisker
Copy link
Member Author

@dLobatog I addressed all your comments and fixed the js bug that cleared the field.

@dLobatog
Copy link
Member

Merged as 1e1339f, thanks @tbrisker & @orrabin , nice work!

@dLobatog dLobatog closed this Nov 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants