fix: replace v-else with v-if on node info table

v-else on <table> element was not recognized by Vue template compiler,
causing the worker node info table to never render. Use v-if="nodes.length > 0"
instead to ensure the table renders when data is available.
This commit is contained in:
root 2026-04-25 09:49:32 +08:00
parent 71f1de0b3d
commit 5bf2b5ef88

View file

@ -49,36 +49,38 @@
</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" }}'" />
<table v-else class="ant-descriptions-table" style="width:100%;border-collapse:collapse;">
<tbody>
<tr style="border-bottom:1px solid #e8e8e8;">
<td style="padding:8px 12px;font-weight:500;background:#fafafa;width:30%;">{{ i18n "pages.nodes.nodeId" }}</td>
<td style="padding:8px 12px;">[[ nodes[0].nodeId ]]</td>
</tr>
<tr style="border-bottom:1px solid #e8e8e8;">
<td style="padding:8px 12px;font-weight:500;background:#fafafa;">{{ i18n "pages.nodes.status" }}</td>
<td style="padding:8px 12px;">
<a-badge :status="nodes[0].online ? 'success' : 'error'" :text="nodes[0].online ? '{{ i18n "pages.nodes.online" }}' : '{{ i18n "pages.nodes.offline" }}'" />
</td>
</tr>
<tr style="border-bottom:1px solid #e8e8e8;">
<td style="padding:8px 12px;font-weight:500;background:#fafafa;">{{ i18n "pages.nodes.lastHeartbeat" }}</td>
<td style="padding:8px 12px;">[[ nodes[0].lastHeartbeatAt ? formatTime(nodes[0].lastHeartbeatAt) : '-' ]]</td>
</tr>
<tr style="border-bottom:1px solid #e8e8e8;">
<td style="padding:8px 12px;font-weight:500;background:#fafafa;">{{ i18n "pages.nodes.lastSync" }}</td>
<td style="padding:8px 12px;">[[ nodes[0].lastSyncAt ? formatTime(nodes[0].lastSyncAt) : '-' ]]</td>
</tr>
<tr style="border-bottom:1px solid #e8e8e8;">
<td style="padding:8px 12px;font-weight:500;background:#fafafa;">{{ i18n "pages.nodes.syncVersion" }}</td>
<td style="padding:8px 12px;">[[ nodes[0].lastSeenVersion ]]</td>
</tr>
<tr>
<td style="padding:8px 12px;font-weight:500;background:#fafafa;">{{ i18n "pages.nodes.error" }}</td>
<td style="padding:8px 12px;">[[ nodes[0].lastError || '-' ]]</td>
</tr>
</tbody>
</table>
<div v-if="nodes.length > 0" style="border:1px solid #e8e8e8;border-radius:4px;overflow:hidden;">
<table style="width:100%;border-collapse:collapse;">
<tbody>
<tr style="border-bottom:1px solid #e8e8e8;">
<td style="padding:8px 12px;font-weight:500;background:#fafafa;width:30%;">{{ i18n "pages.nodes.nodeId" }}</td>
<td style="padding:8px 12px;">[[ nodes[0].nodeId ]]</td>
</tr>
<tr style="border-bottom:1px solid #e8e8e8;">
<td style="padding:8px 12px;font-weight:500;background:#fafafa;">{{ i18n "pages.nodes.status" }}</td>
<td style="padding:8px 12px;">
<a-badge :status="nodes[0].online ? 'success' : 'error'" :text="nodes[0].online ? '{{ i18n "pages.nodes.online" }}' : '{{ i18n "pages.nodes.offline" }}'" />
</td>
</tr>
<tr style="border-bottom:1px solid #e8e8e8;">
<td style="padding:8px 12px;font-weight:500;background:#fafafa;">{{ i18n "pages.nodes.lastHeartbeat" }}</td>
<td style="padding:8px 12px;">[[ nodes[0].lastHeartbeatAt ? formatTime(nodes[0].lastHeartbeatAt) : '-' ]]</td>
</tr>
<tr style="border-bottom:1px solid #e8e8e8;">
<td style="padding:8px 12px;font-weight:500;background:#fafafa;">{{ i18n "pages.nodes.lastSync" }}</td>
<td style="padding:8px 12px;">[[ nodes[0].lastSyncAt ? formatTime(nodes[0].lastSyncAt) : '-' ]]</td>
</tr>
<tr style="border-bottom:1px solid #e8e8e8;">
<td style="padding:8px 12px;font-weight:500;background:#fafafa;">{{ i18n "pages.nodes.syncVersion" }}</td>
<td style="padding:8px 12px;">[[ nodes[0].lastSeenVersion ]]</td>
</tr>
<tr>
<td style="padding:8px 12px;font-weight:500;background:#fafafa;">{{ i18n "pages.nodes.error" }}</td>
<td style="padding:8px 12px;">[[ nodes[0].lastError || '-' ]]</td>
</tr>
</tbody>
</table>
</div>
</div>
<a-empty v-if="nodeRole === 'master' && nodes.length === 0" description='{{ i18n "pages.nodes.noWorkerNodes" }}' />
</a-card>