Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dbarkowsky
Copy link
Collaborator

@dbarkowsky dbarkowsky commented Jan 26, 2024

🎯 Summary

PIMS-668

Changes

  • Added table to display users
  • Added keywork search component for quicksearch.
  • Add select field with quick filtering options
  • Added function for downloading Excel file and added button for UsersTable

Testing

In order to test, you'll have to configure the get users endpoint to return some mock data.
Here's what I used for testing:

Expand Me
export const getUsers = async (req: Request, res: Response) => {
  const rows = [
    {
      id: 0,
      firstName: 'Graham',
      lastName: 'Stewart',
      status: 'Active',
      created: '2023-04-02',
      username: 'username@idir',
      email: '[email protected]',
      agency: 'CITZ',
      position: 'Captain',
      role: 'Admin',
      lastLogin: '2024-02-06',
    },
    {
      id: 1,
      firstName: 'John',
      lastName: 'Smith',
      status: 'Pending',
      created: '2023-04-02',
      username: 'username@idir',
      email: '[email protected]',
      agency: 'CITZ',
      position: 'Captain',
      role: 'Admin',
      lastLogin: '2024-02-06',
    },
    {
      id: 2,
      firstName: 'Alice',
      lastName: 'Johnson',
      status: 'Hold',
      created: '2023-02-03',
      username: 'username@idir',
      email: '[email protected]',
      agency: 'CITZ',
      position: 'Captain',
      role: 'Admin',
      lastLogin: '2024-02-06',
    },
    {
      id: 3,
      firstName: 'Bob',
      lastName: 'Anderson',
      status: 'Active',
      created: '2023-04-03',
      username: 'username@idir',
      email: '[email protected]',
      agency: 'CITZ',
      position: 'Captain',
      role: 'Admin',
      lastLogin: '2024-02-06',
    },
    {
      id: 4,
      firstName: 'Emma',
      lastName: 'White',
      status: 'Pending',
      created: '2023-06-04',
      username: 'username@idir',
      email: '[email protected]',
      agency: 'CITZ',
      position: 'Captain',
      role: 'Admin',
      lastLogin: '2024-02-06',
    },
    {
      id: 5,
      firstName: 'David',
      lastName: 'Taylor',
      status: 'Hold',
      created: '2023-04-04',
      username: 'username@idir',
      email: '[email protected]',
      agency: 'CITZ',
      position: 'Captain',
      role: 'Admin',
      lastLogin: '2024-02-06',
    },
    {
      id: 6,
      firstName: 'Sophie',
      lastName: 'Brown',
      status: 'Active',
      created: '2023-04-05',
      username: 'username@idir',
      email: '[email protected]',
      agency: 'CITZ',
      position: 'Captain',
      role: 'Admin',
      lastLogin: '2024-02-06',
    },
    {
      id: 7,
      firstName: 'Michael',
      lastName: 'Jones',
      status: 'Pending',
      created: '2023-04-05',
      username: 'username@idir',
      email: '[email protected]',
      agency: 'CITZ',
      position: 'Captain',
      role: 'Admin',
      lastLogin: '2024-02-06',
    },
    {
      id: 8,
      firstName: 'Olivia',
      lastName: 'Wilson',
      status: 'Active',
      created: '2023-04-06',
      username: 'username@idir',
      email: '[email protected]',
      agency: 'CITZ',
      position: 'Captain',
      role: 'Admin',
      lastLogin: '2024-02-06',
    },
    {
      id: 9,
      firstName: 'Daniel',
      lastName: 'Miller',
      status: 'Hold',
      created: '2023-04-06',
      username: 'username@idir',
      email: '[email protected]',
      agency: 'CITZ',
      position: 'Captain',
      role: 'Admin',
      lastLogin: '2024-02-06',
    },
    {
      id: 10,
      firstName: 'Cotton-Eye',
      lastName: 'Joe',
      status: 'Hold',
      created: '2023-04-06',
      username: 'username@idir',
      email: '[email protected]',
      agency: 'CITZ',
      position: 'Captain',
      role: 'Admin',
      lastLogin: '2024-02-06',
    },
  ];
  return res.status(200).json(rows);
};

🔰 Checklist

  • I have read and agree with the following checklist and am following the guidelines in our Code of Conduct document.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation where required.
  • I have tested my changes to the best of my ability.
  • My changes generate no new warnings.

@qlty-cloud-legacy
Copy link

qlty-cloud-legacy bot commented Jan 26, 2024

Code Climate has analyzed commit 6a6f487 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 93.8%.

View more on Code Climate.

@dbarkowsky dbarkowsky changed the title PIMS-668 Users Table PIMS-668 Users Table Part 1 Jan 29, 2024
@dbarkowsky dbarkowsky changed the title PIMS-668 Users Table Part 1 PIMS-668 Users Table Jan 30, 2024
Copy link
Collaborator

@TaylorFries TaylorFries left a comment

Choose a reason for hiding this comment

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

Table looks great!
Filtering works as expected, table is responsive to window size, paging works well, and search feature works.
Code looks good and is well documented in my opinion.

@dbarkowsky
Copy link
Collaborator Author

I want to wait to merge this until it has been modified to work with the new API hooks and the recently merged backend code.

@GrahamS-Quartech
Copy link
Contributor

GrahamS-Quartech commented Feb 5, 2024

Tested this, all works as expected. Some great new components in here too. I'll hold off on approval if you wanna wire this up to the hooks next though.
Edit: One thing we should decide on is using material-icons or mdi, they're pretty similar so I'm fine with either but we only really need one of these.

@github-actions github-actions bot removed the Express label Feb 7, 2024
@dbarkowsky dbarkowsky merged commit 9954129 into main Feb 7, 2024
@dbarkowsky dbarkowsky deleted the PIMS-668-Users-Table branch February 7, 2024 16:55
TaylorFries pushed a commit that referenced this pull request Feb 13, 2024
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.

4 participants