Skip to content

fix(console,ui): exclude runtime engine from mesh list and polish Console UI - #1667

Open
robocanic wants to merge 7 commits into
apache:developfrom
robocanic:fix/mesh-list-exclude-engine
Open

robocanic wants to merge 7 commits into
apache:developfrom
robocanic:fix/mesh-list-exclude-engine

Conversation

@robocanic

@robocanic robocanic commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Please provide a description of this PR:

This PR fixes a registry/mesh selection bug in /api/v1/meshes (along with several frontend bugs) and polishes the Console UI across the Cluster Overview, Navigation Bar, Resource Lists, Event Timeline, Service Debug Workbench, and Scene Config pages.


Bug Fixes

  1. Exclude runtime engine from /api/v1/meshes when discoveries are configured

    • pkg/console/handler/mesh.go: ListMeshes previously appended the non-mock Kubernetes runtime engine (id: default) alongside configured registry discoveries (e.g. nacos2.5). Because Applications, Services, merged Instances, and aligned LifecycleEvents belong to the discovery mesh, selecting the engine mesh rendered empty resource lists. ListMeshes now returns configured discoveries and only falls back to a non-mock engine when len(discoveries) == 0.
    • ui-vue3/src/stores/mesh.ts, Login.vue, layout_header.vue: Added resolveActiveMesh() so stale cached mesh IDs (such as default) automatically fall back to the first valid registry mesh on login and page refresh, and removed hardcoded || 'default' fallbacks in the 3 Event tabs.
    • Added Go unit tests (pkg/console/handler/mesh_test.go) and Vitest unit tests (ui-vue3/src/stores/mesh.test.ts).
  2. Remove duplicate vertical scrollbars on list pages

    • ui-vue3/src/layout/tab/layout_tab.vue: Compute #layout-tab-body height dynamically (calc(100vh - 300px) for detail tab pages vs calc(100vh - 176px) for list pages without the tab header).
    • ui-vue3/src/components/SearchTable.vue and 5 list views (applications/index.vue, instances/index.vue, services/search.vue, routingRule/index.vue, tagRule/index.vue): Removed hardcoded scrollY: '367px' so tables no longer nest a second vertical scrollbar inside the page scroll container.
  3. Fix missing i18n placeholder and Scene Config bugs

    • Added missing placeholder.serviceName i18n keys (zh.ts / en.ts) and unified the Application config tab label to 场景配置 / Scene Config.
    • Fixed ConfigPage.vue submit() showing submit success even after validation or server errors.
    • Fixed instances/tabs/configuration.vue resetting form.logFlag instead of form.flowDisabledFlag in the traffic-disable tab.
    • Fixed services/tabs/sceneConfig.vue .param-route fixed height: 320px causing param route cards to overlap the Submit/Reset footer.

UI / UX Improvements (Before & After)

1. Cluster Overview & Top Navigation (home/index.vue, layout_header.vue, layout/index.vue)

  • Aligned KPI cards and distribution charts into a balanced 3-column CSS Grid; made KPI cards clickable to jump directly to Applications / Services / Instances lists.
  • Upgraded G2 donut charts to autoFit: true with centered totals and clean bottom legends (fixing clipped outside labels and center-text overflow); added password masking, copy, and external open actions to the infrastructure table.
  • Simplified the top header to a crisp white 3-column symmetric layout (collapse toggle | centered global search | right registry selector) and moved Account, Language switcher, Theme color picker/reset, and Logout into a pinned bottom-left sidebar menu.
Before After
02-before-header 01-before-overview 01-after-overview

2. Resource Lists (layout_tab.vue, SearchTable.vue, list views)

  • Eliminated double vertical scrollbars and fixed raw placeholder.serviceName text in the Services search bar.
Before After
06-before-instances 06-after-instances

3. Event Timeline (EventTimeline.vue)

  • Replaced the 50%-split <a-timeline mode="left"> with a compact 3-column grid (timestamp | rail | message & source), added All / Normal / Warning severity filters, aligned colors with Dubbo's primary teal palette, and added skeleton loading + full i18n.
Before After
03-before-events 03-after-events

4. Service Debug Workbench (services/tabs/debug.vue)

  • Moved the execution bar (instance selector, timeout, Attachments, and primary Invoke button) above the Request/Response split editors so a full call fits above the fold.
  • Replaced permanent type trees with tabbed Request/Response JSON & Schema panes, added Format / Reset / Copy actions, and only show status + elapsed latency after an invocation.
