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(ESSNTL-4194): Show groups in a table #1767

Merged
merged 16 commits into from
Feb 16, 2023

Conversation

gkarat
Copy link
Contributor

@gkarat gkarat commented Feb 14, 2023

Implements https://issues.redhat.com/browse/ESSNTL-4194.
Mock https://www.sketch.com/s/c19f555b-7887-4423-b55d-575c8dd1dfb7/a/dl8zwyb.

Create the groups list table with three columns: name, total systems and last modified. Implement sorting by each column, filtering by name and pagination.

⚠️ This doesn't implement actions (rename, delete, create group, bulk select) yet (will be in a separate PR).

How to test

  • Deploy locally with mock server (npm run start:mock).
  • Navigate to /inventory/groups and check that the table is rendered with dynamically generated values.
  • You can also disable the mock server and check whether network errors are properly handled with the error state.
  • You can also tweak your mock server and generate empty response (to verify the empty state).
  • The table is API paginated and filtered. Any filter change, pagination or sorting you make must trigger a new API request.

Screenshots

image

No match state:
image

Failed request (any runtime error):
image

Pagination values:
image

@gkarat gkarat requested a review from a team as a code owner February 14, 2023 16:03
@gkarat gkarat marked this pull request as draft February 14, 2023 16:04
@gkarat gkarat marked this pull request as ready for review February 14, 2023 16:34
@gkarat gkarat requested a review from Fewwy February 14, 2023 16:47
@gkarat gkarat self-assigned this Feb 14, 2023
@gkarat gkarat added the enhancement New feature or request label Feb 14, 2023
cypress/support/commands.js Outdated Show resolved Hide resolved
@mmenestr
Copy link

mmenestr commented Feb 14, 2023

Looks good, just a few comments:

  1. Can we reposition the columns so that the "total systems" column is more centered in the table?
  2. Can we update the empty state to look like this (just add icon and button)

image

  1. Search should use the "Search input" component where the icon is on the left
  2. For the error empty state, wonder if that action button is really useful (?) is that what we usually use in other places? If so then leave it, but just wondering!

@Fewwy
Copy link
Contributor

Fewwy commented Feb 15, 2023

When I tried to sort the "Total systems" or "Last modified" columns I got an error
image
image

@Fewwy
Copy link
Contributor

Fewwy commented Feb 15, 2023

First change of page worked fine but after that I encountered this error
image

image
image

@gkarat
Copy link
Contributor Author

gkarat commented Feb 15, 2023

@Fewwy,

  1. regarding sorting: this is expected, the table sends the order_by with the parameter which is not currently listed in the API schema and thus the mock server will throw you error ('name', 'updated_at', host_ids are not allowed currently for order_by parameter).
  2. the same for pagination, the mock server generates crazy values for count and total fields, thus the requests will be broken too with very huge (forbidden) values.

All these problems will not be reproducible with the real API implementation soon.

@Fewwy
Copy link
Contributor

Fewwy commented Feb 15, 2023

@gkarat Other than that the PR look fine :)

@gkarat
Copy link
Contributor Author

gkarat commented Feb 15, 2023

@mmenestr, thanks a lot for your review! I addressed your points in the last commits. For the button in the error state: this would require some work in our library (separate from the inventory frontend): I left the TODO note to fix it later.

@gkarat
Copy link
Contributor Author

gkarat commented Feb 15, 2023

/retest

@gkarat gkarat force-pushed the essntl-4194-groups-table branch from d617d3d to cc91451 Compare February 16, 2023 09:58
src/components/GroupsTable/GroupsTable.js Outdated Show resolved Hide resolved
import { generateLoadingRows } from '../InventoryTable/helpers';
import NoEntitiesFound from '../InventoryTable/NoEntitiesFound';

const GROUPS_TABLE_INITIAL_STATE = {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about extracting assets into separate file?

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'd like to keep it in the same file since these constants are tied to the component's state only

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, maybe there will be a new component that can re-use them? But, not a big deal, this is minor :)

src/components/GroupsTable/GroupsTable.js Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Base: 73.36% // Head: 69.54% // Decreases project coverage by -3.83% ⚠️

Coverage data is based on head (b4d095e) compared to base (b0f8005).
Patch coverage: 41.14% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1767      +/-   ##
==========================================
- Coverage   73.36%   69.54%   -3.83%     
==========================================
  Files         105      108       +3     
  Lines        2219     2420     +201     
  Branches      838      869      +31     
==========================================
+ Hits         1628     1683      +55     
- Misses        591      737     +146     
Impacted Files Coverage Δ
src/components/GroupsTable/GroupsTable.cy.js 0.00% <0.00%> (ø)
...c/components/InventoryGroups/InventoryGroups.cy.js 0.00% <0.00%> (ø)
src/components/GroupsTable/GroupsTable.js 94.54% <94.54%> (ø)
src/components/InventoryGroups/InventoryGroups.js 100.00% <100.00%> (ø)
src/components/InventoryGroups/utils/api.js 88.88% <100.00%> (+3.17%) ⬆️
src/components/InventoryTable/EntityTable.js 97.67% <100.00%> (ø)
src/components/InventoryTable/NoEntitiesFound.js 100.00% <100.00%> (ø)
src/components/InventoryTable/helpers.js 97.22% <100.00%> (+0.16%) ⬆️
src/constants.js 82.53% <100.00%> (+0.28%) ⬆️
src/store/groups.js 100.00% <100.00%> (+85.71%) ⬆️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@mkholjuraev mkholjuraev left a comment

Choose a reason for hiding this comment

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

Codewise looks good!

import { generateLoadingRows } from '../InventoryTable/helpers';
import NoEntitiesFound from '../InventoryTable/NoEntitiesFound';

const GROUPS_TABLE_INITIAL_STATE = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, maybe there will be a new component that can re-use them? But, not a big deal, this is minor :)

@gkarat gkarat merged commit b80c00e into RedHatInsights:master Feb 16, 2023
gkarat pushed a commit that referenced this pull request Feb 16, 2023
# [1.3.0](v1.2.0...v1.3.0) (2023-02-16)

### Features

* **ESSNTL-4194:** Show groups in a table ([#1767](#1767)) ([b80c00e](b80c00e))
@gkarat
Copy link
Contributor Author

gkarat commented Feb 16, 2023

🎉 This PR is included in version 1.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants