2019-09-26 15:33:44 +00:00
|
|
|
import Card from "@material-ui/core/Card";
|
|
|
|
import CardContent from "@material-ui/core/CardContent";
|
|
|
|
import TextField from "@material-ui/core/TextField";
|
|
|
|
import React from "react";
|
|
|
|
import { useIntl } from "react-intl";
|
|
|
|
|
|
|
|
import CardTitle from "@saleor/components/CardTitle";
|
|
|
|
import { FormChange } from "@saleor/hooks/useForm";
|
2020-02-24 14:14:48 +00:00
|
|
|
import { UserError } from "@saleor/types";
|
|
|
|
import { getFieldError } from "@saleor/utils/errors";
|
2019-09-26 15:33:44 +00:00
|
|
|
|
|
|
|
export interface ServiceInfoProps {
|
|
|
|
data: {
|
|
|
|
name: string;
|
|
|
|
};
|
|
|
|
disabled: boolean;
|
2020-02-24 14:14:48 +00:00
|
|
|
errors: UserError[];
|
2019-09-26 15:33:44 +00:00
|
|
|
onChange: FormChange;
|
|
|
|
}
|
|
|
|
|
|
|
|
const ServiceInfo: React.FC<ServiceInfoProps> = props => {
|
|
|
|
const { data, disabled, errors, onChange } = props;
|
|
|
|
const intl = useIntl();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Card>
|
|
|
|
<CardTitle
|
|
|
|
title={intl.formatMessage({
|
|
|
|
defaultMessage: "Service Account Information",
|
|
|
|
description: "header"
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
<CardContent>
|
|
|
|
<TextField
|
|
|
|
disabled={disabled}
|
2020-02-24 14:14:48 +00:00
|
|
|
error={!!getFieldError(errors, "name")}
|
2019-09-26 15:33:44 +00:00
|
|
|
label={intl.formatMessage({
|
|
|
|
defaultMessage: "Account Name",
|
|
|
|
description: "service account"
|
|
|
|
})}
|
2020-02-24 14:14:48 +00:00
|
|
|
helperText={getFieldError(errors, "name")?.message}
|
2019-09-26 15:33:44 +00:00
|
|
|
fullWidth
|
|
|
|
name="name"
|
|
|
|
value={data.name}
|
|
|
|
onChange={onChange}
|
|
|
|
/>
|
|
|
|
</CardContent>
|
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
ServiceInfo.displayName = "ServiceInfo";
|
|
|
|
export default ServiceInfo;
|