2021-01-21 16:09:23 +01:00
|
|
|
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>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-20 14:21:29 +02:00
|
|
|
const content = (adapterData, onRemove, onEdit) => {
|
2021-01-21 16:09:23 +01:00
|
|
|
return (
|
|
|
|
|
<Fragment>
|
|
|
|
|
{adapterData.map((data) => {
|
|
|
|
|
return (
|
|
|
|
|
<Table.Row key={data.id}>
|
|
|
|
|
<Table.Cell>{data.name}</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
|
|
|
|
<div style={{ float: 'right' }}>
|
2021-05-20 14:21:29 +02:00
|
|
|
<Button circular color="blue" icon="edit" onClick={() => onEdit(data.id)} />
|
2021-01-21 16:09:23 +01:00
|
|
|
<Button circular color="red" icon="trash" onClick={() => onRemove(data.id)} />
|
|
|
|
|
</div>
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Fragment>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-20 14:21:29 +02:00
|
|
|
export default function NotificationAdapterTable({ notificationAdapter = [], onRemove, onEdit } = {}) {
|
2021-01-21 16:09:23 +01:00
|
|
|
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>
|
2021-05-20 14:21:29 +02:00
|
|
|
{notificationAdapter.length === 0 ? emptyTable() : content(notificationAdapter, onRemove, onEdit)}
|
2021-01-21 16:09:23 +01:00
|
|
|
</Table.Body>
|
|
|
|
|
</Table>
|
|
|
|
|
);
|
|
|
|
|
}
|