list.tsx 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import {
  2. DeleteButton,
  3. EditButton,
  4. List,
  5. ShowButton,
  6. useTable,
  7. } from "@refinedev/antd";
  8. import type { BaseRecord } from "@refinedev/core";
  9. import { Space, Table, Tag, Button, Tooltip, Typography } from "antd";
  10. import { PlusOutlined, ApiOutlined, ForkOutlined, LockOutlined } from '@ant-design/icons';
  11. const { Title } = Typography;
  12. export const BlueprintList = () => {
  13. const { tableProps } = useTable({
  14. syncWithLocation: true,
  15. });
  16. return (
  17. <>
  18. <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 16 }}>
  19. <Title level={4}>Deployment Blueprints</Title>
  20. <Button type="primary" icon={<PlusOutlined />} href="/blueprints/create">
  21. Create New Blueprint
  22. </Button>
  23. </div>
  24. <List>
  25. <Table {...tableProps} rowKey="id">
  26. <Table.Column dataIndex="id" title="ID" />
  27. <Table.Column
  28. dataIndex="name"
  29. title="Name"
  30. />
  31. <Table.Column
  32. dataIndex="description"
  33. title="Description"
  34. />
  35. <Table.Column
  36. dataIndex="version"
  37. title="Version"
  38. />
  39. <Table.Column
  40. title="Components"
  41. render={(_, record: BaseRecord) => (
  42. <Tag color="blue">
  43. {record?.config?.components?.length || 0} Components
  44. </Tag>
  45. )}
  46. />
  47. <Table.Column
  48. title="Network Policies"
  49. render={(_, record: BaseRecord) => (
  50. <Tag color="purple">
  51. {record?.config?.networkPolicies?.length || 0} Policies
  52. </Tag>
  53. )}
  54. />
  55. <Table.Column
  56. title="Actions"
  57. dataIndex="actions"
  58. render={(_, record: BaseRecord) => (
  59. <Space>
  60. <Tooltip title="Deploy">
  61. <Button
  62. type="primary"
  63. size="small"
  64. icon={<ApiOutlined />}
  65. href={`/deployments/create?blueprintId=${record.id}`}
  66. />
  67. </Tooltip>
  68. <Tooltip title="Clone">
  69. <Button
  70. size="small"
  71. icon={<ForkOutlined />}
  72. href={`/blueprints/create?clone=${record.id}`}
  73. />
  74. </Tooltip>
  75. <ShowButton hideText size="small" recordItemId={record.id} />
  76. <EditButton hideText size="small" recordItemId={record.id} />
  77. <DeleteButton hideText size="small" recordItemId={record.id} />
  78. </Space>
  79. )}
  80. />
  81. </Table>
  82. </List>
  83. </>
  84. );
  85. };