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

Add tag sort, filter, search and pagination #3660

Merged
merged 3 commits into from
Mar 8, 2022

Conversation

huwshimi
Copy link
Contributor

@huwshimi huwshimi commented Mar 4, 2022

Done

  • Add a segmented button component.
  • Add the action bar to Tags to sort, filter and search.
  • Add pagination to the table.

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

  • Visit the tags tab under machines.
  • Check that you can filter by automatic or manual tags.
  • Check that you can search tags.
  • Check that you can change the order of the name and updated columns.
  • Check that you can paginate the table (you may have to reduce the TAGS_PER_PAGE value to less than the number of tags.

Fixes

Fixes: https://github.com/canonical-web-and-design/app-tribe/issues/703.
Fixes: https://github.com/canonical-web-and-design/app-tribe/issues/698.
Fixes: https://github.com/canonical-web-and-design/app-tribe/issues/697.
Fixes: https://github.com/canonical-web-and-design/app-tribe/issues/696.

Screenshots

Screen Shot 2022-03-04 at 12 07 35 pm

@huwshimi
Copy link
Contributor Author

huwshimi commented Mar 4, 2022

Blocked on #3659 landing first.

Comment on lines 21 to 39
<div className="p-segment-toggle">
{options.map(({ title, value }) => (
<Button
className={classNames("p-segment-toggle__button", {
"is-active": value === selected,
})}
key={title}
onClick={() => onSelect(value)}
>
{title}
</Button>
))}
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have a Tabs component in Vanilla that seems to do the same thing https://vanillaframework.io/docs/patterns/tabs#default

Could you use the vanilla copmonent instead and follow accessibility recommendations (add roles tablist, tab, aria-selected to the currently active tab).

More on this here:
https://vanillaframework.io/docs/patterns/tabs#accessibility

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh nice, thanks I didn't know about that one. I think while the styling is correct (I'll update this component to use those classes) I'm not sure those aria roles are right as it's not changing tabs, it's filtering the contents of the table.

It seems like role="radiogroup" might be the right option here. I've updated the component. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, that's even better. Thanks!

Comment on lines 42 to 43
expect(screen.getByTestId(TestId.TagListControls)).toBeInTheDocument();
expect(screen.getByTestId(TestId.TagTable)).toBeInTheDocument();
Copy link
Contributor

Choose a reason for hiding this comment

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

Once you use semantic HTML markup, using a test id will be no longer necessary. Please use a combination of semantic role and label instead.

<div className="kvm-action-bar">
<div className="kvm-action-bar__actions">{actions}</div>
<div className="kvm-action-bar__search">
<div className="action-bar" {...props}>
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
<div className="action-bar" {...props}>
<div className="action-bar" role="group" {...props}>

/>
<>
<TagListControls
data-testid="TagListControls"
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
data-testid="TagListControls"
aria-label="tag list controls"

tagCount={tags.length}
/>
<TagTable
data-testid="TagTable"
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
data-testid="TagTable"
aria-label="tags"

@huwshimi huwshimi merged commit 5e5fc9f into canonical:master Mar 8, 2022
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.

2 participants