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: Add additional power field types for IP address, LXD, and Virsh #5447

Merged
merged 5 commits into from
Sep 3, 2024

Conversation

ndv99
Copy link
Contributor

@ndv99 ndv99 commented May 29, 2024

Done

  • Added LXD, Virsh, and IP address to power field types (in line with new backend types)
  • Added simple IP address validaiton (check if field value is a valid IP address)

QA steps

  • Go to a machine with IPMI power type (details page, "Configuration")
  • Click "Edit" under "Power configuration"
  • Ensure the IP address field is displayed correctly
  • Type an invalid IP address into that field and press tab
  • Ensure an error is displayed
  • Go to machine list and click "Add machine"
  • For power type, select [IPMI/LXD/Virsh]
  • Ensure that the IP address field is displayed correctly
  • Ensure that invalid IP addresses cause an error to be shown in this field

Screenshots

Before

image
image

After

image
image

Notes

The MP for the backend implementation of this is here

@ndv99 ndv99 added Review: Code needed Review: Core needed QA is required from the MAAS core team labels May 29, 2024
@webteam-app
Copy link

@ndv99
Copy link
Contributor Author

ndv99 commented May 29, 2024

Hm, I'm getting some real strange behavior in tests surrounding a couple of selectors

src/app/subnets/views/VLANDetails/VLANDetails.tsx:39:19

const subnets = useSelector((state: RootState) =>
    subnetSelectors.getByIds(state, vlan?.subnet_ids || [])
  );

src/app/machines/views/MachineDetails/MachineConfiguration/TagForm/TagForm.tsx:28:18

 const errors = useSelector((state: RootState) =>
    machineSelectors.eventErrorsForIds(state, systemId, [
      NodeActions.TAG,
      NodeActions.UNTAG,
    ])
  )[0]?.error;

Not quite sure what's causing these (or especially how it's related to this PR's changes), @petermakowski could you take a look if you have a minute?

@petermakowski
Copy link
Contributor

Not quite sure what's causing these (or especially how it's related to this PR's changes), @petermakowski could you take a look if you have a minute?

#5448

Copy link
Contributor

@petermakowski petermakowski left a comment

Choose a reason for hiding this comment

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

Have you checked the bundle size impact of adding a new dependency?

src/app/store/general/utils/powerTypes.ts Outdated Show resolved Hide resolved
@ndv99
Copy link
Contributor Author

ndv99 commented May 29, 2024

Have you checked the bundle size impact of adding a new dependency?

Good point - I'll run a before/after check. Although likelihood is we'll need this anyway for upcoming reserved IP work

@ndv99
Copy link
Contributor Author

ndv99 commented May 29, 2024

Have you checked the bundle size impact of adding a new dependency?

Good point - I'll run a before/after check. Although likelihood is we'll need this anyway for upcoming reserved IP work

image

Adding is-ip increases the (compressed) bundle size by 4066KiB

@ndv99 ndv99 force-pushed the feat-power-field-ip-validation branch from 86aea4e to c59e8b8 Compare May 29, 2024 14:35
@ndv99 ndv99 marked this pull request as ready for review August 30, 2024 07:21
@amylily1011
Copy link
Contributor

Screenshot 2024-08-30 at 22 04 55

It looks like the IP address field didn't show up for me.

It looks like I'm in the correct branch

From https://github.com/canonical/maas-ui
 * [new ref]             refs/pull/5447/head -> feat-power-field-ip-validation
Switched to branch 'feat-power-field-ip-validation'

@ndv99
Copy link
Contributor Author

ndv99 commented Sep 2, 2024

Screenshot 2024-08-30 at 22 04 55

It looks like the IP address field didn't show up for me.

It looks like I'm in the correct branch

From https://github.com/canonical/maas-ui
 * [new ref]             refs/pull/5447/head -> feat-power-field-ip-validation
Switched to branch 'feat-power-field-ip-validation'

Ahh - this is intended behaviour, my QA steps are wrong :) updated this to reflect expected functionality

Copy link
Collaborator

@tmerten tmerten left a comment

Choose a reason for hiding this comment

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

lgtm, QA done.

@@ -50,6 +51,23 @@ export const formatPowerParameters = (
return params;
}, {}) || {};

const getPowerFieldSchema = (fieldType: PowerFieldType) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

@tmerten tmerten added Review: Code +1 Review: QA +1 and removed Review: Code needed Review: Core needed QA is required from the MAAS core team labels Sep 3, 2024
@ndv99 ndv99 merged commit e2429a3 into canonical:main Sep 3, 2024
12 of 13 checks passed
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