Skip to content

#4616 - Ministry View Change Request Revamp (Application view menu) #4628

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

Merged

Conversation

andrewsignori-aot
Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot commented Apr 23, 2025

API Related Changes

  • Change the API that retrieves the application's overall information to also get the supporting users' information, which allowed the old API method to be removed as planned in the previous efforts.
    • Kept the logic to decide which application version is an "in-progress change request" in the API, which means that the API is responsible for returning a change request in an explicit way (DTO property inProgressChangeRequest).
    • Considered all applications as a version of itself, which means current, change request, and past versions share the same output DTO.
    • As a side effect of having the supporting users associated with change requests, every version now can easily display supporting users in the UI (it is just not enabled yet because it is not part of the ACs).
  • Added the below E2E for the new scenarios
    • Should get the original application and no application versions in overall details when there is no edited application associated with the given application.
    • Should get the current application and an in-progress change request, including supporting users when the application has an in-progress change request.
    • Should get the current application and an application version when the application has a declined change request.
    • Should get the current application and versions supporting users when the application and its versions have supporting users.

UI related changes

  • Refactored the Ministry applications menu to look more like the Ministry main left menu.
    • The menu is now integrated with the routes and has the active behavior.
  • The route for the pending change request is the same as any other application version, and the "change request" is treated as a regular past version.

In-progress change request

image

Parents and Partner with pending change request

image

Active application with versions and no pending request

image

How it was displayed on Edge (previously, there was extra white space between the icons)

image

Local change only to allow displaying the Changed with approval renamed to Changed

image

@andrewsignori-aot andrewsignori-aot self-assigned this Apr 23, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the Ministry view for handling change requests and supporting users in both the UI and API. Key changes include updating DTOs to include supporting user data, refactoring the Ministry applications menu with dynamic route-based navigation, and updating the API query to return the active application along with its versions.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sources/packages/web/src/types/contracts/Common.ts Added additional properties (subtitle, slim, color, opacity) to the MenuItemModel to support richer UI.
sources/packages/web/src/services/http/dto/Application.dto.ts Added new DTO classes/interfaces to include supporting users within application versions and overall details.
sources/packages/web/src/composables/useApplication.ts Introduced a helper to map application edit statuses for the Ministry view.
sources/packages/web/src/components/layouts/aest/AESTApplicationSideBar.vue Refactored the sidebar to build menu items dynamically, integrating routes and supporting users.
sources/packages/backend/apps/api/src/services/application/application.service.ts Modified the query to join supporting users and return a single application record with versions.
sources/packages/backend/apps/api/src/route-controllers/application/models/application.dto.ts Updated the application DTOs to include supporting users and overall details for active and change-request versions.
sources/packages/backend/apps/api/src/route-controllers/application/application.controller.service.ts Adjusted the controller service to transform application data with supporting users and handle change request separation.
sources/packages/backend/apps/api/src/route-controllers/application/tests/application.aest.controller.getApplicationOverallDetails.e2e-spec.ts Added comprehensive E2E tests to cover scenarios for original applications, in-progress change requests, and declined change requests with supporting users.
Comments suppressed due to low confidence (1)

sources/packages/backend/apps/api/src/route-controllers/application/models/application.dto.ts:267

  • Duplicate definitions of ApplicationSupportingUsersAPIOutDTO are present (both as an interface and as a class). Consider consolidating these into a single consistent type to avoid confusion.
