Skip to content

Adapt node actions to the updated OpenSVC API - #72

Open
PaulJouvanceau wants to merge 2 commits into
opensvc:mainfrom
PaulJouvanceau:dev
Open

PaulJouvanceau wants to merge 2 commits into
opensvc:mainfrom
PaulJouvanceau:dev

Conversation

@PaulJouvanceau

Copy link
Copy Markdown
Contributor

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

- `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.
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.

1 participant