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 #11749 - puppet env jquery selector more restrictive #3642

Closed
wants to merge 1 commit into from

Conversation

jlsherrill
Copy link
Contributor

This current jquery selector for puppet environment
selection would match any select box where name
included environment_id. This caused issues with
katello as we put a field containing lifecycle_environment_id
in the form

@jlsherrill
Copy link
Contributor Author

Note an alternative solution is: $('label[for=environment_id]~div select')

but I think the current one is less likely to break and easier to understand.

@jlsherrill
Copy link
Contributor Author

[test]

@@ -388,7 +388,7 @@ $(function() {

function update_puppetclasses(element) {
var host_id = $("form").data('id')
var env_id = $('select[name*=environment_id]').val();
var env_id = $('select[name*=\\[environment_id\\]]').val();
Copy link
Member

Choose a reason for hiding this comment

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

I believe that element in this context should already be the select element.
This variable is only used to short-circuit this function if the environment is empty, I think this can be replaced by
if (element.value == '') return; at the top of the function.
I'm not sure that short-circuiting is the correct action to take in case the environment is removed, but it will fix this issue and get rid of an ugly matcher at the same time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Updated to reflect that, tested and seemed to have no issue.

This current jquery selector for puppet environment
selection would match any select box where name
included environment_id.  This caused issues with
katello as we put a field containing lifecycle_environment_id
in the form
@tbrisker
Copy link
Member

The whole logic of this and related functions should be revisited, however it is out of scope for this PR.
I'm going to merge this to handle the issue faced by katello.

@tbrisker
Copy link
Member

Merged as 4eeea97, thanks @jlsherrill!

@tbrisker tbrisker closed this Jul 14, 2016
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.

3 participants