Skip to content

fix(#5188): implement refreshApplications method and update refreshContext to use it#5191

Merged
SteKoe merged 4 commits intomasterfrom
fix/5188-respect-context-path-in-refresh-applications-call
Mar 25, 2026
Merged

fix(#5188): implement refreshApplications method and update refreshContext to use it#5191
SteKoe merged 4 commits intomasterfrom
fix/5188-respect-context-path-in-refresh-applications-call

Conversation

@SteKoe
Copy link
Contributor

@SteKoe SteKoe commented Mar 24, 2026

This pull request introduces a new method for refreshing the list of applications and refactors the refresh logic to use this new method, improving code organization and error handling. The main changes are grouped into two themes: feature addition and refactoring.

Feature Addition:

  • Added a static refreshApplications method to the Application class, which sends a POST request to the applications endpoint.

Refactoring and Error Handling:

  • Updated the refreshContext function in index.vue to use the new Application.refreshApplications method, added error handling with a try/catch block, and improved user feedback via notifications.
  • Removed the direct import of axios from index.vue since requests are now handled through the Application service.

@SteKoe SteKoe requested a review from a team as a code owner March 24, 2026 20:51
Copilot AI review requested due to automatic review settings March 24, 2026 20:51
Copy link
Contributor

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

Adds a centralized UI service method for triggering an applications refresh and refactors the Applications view to use it instead of calling axios directly.

Changes:

  • Added Application.refreshApplications() to POST to the applications endpoint.
  • Refactored views/applications/index.vue refresh handler to use the new service method and wrap it in try/catch.
  • Removed the now-unneeded direct axios import from the view.

Reviewed changes

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

File Description
spring-boot-admin-server-ui/src/main/frontend/views/applications/index.vue Refactors the “refresh applications” action to call Application.refreshApplications() and adds a try/catch.
spring-boot-admin-server-ui/src/main/frontend/services/application.ts Introduces refreshApplications() as a shared service method for the POST refresh call.

Copilot AI review requested due to automatic review settings March 25, 2026 07:08
Copy link
Contributor

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

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

Copilot AI review requested due to automatic review settings March 25, 2026 07:34
@SteKoe SteKoe force-pushed the fix/5188-respect-context-path-in-refresh-applications-call branch from d83cae0 to 7d060a1 Compare March 25, 2026 07:34
Copy link
Contributor

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines +233 to +247
it('clicking the refresh button invokes Application.refreshApplications', async () => {
const refreshSpy = vi.spyOn(Application, 'refreshApplications');

const refreshButton = screen.getByTitle('Refresh applications');
// First click - enters confirm mode
await userEvent.click(refreshButton);

// Second click - confirms and executes
const confirmButton = await screen.findByText('Confirm');
await userEvent.click(confirmButton);

await waitFor(() => {
expect(refreshSpy).toHaveBeenCalled();
});
});
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

This test spies on Application.refreshApplications but doesn’t mock its implementation, so it will execute the real axios POST. With MSW configured to error on unhandled requests, this will fail unless you add a POST /applications handler or mock the method to resolve (like the next test does).

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings March 25, 2026 08:52
@SteKoe SteKoe force-pushed the fix/5188-respect-context-path-in-refresh-applications-call branch from c7a4bf3 to f399080 Compare March 25, 2026 08:52
Copy link
Contributor

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines +259 to +274
it('calls refreshApplications and handles success without errors', async () => {
const refreshSpy = vi.spyOn(Application, 'refreshApplications');

const refreshButton = screen.getByTitle('Refresh applications');
// First click - enters confirm mode
await userEvent.click(refreshButton);

// Second click - confirms and executes
const confirmButton = await screen.findByText('Confirm');
await userEvent.click(confirmButton);

await waitFor(() => {
expect(refreshSpy).toHaveBeenCalled();
});
});

Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

The first two refresh-button tests exercise the same behavior (click refresh -> confirm -> expect refreshApplications called). Consider removing one of them or changing one to assert a different outcome (e.g., that the success notification is shown) to avoid redundant coverage.

Suggested change
it('calls refreshApplications and handles success without errors', async () => {
const refreshSpy = vi.spyOn(Application, 'refreshApplications');
const refreshButton = screen.getByTitle('Refresh applications');
// First click - enters confirm mode
await userEvent.click(refreshButton);
// Second click - confirms and executes
const confirmButton = await screen.findByText('Confirm');
await userEvent.click(confirmButton);
await waitFor(() => {
expect(refreshSpy).toHaveBeenCalled();
});
});

Copilot uses AI. Check for mistakes.
@SteKoe SteKoe force-pushed the fix/5188-respect-context-path-in-refresh-applications-call branch from f399080 to 1652d87 Compare March 25, 2026 09:00
@SteKoe SteKoe merged commit 9e8c079 into master Mar 25, 2026
2 checks passed
@SteKoe SteKoe deleted the fix/5188-respect-context-path-in-refresh-applications-call branch March 25, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants