Skip to content

fix(instance): distinguish deleted and unknown states - #727

Open
cloudbase-ai wants to merge 1 commit into
apache:masterfrom
cloudbase-ai:fix/issue-7694-instance-state
Open

cloudbase-ai wants to merge 1 commit into
apache:masterfrom
cloudbase-ai:fix/issue-7694-instance-state

Conversation

@cloudbase-ai

@cloudbase-ai cloudbase-ai commented Oct 21, 2026 •

Copy link
Copy Markdown

Part of apache/shenyu#7694.

The instance table labels backend state 0 as unknown, while Admin and chart data define it as DELETED. It also renders nothing for null or unrecognized state values.

Map 0 to the localized Deleted/已删除 label, retain 1 as Online and 2 as Offline, and render the existing Unknown label for unrecognized values. Add direct tests of the actual state-column renderer and both locale labels. No numeric API values or dependencies change.

Validation:

  • npm test — 58 suites, 340 tests passed.
  • ./node_modules/.bin/eslint src/routes/System/Instance/index.js src/routes/System/Instance/state.test.js — passed after formatting.
  • npm run build — passed.

Main-repository companion: apache/shenyu#7889. It includes backend unknown-value handling, documented state semantics, corrected schema comments, and the generated Admin static bundle from dashboard commit f239397e67c970c25a769f3b41ad3aaa7aca7a72. Merge the dashboard source before its bundled-resource companion.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue
What changed in this PR

Fixes the Instance table’s state rendering to align UI semantics with Admin/chart data by treating backend state 0 as Deleted (not Unknown) and ensuring null/unrecognized values render Unknown rather than an empty cell.

Changes:

  • Map state 0 to the localized Deleted/已删除 label; keep 1 Online and 2 Offline.
  • Add a default renderer branch to display Unknown for null/unrecognized values.
  • Add unit tests covering the state-column renderer and locale labels for Deleted vs Unknown.
File Description
src/​routes/​System/​Instance/​index.js Updates state renderer mapping and adds fallback Unknown rendering for unrecognized values.
src/​routes/​System/​Instance/​state.test.js Adds direct tests for renderer output and validates locale label separation for Deleted vs Unknown.
src/​locales/​en-US.json Fixes casing for “Unknown” and adds “Deleted” translation.
src/​locales/​zh-CN.json Adds “已删除” translation for Deleted.

Review effort: Lite

Comment on lines +32 to +39
const instance = new Instance({});
instance.setState = (update) => {
instance.state = { ...instance.state, ...update };
};
instance.initInstanceColumns();
renderState = instance.state.columns.find(
(column) => column.dataIndex === "instanceState",
).render;

This branch has not been deployed

No deployments
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