Before After
04-before-debug 04-after-debug

5. Scene Config Workbench (ConfigPage.vue, app/instance/service config tabs)

  • Unified Application / Instance / Service Scene Config into a clean workbench shell, removed the 30px duplicate title and scale(1.1) menu distortion, made rule tables full-width responsive, and moved 添加参数路由 to the top-right header action bar consistent with Flow Weight and Gray Isolation.
After
05-after-scene-config

Verification

  • go test -v ./pkg/console/handler/... ./pkg/console/router/... — PASS (TestListMeshes 4/4)
  • cd ui-vue3 && npm run test:unit -- --run — PASS (15 test files / 79 tests, including src/stores/mesh.test.ts 4/4)
  • eslint & vue-tsc on all modified files — zero new errors

To help us figure out who should review this PR, please put an X in all the areas that this PR affects.

  • Docs
  • Installation
  • User Experience
  • Dubboctl
  • Console
  • Core Component

@AsperforMias AsperforMias 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.

感谢贡献!后端排除 runtime engine 避免混入「注册中心」下拉框的方向非常合理,总览环形图防截断、列表双滚动条修复以及服务调试工作台的首屏信息层级也有明显提升。

不过当前 PR(27 个文件,+2818 / -1112)将约 200 行的核心 Bugfix 与大范围 UI 改版混在了一起,且代码和交互层存在几个较关键的问题,建议修复并考虑拆分后再合入:

拆分建议

建议将核心修复与 UI 重构拆为独立 PR,避免低风险 Bugfix 被大改版阻塞:

  1. 优先合入:fix(console,ui): exclude runtime engine from mesh list & fix list scrollbars(后端 mesh.go、前端 mesh store/状态清理、列表双滚动条修复)
  2. 后续拆出:全局导航/集群总览视觉改版,以及事件流/调试/场景配置工作台重构

P0(阻塞合入)

  1. 服务场景配置子页签不加载后端数据,提交会覆盖线上规则
    • ui-vue3/src/components/ConfigPage.vue:110-120 改为维护组件内部 activeIndex,selectOption() 不再同步更新 props.options.current;
    • ui-vue3/src/views/resources/services/tabs/sceneConfig.vue:343-352 依赖 watch(() => options.current[0]) 在切换页签时触发 loadConfigData(),导致切到 retryNum、sameAreaFirst、paramRoute 时永远不拉取后端数据,展示为空默认值,误点提交会直接覆盖线上配置。
    • 建议:保持 props.options.current 同步(或改用显式 v-model:activeIndex 统一更新所有调用方),并补充组件单测。

P1(建议本轮修复或明确跟进)

  1. 总览基础设施外链泄漏明文凭据(安全)

    • ui-vue3/src/views/home/index.vue:88-97, 205-219 中 maskSecretInUrl 只脱敏了展示文本 displayValue,<a :href="entry.rawValue"> 依然把未脱敏的原始 URL 输出到了 DOM 和新标签页地址中;同时正则只匹配 (nacos.)?password=,遗漏了 user:pass@host、token=、secret= 等常见形式。
    • 建议:在后端 AdminMetadata 返回前统一剥离/脱敏 URL 凭据(userinfo 及敏感 query 参数),前端 href 不应绑定未脱敏 URL。
  2. 事件流客户端筛选与服务端分页冲突

    • ui-vue3/src/components/EventTimeline.vue:55-62, 94-103, 133-168 的 All / Normal / Warning 计数与过滤只针对已加载页,容易误导运维认为“告警数为 0”;且筛选后 filteredEvents.length === 0 会隐藏 footer,若 loadMoreTriggerRef 一直留在视口内无法再次触发 IntersectionObserver,页面会卡在空状态无法继续拉取后续分页。
    • 建议:最好在后端事件接口支持按 type 筛选与分类计数;如果先保留客户端筛选,建议明确提示基于已加载数据,并在 filteredEvents.length === 0 && hasMore 时提供显式「加载更多」或受控续拉。
  3. 多处新增硬编码中文破坏 i18n

    • 全局左下角菜单 ui-vue3/src/layout/index.vue:59, 75, 84, 90(语言、主题色、重置、退出登录)在英文模式下会直接显示中文(相比改前属于 i18n 退化);
    • ui-vue3/src/views/home/index.vue:48, 75, 94, 101, 187-199, 292-294、ui-vue3/src/views/resources/services/tabs/debug.vue 以及场景配置页也新增了较多硬编码中文,且 copy / copySuccessfully / reset 等已有 key 未复用。
    • 建议:统一抽入 zh.ts / en.ts。
  4. Mesh 列表为空时未清理过期缓存

    • ui-vue3/src/Login.vue:66-69 与 ui-vue3/src/layout/header/layout_header.vue:114-118 判断为 if (resolvedMesh && resolvedMesh !== meshStore.mesh);当接口返回空列表(resolvedMesh === '')时不会清理 localStorage 中残留的旧 meshStore.mesh(如升级前残留的 'default')。
    • 建议:改为 if (resolvedMesh !== meshStore.mesh)。
  5. 排除 runtime engine 后的可观测性缺口(可单开 follow-up issue 跟进)

    • 未配置 dubboDiscoveryIdentifier 的 K8s Pod 其 RuntimeInstance.Mesh 为 "default",pkg/core/discovery/subscriber/lifecycle_event.go:109-144 未按 IP 对齐到真实 Discovery mesh,排除 engine 后这部分 Pod 生命周期事件将无法从 UI 查到;
    • 此外,总览页「基础设施配置」暂未展示已接入的 Runtime Engine(如 K8s 集群名称与类型),建议后续在 /api/v1/metadata 增加只读展示,方便排障确认 Engine 是否生效。
  6. 非 HTTPS 剪贴板不可用 & Promise.all 缺少容错与卸载保护

    • ui-vue3/src/views/home/index.vue:288-296 与 ui-vue3/src/views/resources/services/tabs/debug.vue:558-566 直接调用 navigator.clipboard.writeText,在内网纯 HTTP 部署下 navigator.clipboard 为 undefined 会直接报错(仓库已有 vue-clipboard3 可统一复用);
    • ui-vue3/src/views/home/index.vue:307-327 的 Promise.all 缺少 catch(任一接口失败会丢弃另一成功结果并产生未捕获拒绝),且组件卸载后仍可能执行 renderDonutChart,建议改用 Promise.allSettled 并增加 isUnmounted 守卫。

P2(体验与细节打磨)

  • 主题色冲突:layout/index.vue:269、home/index.vue:401、ConfigPage.vue:232、EventTimeline.vue:236、debug.vue:886 等处激活态背景硬编码为 #e6f7f3,但文字/图标绑定动态 primaryColor,切换其他主题色时会出现视觉割裂,建议改为基于主题色的透明/混色背景。
  • 侧边栏账号浮层:ui-vue3/src/layout/index.vue:38-94 在 <a-menu>(<ul>)内直接嵌套 <div class="pref-menu-row"> 和 <color-picker>,不仅 DOM 语义不规范,点击外部取色弹层时也容易触发 <a-dropdown> 收起,建议改用 a-popover;同时第 40/50 行未拉回用户信息时建议不要硬兜底显示 'admin'。
  • 表单错误提示:ConfigPage.vue:127 中 Ant Design Vue 校验失败对象没有 .message,会弹出 submit failed [form check]: [object Object],建议提取 e?.errorFields?.[0]?.errors?.[0]。
  • 调试页边界:debug.vue 快速切换方法时 loadMethodDetail 建议加请求序号防竞态,void 返回值避免 JSON.stringify(undefined),方法搜索无结果时补充空态提示。
  • 双滚动条遗漏:services/tabs/distribution.vue:127、applications/tabs/service.vue:78、applications/tabs/instance.vue:274 仍保留固定 scrollY,可一并清理。

@sonarqubecloud

sonarqubecloud Bot commented Dec 5, 2026

Copy link
Copy Markdown

@robocanic

Copy link
Copy Markdown
Contributor Author

@AsperforMias 已在提交 441956ab 中完成本轮 Review 涉及的全部 P0 / P1 / P2 修复,逐条同步如下:

P0

  1. 服务场景配置切页同步与数据加载:ConfigPage.vue 改为显式支持 v-model:activeIndex 并触发 change 事件;sceneConfig.vue 绑定 activeIndex 监听切页,确保切换至 retryNum、sameAreaFirst、paramRoute 时均触发后端配置拉取;补充了 ConfigPage.test.ts 单测。

