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

feat(machines): update DHCP and discovery forms to use the new API #1116 #4389

Conversation

petermakowski
Copy link
Contributor

@petermakowski petermakowski commented Sep 6, 2022

Done

  • update DHCP add form to use list box
  • Update discovery form to use the new API and machine list box
  • keep previous data to prevent flashes of no data in between data requests
  • add e2e test for dhcp snippets
  • add SelectButton component
  • add OutsideClickHandler component

QA

MAAS deployment

To run this branch you will need access to one of the following MAAS deployments:

Running the branch

You can run this branch by:

QA steps

  • Go to MAAS/r/settings/dhcp
  • Select Type: Machine and pick a machine from the list
  • Go to network discovery
  • Expand the dropdown on the right hand side and select "Add discovery..."
  • Select a machine from the list in the Parent field and
  • Ensure the device.create websocket message has been sent with the correct payload (including the id of a machine which was selected as a parent)
  • You can look at websocket messages using developer tools
    • go to network tab -> filter by WS
    • look for an entry starting with ws?csrftoken=
  • You can verify the parent id is valid by visiting the machine details page with a given id and verifying it's the one that was requested in the form (e.g. /MAAS/r/machine/[replace-this-with-your-selected-parent-id])

Fixes

Fixes: https://github.com/canonical/app-tribe/issues/1116
Fixes: https://github.com/canonical/app-tribe/issues/1112
Fixes: https://github.com/canonical/app-tribe/issues/1340

Launchpad issue

Related Launchpad maas issue in the form lp#number.

Backports

In general, please propose fixes against main rather than release branches (e.g. 2.7), unless the fix is only applicable for that specific release. Please apply backport labels to the PR (e.g. "Backport 2.7") for the appropriate releases to target.

Only bug and security fixes should be backported, new features should only land in main.

Screenshots

Kapture 2022-09-07 at 15 55 02

@webteam-app
Copy link

Demo starting at https://maas-ui-4389.demos.haus

@petermakowski
Copy link
Contributor Author

@rayito Decided not to implement the absolute positioning for the select dropdown - it can be tricky when there's not enough content on the page parts of the dropdown may get cut off. If you feel strongly about it I'd suggest we look into this in a separate ticket.

@rayito
Copy link

rayito commented Sep 7, 2022

Totally fine

@rayito Decided not to implement the absolute positioning for the select dropdown - it can be tricky when there's not enough content on the page parts of the dropdown may get cut off. If you feel strongly about it I'd suggest we look into this in a separate ticket.

Totally fine, closing it by clicking outside was more important than that. UX+1

@petermakowski
Copy link
Contributor Author

Searching by machine id doesn't currently work and will be looked at in a separate ticket https://github.com/canonical/app-tribe/issues/1339

Copy link
Contributor

@huwshimi huwshimi left a comment

Choose a reason for hiding this comment

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

Hey @petermakowski apologies for the "code -1" but I think there are big enough changes needed that this will require another review.

Happy to chat if any of my comments don't make sense.

Copy link
Contributor

@huwshimi huwshimi left a comment

Choose a reason for hiding this comment

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

Thanks for doing those changes @petermakowski. I think changing this to a FormikField is worth doing in this PR (but not the ContextualMenu parts) as a fair bit of this will be made redundant.

@petermakowski petermakowski changed the title feat(machines): update DHCP add form #1116 feat(machines): update DHCP and discovery forms to use the new API #1116 Sep 9, 2022
Comment on lines +67 to +70
<Field label={<span id={labelId}>{label}</span>} {...props}>
<OutsideClickHandler onClick={() => setIsOpen(false)}>
<SelectButton
aria-describedby={labelId}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is in order to get additional description for the button element, rendered result below.
image

@petermakowski
Copy link
Contributor Author

@huwshimi could you take another look at this please?

Copy link
Contributor

@ndv99 ndv99 left a comment

Choose a reason for hiding this comment

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

You can probably remove Loading from this enum since it isn't used in the file any more
https://github.com/canonical/maas-ui/pull/4389/files#diff-3fc2d13129aa52e7573026eac1c141e58e9f922cf86d851e9e56fd4902f85ba5R19-R23

Copy link
Contributor

@ndv99 ndv99 left a comment

Choose a reason for hiding this comment

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

Happy with the code over all but obviously QA can't be done until that error message in the discovery form is dealt with

@petermakowski
Copy link
Contributor Author

petermakowski commented Sep 20, 2022

Happy with the code over all but obviously QA can't be done until that error message in the discovery form is dealt with

As it's due to a bug in MAAS (https://bugs.launchpad.net/maas/+bug/1933408) I think it's fine to QA by verifying the right websocket message is being sent. Updated the QA description.

Copy link
Contributor

@ndv99 ndv99 left a comment

Choose a reason for hiding this comment

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

LGTM!

@petermakowski petermakowski merged commit 409fc0b into canonical:server-side-search-and-filter Sep 20, 2022
@petermakowski petermakowski deleted the dhcp-add-form-#1116 branch May 9, 2024 10:21
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.

5 participants