fix(node): hide local-only metrics and actions for remote nodes

This commit is contained in:
sagit
2026-02-10 10:13:36 +00:00
parent 3b697f4d13
commit 5aea281e16
+20 -6
View File
@@ -1114,7 +1114,10 @@ export default function NodePage() {
strategy={rectSortingStrategy}
>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-4">
{sortedNodes.map((node) => (
{sortedNodes.map((node) => {
const isRemoteNode = node.isRemote === 1;
return (
<SortableItem key={node.id} id={node.id}>
{(listeners) => (
<Card
@@ -1135,7 +1138,7 @@ export default function NodePage() {
</h3>
</div>
<div className="flex items-center gap-1.5 ml-2">
{node.isRemote === 1 && (
{isRemoteNode && (
<Chip
className="text-xs"
color="secondary"
@@ -1215,6 +1218,8 @@ export default function NodePage() {
)}
</div>
</div>
{!isRemoteNode && (
<>
<div className="flex justify-between text-sm">
<span className="text-default-600">版本</span>
<span className="text-xs">
@@ -1230,8 +1235,12 @@ export default function NodePage() {
: "-"}
</span>
</div>
</>
)}
</div>
{!isRemoteNode && (
<>
{/* 系统监控 */}
<div className="space-y-3 mb-4">
<div className="grid grid-cols-2 gap-3">
@@ -1346,14 +1355,17 @@ export default function NodePage() {
</div>
</div>
</div>
</>
)}
{/* 操作按钮 */}
<div className="space-y-1.5">
<div className="flex gap-1.5">
{!isRemoteNode && (
<>
<Button
className="flex-1 min-h-8"
color="success"
isDisabled={node.isRemote === 1}
isLoading={node.copyLoading}
size="sm"
variant="flat"
@@ -1364,15 +1376,16 @@ export default function NodePage() {
<Button
className="flex-1 min-h-8"
color="primary"
isDisabled={node.isRemote === 1}
size="sm"
variant="flat"
onPress={() => handleEdit(node)}
>
编辑
</Button>
</>
)}
<Button
className="flex-1 min-h-8"
className={`min-h-8 ${isRemoteNode ? "w-full" : "flex-1"}`}
color="danger"
size="sm"
variant="flat"
@@ -1386,7 +1399,8 @@ export default function NodePage() {
</Card>
)}
</SortableItem>
))}
);
})}
</div>
</SortableContext>
</DndContext>