Skip to content

Storage UI: Delete Partition (in proposal; trash-can icon)#1915

Merged
mvidner merged 11 commits intostorage-config-uifrom
delete-proposed-partition
Jan 23, 2025
Merged

Storage UI: Delete Partition (in proposal; trash-can icon)#1915
mvidner merged 11 commits intostorage-config-uifrom
delete-proposed-partition

Conversation

@mvidner
Copy link
Copy Markdown
Contributor

@mvidner mvidner commented Jan 17, 2025

Problem

Making the trash-can icon work

deleteme_C3_A7

Solution

  • delete the item from the list (via configModel.Config)
  • ask for confirmation
  • check that the partition is not mandatory ... these two are postponed to a followup PBI

Testing

  • Tested manually
  • Added a unit test for the UI part (thanks David!)

Screenshots

No. The deleted partition is not visible 🤣 and a video would be overkill.

@mvidner mvidner changed the title WIP just log onClick the Delete icon Storage UI: Delete Partition (in proposal; trash-can icon) Jan 17, 2025
that is, without asking for confirmation or checking if it is mandatory.

split out PartitionMenuItem, because eslint said:
607:40  error  React Hook "usePartition" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function  react-hooks/rules-of-hooks
apparently a copy-paste bug in the prototype

BTW shouldn't we use _(translations) more?
@mvidner mvidner force-pushed the delete-proposed-partition branch from bfc96fb to f2f32f3 Compare January 17, 2025 15:10
@mvidner mvidner marked this pull request as ready for review January 17, 2025 15:11
dgdavid

This comment was marked as outdated.

@mvidner

This comment was marked as outdated.

@mvidner
Copy link
Copy Markdown
Contributor Author

mvidner commented Jan 22, 2025

I haven't reviewed all the code again, but if you don't mind would be nice if you add a unit test for ensuring the interface behaves as we expect.

BTW I noticed that the ci-web.yml job does have a npm test -- --coverage --silent step, but we also used to upload the result to coveralls.io which is now commented out. Perhaps it is time to bring it back?

@dgdavid
Copy link
Copy Markdown
Contributor

dgdavid commented Jan 22, 2025

I haven't reviewed all the code again, but if you don't mind would be nice if you add a unit test for ensuring the interface behaves as we expect.

BTW I noticed that the ci-web.yml job does have a npm test -- --coverage --silent step, but we also used to upload the result to coveralls.io which is now commented out. Perhaps it is time to bring it back?

I think so. In fact, I asked for it back in September 12th at internal #team-yast Slack channel 😉 (see https://suse.slack.com/archives/C06JYR4ARRC/p1726172205760599)

@dgdavid
Copy link
Copy Markdown
Contributor

dgdavid commented Jan 23, 2025

@mvidner I have updated the code and the test. Find some random comments below.

About your doubts written as comments in the test, you were right. There are a lot of missing pieces in the interface concerning a11y. That’s somewhat intentional for the first round of this new proposal. It’s not the ideal way to work, since a11y should be another success criterion for a good MVP, but…

Fortunately, RTL helps a lot in spotting an interface with markup issues due to its user interaction-based testing approach. Please, have a look at the changes I made and let’s discuss them in a meeting if needed. I’ve only done a few basic things to ensure we can at least test it easily, but there’s more work ahead (as follow-up tasks, I mean).

As an aside note, think of these aria-labels as the missing labels for these selectors. We’ve used sentences to provide context for sighted people, but we need to think of a good way to provide similar information with the same interaction fluency for screen readers.

Another thing, not related to your PR, is the number of components inside the DriveEditor file. They should be exported in order to test them in isolation, for unit testing. Also, we need to review the entire file to reduce component nesting as much as possible, which might result in splitting it into a couple of files to group the pieces that are part of the DriveEditor thingy.

Finally, it would be great if you could rebase the storage-config-ui branch before proceeding with the merge, as quite some things have changed. Don’t forget to run npm install after doing so.

@dgdavid dgdavid force-pushed the delete-proposed-partition branch from 9c94e8b to 5f012bb Compare January 23, 2025 02:06
mvidner and others added 3 commits January 23, 2025 10:42
and use `deletePartition` as variable name
not to collide with the `delete` operator
having to set up mocks for the whole DriveEditor is not what I expected
:-/
Markup for adding roles and labels to make the interface a bit more
accessible and easing unit testing with React Testing Library.

Still needing love, thougth. But this is a kind of starting point /
guidance commit.
@mvidner mvidner force-pushed the delete-proposed-partition branch from 5f012bb to f292d2c Compare January 23, 2025 09:55
@coveralls
Copy link
Copy Markdown

coveralls commented Jan 23, 2025

Pull Request Test Coverage Report for Build 12929888022

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 72.423%

Totals Coverage Status
Change from base Build 12887288857: 0.0%
Covered Lines: 19011
Relevant Lines: 26250

💛 - Coveralls

};

// driveName, like "/dev/sda"
// mountPath, like "/" or "swap"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It makes sense to follow here the same syntax (jsdoc?) we are using all along the rest of the code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So this could be the first properly documented function in this file.

mountPath: "swap",
size: {
min: 2_000_000_000,
default: false, // WTF does default mean??
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If the size was omitted and, as a result, that min of 2_000_000_000 was calculated by Agama itself, then "default" is true.

On the other hand, if that value of 2_000_000_000 was provided by the user, "default" is false.

Copy link
Copy Markdown
Contributor

@ancorgs ancorgs left a comment

Choose a reason for hiding this comment

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

Generally looks good. I added a comment about documentation and a clarification about a question raised in a comment.

Other than that, I only miss the changelog entry.

even better it belongs to storage.model.schema.json
mountPath: "swap",
size: {
min: 2_000_000_000,
default: false, // false: user provided, true: calculated
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ancorgs thanks for the explanation...
now I know that the comment should actually go to storage.model.schema.json, but I haven't found a Makefile-like declaration to update the generated config-model.ts so I am postponing this yak shave

Copy link
Copy Markdown
Contributor

@ancorgs ancorgs left a comment

Choose a reason for hiding this comment

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

LGTM

@mvidner mvidner merged commit 8d0d533 into storage-config-ui Jan 23, 2025
@mvidner mvidner deleted the delete-proposed-partition branch January 23, 2025 21:00
mvidner added a commit that referenced this pull request Jan 30, 2025
…his device) (#1934)

## Problem

https://trello.com/c/JQ3blpRm


![remove](https://github.com/user-attachments/assets/0b714e90-dacf-46f9-8ee4-e6e863a176ae)


## Solution

The implementation was easier because the UI model already had a
`removeDrive` method...
but testing was fun again, because imitating the tests that worked for
deleting a partition was not enough this time 😅


## Testing

- Added a new unit test
- Tested manually


## Screenshots

In action (used [Peek](https://github.com/phw/peek) for recording,
thanks Ancor for the tip)
1. Try to delete `nvme01` but not possible because it contains `/`
2. Delete `/` from it (#1915)... (and we have an issue box, that's new
but not from me 😄 )
3. Now can delete `nvme01`

![agama-delete-proposed-partition-and-drive](https://github.com/user-attachments/assets/81ae11b2-6fd3-4921-8d6e-d423af94cb1a)
@imobachgs imobachgs mentioned this pull request Feb 26, 2025
imobachgs added a commit that referenced this pull request Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants