mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 21:24:10 +00:00
fix: unify master/worker connected nodes to single a-table
Replace worker's plain HTML table with the same a-table used by master, fixing inconsistencies: missing role column, no error ellipsis, dead-code empty state ternary, and duplicate a-empty elements.
This commit is contained in:
parent
badbbf71f5
commit
61f7956af4
3 changed files with 33 additions and 49 deletions
|
|
@ -1 +1 @@
|
|||
v1.6.6.2
|
||||
v1.6.6.3
|
||||
|
|
|
|||
30
docs/Tasktracking/2026-04-25-unify-nodes-table-style.md
Normal file
30
docs/Tasktracking/2026-04-25-unify-nodes-table-style.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# 2026-04-25 Unify master/worker connected nodes table to a-table
|
||||
|
||||
## Problem
|
||||
|
||||
Worker node used a plain HTML `<table>` to display the connected master node, while master
|
||||
used `<a-table>`. This caused several inconsistencies:
|
||||
- Worker table had no role column, no ellipsis on error column
|
||||
- Worker empty state had dead-code ternary (checking `nodeRole === 'master'` inside a `v-if="nodeRole === 'worker'"` block)
|
||||
- Two separate `<a-empty>` instances with overlapping conditions
|
||||
- 8 lines of CSS (`.node-info-table`, `.node-info-wrap`) only used by the worker table
|
||||
|
||||
## Fix
|
||||
|
||||
Unified both views to a single `<a-table>` using the existing `nodeColumns` definition:
|
||||
- Removed `v-if="nodeRole === 'master'"` so the table renders for both roles
|
||||
- Worker now shows all 7 columns (including role) with proper ellipsis on error
|
||||
- Empty state handled via `<a-table :locale="{ emptyText: ... }">` with role-aware message
|
||||
- Removed unused `.node-info-table` / `.node-info-wrap` CSS
|
||||
- Removed the duplicate `<a-empty>` and the dead-code ternary
|
||||
|
||||
## Safety
|
||||
|
||||
The previous v1.6.6.x fixes are not regressed:
|
||||
- `a-descriptions` tree-shaking issue: not applicable, `<a-table>` is already in the bundle (used by master)
|
||||
- `v-else` on table: removed entirely, no conditional rendering on table element
|
||||
- Self-closing `<a-empty>`: removed worker's `<a-empty>`, empty state is now via table locale prop
|
||||
|
||||
## Files Changed
|
||||
|
||||
- `web/html/nodes.html`: unified to single `<a-table>`, removed plain table + CSS + duplicate empty state
|
||||
|
|
@ -1,14 +1,4 @@
|
|||
{{ template "page/head_start" .}}
|
||||
<style>
|
||||
.node-info-table { width:100%; border-collapse:collapse; }
|
||||
.node-info-table td { padding:8px 12px; border-bottom:1px solid #e8e8e8; }
|
||||
.node-info-table tr:last-child td { border-bottom:none; }
|
||||
.node-info-table .label { font-weight:500; background:#fafafa; width:30%; }
|
||||
.node-info-wrap { border:1px solid #e8e8e8; border-radius:4px; overflow:hidden; }
|
||||
.dark .node-info-wrap { border-color:var(--dark-color-stroke); }
|
||||
.dark .node-info-table td { border-color:var(--dark-color-stroke); color:var(--dark-color-text-primary); }
|
||||
.dark .node-info-table .label { background:var(--dark-color-surface-200); }
|
||||
</style>
|
||||
{{ template "page/head_end" .}}
|
||||
|
||||
{{ template "page/body_start" .}}
|
||||
|
|
@ -37,13 +27,13 @@
|
|||
</a-row>
|
||||
</template>
|
||||
<a-table
|
||||
v-if="nodeRole === 'master'"
|
||||
:columns="nodeColumns"
|
||||
:data-source="nodes"
|
||||
:row-key="record => record.nodeId"
|
||||
:pagination="false"
|
||||
:scroll="isMobile ? { x: 700 } : undefined"
|
||||
size="middle">
|
||||
size="middle"
|
||||
:locale="{ emptyText: nodeRole === 'master' ? '{{ i18n "pages.nodes.noWorkerNodes" }}' : '{{ i18n "pages.nodes.noMasterNode" }}' }">
|
||||
<template slot="status" slot-scope="text, record">
|
||||
<a-badge :status="record.online ? 'success' : 'error'" :text="record.online ? '{{ i18n "pages.nodes.online" }}' : '{{ i18n "pages.nodes.offline" }}'" />
|
||||
</template>
|
||||
|
|
@ -57,42 +47,6 @@
|
|||
[[ record.lastSyncAt ? formatTime(record.lastSyncAt) : '-' ]]
|
||||
</template>
|
||||
</a-table>
|
||||
<div v-if="nodeRole === 'worker'">
|
||||
<a-empty v-if="nodes.length === 0" :description="nodeRole === 'master' ? '{{ i18n "pages.nodes.noWorkerNodes" }}' : '{{ i18n "pages.nodes.noMasterNode" }}'"></a-empty>
|
||||
<div v-if="nodes.length > 0" class="node-info-wrap">
|
||||
<table class="node-info-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="label">{{ i18n "pages.nodes.nodeId" }}</td>
|
||||
<td>[[ nodes[0].nodeId ]]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">{{ i18n "pages.nodes.status" }}</td>
|
||||
<td>
|
||||
<a-badge :status="nodes[0].online ? 'success' : 'error'" :text="nodes[0].online ? '{{ i18n "pages.nodes.online" }}' : '{{ i18n "pages.nodes.offline" }}'" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">{{ i18n "pages.nodes.lastHeartbeat" }}</td>
|
||||
<td>[[ nodes[0].lastHeartbeatAt ? formatTime(nodes[0].lastHeartbeatAt) : '-' ]]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">{{ i18n "pages.nodes.lastSync" }}</td>
|
||||
<td>[[ nodes[0].lastSyncAt ? formatTime(nodes[0].lastSyncAt) : '-' ]]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">{{ i18n "pages.nodes.syncVersion" }}</td>
|
||||
<td>[[ nodes[0].lastSeenVersion ]]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">{{ i18n "pages.nodes.error" }}</td>
|
||||
<td>[[ nodes[0].lastError || '-' ]]</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<a-empty v-if="nodeRole === 'master' && nodes.length === 0" description='{{ i18n "pages.nodes.noWorkerNodes" }}'></a-empty>
|
||||
</a-card>
|
||||
</a-col>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue