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 #24599 - Not custom instance type should disable params #5945

Merged
merged 1 commit into from Sep 3, 2018

Conversation

shiramax
Copy link
Contributor

No description provided.

@theforeman-bot
Copy link
Member

Issues: #24599

$('[id$=_cores]').attr('disabled', 'disabled');
$('[id$=_sockets]').attr('disabled', 'disabled');
$('[id$=_ha]').attr('disabled', 'disabled');
}

Choose a reason for hiding this comment

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

Closing curly brace does not appear on the same line as the subsequent block brace-style

@lizagilman
Copy link
Member

tnx @shiramax ,
could you provide a screenshot of before & after?

@shiramax
Copy link
Contributor Author

Thanks @lizagilman
Before :
image

After:
image

@shiramax
Copy link
Contributor Author

also the instance type text was changed:
before:
image
after:
image

@lizagilman
Copy link
Member

lizagilman commented Aug 16, 2018

I find the current default values for Template and Instance type fields a bit confusing.
Currently the options are:

For Template field -

"Select template" (current default)
Blank
and a list of available templates

image

For Instance Type field-
"Select instance type" (current default)
and a list of available instances

image

Basically "Select Template" and "Blank" has the same behavior - no auto updating of any other fields.
So if a user proceeds on with filling out the form, why are they told to "Select Template" ?

image

I can think of three other options for default values.

For Template -

  1. "No template selected"
  2. "Blank"
  3. just display an empty select field

For Instance type -

  1. "Costume instance type" (as suggested in this pr)
  2. "No instance type selected"
  3. just display an empty select field

also should the field names and the option names, or some of them, be titlized?

@Rohoover / @terezanovotna could you advise here?

@terezanovotna
Copy link

Hi @lizagilman,

I am looking on the PF Multiple Select component, how about using "Nothing Selected" for both template and instance type?

@lizagilman
Copy link
Member

Hi @terezanovotna tnx for the reply

Sounds good for the Template field
Not sure about the Instance Type field, because when nothing is selected, then it's a costume instance.

@shiramax
Copy link
Contributor Author

@lizagilman, @terezanovotna
The template and instance type should reflect the template and instance type in ovirt.
"Nothing selected" is not the correct behavior in Ovirt for the template and for instance type.
If nothing is selected by the user, the default template selected is "blank" template
the same for instance type, if the user doesn't select an instance type, then the default one is "custom":
image

@terezanovotna
Copy link

Thanks for the explanation @shiramax that is helpful!

If it is default and already has a name, could we name it:

Default - Blank
Default - Custom

Would that make sense? The user knows it is default and if he/she wants select something different, he/she can.

@shiramax
Copy link
Contributor Author

@lizagilman @terezanovotna , I'm not loving the prefix "Default-"
Why shouldn't we write it the same it's in ovirt?

@terezanovotna
Copy link

@shiramax Do you think it is clear for the user that Blank and Custom are default? If so, it's fine to use it. I want to avoid the situation when the user starts wondering what Blank and Custom actually mean

@Rohoover
Copy link

I agree with @shiramax

We should mimic ovirt. Are these optional fields or required?

Another option would be to make the fields required, keep "Select XX" but force a selection. "Select XX" should not be a clickable option.

$('[id$=_memory]').attr('disabled', 'disabled');
$('[id$=_cores]').attr('disabled', 'disabled');
$('[id$=_sockets]').attr('disabled', 'disabled');
$('[id$=_ha]').attr('disabled', 'disabled');
Copy link
Member

Choose a reason for hiding this comment

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

If you would like, you can do something like [ $('[id$=_memory]'), $('[id$=_cores]'), $('[id$=_sockets]'), $('[id$=_ha]') ].forEach( ()=> $(this).attr('disabled', 'disabled') })

@lizagilman
Copy link
Member

[test foreman]

$('[id$=_cores]').removeAttr('disabled');
$('[id$=_sockets]').removeAttr('disabled');
$('[id$=_ha]').removeAttr('disabled');
}
Copy link
Member

Choose a reason for hiding this comment

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

Please use .prop('disabled', <true or false>) instead of attr and removeAttr. Building on @lizagilman's suggestion, you can do it all in one:

[ _'memory', '_cores', '_sockets', '_ha'].forEach((name)=> 
  $(`[id$=${name}]`).prop('disabled', (result.name != null)))

$('[id$=_sockets]').val(result.sockets);
$('[id$=_ha]').prop('checked', result.ha);
}
[ '_memory', '_cores', '_sockets', '_ha'].forEach((name)=> $(`[id$=${name}]`).prop('readOnly', (result.name != null)))

Choose a reason for hiding this comment

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

There should be no space after '[' array-bracket-spacing
Unexpected parentheses around single function argument having a body with no curly braces arrow-parens
Missing space before => arrow-spacing
Missing semicolon semi

$('[id$=_memory]').val(result.memory).trigger('change');
$('[id$=_cores]').val(result.cores);
$('[id$=_sockets]').val(result.sockets);
$('[id$=_ha]').prop('checked', result.ha);

Choose a reason for hiding this comment

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

Expected indentation of 10 spaces but found 12 indent

if (result.name != null) {
$('[id$=_memory]').val(result.memory).trigger('change');
$('[id$=_cores]').val(result.cores);
$('[id$=_sockets]').val(result.sockets);

Choose a reason for hiding this comment

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

Expected indentation of 10 spaces but found 12 indent

$('[id$=_ha]').prop('checked', result.ha);
if (result.name != null) {
$('[id$=_memory]').val(result.memory).trigger('change');
$('[id$=_cores]').val(result.cores);

Choose a reason for hiding this comment

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

Expected indentation of 10 spaces but found 12 indent

$('[id$=_sockets]').val(result.sockets);
$('[id$=_ha]').prop('checked', result.ha);
if (result.name != null) {
$('[id$=_memory]').val(result.memory).trigger('change');

Choose a reason for hiding this comment

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

Expected indentation of 10 spaces but found 12 indent

const instanceTypeSelector = $('#host_compute_attributes_instance_type');

Choose a reason for hiding this comment

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

Trailing spaces not allowed no-trailing-spaces

@shiramax shiramax force-pushed the 24599 branch 2 times, most recently from 8f3b324 to 449e2cd Compare August 28, 2018 12:15
@shiramax
Copy link
Contributor Author

shiramax commented Sep 3, 2018

@lizagilman, @tbrisker please review again :)

@lizagilman
Copy link
Member

LGTM 👍

Copy link
Member

@tbrisker tbrisker left a comment

Choose a reason for hiding this comment

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

Thanks @shiramax and @lizagilman !

@tbrisker tbrisker merged commit 735c73a into theforeman:develop Sep 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants