
* create Apps view * create more app components, generate types and messages * apps refactor, update snapshots * show error message in tooltip when app installation fail * update apps components and view, add apps list to storybook * update defaultMessages * create app details view * update AppListPage with Skeleton component * create app activate/deactivate dialogs, create app details stories * add AppHeader to AppDetailsPage * update defaultMessages * update AppDetails view and components after review * create custom app details view * refactor webhooks * update webhooks fixtures * update WebhookDetailsPage story * update strings * create CustomAppCreate view and components * update AppListPage story * create AppInstall view and page * handle errors in AppInstall view * update defaultMessages * add AppInstallPage to storybook * add status prop to MessageManager * update defaultMessages * remove service account section * remove service account routes * remove as operator from notify status * add notifications for app installations * update styles for deactivated app * update app installations with local storage * update defaultMessages * AppInstall update * dd delete button to ongoin installations table * fix active installations condition * fix error messages in AppsList * update defaultMessages * add iframe to AppDetailsPage * create AppDetailsSettingsPage * install macaw-ui * apps styles clean up * update schema, fixtures * few apps updates * WebhookCreate - fix onBack button name * WebhookCreatePage story update * rename apps table from external to thirdparty * update defaultMessages * fix test, update snapshots * AppDetailsSettings - add token to headers * fix first number in local apps query * app details settings - use shop domain host * add onSettingsRowClick to InstalledApps * resolve conflicts * update changelog and messages * add noopener noreferrer do app privacy link * update snapshots * update snapshots * updates after review * update defaultMessages * CustomAppDetails - add missing notify status
104 lines
3.4 KiB
TypeScript
104 lines
3.4 KiB
TypeScript
import Button from "@material-ui/core/Button";
|
|
import Card from "@material-ui/core/Card";
|
|
import IconButton from "@material-ui/core/IconButton";
|
|
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 CardTitle from "@saleor/components/CardTitle";
|
|
import ResponsiveTable from "@saleor/components/ResponsiveTable";
|
|
import Skeleton from "@saleor/components/Skeleton";
|
|
import { renderCollection } from "@saleor/misc";
|
|
import React from "react";
|
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
|
|
import { AppUpdate_appUpdate_app_tokens } from "../../types/AppUpdate";
|
|
import { useStyles } from "./styles";
|
|
|
|
export interface CustomAppTokensProps {
|
|
tokens: Array<AppUpdate_appUpdate_app_tokens | null> | null;
|
|
onCreate: () => void;
|
|
onDelete: (id: string) => void;
|
|
}
|
|
|
|
const numberOfColumns = 3;
|
|
|
|
const CustomAppTokens: React.FC<CustomAppTokensProps> = props => {
|
|
const { tokens, onCreate, onDelete } = props;
|
|
const classes = useStyles(props);
|
|
const intl = useIntl();
|
|
|
|
return (
|
|
<Card>
|
|
<CardTitle
|
|
title={intl.formatMessage({
|
|
defaultMessage: "Tokens",
|
|
description: "header"
|
|
})}
|
|
toolbar={
|
|
<Button color="primary" onClick={onCreate}>
|
|
<FormattedMessage
|
|
defaultMessage="Create Token"
|
|
description="button"
|
|
/>
|
|
</Button>
|
|
}
|
|
/>
|
|
<ResponsiveTable>
|
|
<TableHead>
|
|
<TableRow>
|
|
<TableCell className={classes.colNote}>
|
|
<FormattedMessage defaultMessage="Token Note" />
|
|
</TableCell>
|
|
<TableCell className={classes.colKey}>
|
|
<FormattedMessage
|
|
defaultMessage="Key"
|
|
description="custom app token key"
|
|
/>
|
|
</TableCell>
|
|
<TableCell className={classes.colActions}>
|
|
<FormattedMessage
|
|
defaultMessage="Actions"
|
|
description="table actions"
|
|
/>
|
|
</TableCell>
|
|
</TableRow>
|
|
</TableHead>
|
|
<TableBody>
|
|
{renderCollection(
|
|
tokens,
|
|
token => (
|
|
<TableRow key={token ? token.id : "skeleton"}>
|
|
<TableCell className={classes.colNote}>
|
|
{token?.name || <Skeleton />}
|
|
</TableCell>
|
|
<TableCell className={classes.colKey}>
|
|
{token?.authToken ? `**** ${token.authToken}` : <Skeleton />}
|
|
</TableCell>
|
|
<TableCell className={classes.colActions}>
|
|
<IconButton
|
|
color="primary"
|
|
onClick={() => onDelete(token.id)}
|
|
>
|
|
<DeleteIcon />
|
|
</IconButton>
|
|
</TableCell>
|
|
</TableRow>
|
|
),
|
|
() => (
|
|
<TableRow>
|
|
<TableCell colSpan={numberOfColumns}>
|
|
<FormattedMessage defaultMessage="No tokens found" />
|
|
</TableCell>
|
|
</TableRow>
|
|
)
|
|
)}
|
|
</TableBody>
|
|
</ResponsiveTable>
|
|
</Card>
|
|
);
|
|
};
|
|
|
|
CustomAppTokens.displayName = "CustomAppTokens";
|
|
export default CustomAppTokens;
|