Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add trash icon to remove keys

dominik-zeglen6aedca5ac750
diff --git a/saleor/static/dashboard-next/siteSettings/components/SiteSettingsKeys/SiteSettingsKeys.tsx b/saleor/static/dashboard-next/siteSettings/components/SiteSettingsKeys/SiteSettingsKeys.tsx
index aa6f833237..94da6fff0b 100644
--- a/saleor/static/dashboard-next/siteSettings/components/SiteSettingsKeys/SiteSettingsKeys.tsx
+++ b/saleor/static/dashboard-next/siteSettings/components/SiteSettingsKeys/SiteSettingsKeys.tsx
@@ -1,11 +1,13 @@
import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
+import IconButton from "@material-ui/core/IconButton";
import { 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 TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
+import DeleteIcon from "@material-ui/icons/Delete";
import * as React from "react";
import CardTitle from "../../../components/CardTitle";
@@ -22,13 +24,19 @@ interface SiteSettingsKeysProps {
onRowClick: (name: string) => void;
}
-const decorate = withStyles({
+const decorate = withStyles(theme => ({
+ iconCell: {
+ "&:last-child": {
+ paddingRight: 0
+ },
+ width: 48 + theme.spacing.unit / 2
+ },
row: {
cursor: "pointer" as "pointer"
}
-});
+}));
const SiteSettingsKeys = decorate<SiteSettingsKeysProps>(
- ({ classes, disabled, keys, onAdd, onRowClick }) => (
+ ({ classes, disabled, keys, onAdd, onRemove, onRowClick }) => (
<Card>
<CardTitle
title={i18n.t("Authentication Keys", {
@@ -54,6 +62,7 @@ const SiteSettingsKeys = decorate<SiteSettingsKeysProps>(
{i18n.t("Authentication Type", { context: "table header" })}
</TableCell>
<TableCell>{i18n.t("Key", { context: "table header" })}</TableCell>
+ <TableCell />
</TableRow>
</TableHead>
<TableBody>
@@ -76,11 +85,16 @@ const SiteSettingsKeys = decorate<SiteSettingsKeysProps>(
<TableCell>
{maybe(() => key.key) ? key.key : <Skeleton />}
</TableCell>
+ <TableCell className={classes.iconCell}>
+ <IconButton onClick={() => onRemove(key.name)}>
+ <DeleteIcon color="secondary" />
+ </IconButton>
+ </TableCell>
</TableRow>
),
() => (
<TableRow>
- <TableCell colSpan={2}>{i18n.t("No keys")}</TableCell>
+ <TableCell colSpan={3}>{i18n.t("No keys")}</TableCell>
</TableRow>
)
)}