mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
35 lines
975 B
TypeScript
35 lines
975 B
TypeScript
import React, { FC } from 'react';
|
|
|
|
import { Input, Field, FieldSet, Button, Form } from '@grafana/ui';
|
|
import { contextSrv } from 'app/core/core';
|
|
import { AccessControlAction } from 'app/types';
|
|
|
|
export interface Props {
|
|
orgName: string;
|
|
onSubmit: (orgName: string) => void;
|
|
}
|
|
|
|
interface FormDTO {
|
|
orgName: string;
|
|
}
|
|
|
|
const OrgProfile: FC<Props> = ({ onSubmit, orgName }) => {
|
|
const canWriteOrg = contextSrv.hasPermission(AccessControlAction.OrgsWrite);
|
|
|
|
return (
|
|
<Form defaultValues={{ orgName }} onSubmit={({ orgName }: FormDTO) => onSubmit(orgName)}>
|
|
{({ register }) => (
|
|
<FieldSet label="Organization profile" disabled={!canWriteOrg}>
|
|
<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>
|
|
);
|
|
};
|
|
|
|
export default OrgProfile;
|