fix: add edit buttons to resource table rows
This commit is contained in:
@@ -363,6 +363,33 @@ export default function K8sResourceList() {
|
||||
<TableCell>{metadata.namespace || '-'}</TableCell>
|
||||
<TableCell>{`${status.readyReplicas || 0}/${spec.replicas || 0}`}</TableCell>
|
||||
<TableCell>{getAge(metadata.creationTimestamp)}</TableCell>
|
||||
<TableCell>
|
||||
<Tooltip title="编辑">
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={() => handleEditResource(metadata.name, metadata.namespace, selectedKind.label)}
|
||||
>
|
||||
<EditIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="查看日志">
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={() => handleViewLogs(metadata.name, metadata.namespace)}
|
||||
>
|
||||
<VisibilityIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="删除">
|
||||
<IconButton
|
||||
size="small"
|
||||
color="error"
|
||||
onClick={() => openDeleteDialog(metadata.name, metadata.namespace)}
|
||||
>
|
||||
<DeleteIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
case 'service':
|
||||
@@ -375,6 +402,25 @@ export default function K8sResourceList() {
|
||||
<TableCell>{spec.externalIPs?.join(', ') || status.loadBalancer?.ingress?.map((i: any) => i.ip || i.hostname).join(', ') || '-'}</TableCell>
|
||||
<TableCell>{spec.ports?.map((p: any) => `${p.port}/${p.protocol}`).join(', ') || '-'}</TableCell>
|
||||
<TableCell>{getAge(metadata.creationTimestamp)}</TableCell>
|
||||
<TableCell>
|
||||
<Tooltip title="编辑">
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={() => handleEditResource(metadata.name, metadata.namespace, selectedKind.label)}
|
||||
>
|
||||
<EditIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="删除">
|
||||
<IconButton
|
||||
size="small"
|
||||
color="error"
|
||||
onClick={() => openDeleteDialog(metadata.name, metadata.namespace)}
|
||||
>
|
||||
<DeleteIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
case 'configmap':
|
||||
@@ -384,6 +430,25 @@ export default function K8sResourceList() {
|
||||
<TableCell>{metadata.namespace || '-'}</TableCell>
|
||||
<TableCell>{Object.keys(resource.data || {}).length}</TableCell>
|
||||
<TableCell>{getAge(metadata.creationTimestamp)}</TableCell>
|
||||
<TableCell>
|
||||
<Tooltip title="编辑">
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={() => handleEditResource(metadata.name, metadata.namespace, selectedKind.label)}
|
||||
>
|
||||
<EditIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="删除">
|
||||
<IconButton
|
||||
size="small"
|
||||
color="error"
|
||||
onClick={() => openDeleteDialog(metadata.name, metadata.namespace)}
|
||||
>
|
||||
<DeleteIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
case 'pod':
|
||||
|
||||
Reference in New Issue
Block a user