export interface ApplicationSupportingUsersAPIOutDTO {

@andrewsignori-aot andrewsignori-aot marked this pull request as ready for review April 24, 2025 19:47
@dheepak-aot dheepak-aot self-requested a review April 24, 2025 21:16
* @param applicationId application id.
* @return list of supporting users of an application.
*/
@Get("application/:applicationId")
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Comment on lines +839 to +853
let previousVersions = application.parentApplication.versions.map(
(version) => this.transformToApplicationOverallDetailsAPIOutDTO(version),
);
// Check if there is an in-progress change request for the application.
const inProgressChangeRequest = previousVersions.find((version) =>
APPLICATION_EDIT_STATUS_IN_PROGRESS_VALUES.includes(
version.applicationEditStatus,
),
);
// Remove the in-progress change request from the previous versions list.
// A maximum of one in-progress change request is allowed.
if (inProgressChangeRequest) {
previousVersions = previousVersions.filter(
(version) => version.id !== inProgressChangeRequest.id,
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can do an early return if the previous versions are not present.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The goal of the early return is to reduce nesting, complexity, and make the code easy to read.
The nesting would not be reduced in this situation. I added the early return to see how it looks and it does not seems like an improvement in this scenario. Please let me know if I am missing something at a level that it would be a blocker.

@dheepak-aot
Copy link
Collaborator

Great start @andrewsignori-aot only minor comments.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR revamps the ministry view change request by integrating supporting users into the application overall details API and updating the UI menus accordingly. The key changes include:

  • Adding supporting users to the application version and overall details DTOs.
  • Refactoring the ministry applications sidebar to integrate with current routing and active state behavior.
  • Removing obsolete API methods and updating the relevant tests to cover new scenarios.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sources/packages/web/src/types/contracts/Common.ts Added new optional menu item properties (subtitle, class, slim, color, opacity) to support enhanced UI.
sources/packages/web/src/services/http/dto/SupportingUser.dto.ts Removed the redundant ApplicationSupportingUsersAPIOutDTO in favor of other supporting user DTOs.
sources/packages/web/src/services/http/dto/Application.dto.ts Extended and added new DTOs to include supportingUsers in application version and overall details.
sources/packages/web/src/services/http/SupportingUserApi.ts Removed the deprecated getSupportingUsersForSideBar method.
sources/packages/web/src/services/SupportingUserService.ts Removed the redundant getSupportingUsersForSideBar method for consistency with API changes.
sources/packages/web/src/composables/useApplication.ts Introduced mapApplicationEditStatusForMinistry to provide a Ministry-specific edit status mapping.
sources/packages/web/src/components/layouts/aest/AESTApplicationSideBar.vue Refactored the sidebar layout to tie menu items to routes and improved the handling of change request and version menus.
sources/packages/backend/apps/api/src/services/application/application.service.ts Updated the application versions query to join supporting users and return the active application with its versions in one call.
sources/packages/backend/apps/api/src/route-controllers/* Adjusted controllers and models to support the new structure of application details and remove obsolete DTOs.
sources/packages/backend/apps/api/src/route-controllers/application/tests/* Updated E2E tests to validate the new application overall details structure including supporting users.
Comments suppressed due to low confidence (3)

sources/packages/web/src/components/layouts/aest/AESTApplicationSideBar.vue:70

  • [nitpick] For the 'Partner' title, if multiple partners exist, consider including an index or unique identifier to differentiate each entry.
const createSupportingUsersMenu = (

sources/packages/backend/apps/api/src/route-controllers/application/application.controller.service.ts:875

  • Returning undefined when there are no supporting users might lead to inconsistent API responses; consider returning an empty array instead.
supportingUsers: application.supportingUsers.length ? application.supportingUsers.map((user) => ({

sources/packages/backend/apps/api/src/services/application/application.service.ts:2210

  • Verify that the join condition does not inadvertently filter out application versions with no supporting users, as this might impact the overall returned data.
leftJoin("version.supportingUsers", "versionSupportingUser", "versionSupportingUser.id IS NOT NULL")

});
},
},
...versionSupportingUsersMenuItems,
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@dheepak-aot dheepak-aot left a comment

Choose a reason for hiding this comment

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

Thanks for doing the changes. Looks good 👍

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR revamps the Ministry view for change requests by updating the API to include supporting users information and by refactoring the UI menu to be more consistent with the Ministry main left menu. Key changes include:

  • Enhancements to API DTOs and service methods to return supporting users alongside application versions.
  • Removal of deprecated endpoints and methods related to supporting users.
  • A complete overhaul of the Ministry sidebar component, integrating dynamic menu creation and active route support.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sources/packages/web/src/types/contracts/Common.ts Added new menu item properties (subtitle, class, slim, color, opacity) for UI styling improvements.
sources/packages/web/src/services/http/dto/SupportingUser.dto.ts Removed the old ApplicationSupportingUsersAPIOutDTO interface in favor of a unified supporting users interface.
sources/packages/web/src/services/http/dto/Application.dto.ts Introduced supportingUsers array in application version and overall details DTOs.
sources/packages/web/src/services/http/SupportingUserApi.ts & SupportingUserService.ts Removed methods for fetching supporting users separately as this is now integrated into the overall application details.
sources/packages/web/src/composables/useApplication.ts & AESTApplicationSideBar.vue Refactored menu generation and routing logic for the Ministry sidebar with enhanced integration and active state management.
sources/packages/backend/apps/api Updated service and controller logic to return comprehensive application details (including supporting users) and revised error handling, with corresponding updates in E2E tests.
Comments suppressed due to low confidence (1)

sources/packages/backend/apps/api/src/route-controllers/application/application.controller.service.ts:875

  • Consider returning an empty array instead of undefined when there are no supporting users to ensure a consistent API response structure.
supportingUsers: application.supportingUsers.length ? application.supportingUsers.map((user) => ({

Copy link
Collaborator

@bidyashish bidyashish left a comment

Choose a reason for hiding this comment

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

Looks good to me @andrewsignori-aot
Nice work.

Copy link

Copy link

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 72.78% ( 679 / 933 )
Methods: 74.77% ( 83 / 111 )
Lines: 74.79% ( 531 / 710 )
Branches: 58.04% ( 65 / 112 )

Copy link

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 21.84% ( 4012 / 18369 )
Methods: 9.92% ( 233 / 2349 )
Lines: 25.2% ( 3467 / 13757 )
Branches: 13.79% ( 312 / 2263 )

Copy link

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 85.75% ( 1511 / 1762 )
Methods: 83.41% ( 171 / 205 )
Lines: 88.12% ( 1246 / 1414 )
Branches: 65.73% ( 94 / 143 )

Copy link

E2E SIMS API Coverage Report

Totals Coverage
Statements: 71.25% ( 6735 / 9453 )
Methods: 69.32% ( 836 / 1206 )
Lines: 74.76% ( 5224 / 6988 )
Branches: 53.61% ( 675 / 1259 )

@andrewsignori-aot andrewsignori-aot added this pull request to the merge queue Apr 25, 2025
Merged via the queue into main with commit 3c6b0ec Apr 25, 2025
22 checks passed
@andrewsignori-aot andrewsignori-aot deleted the feature/#4616-change-request-ministry-application-view branch April 25, 2025 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ministry Ministry Features SIMS-Api SIMS-Api Web portal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants