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} 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"> <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}> <SortableItem key={node.id} id={node.id}>
{(listeners) => ( {(listeners) => (
<Card <Card
@@ -1135,7 +1138,7 @@ export default function NodePage() {
</h3> </h3>
</div> </div>
<div className="flex items-center gap-1.5 ml-2"> <div className="flex items-center gap-1.5 ml-2">
{node.isRemote === 1 && ( {isRemoteNode && (
<Chip <Chip
className="text-xs" className="text-xs"
color="secondary" color="secondary"
@@ -1215,6 +1218,8 @@ export default function NodePage() {
)} )}
</div> </div>
</div> </div>
{!isRemoteNode && (
<>
<div className="flex justify-between text-sm"> <div className="flex justify-between text-sm">
<span className="text-default-600">版本</span> <span className="text-default-600">版本</span>
<span className="text-xs"> <span className="text-xs">
@@ -1230,8 +1235,12 @@ export default function NodePage() {
: "-"} : "-"}
</span> </span>
</div> </div>
</>
)}
</div> </div>
{!isRemoteNode && (
<>
{/* 系统监控 */} {/* 系统监控 */}
<div className="space-y-3 mb-4"> <div className="space-y-3 mb-4">
<div className="grid grid-cols-2 gap-3"> <div className="grid grid-cols-2 gap-3">
@@ -1346,14 +1355,17 @@ export default function NodePage() {
</div> </div>
</div> </div>
</div> </div>
</>
)}
{/* 操作按钮 */} {/* 操作按钮 */}
<div className="space-y-1.5"> <div className="space-y-1.5">
<div className="flex gap-1.5"> <div className="flex gap-1.5">
{!isRemoteNode && (
<>
<Button <Button
className="flex-1 min-h-8" className="flex-1 min-h-8"
color="success" color="success"
isDisabled={node.isRemote === 1}
isLoading={node.copyLoading} isLoading={node.copyLoading}
size="sm" size="sm"
variant="flat" variant="flat"
@@ -1364,15 +1376,16 @@ export default function NodePage() {
<Button <Button
className="flex-1 min-h-8" className="flex-1 min-h-8"
color="primary" color="primary"
isDisabled={node.isRemote === 1}
size="sm" size="sm"
variant="flat" variant="flat"
onPress={() => handleEdit(node)} onPress={() => handleEdit(node)}
> >
编辑 编辑
</Button> </Button>
</>
)}
<Button <Button
className="flex-1 min-h-8" className={`min-h-8 ${isRemoteNode ? "w-full" : "flex-1"}`}
color="danger" color="danger"
size="sm" size="sm"
variant="flat" variant="flat"
@@ -1386,7 +1399,8 @@ export default function NodePage() {
</Card> </Card>
)} )}
</SortableItem> </SortableItem>
))} );
})}
</div> </div>
</SortableContext> </SortableContext>
</DndContext> </DndContext>