import Card from "@material-ui/core/Card"; import IconButton from "@material-ui/core/IconButton"; import { createStyles, Theme, withStyles, WithStyles } from "@material-ui/core/styles"; import Table from "@material-ui/core/Table"; import TableBody from "@material-ui/core/TableBody"; import TableCell from "@material-ui/core/TableCell"; import TableFooter from "@material-ui/core/TableFooter"; import TableHead from "@material-ui/core/TableHead"; import TableRow from "@material-ui/core/TableRow"; import EditIcon from "@material-ui/icons/Edit"; import DeleteIcon from "@material-ui/icons/Delete"; import React from "react"; import { useIntl } from "react-intl"; import Skeleton from "@saleor/components/Skeleton"; import TablePagination from "@saleor/components/TablePagination"; import { maybe, renderCollection } from "@saleor/misc"; import { ListProps } from "@saleor/types"; import { Webhooks_webhooks_edges_node } from "../../types/Webhooks"; export interface WebhooksListProps extends ListProps { webhooks: Webhooks_webhooks_edges_node[]; onRemove: (id: string) => void; } const styles = (theme: Theme) => createStyles({ [theme.breakpoints.up("lg")]: { colAction: { "& svg": { color: theme.palette.primary.main }, textAlign: "right" }, colActive: {}, colName: {} }, colAction: {}, colActive: {}, colName: {}, link: { cursor: "pointer" } }); const numberOfColumns = 4; const WebhooksList = withStyles(styles, { name: "PluginList" })( ({ classes, settings, webhooks, disabled, onNextPage, pageInfo, onRowClick, onRemove, onUpdateListSettings, onPreviousPage }: WebhooksListProps & WithStyles) => { const intl = useIntl(); return ( {intl.formatMessage({ defaultMessage: "Name", description: "webhook name" })} {intl.formatMessage({ defaultMessage: "Service Account", description: "webhook service account" })} {intl.formatMessage({ defaultMessage: "Action", description: "user action bar" })} {renderCollection( webhooks, webhook => { return ( {maybe(() => webhook.name, )} {maybe( () => webhook.serviceAccount.name, )}
onRemove(webhook.id) : undefined } >
); }, () => ( {intl.formatMessage({ defaultMessage: "No webhooks found" })} ) )}
); } ); WebhooksList.displayName = "WebhooksList"; export default WebhooksList;