grafana/public/app/features/org/OrgProfile.tsx
Tobias Skarhed d3299796f5
Migration: Settings forms (#24741)
* Migrate shared preferences

* Remove unused import

* Migrate org name form

* Update TeamSettings

* Convert user settings

* Fix inital default values

* Update snapshots

* Fix CI errors

* Fix failing Ci

* Update snapshots

* Large spacing

* Move use Form for OrgSettings and add FieldSet

* Remove snapshots

* Add snapshots

* Remove unused prop
2020-06-24 10:55:39 +02:00

30 lines
762 B
TypeScript

import React, { FC } from 'react';
import { Input, Field, FieldSet, Button, Form } from '@grafana/ui';
export interface Props {
orgName: string;
onSubmit: (orgName: string) => void;
}
interface FormDTO {
orgName: string;
}
const OrgProfile: FC<Props> = ({ onSubmit, orgName }) => {
return (
<Form defaultValues={{ orgName }} onSubmit={({ orgName }: FormDTO) => onSubmit(orgName)}>
{({ register }) => (
<FieldSet label="Organization profile">
<Field label="Organization name">
<Input name="orgName" type="text" ref={register({ required: true })} />
</Field>
<Button type="submit">Update organization name</Button>
</FieldSet>
)}
</Form>
);
};
export default OrgProfile;