grafana/public/app/features/org/OrgProfile.tsx

30 lines
777 B
TypeScript
Raw Normal View History

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;
onSubmit: (orgName: string) => void;
2018-10-25 09:56:49 -05:00
}
interface FormDTO {
orgName: string;
}
const OrgProfile: FC<Props> = ({ onSubmit, orgName }) => {
2018-10-25 09:56:49 -05:00
return (
<Form defaultValues={{ orgName }} onSubmit={({ orgName }: FormDTO) => onSubmit(orgName)}>
{({ register }) => (
<FieldSet label="Organization profile">
<Field label="Organization name">
<Input id="org-name-input" type="text" {...register('orgName', { required: true })} />
</Field>
<Button type="submit">Update organization name</Button>
</FieldSet>
)}
</Form>
2018-10-25 09:56:49 -05:00
);
};
export default OrgProfile;