P1

  1. 总览基础设施外链凭据脱敏:在后端 pkg/console/handler/overview.go 新增 sanitizeMetadataURL,统一剥离 user:pass@ 及敏感 query 参数(password/token/secret/api_key 等)并补充 overview_test.go;前端 views/home/index.vue 外链仅绑定脱敏后的安全 URL,不再输出原始凭据链接。
  2. 事件流筛选与分页交互:EventTimeline.vue 在 hasMore 为 true 时为筛选项计数增加 + 标识;当客户端筛选结果为空且仍有后续分页时,展示明确提示并提供显式「加载更多」按钮,同时保持 footer 可用,避免 IntersectionObserver 不再触发导致卡死;补充了 EventTimeline.test.ts。后端事件接口支持 type 筛选与分类计数作为后续优化跟进。
  3. i18n 补齐:将侧边栏账号浮层、集群总览、事件流、服务调试及场景配置中新增的硬编码中文统一抽入 zh.ts / en.ts,并复用现有 copy / copySuccessfully / reset 等 key。
  4. Mesh 空列表缓存清理:Login.vue 与 layout_header.vue 将判断条件改为 if (resolvedMesh !== meshStore.mesh),当接口返回空列表时自动清空 localStorage 中残留的旧 mesh。
  5. 排除 runtime engine 后的可观测性缺口:确认无 dubboDiscoveryIdentifier 的 Pod 事件对齐与 /api/v1/metadata 展示 Runtime Engine 信息需要独立改动,将单开 Follow-up Issue 跟进,不阻塞本 PR。
  6. 非 HTTPS 剪贴板兼容与总览容错:views/home/index.vue 与 services/tabs/debug.vue 统一改用仓库已有的 vue-clipboard3;总览页请求改用 Promise.allSettled 独立处理各接口结果,并增加 isUnmounted 守卫防止卸载后渲染/泄漏 G2 图表实例。

P2

  • 主题色冲突:将 5 个文件共 7 处硬编码的 #e6f7f3 替换为 color-mix(in srgb, v-bind('primaryColor') 12%, #ffffff)。
  • 侧边栏账号浮层:layout/index.vue 改用 <a-popover> 替代在 <a-menu> 内嵌非菜单节点,并移除未拉回用户信息时的 'admin' 硬兜底。
  • 表单校验错误提示:ConfigPage.vue 改为提取 e?.errorFields?.[0]?.errors?.[0],避免弹出 [object Object]。
  • 调试页边界:debug.vue 增加 detailRequestSeq 防止快速切方法竞态,对 void/undefined 返回值做安全格式化,并补充方法搜索无匹配时的空态提示。
  • 残留固定 scrollY:一并清理 services/tabs/distribution.vue、applications/tabs/service.vue、applications/tabs/instance.vue 中的固定 scrollY。

验证

  • go test ./pkg/console/handler/... ./pkg/console/router/... 全部通过
  • vitest run(17 个测试文件 / 82 个用例)全部通过
  • prettier --check 及 vite build 均通过

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.

🟡 Changes recommended

An unresolved critical redaction bypass can expose credentials through /api/v1/metadata when URLs or query parameters are malformed.

10 open issues
What changed in this PR

Corrects registry selection for Console resources and refreshes the Vue interface, keeping mesh selection aligned with backend resource ownership.

Changes:

  • Filter mesh options, repair stale selections, and add regression tests.
  • Redesign overview, navigation, event, debug, and configuration interfaces.
  • Simplify scrolling, fix form behavior, and redact infrastructure credentials.

Validation was limited to a standalone URL-sanitization check; project tests and browser checks were not run.

