2025-12-11 10:40:55 +01:00
|
|
|
/*
|
2026-01-12 15:00:36 +01:00
|
|
|
* Copyright (c) 2026 by Christian Kellner.
|
2025-12-11 10:40:55 +01:00
|
|
|
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2026-01-22 16:09:36 +01:00
|
|
|
import { Empty, Table, Button } from '@douyinfe/semi-ui-19';
|
2025-11-26 17:10:42 +01:00
|
|
|
import { IconDelete, IconEdit } from '@douyinfe/semi-icons';
|
2026-01-28 14:27:03 +01:00
|
|
|
import { Typography } from '@douyinfe/semi-ui';
|
2021-01-21 16:09:23 +01:00
|
|
|
|
2025-11-26 17:10:42 +01:00
|
|
|
export default function ProviderTable({ providerData = [], onRemove, onEdit } = {}) {
|
2026-01-28 14:27:03 +01:00
|
|
|
const { Text } = Typography;
|
2021-01-21 16:09:23 +01:00
|
|
|
return (
|
2023-03-20 08:52:13 +01:00
|
|
|
<Table
|
|
|
|
|
pagination={false}
|
2025-08-01 09:51:42 +02:00
|
|
|
empty={<Empty description="No providers found." />}
|
2023-03-20 08:52:13 +01:00
|
|
|
columns={[
|
|
|
|
|
{
|
2025-08-01 09:51:42 +02:00
|
|
|
title: 'Name',
|
2023-03-20 08:52:13 +01:00
|
|
|
dataIndex: 'name',
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-08-01 09:51:42 +02:00
|
|
|
title: 'URL',
|
2023-03-20 08:52:13 +01:00
|
|
|
dataIndex: 'url',
|
|
|
|
|
render: (_, data) => {
|
2026-01-28 14:27:03 +01:00
|
|
|
return <Text link={{ href: data.url, target: '_blank' }}>Open Provider</Text>;
|
2023-03-20 08:52:13 +01:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '',
|
|
|
|
|
dataIndex: 'tools',
|
|
|
|
|
render: (_, record) => {
|
|
|
|
|
return (
|
2021-01-21 16:09:23 +01:00
|
|
|
<div style={{ float: 'right' }}>
|
2025-11-26 17:10:42 +01:00
|
|
|
<Button type="secondary" icon={<IconEdit />} onClick={() => onEdit(record)} />
|
|
|
|
|
<div style={{ display: 'inline-block', width: '16px' }} />
|
2025-07-19 20:10:19 +02:00
|
|
|
<Button type="danger" icon={<IconDelete />} onClick={() => onRemove(record.url)} />
|
2021-01-21 16:09:23 +01:00
|
|
|
</div>
|
2023-03-20 08:52:13 +01:00
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
dataSource={providerData}
|
|
|
|
|
/>
|
2021-01-21 16:09:23 +01:00
|
|
|
);
|
|
|
|
|
}
|