The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/org/OrgProfile.tsx

34 lines
963 B

import React 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 = ({ onSubmit, orgName }: Props) => {
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;