Adapt node actions to the updated OpenSVC API - #72
Open
PaulJouvanceau wants to merge 2 commits into
Open
PaulJouvanceau wants to merge 2 commits into
PaulJouvanceau wants to merge 2 commits into
Conversation
- `postActionUrl` now sends "stop" and "restart daemon" to
`/api/node/name/{node}/daemon/action/{stop|restart}` instead of the
node-level `/action/...` path.
- Removed "start" from `NODE_ACTIONS
- Add `endpoint` field to NODE_ACTIONS; postActionUrl now looks it up. - Fix 404s: stop/restart daemon -> /daemon/action/*, asset/disk/pkg -> /action/push/*, capabilities -> /action/scan/capabilities. - Remove start, provision, unprovision, switch, giveback, delete (no node-level endpoint in the API). - Update tests: split daemon/node URL cases, cover corrected routes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The OpenSVC API changed its node action routes. The UI still called the old endpoints, producing 404 Not Found (e.g. POST /api/node/name/{node}/action/stop instead of POST /api/node/name/{node}/daemon/action/stop).
Changes
Endpoint mapping. NODE_ACTIONS now carries an explicit endpoint field per action. postActionUrl is a simple lookup; the DAEMON_ACTIONS constant and the "restart daemon" special case are removed.
Routes fixed:
stop /action/stop (404) -> /daemon/action/stop
asset /action/asset (404) -> /action/push/asset
disk /action/disk (404) -> /action/push/disk
pkg /action/pkg (404) -> /action/push/pkg
capabilities /action/capabilities (404) -> /action/scan/capabilities
Actions removed (no node-level endpoint in the API, only produced 404): start, provision, unprovision, switch, giveback, delete. start is covered by restart daemon; the daemon start route requires a heartbeat name this UI does not have.
Styling. stop is now rendered in error.main.
Tests. Split the "standard action" URL test into explicit daemon-stop and node-freeze cases; use anchored stringMatching instead of stringContaining; add a test.each covering the corrected push/*, scan/capabilities, sysreport, drain, abort, clear routes.
Files
src/constants/actions.js
src/components/NodesTable.jsx
src/components/tests/NodesTable.test.jsx