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 #31492 - Add basic hosts and inputs page #556

Merged
merged 3 commits into from Aug 25, 2021

Conversation

MariaAga
Copy link
Member

To only include the hosts selection method (without the actual selection), show host chips and show inputs.
Depends on: #554 for the input templates
Screenshot from 2020-12-10 16-16-13
Screenshot from 2020-12-10 16-16-07

@MariaAga MariaAga changed the title Add hosts job wizard Fixes #31492 - Add basic hosts and inputs page Dec 10, 2020
Comment on lines 40 to 46
<Title headingLevel="h2" className="wizard-title">
{__('Category And Template')}
</Title>
<Text component={TextVariants.p}>{__('All fields are required.')}</Text>
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
<Title headingLevel="h2" className="wizard-title">
{__('Category And Template')}
</Title>
<Text component={TextVariants.p}>{__('All fields are required.')}</Text>
<div className="wizard-title">
<Title headingLevel="h2">{__('Category And Template')}</Title>
<Text component={TextVariants.p}>{__('All fields are required.')}</Text>
</div>

@MariaAga
Copy link
Member Author

MariaAga commented Jul 6, 2021

@LaViro This is also ready for a review

@xprazak2
Copy link
Contributor

xprazak2 commented Jul 12, 2021

Looks nice. A couple of thoughts

  1. I might be missing something but there are resource categories in the dropdown select - how do we use it to select the targeted hosts? If user selects for example 'Host group', how do we know which hostgroup(s) the job should target?
    Edit: I just noticed Fixes #32314 - Add target selection in job wizard #578. It seems like it is addressed there.

  2. Should selecting a different category clear the chips?
    chips

  3. I see warnings in the console:
    React does not recognize the 'isRequired' prop on a DOM element
    React does not recognize the 'labelText' prop on a DOM element

  4. If there is a required input, should transitioning to the next step be allowed?
    required-field

@MariaAga
Copy link
Member Author

MariaAga commented Jul 12, 2021

  1. I don't think so? I don't know why a user might change a template in the middle of the form but if they selected the wrong one by mistake it would not be fun to re-select hosts
  2. is fixed in this pr: Refs #31459 - remove snapshot testing in the job wizard #607
  3. will be addressed here: https://projects.theforeman.org/issues/32667

@adamruzicka
Copy link
Contributor

Needs a rebase

@MariaAga MariaAga force-pushed the add-hosts-job-wizard branch 2 times, most recently from 9093181 to 94f3124 Compare July 12, 2021 14:35
@MariaAga
Copy link
Member Author

rebased and changed the tests

Copy link
Member

@Ron-Lavi Ron-Lavi left a comment

Choose a reason for hiding this comment

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

Great work @MariaAga !
PR looks great and since it's small and readable,
I would suggest adding here some actual data

webpack/JobWizard/JobWizard.js Outdated Show resolved Hide resolved
webpack/JobWizard/steps/HostsAndInputs/TemplateInputs.js Outdated Show resolved Hide resolved
webpack/JobWizard/JobWizard.js Outdated Show resolved Hide resolved
webpack/JobWizard/JobWizard.js Show resolved Hide resolved
@MariaAga
Copy link
Member Author

MariaAga commented Jul 13, 2021

The next pr adds data and has 750+ lines so I think its best to keep it split (#578) .
Also this pr uses real user input in the templates.

@adamruzicka
Copy link
Contributor

Could we set minimum width and height on the input fields?

By default it looks good
image

but you can resize it by hand into something like
image

@MariaAga
Copy link
Member Author

added min size to the css, but generally I don't think it's a design issue that the user can do that. In the old form it was possible as well
Screenshot from 2021-07-27 17-57-57

@adamruzicka
Copy link
Contributor

Looks good to me. @LaViro could you do a final review here?

Copy link
Member

@Ron-Lavi Ron-Lavi left a comment

Choose a reason for hiding this comment

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

Thanks @MariaAga ! works nicely,
left a few comments

webpack/JobWizard/JobWizard.js Outdated Show resolved Hide resolved
webpack/JobWizard/JobWizard.js Outdated Show resolved Hide resolved
@@ -72,7 +64,7 @@ describe('AdvancedFields', () => {
.simulate('click');

expect(wrapper.find('.pf-c-wizard__nav-link.pf-m-current').text()).toEqual(
'Target Hosts'
'Target hosts and inputs'
Copy link
Member

Choose a reason for hiding this comment

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

should it be WIZARD_TITLES.hostsAndInputs ?

Copy link
Member Author

Choose a reason for hiding this comment

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

We usually dont use consts in tests. I think this could cause issues if there is an issue with the constant, for example if it's undefined or has a typo.

);
await act(async () => {
await fireEvent.click(
screen.getByText('Target hosts and inputs', { selector: 'button' })
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
screen.getByText('Target hosts and inputs', { selector: 'button' })
screen.getByText(WIZARD_TITLES.hostsAndInputs, { selector: 'button' })

Copy link
Member

@Ron-Lavi Ron-Lavi left a comment

Choose a reason for hiding this comment

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

ACK, thanks @MariaAga !
test error seem unrelated, happens due to minor version update of PF iiuc

Copy link
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

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

Let's get this in

@adamruzicka adamruzicka merged commit f6b84c8 into theforeman:master Aug 25, 2021
@adamruzicka
Copy link
Contributor

Thank you @MariaAga & @LaViro !

adamruzicka pushed a commit that referenced this pull request Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants