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

Refactored due/overdue for audit, added due/overdue for checkin API endpoint and GUI #14655

Merged
merged 43 commits into from May 2, 2024

Conversation

snipe
Copy link
Owner

@snipe snipe commented Apr 26, 2024

Whew. This got a lot messier and bigger than I had intended.

  • Refactors the /api/v1/hardware/audits/due and /api/v1/hardware/audits/overdue endpoints
  • Added the /api/v1/hardware/checkins/due and /api/v1/hardware/checkins/overdue endpoints
  • Added the /api/v1/hardware/checkins/due-or-overdue and /api/v1/hardware/audits/due-or-overdue endpoints
  • Removed duplicate api/v1/hardware/audit/due API routes that somehow snuck through (they have been there a while)
  • Added a UI interface for the new due/overdue checkins
  • Added badge numbers to the sidebar with counts for checkins and audits
  • Changed the badges to be more consistent with our other badges
  • Changes the Due for Audit UI into a tabbed interface so we can have both Due/Overdue for Audit and Checkin without adding too much more stuff to that side menu
  • Updated notifications to use the same scoping for consistency
  • Added tests

By expanding out the existing index API, it means we can still filter/sort/search/etc on these new endpoints the same as we can for any other asset listing page.

Screenshot 2024-04-26 at 7 20 03 PM

To do eventually:

  • Refactor the Notifications for expected checkins to use the new model scopes.
  • See if we can't make that sidenav hover width a little bigger for less wrapping

snipe added 29 commits April 26, 2024 14:01
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Copy link

what-the-diff bot commented Apr 26, 2024

PR Summary

  • Enhanced Assets Controllers
    The Main API AssetsController has been refined to handle due and overdue audits and checkin dates. The main AssetsController has some methods revamped to be more focused on checkin-related tasks. Previous methods have been made simpler and clearer.

  • Updated Middleware for Asset Count
    Several new metrics have been added for view's sidebar in AssetCountForSidebar middleware, including those concerning audits and checkins both due and overdue, enhancing overall ease of navigation and tracking.

  • Extended Functionality in Asset Model
    The Asset model has been enhanced to be more encompassing with methods for daily checkins, overdue checkins and overall due or overdue checkins, making its utilisation robust.

  • Modification in Public UI files
    UI changes have been incorporated in app.css, overrides.css, and all.css with a new rule for sidebar menu styling resulting in improved aesthetics.

  • Update in Translation File
    Two additional translations added, concerning audit due days and checkin due days, leading to clearer communication with users.

  • Improved Views
    The view audit-dure.blade.php has been updated with improved navigation and data attribute handling providing a better user experience. The file audit-overdue.blade.php has been removed, replaced by an added file checkin-due.blade.php.

  • Updated Layout
    The default layout file now displays badges with more relevant data, thus helping users know the status of their assets at a glance with the incorporation of badges.

  • API Routes Update
    New API endpoint added to fetch upcoming audits and checkins along with the removal of duplicate endpoints. This would help in reducing redundancy and improving system efficiency.

  • Web Routes Management
    The web routes for the hardware has been cleaned up by removing redundant code, making the system lighter and faster.

  • Test Feature Changes
    Test names are more descriptive now and new tests for API endpoints have been added to cover all possible sceneries. The refactoring of tests leads to better code coverage and potential problem identification.

Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm just diving in but I wanted to share this first:

I think we can increase confidence in these tests by creating an asset(s) in each "status" and then querying to make sure we only get back the ones expected. So the outline for a test might look like

  1. Create an asset that has upcoming audit
  2. Create an asset that is overdue for audit
  3. (maybe) Create an asset in another state that shouldn't show up?
  4. Send queries with upcoming_status set to overdue, due-or-overdue, due
  5. Check if the asset ids you expect from the assets created above are included and the ones that shouldn't be included aren't.

The increased confidence comes from knowing the test created assets that shouldn't be returned and checking that they weren't.

Copy link
Collaborator

@marcusmoore marcusmoore left a comment

Choose a reason for hiding this comment

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

I did a pure-code review and found a couple changes. Going to pull it up and fully test in a browser soon.

tests/Feature/Api/Assets/AssetIndexTest.php Outdated Show resolved Hide resolved
resources/views/layouts/default.blade.php Outdated Show resolved Hide resolved
app/Http/Middleware/AssetCountForSidebar.php Outdated Show resolved Hide resolved
app/Http/Middleware/AssetCountForSidebar.php Outdated Show resolved Hide resolved
app/Http/Controllers/Api/AssetsController.php Outdated Show resolved Hide resolved
resources/views/hardware/checkin-due.blade.php Outdated Show resolved Hide resolved
snipe added 5 commits May 2, 2024 12:24
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
@snipe snipe merged commit 4850227 into develop May 2, 2024
8 checks passed
@snipe snipe deleted the feature/sc-25381/simpler_overdue_endpoints branch May 2, 2024 12:11
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

2 participants