Skip to content

fix: fix refresh power button issue#3441

Merged
DevipriyaS17 merged 7 commits into
mainfrom
pr-3430
Jul 20, 2026
Merged

fix: fix refresh power button issue#3441
DevipriyaS17 merged 7 commits into
mainfrom
pr-3430

Conversation

@DevipriyaS17

@DevipriyaS17 DevipriyaS17 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

  • Unit Tests have been added for new changes
  • API tests have been updated if applicable
  • All commented code has been removed
  • If you've added a dependency, you've ensured license is compatible with Apache 2.0 and clearly outlined the added dependency.

What are you changing?

Issue - #3440 Clicking the Refresh Power Status icon does not retrieve the latest power state

Root Cause:

The toolbar was using getPowerStateCached() for power-state reads, which can return a previously cached value instead of issuing a new HTTP request. That is correct for the initial load, but not for a manual refresh.

Behavior:

  • User opens the device detail page
  • ngOnInit() loads the current power state using the cached path
  • Toolbar shows the current state
  • User clicks the Refresh Power Status icon
  • The refresh action now bypasses the cache and calls devicesService.getPowerState()
  • The UI receives the latest state from the backend instead of reusing stale cached data

Fix:

  • Kept the initial load path using getPowerStateCached() so simultaneous startup requests remain deduped
  • Changed the refresh action to call getPowerState() directly so every manual refresh makes a fresh HTTP request
  • Updated the refresh control to use a real button for keyboard accessibility
  • Added/updated tests to cover the refresh path and preserve the cached-vs-fresh behavior

Request URL
https://10.99.115.56/mps/api/v1/amt/power/state/4939adac-fc23-8c93-c2d0-88aedd6e4316
Request Method
GET
Status Code
200 OK
{"powerstate":2,"OSPowerSavingState":2}

Request URL
https://10.99.115.56/mps/api/v1/amt/power/action/4939adac-fc23-8c93-c2d0-88aedd6e4316
Request Method
POST
Status Code
200 OK
{
"Header": {
"To": "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous",
"RelatesTo": 0,
"Action": "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PowerManagementService/RequestPowerStateChangeResponse",
"MessageID": "uuid:00000000-8086-8086-8086-00000000014C",
"ResourceURI": "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PowerManagementService"
},
"Body": {
"ReturnValue": 0,
"ReturnValueStr": "SUCCESS"
}
}

3.Request URL
https://10.99.115.56/mps/api/v1/amt/power/state/4939adac-fc23-8c93-c2d0-88aedd6e4316
Request Method
GET
Status Code
200 OK
Remote Address

{"powerstate":8,"OSPowerSavingState":0}

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes a regression on the Device Details toolbar where clicking the Refresh Power Status icon could return a stale cached power state instead of fetching the latest state from the device (issue #3440).

Changes:

  • Update the toolbar power-state refresh flow to call devicesService.getPowerState() (fresh HTTP request) instead of getPowerStateCached().
  • Update the inline comment to reflect the intended “bypass cache on refresh” behavior.

Comment thread src/app/devices/device-toolbar/device-toolbar.component.ts Outdated
Comment thread src/app/devices/device-toolbar/device-toolbar.component.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread src/app/devices/device-toolbar/device-toolbar.component.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 2 comments.

Comment thread src/app/devices/device-toolbar/device-toolbar.component.ts Outdated
Comment thread src/app/devices/device-toolbar/device-toolbar.component.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 1 comment.

Comment thread src/app/devices/device-toolbar/device-toolbar.component.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 thread src/app/devices/device-toolbar/device-toolbar.component.html Outdated
Comment thread src/app/devices/device-toolbar/device-toolbar.component.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 thread src/app/devices/device-toolbar/device-toolbar.component.ts
Comment thread src/app/devices/device-toolbar/device-toolbar.component.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 1 comment.

Comment thread src/app/devices/device-toolbar/device-toolbar.component.html Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 1 comment.

Comment thread src/app/devices/device-toolbar/device-toolbar.component.spec.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 1 comment.

Comment thread src/app/devices/device-toolbar/device-toolbar.component.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 no new comments.

@DevipriyaS17
DevipriyaS17 marked this pull request as ready for review July 15, 2026 06:36
Comment thread src/app/devices/device-toolbar/device-toolbar.component.html Outdated
Comment thread src/app/devices/device-toolbar/device-toolbar.component.ts
@madhavilosetty-intel

madhavilosetty-intel commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@DevipriyaS17

  1. When I power off the device, though I get the response as {ReturnValue: 0}, Power on button is green until I refresh the page. Same thing happen when I power up the device.
image

I have tested on AMT 15 and AMT 19

@DevipriyaS17
DevipriyaS17 force-pushed the pr-3430 branch 2 times, most recently from b342e39 to 755c277 Compare July 16, 2026 08:46
@DevipriyaS17

Copy link
Copy Markdown
Contributor Author

@DevipriyaS17

  1. When I power off the device, though I get the response as {ReturnValue: 0}, Power on button is green until I refresh the page. Same thing happen when I power up the device.
image I have tested on AMT 15 and AMT 19

Updated the code to fix the issue

@DevipriyaS17
DevipriyaS17 merged commit 98210d2 into main Jul 20, 2026
10 checks passed
@DevipriyaS17
DevipriyaS17 deleted the pr-3430 branch July 20, 2026 04:59
RosieAMT pushed a commit that referenced this pull request Jul 20, 2026
## [3.60.1](v3.60.0...v3.60.1) (2026-07-20)

### Bug Fixes

* fix refresh power button issue ([#3441](#3441)) ([98210d2](98210d2))
@RosieAMT

Copy link
Copy Markdown

🎉 This PR is included in version 3.60.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants