Automatically selecting "Image Based" and Image

(This was originally posted on the foreman-users group but I have been told
that this is probably a better place to get opinions. Sorry for the
duplication.)

I've been trying to change the behavior of the New Hosts page so that the
'image based' provisioning method is selected and the first available image
in the selector is also selected.
It looks like this is filled in by a series of javascript events: First on
the 'Host Group' selector, then on the 'Compute profile' selector then by
clicking on the 'Image Based' radio button and, finally, selecting the
Image.

What I would like is for the Compute profile to be automatically set to the
first entry, the Image Based button to be selected and the first entry in
the Image selector to be selected when the Host Group is selected or, as a
fall back, when the Host Group and Compute profile is selected.

I figure the selectors can be set by setting ':include_blank => false' in
the select_f but I then need to automatically call the ':onchange' to make
the chain of events happen in the right order. The Compute profile selector
would need to call the 'computeResourceSelected()' function and the radio
button would call the 'update_capabilities()' javascript function.

Any thoughts on this approach? Any hints on implementing it?

Thanks
-david-

Hi David,

This makes sense generally but you should be wary of a couple of things.
First off, "New host" defaults to creating a host not in a compute
resource, so image based provisioning cannot be selected by default.
Secondly, I'd go for not selecting any image by default, especially since
it might not match the rest of the parameters (memory, disk size, etc…).
Compute Profiles do have a "Image" field that can be set to specify a
default image that could be used

If you keep the current default for New Host (not using a compute
resource), as soon as you choose a Compute Resource, it'll trigger a bunch
of things. Don't use :include_blank false because users might not be using
Compute Profiles, instead, make computeResourceSelected() change the
Compute Profiles selector to the smallest one, and that should trigger the
:onchange.

··· On Fri, Jun 6, 2014 at 3:05 PM, wrote:

(This was originally posted on the foreman-users group but I have been
told that this is probably a better place to get opinions. Sorry for the
duplication.)

I’ve been trying to change the behavior of the New Hosts page so that the
’image based’ provisioning method is selected and the first available image
in the selector is also selected.
It looks like this is filled in by a series of javascript events: First on
the ‘Host Group’ selector, then on the ‘Compute profile’ selector then by
clicking on the ‘Image Based’ radio button and, finally, selecting the
Image.

What I would like is for the Compute profile to be automatically set to
the first entry, the Image Based button to be selected and the first entry
in the Image selector to be selected when the Host Group is selected or, as
a fall back, when the Host Group and Compute profile is selected.

I figure the selectors can be set by setting ‘:include_blank => false’ in
the select_f but I then need to automatically call the ‘:onchange’ to make
the chain of events happen in the right order. The Compute profile selector
would need to call the ‘computeResourceSelected()’ function and the radio
button would call the ‘update_capabilities()’ javascript function.

Any thoughts on this approach? Any hints on implementing it?

Thanks
-david-


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Daniel Lobato

@elobatoss
blog.daniellobato.me
daniellobato.me

GPG: http://keys.gnupg.net/pks/lookup?op=get&search=0x7A92D6DD38D6DE30