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 inability to delete single profiles + minor UI change - [WD-10834] #769

Merged

Conversation

Kxiru
Copy link
Contributor

@Kxiru Kxiru commented May 14, 2024

Done

  • "Add Profile" button now on a new line whenever there are no profiles in an instance (UI change)
  • Instances with single profiles can now delete the profile as long as an alternative disk device is specified, or the default disk device, overridden.
  • The above applies to when instances are being created and when they are being edited.
  • Changes have only been made to ProfileSelector.tsx.
  • Updated the "Delete" button and it's classname to be "Remove" for better UX.

QA

  1. Run the LXD-UI:
    • On the demo server via the link posted by @webteam-app below. This is only available for PRs created by collaborators of the repo. Ask @mas-who or @edlerd for access.
    • With a local copy of this branch, run as described here.
  2. Perform the following QA steps:
    • To test this fix, navigate to an existing instance -> "Edit Instance" -> View the ability to delete a single instance.
    • Attempting to save an instance with no profile and no alternative disk device specified should result in an error, and an inability to save the changes.
    • One can also create a new instance and view the same feature. Both the instance creation and instance editing pages have the same component.

Screenshots

image

image

@webteam-app
Copy link

@Kxiru Kxiru force-pushed the allow-edit-create-instance-without-profile branch 12 times, most recently from 4a5e12e to a38bd96 Compare May 14, 2024 15:17
@Kxiru Kxiru requested review from edlerd and mas-who May 15, 2024 09:14
@Kxiru Kxiru force-pushed the allow-edit-create-instance-without-profile branch 3 times, most recently from a28aeab to b1a4be8 Compare May 15, 2024 12:50
@mas-who
Copy link
Contributor

mas-who commented May 16, 2024

Thanks for the changes :) Just one small question regarding some scss update.

Just leaving the list of comments addressed based on our in person discussion for future reference:

  • Use css classes instead of inline styling
  • Instead of using <div> to create block elements, use css display: block
  • Instead of having align-items: start on the wrapping div, rather use align-self: start on the button element since its siblings do not need the alignments
  • Some discussions regarding vanilla and how the styling system works

@mas-who
Copy link
Contributor

mas-who commented May 16, 2024

@Kxiru , there were some fixes from @edlerd that just got merged #771 and #772 . This is a good opportunity to rebase main.

@Kxiru Kxiru force-pushed the allow-edit-create-instance-without-profile branch from b1a4be8 to 25293de Compare May 16, 2024 09:34
@mas-who
Copy link
Contributor

mas-who commented May 16, 2024

LGTM 👍

@piperdeck please have a design pass on this

@piperdeck
Copy link

This is looking great!

A couple things:


When a new profile is added, the dropdown defaults to the last profile in the list. This is especially strange behaviour given that the default profile seems to be correctly stickied to the top of the list, so a new profile will never default to the default profile until it's the last profile available. Can we make new attached profiles default to the first in the list rather than the last in the list?

CleanShot.2024-05-16.at.15.29.49.mp4

When the list of profiles overflows the viewport, I need to repeatedly scroll down in order to keep the "Add Profile" button in view. Could we make it so that it scrolls down automatically to keep the bottom of the list visible when you add a new profile?

CleanShot.2024-05-16.at.15.31.32.mp4

@Kxiru
Copy link
Contributor Author

Kxiru commented May 16, 2024

Thanks, @piperdeck for signing off on the existing work.
I can also definitely look into adding the additional amendments that you described.

@mas-who @edlerd , for the amendments, should these become a new PR, a new commit, or simply another amendment to the initial commit?

Please advise and I will get started.

@mas-who
Copy link
Contributor

mas-who commented May 16, 2024

Thanks, @piperdeck for signing off on the existing work. I can also definitely look into adding the additional amendments that you described.

@mas-who @edlerd , for the amendments, should these become a new PR, a new commit, or simply another amendment to the initial commit?

Please advise and I will get started.

These changes are related to this update, so I'd keep it in the same PR.

@Kxiru Kxiru force-pushed the allow-edit-create-instance-without-profile branch 4 times, most recently from 82d8fd5 to 49e2504 Compare May 20, 2024 15:39
@Kxiru
Copy link
Contributor Author

Kxiru commented May 20, 2024

Hi there, @piperdeck , I have implemented your suggestions. Do you mind reviewing the PR so I can grab that sweet Design review +1?
Thanks!

README.md Outdated
@@ -5,15 +5,19 @@ Targets small and large scale private clouds.

# Install

Get the LXD snap
1. Get the LXD snap
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this file changed? I think we should undo the changes here to keep the commit clean.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I might need some assistance here :')

Copy link
Contributor

Choose a reason for hiding this comment

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

Easiest way is probably just copy the same file content on the master branch on github and paste it into your local file.

@@ -38,12 +36,22 @@ const ScrollableContainer: FC<Props> = ({
childContainer.setAttribute("style", style);
};

useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's revert all the changes in ScrollableContainer as the component is used in many other places. I would put this logic in ProfileSelector and the useEffect can track the selected prop.

As a side note, an useEffect hook with no dependencies array is an anti-pattern in React and should be avoided.

@Kxiru Kxiru force-pushed the allow-edit-create-instance-without-profile branch from 49e2504 to 324f28e Compare May 22, 2024 10:08
</div>
))}
{!readOnly && (
<Button
id={"addProfileButton"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
id={"addProfileButton"}
id="addProfileButton"

disabled={unselected.length === 0}
className={"profile-add-btn"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
className={"profile-add-btn"}
className="profile-add-btn"

@@ -53,7 +53,7 @@ const ProfileSelector: FC<Props> = ({
);

const addProfile = () => {
const nextProfile = unselected.pop()?.name;
const nextProfile = unselected[0]?.name;
Copy link
Contributor

Choose a reason for hiding this comment

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

nice, quick and easy solution 🙂

@Kxiru Kxiru force-pushed the allow-edit-create-instance-without-profile branch from 324f28e to 94aa2c6 Compare May 22, 2024 10:11
@Kxiru Kxiru force-pushed the allow-edit-create-instance-without-profile branch 2 times, most recently from eeeb06a to dbdd1a5 Compare May 22, 2024 11:10
- Minor UI and scss changes
- Profile dropdown defaults to the first profile in the list
- Scrollbar 'follows' new additions of profiles.

Signed-off-by: Nkeiruka <[email protected]>
@Kxiru Kxiru force-pushed the allow-edit-create-instance-without-profile branch from dbdd1a5 to 8ce0549 Compare May 22, 2024 11:12
@piperdeck
Copy link

LGTM

@Kxiru Kxiru merged commit 74d0169 into canonical:main May 24, 2024
12 checks passed
github-actions bot pushed a commit that referenced this pull request May 24, 2024
@Kxiru Kxiru deleted the allow-edit-create-instance-without-profile branch May 27, 2024 10:34
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.

None yet

5 participants