File Description
ui-vue3/​src/​views/​traffic/​tagRule/​index.vue Remove fixed table scrolling.
ui-vue3/​src/​views/​traffic/​routingRule/​index.vue Remove fixed table scrolling.
ui-vue3/​src/​views/​resources/​services/​tabs/​sceneConfig.vue Update configuration navigation and route layout.
ui-vue3/​src/​views/​resources/​services/​tabs/​paramRoute.vue Make routing cards responsive.
ui-vue3/​src/​views/​resources/​services/​tabs/​event.vue Use the selected mesh directly.
ui-vue3/​src/​views/​resources/​services/​tabs/​distribution.vue Remove fixed table scrolling.
ui-vue3/​src/​views/​resources/​services/​tabs/​debug.vue Rebuild the service debug workbench.
ui-vue3/​src/​views/​resources/​services/​search.vue Remove fixed table scrolling.
ui-vue3/​src/​views/​resources/​instances/​tabs/​event.vue Use the selected mesh directly.
ui-vue3/​src/​views/​resources/​instances/​tabs/​configuration.vue Correct traffic-disable reset behavior.
ui-vue3/​src/​views/​resources/​instances/​index.vue Remove fixed table scrolling.
ui-vue3/​src/​views/​resources/​applications/​tabs/​service.vue Remove nested table scrolling.
ui-vue3/​src/​views/​resources/​applications/​tabs/​instance.vue Remove nested table scrolling.
ui-vue3/​src/​views/​resources/​applications/​tabs/​event.vue Use the selected mesh directly.
ui-vue3/​src/​views/​resources/​applications/​tabs/​config.vue Restyle rule cards and scope editors.
ui-vue3/​src/​views/​resources/​applications/​index.vue Remove fixed table scrolling.
ui-vue3/​src/​views/​home/​index.vue Refresh charts, resource links, and metadata display.
ui-vue3/​src/​stores/​mesh.ts Add active-mesh resolution.
ui-vue3/​src/​stores/​mesh.test.ts Test mesh-selection fallback behavior.
ui-vue3/​src/​Login.vue Resolve stale mesh selections after login.
ui-vue3/​src/​layout/​tab/​layout_tab.vue Adjust page height by tab layout.
ui-vue3/​src/​layout/​index.vue Move account preferences into the sidebar.
ui-vue3/​src/​layout/​header/​layout_header.vue Simplify navigation and resolve mesh selection.
ui-vue3/​src/​components/​SearchTable.vue Omit unspecified scroll dimensions.
ui-vue3/​src/​components/​EventTimeline.vue Add compact event layout and severity filters.
ui-vue3/​src/​components/​EventTimeline.test.ts Test filtered-event pagination access.
ui-vue3/​src/​components/​ConfigPage.vue Refresh configuration layout and submission handling.
ui-vue3/​src/​components/​ConfigPage.test.ts Test tab events and validation failures.
ui-vue3/​src/​base/​i18n/​zh.ts Add Chinese labels and placeholders.
ui-vue3/​src/​base/​i18n/​en.ts Add English labels and placeholders.
pkg/​console/​handler/​overview.go Redact credentials from metadata URLs.
pkg/​console/​handler/​overview_test.go Test metadata credential redaction.
pkg/​console/​handler/​mesh.go Prefer discovery meshes over runtime engines.
pkg/​console/​handler/​mesh_test.go Test discovery selection and engine fallback.

Review effort: Max

Comment on lines +81 to +109
func sanitizeMetadataURL(raw string) string {
trimmed := strings.TrimSpace(raw)
if trimmed == "" {
return ""
}
parsed, err := url.Parse(trimmed)
if err != nil {
return trimmed
}
if parsed.User != nil {
if _, hasPassword := parsed.User.Password(); hasPassword {
parsed.User = nil
}
}
if parsed.RawQuery != "" {
query := parsed.Query()
changed := false
for key := range query {
if isSensitiveQueryKey(key) {
query.Del(key)
changed = true
}
}
if changed {
parsed.RawQuery = query.Encode()
}
}
return parsed.String()
}
// Include the engine as a mesh so K8s resources are discoverable in the UI
engineCfg := ctx.Config().Engine
if engineCfg != nil && engineCfg.Type != enginecfg.Mock {
if len(meshes) == 0 && engineCfg != nil && engineCfg.Type != enginecfg.Mock {
Metadata: sanitizeMetadataURL(metadataAddr),
Config: sanitizeMetadataURL(configAddr),
Prometheus: sanitizeMetadataURL(prometheusURL),
Grafana: sanitizeMetadataURL(grafanaURL),
Comment on lines +164 to +165
await cur.submit(cur.form)
message.success('submit success')
Comment on lines +148 to +150
appCount: 0,
serviceCount: 0,
insCount: 0
background: #ffffff;
border: 1px solid #eef0f4;
border-radius: 10px;
overflow: hidden;
Comment on lines +44 to +51
<ul v-else class="method-list" role="listbox" :aria-label="$t('debugDomain.methodList')">
<li v-for="entry in filteredMethods" :key="entry.key">
<button
type="button"
class="method-item"
:class="{ active: activeKey === entry.key }"
:title="entry.method.signature || entry.method.methodName"
:aria-selected="activeKey === entry.key"
</span>
</div>
<monaco-editor
v-else
}

async function loadMethodDetail(method: MethodSummary) {
const reqSeq = ++detailRequestSeq
<template #extra>
<a-button danger type="text" size="small" @click="emit('deleteParamRoute', props.index)">
<DeleteOutlined />
删除
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.

3 participants