mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
import React, { Fragment } from 'react';
|
|
|
|
import { Table, Button } from 'semantic-ui-react';
|
|
|
|
const emptyTable = () => {
|
|
return (
|
|
<Table.Row>
|
|
<Table.Cell collapsing colSpan="3" style={{ textAlign: 'center' }}>
|
|
No Data
|
|
</Table.Cell>
|
|
</Table.Row>
|
|
);
|
|
};
|
|
|
|
const content = (adapterData, onRemove, onEdit) => {
|
|
return (
|
|
<Fragment>
|
|
{adapterData.map((data) => {
|
|
return (
|
|
<Table.Row key={data.id}>
|
|
<Table.Cell>{data.name}</Table.Cell>
|
|
<Table.Cell>
|
|
<div style={{ float: 'right' }}>
|
|
<Button circular color="blue" icon="edit" onClick={() => onEdit(data.id)} />
|
|
<Button circular color="red" icon="trash" onClick={() => onRemove(data.id)} />
|
|
</div>
|
|
</Table.Cell>
|
|
</Table.Row>
|
|
);
|
|
})}
|
|
</Fragment>
|
|
);
|
|
};
|
|
|
|
export default function NotificationAdapterTable({ notificationAdapter = [], onRemove, onEdit } = {}) {
|
|
return (
|
|
<Table singleLine inverted>
|
|
<Table.Header>
|
|
<Table.Row>
|
|
<Table.HeaderCell>Notification Adapter Name</Table.HeaderCell>
|
|
<Table.HeaderCell></Table.HeaderCell>
|
|
</Table.Row>
|
|
</Table.Header>
|
|
|
|
<Table.Body>
|
|
{notificationAdapter.length === 0 ? emptyTable() : content(notificationAdapter, onRemove, onEdit)}
|
|
</Table.Body>
|
|
</Table>
|
|
);
|
|
}
|