2020-06-24 03:55:39 -05:00
|
|
|
import React, { FC } from 'react';
|
|
|
|
import { Input, Field, FieldSet, Button, Form } from '@grafana/ui';
|
2018-10-25 09:56:49 -05:00
|
|
|
|
2018-10-29 07:46:12 -05:00
|
|
|
export interface Props {
|
2018-10-25 09:56:49 -05:00
|
|
|
orgName: string;
|
2020-06-24 03:55:39 -05:00
|
|
|
onSubmit: (orgName: string) => void;
|
2018-10-25 09:56:49 -05:00
|
|
|
}
|
|
|
|
|
2020-06-24 03:55:39 -05:00
|
|
|
interface FormDTO {
|
|
|
|
orgName: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const OrgProfile: FC<Props> = ({ onSubmit, orgName }) => {
|
2018-10-25 09:56:49 -05:00
|
|
|
return (
|
2020-06-24 03:55:39 -05:00
|
|
|
<Form defaultValues={{ orgName }} onSubmit={({ orgName }: FormDTO) => onSubmit(orgName)}>
|
|
|
|
{({ register }) => (
|
|
|
|
<FieldSet label="Organization profile">
|
|
|
|
<Field label="Organization name">
|
2021-10-01 09:58:18 -05:00
|
|
|
<Input id="org-name-input" type="text" {...register('orgName', { required: true })} />
|
2020-06-24 03:55:39 -05:00
|
|
|
</Field>
|
|
|
|
|
|
|
|
<Button type="submit">Update organization name</Button>
|
|
|
|
</FieldSet>
|
|
|
|
)}
|
|
|
|
</Form>
|
2018-10-25 09:56:49 -05:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default OrgProfile;
|