Commit 2e58a65e by Tobias Skarhed Committed by GitHub

Forms migration: Remove Input from Forms namespace (#23301)

parent c7ffc119
import { Controller as InputControl } from 'react-hook-form'; import { Controller as InputControl } from 'react-hook-form';
import { getFormStyles } from './getFormStyles'; import { getFormStyles } from './getFormStyles';
import { Label } from './Label'; import { Label } from './Label';
// To be removed
import { Input } from './Input/Input'; import { Input } from './Input/Input';
import { RadioButtonGroup } from './RadioButtonGroup/RadioButtonGroup'; import { RadioButtonGroup } from './RadioButtonGroup/RadioButtonGroup';
import { Form } from './Form'; import { Form } from './Form';
...@@ -15,6 +16,7 @@ const Forms = { ...@@ -15,6 +16,7 @@ const Forms = {
Switch, Switch,
getFormStyles, getFormStyles,
Label, Label,
// To be removed
Input, Input,
Form, Form,
Field, Field,
......
...@@ -5,7 +5,7 @@ import { ...@@ -5,7 +5,7 @@ import {
toFloatOrUndefined, toFloatOrUndefined,
NumberFieldConfigSettings, NumberFieldConfigSettings,
} from '@grafana/data'; } from '@grafana/data';
import Forms from '../Forms'; import { Input } from '../Forms/Input/Input';
export const NumberValueEditor: React.FC<FieldConfigEditorProps<number, NumberFieldConfigSettings>> = ({ export const NumberValueEditor: React.FC<FieldConfigEditorProps<number, NumberFieldConfigSettings>> = ({
value, value,
...@@ -14,7 +14,7 @@ export const NumberValueEditor: React.FC<FieldConfigEditorProps<number, NumberFi ...@@ -14,7 +14,7 @@ export const NumberValueEditor: React.FC<FieldConfigEditorProps<number, NumberFi
}) => { }) => {
const { settings } = item; const { settings } = item;
return ( return (
<Forms.Input <Input
value={isNaN(value) ? '' : value} value={isNaN(value) ? '' : value}
min={settings?.min} min={settings?.min}
max={settings?.max} max={settings?.max}
......
import React from 'react'; import React from 'react';
import { FieldConfigEditorProps, StringFieldConfigSettings } from '@grafana/data'; import { FieldConfigEditorProps, StringFieldConfigSettings } from '@grafana/data';
import Forms from '../Forms'; import { Input } from '../Forms/Input/Input';
export const StringValueEditor: React.FC<FieldConfigEditorProps<string, StringFieldConfigSettings>> = ({ export const StringValueEditor: React.FC<FieldConfigEditorProps<string, StringFieldConfigSettings>> = ({
value, value,
...@@ -8,7 +8,7 @@ export const StringValueEditor: React.FC<FieldConfigEditorProps<string, StringFi ...@@ -8,7 +8,7 @@ export const StringValueEditor: React.FC<FieldConfigEditorProps<string, StringFi
item, item,
}) => { }) => {
return ( return (
<Forms.Input <Input
placeholder={item.settings?.placeholder} placeholder={item.settings?.placeholder}
value={value || ''} value={value || ''}
onChange={e => onChange(e.currentTarget.value)} onChange={e => onChange(e.currentTarget.value)}
......
...@@ -4,6 +4,7 @@ import { stringToDateTimeType, isValidTimeString } from '../time'; ...@@ -4,6 +4,7 @@ import { stringToDateTimeType, isValidTimeString } from '../time';
import { mapStringsToTimeRange } from './mapper'; import { mapStringsToTimeRange } from './mapper';
import { TimePickerCalendar } from './TimePickerCalendar'; import { TimePickerCalendar } from './TimePickerCalendar';
import Forms from '../../Forms'; import Forms from '../../Forms';
import { Input } from '../../Forms/Input/Input';
import { Button } from '../../Button'; import { Button } from '../../Button';
interface Props { interface Props {
...@@ -66,7 +67,7 @@ export const TimeRangeForm: React.FC<Props> = props => { ...@@ -66,7 +67,7 @@ export const TimeRangeForm: React.FC<Props> = props => {
return ( return (
<> <>
<Forms.Field label="From" invalid={from.invalid} error={errorMessage}> <Forms.Field label="From" invalid={from.invalid} error={errorMessage}>
<Forms.Input <Input
onClick={event => event.stopPropagation()} onClick={event => event.stopPropagation()}
onFocus={onFocus} onFocus={onFocus}
onChange={event => setFrom(eventToState(event, false, timeZone))} onChange={event => setFrom(eventToState(event, false, timeZone))}
...@@ -75,7 +76,7 @@ export const TimeRangeForm: React.FC<Props> = props => { ...@@ -75,7 +76,7 @@ export const TimeRangeForm: React.FC<Props> = props => {
/> />
</Forms.Field> </Forms.Field>
<Forms.Field label="To" invalid={to.invalid} error={errorMessage}> <Forms.Field label="To" invalid={to.invalid} error={errorMessage}>
<Forms.Input <Input
onClick={event => event.stopPropagation()} onClick={event => event.stopPropagation()}
onFocus={onFocus} onFocus={onFocus}
onChange={event => setTo(eventToState(event, true, timeZone))} onChange={event => setTo(eventToState(event, true, timeZone))}
......
...@@ -2,6 +2,7 @@ import React, { ChangeEvent } from 'react'; ...@@ -2,6 +2,7 @@ import React, { ChangeEvent } from 'react';
import { HorizontalGroup } from '../Layout/Layout'; import { HorizontalGroup } from '../Layout/Layout';
import { Select } from '../index'; import { Select } from '../index';
import Forms from '../Forms'; import Forms from '../Forms';
import { Input } from '../Forms/Input/Input';
import { MappingType, RangeMap, ValueMap, ValueMapping } from '@grafana/data'; import { MappingType, RangeMap, ValueMap, ValueMapping } from '@grafana/data';
import * as styleMixins from '../../themes/mixins'; import * as styleMixins from '../../themes/mixins';
import { useTheme } from '../../themes'; import { useTheme } from '../../themes';
...@@ -48,15 +49,15 @@ export const MappingRow: React.FC<Props> = ({ valueMapping, updateValueMapping, ...@@ -48,15 +49,15 @@ export const MappingRow: React.FC<Props> = ({ valueMapping, updateValueMapping,
<> <>
<HorizontalGroup> <HorizontalGroup>
<Forms.Field label="From"> <Forms.Field label="From">
<Forms.Input type="number" defaultValue={(valueMapping as RangeMap).from!} onBlur={onMappingFromChange} /> <Input type="number" defaultValue={(valueMapping as RangeMap).from!} onBlur={onMappingFromChange} />
</Forms.Field> </Forms.Field>
<Forms.Field label="To"> <Forms.Field label="To">
<Forms.Input type="number" defaultValue={(valueMapping as RangeMap).to} onBlur={onMappingToChange} /> <Input type="number" defaultValue={(valueMapping as RangeMap).to} onBlur={onMappingToChange} />
</Forms.Field> </Forms.Field>
</HorizontalGroup> </HorizontalGroup>
<Forms.Field label="Text"> <Forms.Field label="Text">
<Forms.Input defaultValue={valueMapping.text} onBlur={onMappingTextChange} /> <Input defaultValue={valueMapping.text} onBlur={onMappingTextChange} />
</Forms.Field> </Forms.Field>
</> </>
); );
...@@ -65,11 +66,11 @@ export const MappingRow: React.FC<Props> = ({ valueMapping, updateValueMapping, ...@@ -65,11 +66,11 @@ export const MappingRow: React.FC<Props> = ({ valueMapping, updateValueMapping,
return ( return (
<> <>
<Forms.Field label="Value"> <Forms.Field label="Value">
<Forms.Input type="number" defaultValue={(valueMapping as ValueMap).value} onBlur={onMappingValueChange} /> <Input type="number" defaultValue={(valueMapping as ValueMap).value} onBlur={onMappingValueChange} />
</Forms.Field> </Forms.Field>
<Forms.Field label="Text"> <Forms.Field label="Text">
<Forms.Input defaultValue={valueMapping.text} onBlur={onMappingTextChange} /> <Input defaultValue={valueMapping.text} onBlur={onMappingTextChange} />
</Forms.Field> </Forms.Field>
</> </>
); );
......
...@@ -139,6 +139,8 @@ export { ButtonSelect } from './Select/ButtonSelect'; ...@@ -139,6 +139,8 @@ export { ButtonSelect } from './Select/ButtonSelect';
export { HorizontalGroup, VerticalGroup, Container } from './Layout/Layout'; export { HorizontalGroup, VerticalGroup, Container } from './Layout/Layout';
export { RadioButtonGroup } from './Forms/RadioButtonGroup/RadioButtonGroup'; export { RadioButtonGroup } from './Forms/RadioButtonGroup/RadioButtonGroup';
export { Input } from './Forms/Input/Input';
// Legacy forms // Legacy forms
// Select // Select
......
import React, { FC } from 'react'; import React, { FC } from 'react';
import { escapeStringForRegex, unEscapeStringFromRegex } from '@grafana/data'; import { escapeStringForRegex, unEscapeStringFromRegex } from '@grafana/data';
import { Forms, Icon } from '@grafana/ui'; import { Input, Icon } from '@grafana/ui';
export interface Props { export interface Props {
value: string | undefined; value: string | undefined;
...@@ -11,7 +11,7 @@ export interface Props { ...@@ -11,7 +11,7 @@ export interface Props {
} }
export const FilterInput: FC<Props> = props => ( export const FilterInput: FC<Props> = props => (
<Forms.Input <Input
// Replaces the usage of ref // Replaces the usage of ref
autoFocus autoFocus
prefix={<Icon name="search" />} prefix={<Icon name="search" />}
......
import React, { useCallback } from 'react'; import React, { useCallback } from 'react';
import { hot } from 'react-hot-loader'; import { hot } from 'react-hot-loader';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Forms, Button } from '@grafana/ui'; import { Forms, Button, Input } from '@grafana/ui';
import { NavModel } from '@grafana/data'; import { NavModel } from '@grafana/data';
import { getBackendSrv } from '@grafana/runtime'; import { getBackendSrv } from '@grafana/runtime';
import { StoreState } from '../../types'; import { StoreState } from '../../types';
...@@ -37,15 +37,15 @@ const UserCreatePage: React.FC<UserCreatePageProps> = ({ navModel, updateLocatio ...@@ -37,15 +37,15 @@ const UserCreatePage: React.FC<UserCreatePageProps> = ({ navModel, updateLocatio
return ( return (
<> <>
<Forms.Field label="Name" required invalid={!!errors.name} error={!!errors.name && 'Name is required'}> <Forms.Field label="Name" required invalid={!!errors.name} error={!!errors.name && 'Name is required'}>
<Forms.Input name="name" size="md" ref={register({ required: true })} /> <Input name="name" size="md" ref={register({ required: true })} />
</Forms.Field> </Forms.Field>
<Forms.Field label="E-mail"> <Forms.Field label="E-mail">
<Forms.Input name="email" size="md" ref={register} /> <Input name="email" size="md" ref={register} />
</Forms.Field> </Forms.Field>
<Forms.Field label="Username"> <Forms.Field label="Username">
<Forms.Input name="login" size="md" ref={register} /> <Input name="login" size="md" ref={register} />
</Forms.Field> </Forms.Field>
<Forms.Field <Forms.Field
label="Password" label="Password"
...@@ -53,7 +53,7 @@ const UserCreatePage: React.FC<UserCreatePageProps> = ({ navModel, updateLocatio ...@@ -53,7 +53,7 @@ const UserCreatePage: React.FC<UserCreatePageProps> = ({ navModel, updateLocatio
invalid={!!errors.password} invalid={!!errors.password}
error={!!errors.password && 'Password is required and must contain at least 4 characters'} error={!!errors.password && 'Password is required and must contain at least 4 characters'}
> >
<Forms.Input <Input
size="md" size="md"
type="password" type="password"
name="password" name="password"
......
...@@ -3,7 +3,7 @@ import { css, cx } from 'emotion'; ...@@ -3,7 +3,7 @@ import { css, cx } from 'emotion';
import { hot } from 'react-hot-loader'; import { hot } from 'react-hot-loader';
import { connect, MapDispatchToProps, MapStateToProps } from 'react-redux'; import { connect, MapDispatchToProps, MapStateToProps } from 'react-redux';
import { NavModel } from '@grafana/data'; import { NavModel } from '@grafana/data';
import { Pagination, Forms, Tooltip, HorizontalGroup, stylesFactory, LinkButton } from '@grafana/ui'; import { Pagination, Tooltip, HorizontalGroup, stylesFactory, LinkButton, Input } from '@grafana/ui';
import { StoreState, UserDTO } from '../../types'; import { StoreState, UserDTO } from '../../types';
import Page from 'app/core/components/Page/Page'; import Page from 'app/core/components/Page/Page';
import { getNavModel } from '../../core/selectors/navModel'; import { getNavModel } from '../../core/selectors/navModel';
...@@ -42,7 +42,7 @@ const UserListAdminPageUnConnected: React.FC<Props> = props => { ...@@ -42,7 +42,7 @@ const UserListAdminPageUnConnected: React.FC<Props> = props => {
<> <>
<div> <div>
<HorizontalGroup justify="space-between"> <HorizontalGroup justify="space-between">
<Forms.Input <Input
size="md" size="md"
type="text" type="text"
placeholder="Search user by login,email or name" placeholder="Search user by login,email or name"
......
...@@ -3,7 +3,7 @@ import { UserDTO } from 'app/types'; ...@@ -3,7 +3,7 @@ import { UserDTO } from 'app/types';
import { cx, css } from 'emotion'; import { cx, css } from 'emotion';
import { config } from 'app/core/config'; import { config } from 'app/core/config';
import { GrafanaTheme } from '@grafana/data'; import { GrafanaTheme } from '@grafana/data';
import { ConfirmButton, ConfirmModal, LegacyInputStatus, Button, stylesFactory, Forms } from '@grafana/ui'; import { ConfirmButton, ConfirmModal, LegacyInputStatus, Button, stylesFactory, Input } from '@grafana/ui';
interface Props { interface Props {
user: UserDTO; user: UserDTO;
...@@ -265,7 +265,7 @@ export class UserProfileRow extends PureComponent<UserProfileRowProps, UserProfi ...@@ -265,7 +265,7 @@ export class UserProfileRow extends PureComponent<UserProfileRowProps, UserProfi
<td className={labelClass}>{label}</td> <td className={labelClass}>{label}</td>
<td className="width-25" colSpan={2}> <td className="width-25" colSpan={2}>
{this.state.editing ? ( {this.state.editing ? (
<Forms.Input <Input
size="md" size="md"
type={inputType} type={inputType}
defaultValue={value} defaultValue={value}
......
import React, { FC, useMemo } from 'react'; import React, { FC, useMemo } from 'react';
import { PanelModel } from '../../state'; import { PanelModel } from '../../state';
import { SelectableValue } from '@grafana/data'; import { SelectableValue } from '@grafana/data';
import { Forms, Select, DataLinksInlineEditor } from '@grafana/ui'; import { Forms, Select, DataLinksInlineEditor, Input } from '@grafana/ui';
import { OptionsGroup } from './OptionsGroup'; import { OptionsGroup } from './OptionsGroup';
import { getPanelLinksVariableSuggestions } from '../../../panel/panellinks/link_srv'; import { getPanelLinksVariableSuggestions } from '../../../panel/panellinks/link_srv';
import { getVariables } from '../../../variables/state/selectors'; import { getVariables } from '../../../variables/state/selectors';
...@@ -24,7 +24,7 @@ export const GeneralPanelOptions: FC<{ ...@@ -24,7 +24,7 @@ export const GeneralPanelOptions: FC<{
<div> <div>
<OptionsGroup title="Panel settings"> <OptionsGroup title="Panel settings">
<Forms.Field label="Panel title"> <Forms.Field label="Panel title">
<Forms.Input defaultValue={panel.title} onBlur={e => onPanelConfigChange('title', e.currentTarget.value)} /> <Input defaultValue={panel.title} onBlur={e => onPanelConfigChange('title', e.currentTarget.value)} />
</Forms.Field> </Forms.Field>
<Forms.Field label="Description" description="Panel description supports markdown and links."> <Forms.Field label="Description" description="Panel description supports markdown and links.">
<Forms.TextArea <Forms.TextArea
......
...@@ -10,8 +10,8 @@ import { ...@@ -10,8 +10,8 @@ import {
TabsBar, TabsBar,
useTheme, useTheme,
Container, Container,
Forms,
Icon, Icon,
Input,
} from '@grafana/ui'; } from '@grafana/ui';
import { DefaultFieldConfigEditor, OverrideFieldConfigEditor } from './FieldConfigEditor'; import { DefaultFieldConfigEditor, OverrideFieldConfigEditor } from './FieldConfigEditor';
import { AngularPanelOptions } from './AngularPanelOptions'; import { AngularPanelOptions } from './AngularPanelOptions';
...@@ -147,7 +147,7 @@ export const OptionsPaneContent: React.FC<{ ...@@ -147,7 +147,7 @@ export const OptionsPaneContent: React.FC<{
return ( return (
<div className={styles.searchWrapper}> <div className={styles.searchWrapper}>
<div style={{ ...defaultStyles, ...transitionStyles[state] }}> <div style={{ ...defaultStyles, ...transitionStyles[state] }}>
<Forms.Input <Input
className={styles.searchInput} className={styles.searchInput}
type="text" type="text"
prefix={<Icon name="search" />} prefix={<Icon name="search" />}
......
import React, { FC, useState } from 'react'; import React, { FC, useState } from 'react';
import { css } from 'emotion'; import { css } from 'emotion';
import { GrafanaTheme, PanelPlugin, PanelPluginMeta } from '@grafana/data'; import { GrafanaTheme, PanelPlugin, PanelPluginMeta } from '@grafana/data';
import { CustomScrollbar, useTheme, stylesFactory, Forms, Icon } from '@grafana/ui'; import { CustomScrollbar, useTheme, stylesFactory, Icon, Input } from '@grafana/ui';
import { changePanelPlugin } from '../../state/actions'; import { changePanelPlugin } from '../../state/actions';
import { StoreState } from 'app/types'; import { StoreState } from 'app/types';
import { PanelModel } from '../../state/PanelModel'; import { PanelModel } from '../../state/PanelModel';
...@@ -45,7 +45,7 @@ export const VisualizationTabUnconnected: FC<Props> = ({ panel, plugin, changePa ...@@ -45,7 +45,7 @@ export const VisualizationTabUnconnected: FC<Props> = ({ panel, plugin, changePa
return ( return (
<div className={styles.wrapper}> <div className={styles.wrapper}>
<div className={styles.search}> <div className={styles.search}>
<Forms.Input <Input
value={searchQuery} value={searchQuery}
onChange={e => setSearchQuery(e.currentTarget.value)} onChange={e => setSearchQuery(e.currentTarget.value)}
prefix={<Icon name="filter" className={styles.icon} />} prefix={<Icon name="filter" className={styles.icon} />}
......
import React from 'react'; import React from 'react';
import { Button, Forms, HorizontalGroup } from '@grafana/ui'; import { Button, Forms, HorizontalGroup, Input } from '@grafana/ui';
import { DashboardModel, PanelModel } from 'app/features/dashboard/state'; import { DashboardModel, PanelModel } from 'app/features/dashboard/state';
import { FolderPicker } from 'app/core/components/Select/FolderPicker'; import { FolderPicker } from 'app/core/components/Select/FolderPicker';
import { SaveDashboardFormProps } from '../types'; import { SaveDashboardFormProps } from '../types';
...@@ -75,12 +75,7 @@ export const SaveDashboardAsForm: React.FC<SaveDashboardFormProps & { isNew?: bo ...@@ -75,12 +75,7 @@ export const SaveDashboardAsForm: React.FC<SaveDashboardFormProps & { isNew?: bo
{({ register, control, errors }) => ( {({ register, control, errors }) => (
<> <>
<Forms.Field label="Dashboard name" invalid={!!errors.title} error="Dashboard name is required"> <Forms.Field label="Dashboard name" invalid={!!errors.title} error="Dashboard name is required">
<Forms.Input <Input name="title" ref={register({ required: true })} aria-label="Save dashboard title field" autoFocus />
name="title"
ref={register({ required: true })}
aria-label="Save dashboard title field"
autoFocus
/>
</Forms.Field> </Forms.Field>
<Forms.Field label="Folder"> <Forms.Field label="Folder">
<Forms.InputControl <Forms.InputControl
......
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { connect, MapDispatchToProps, MapStateToProps } from 'react-redux'; import { connect, MapDispatchToProps, MapStateToProps } from 'react-redux';
import { NavModel } from '@grafana/data'; import { NavModel } from '@grafana/data';
import { Forms, Button } from '@grafana/ui'; import { Forms, Button, Input } from '@grafana/ui';
import Page from 'app/core/components/Page/Page'; import Page from 'app/core/components/Page/Page';
import { createNewFolder } from '../state/actions'; import { createNewFolder } from '../state/actions';
import { getNavModel } from 'app/core/selectors/navModel'; import { getNavModel } from 'app/core/selectors/navModel';
...@@ -55,7 +55,7 @@ export class NewDashboardsFolder extends PureComponent<Props> { ...@@ -55,7 +55,7 @@ export class NewDashboardsFolder extends PureComponent<Props> {
invalid={!!errors.folderName} invalid={!!errors.folderName}
error={errors.folderName && errors.folderName.message} error={errors.folderName && errors.folderName.message}
> >
<Forms.Input <Input
name="folderName" name="folderName"
ref={register({ ref={register({
required: 'Folder name is required.', required: 'Folder name is required.',
......
...@@ -2,7 +2,7 @@ import React, { FormEvent, PureComponent } from 'react'; ...@@ -2,7 +2,7 @@ import React, { FormEvent, PureComponent } from 'react';
import { connect, MapDispatchToProps, MapStateToProps } from 'react-redux'; import { connect, MapDispatchToProps, MapStateToProps } from 'react-redux';
import { css } from 'emotion'; import { css } from 'emotion';
import { AppEvents, NavModel } from '@grafana/data'; import { AppEvents, NavModel } from '@grafana/data';
import { Button, Forms, stylesFactory } from '@grafana/ui'; import { Button, Forms, stylesFactory, Input } from '@grafana/ui';
import Page from 'app/core/components/Page/Page'; import Page from 'app/core/components/Page/Page';
import { ImportDashboardOverview } from './components/ImportDashboardOverview'; import { ImportDashboardOverview } from './components/ImportDashboardOverview';
import { DashboardFileUpload } from './components/DashboardFileUpload'; import { DashboardFileUpload } from './components/DashboardFileUpload';
...@@ -87,7 +87,7 @@ class DashboardImportUnConnected extends PureComponent<Props> { ...@@ -87,7 +87,7 @@ class DashboardImportUnConnected extends PureComponent<Props> {
invalid={!!errors.gcomDashboard} invalid={!!errors.gcomDashboard}
error={errors.gcomDashboard && errors.gcomDashboard.message} error={errors.gcomDashboard && errors.gcomDashboard.message}
> >
<Forms.Input <Input
size="md" size="md"
name="gcomDashboard" name="gcomDashboard"
placeholder="Grafana.com dashboard url or id" placeholder="Grafana.com dashboard url or id"
......
import React, { FC, useEffect, useState } from 'react'; import React, { FC, useEffect, useState } from 'react';
import { Button, Forms, FormAPI, FormsOnSubmit, HorizontalGroup, FormFieldErrors } from '@grafana/ui'; import { Button, Forms, FormAPI, FormsOnSubmit, HorizontalGroup, FormFieldErrors, Input } from '@grafana/ui';
import { FolderPicker } from 'app/core/components/Select/FolderPicker'; import { FolderPicker } from 'app/core/components/Select/FolderPicker';
import DataSourcePicker from 'app/core/components/Select/DataSourcePicker'; import DataSourcePicker from 'app/core/components/Select/DataSourcePicker';
import { DashboardInput, DashboardInputs, DataSourceInput, ImportDashboardDTO } from '../state/reducers'; import { DashboardInput, DashboardInputs, DataSourceInput, ImportDashboardDTO } from '../state/reducers';
...@@ -43,7 +43,7 @@ export const ImportDashboardForm: FC<Props> = ({ ...@@ -43,7 +43,7 @@ export const ImportDashboardForm: FC<Props> = ({
<> <>
<Forms.Legend>Options</Forms.Legend> <Forms.Legend>Options</Forms.Legend>
<Forms.Field label="Name" invalid={!!errors.title} error={errors.title && errors.title.message}> <Forms.Field label="Name" invalid={!!errors.title} error={errors.title && errors.title.message}>
<Forms.Input <Input
name="title" name="title"
size="md" size="md"
type="text" type="text"
...@@ -72,7 +72,7 @@ export const ImportDashboardForm: FC<Props> = ({ ...@@ -72,7 +72,7 @@ export const ImportDashboardForm: FC<Props> = ({
> >
<> <>
{!uidReset ? ( {!uidReset ? (
<Forms.Input <Input
size="md" size="md"
name="uid" name="uid"
disabled disabled
...@@ -80,7 +80,7 @@ export const ImportDashboardForm: FC<Props> = ({ ...@@ -80,7 +80,7 @@ export const ImportDashboardForm: FC<Props> = ({
addonAfter={!uidReset && <Button onClick={onUidReset}>Change uid</Button>} addonAfter={!uidReset && <Button onClick={onUidReset}>Change uid</Button>}
/> />
) : ( ) : (
<Forms.Input <Input
size="md" size="md"
name="uid" name="uid"
ref={register({ required: true, validate: async (v: string) => await validateUid(v) })} ref={register({ required: true, validate: async (v: string) => await validateUid(v) })}
...@@ -119,7 +119,7 @@ export const ImportDashboardForm: FC<Props> = ({ ...@@ -119,7 +119,7 @@ export const ImportDashboardForm: FC<Props> = ({
invalid={errors.constants && !!errors.constants[index]} invalid={errors.constants && !!errors.constants[index]}
key={constantIndex} key={constantIndex}
> >
<Forms.Input <Input
ref={register({ required: true })} ref={register({ required: true })}
name={`${constantIndex}`} name={`${constantIndex}`}
size="md" size="md"
......
import React, { FC } from 'react'; import React, { FC } from 'react';
import { getBackendSrv } from '@grafana/runtime'; import { getBackendSrv } from '@grafana/runtime';
import Page from 'app/core/components/Page/Page'; import Page from 'app/core/components/Page/Page';
import { Forms, Button } from '@grafana/ui'; import { Forms, Button, Input } from '@grafana/ui';
import { getConfig } from 'app/core/config'; import { getConfig } from 'app/core/config';
import { StoreState } from 'app/types'; import { StoreState } from 'app/types';
import { hot } from 'react-hot-loader'; import { hot } from 'react-hot-loader';
...@@ -58,7 +58,7 @@ export const NewOrgPage: FC<PropsWithState> = ({ navModel }) => { ...@@ -58,7 +58,7 @@ export const NewOrgPage: FC<PropsWithState> = ({ navModel }) => {
invalid={!!errors.name} invalid={!!errors.name}
error={errors.name && errors.name.message} error={errors.name && errors.name.message}
> >
<Forms.Input <Input
size="md" size="md"
placeholder="Org. name" placeholder="Org. name"
name="name" name="name"
......
import React, { FC } from 'react'; import React, { FC } from 'react';
import { Forms, HorizontalGroup, Button, LinkButton } from '@grafana/ui'; import { Forms, HorizontalGroup, Button, LinkButton, Input } from '@grafana/ui';
import { getConfig } from 'app/core/config'; import { getConfig } from 'app/core/config';
import { OrgRole } from 'app/types'; import { OrgRole } from 'app/types';
import { getBackendSrv } from '@grafana/runtime'; import { getBackendSrv } from '@grafana/runtime';
...@@ -54,15 +54,10 @@ export const UserInviteForm: FC<Props> = ({ updateLocation }) => { ...@@ -54,15 +54,10 @@ export const UserInviteForm: FC<Props> = ({ updateLocation }) => {
error={!!errors.loginOrEmail && 'Email or Username is required'} error={!!errors.loginOrEmail && 'Email or Username is required'}
label="Email or Username" label="Email or Username"
> >
<Forms.Input <Input size="md" name="loginOrEmail" placeholder="email@example.com" ref={register({ required: true })} />
size="md"
name="loginOrEmail"
placeholder="email@example.com"
ref={register({ required: true })}
/>
</Forms.Field> </Forms.Field>
<Forms.Field invalid={!!errors.name} label="Name"> <Forms.Field invalid={!!errors.name} label="Name">
<Forms.Input size="md" name="name" placeholder="(optional)" ref={register} /> <Input size="md" name="name" placeholder="(optional)" ref={register} />
</Forms.Field> </Forms.Field>
<Forms.Field invalid={!!errors.role} label="Role"> <Forms.Field invalid={!!errors.role} label="Role">
<Forms.InputControl as={Forms.RadioButtonGroup} control={control} options={roles} name="role" /> <Forms.InputControl as={Forms.RadioButtonGroup} control={control} options={roles} name="role" />
......
import React, { FC } from 'react'; import React, { FC } from 'react';
import { Forms, Button, LinkButton } from '@grafana/ui'; import { Forms, Button, LinkButton, Input } from '@grafana/ui';
import { css } from 'emotion'; import { css } from 'emotion';
import { getConfig } from 'app/core/config'; import { getConfig } from 'app/core/config';
...@@ -66,19 +66,19 @@ export const SignupForm: FC<Props> = props => { ...@@ -66,19 +66,19 @@ export const SignupForm: FC<Props> = props => {
<> <>
{verifyEmailEnabled && ( {verifyEmailEnabled && (
<Forms.Field label="Email verification code (sent to your email)"> <Forms.Field label="Email verification code (sent to your email)">
<Forms.Input name="code" size="md" ref={register} placeholder="Code" /> <Input name="code" size="md" ref={register} placeholder="Code" />
</Forms.Field> </Forms.Field>
)} )}
{!autoAssignOrg && ( {!autoAssignOrg && (
<Forms.Field label="Org. name"> <Forms.Field label="Org. name">
<Forms.Input size="md" name="orgName" placeholder="Org. name" ref={register} /> <Input size="md" name="orgName" placeholder="Org. name" ref={register} />
</Forms.Field> </Forms.Field>
)} )}
<Forms.Field label="Your name"> <Forms.Field label="Your name">
<Forms.Input size="md" name="name" placeholder="(optional)" ref={register} /> <Input size="md" name="name" placeholder="(optional)" ref={register} />
</Forms.Field> </Forms.Field>
<Forms.Field label="Email" invalid={!!errors.email} error={!!errors.email && errors.email.message}> <Forms.Field label="Email" invalid={!!errors.email} error={!!errors.email && errors.email.message}>
<Forms.Input <Input
size="md" size="md"
name="email" name="email"
type="email" type="email"
...@@ -97,7 +97,7 @@ export const SignupForm: FC<Props> = props => { ...@@ -97,7 +97,7 @@ export const SignupForm: FC<Props> = props => {
invalid={!!errors.password} invalid={!!errors.password}
error={!!errors.password && errors.password.message} error={!!errors.password && errors.password.message}
> >
<Forms.Input <Input
size="md" size="md"
name="password" name="password"
type="password" type="password"
......
...@@ -4,7 +4,7 @@ import { connect, MapStateToProps, MapDispatchToProps } from 'react-redux'; ...@@ -4,7 +4,7 @@ import { connect, MapStateToProps, MapDispatchToProps } from 'react-redux';
import { StoreState } from 'app/types'; import { StoreState } from 'app/types';
import { updateLocation } from 'app/core/actions'; import { updateLocation } from 'app/core/actions';
import { UrlQueryValue, getBackendSrv } from '@grafana/runtime'; import { UrlQueryValue, getBackendSrv } from '@grafana/runtime';
import { Forms, Button } from '@grafana/ui'; import { Forms, Button, Input } from '@grafana/ui';
import { useAsync } from 'react-use'; import { useAsync } from 'react-use';
import Page from 'app/core/components/Page/Page'; import Page from 'app/core/components/Page/Page';
import { contextSrv } from 'app/core/core'; import { contextSrv } from 'app/core/core';
...@@ -73,7 +73,7 @@ const SingupInvitedPageUnconnected: FC<DispatchProps & ConnectedProps> = ({ code ...@@ -73,7 +73,7 @@ const SingupInvitedPageUnconnected: FC<DispatchProps & ConnectedProps> = ({ code
{({ register, errors }) => ( {({ register, errors }) => (
<> <>
<Forms.Field invalid={!!errors.email} error={!!errors.email && errors.email.message} label="Email"> <Forms.Field invalid={!!errors.email} error={!!errors.email && errors.email.message} label="Email">
<Forms.Input <Input
size="md" size="md"
placeholder="email@example.com" placeholder="email@example.com"
name="email" name="email"
...@@ -87,14 +87,14 @@ const SingupInvitedPageUnconnected: FC<DispatchProps & ConnectedProps> = ({ code ...@@ -87,14 +87,14 @@ const SingupInvitedPageUnconnected: FC<DispatchProps & ConnectedProps> = ({ code
/> />
</Forms.Field> </Forms.Field>
<Forms.Field invalid={!!errors.name} error={!!errors.name && errors.name.message} label="Name"> <Forms.Field invalid={!!errors.name} error={!!errors.name && errors.name.message} label="Name">
<Forms.Input size="md" placeholder="Name (optional)" name="name" ref={register} /> <Input size="md" placeholder="Name (optional)" name="name" ref={register} />
</Forms.Field> </Forms.Field>
<Forms.Field <Forms.Field
invalid={!!errors.username} invalid={!!errors.username}
error={!!errors.username && errors.username.message} error={!!errors.username && errors.username.message}
label="Username" label="Username"
> >
<Forms.Input <Input
size="md" size="md"
placeholder="Username" placeholder="Username"
name="username" name="username"
...@@ -106,7 +106,7 @@ const SingupInvitedPageUnconnected: FC<DispatchProps & ConnectedProps> = ({ code ...@@ -106,7 +106,7 @@ const SingupInvitedPageUnconnected: FC<DispatchProps & ConnectedProps> = ({ code
error={!!errors.password && errors.password.message} error={!!errors.password && errors.password.message}
label="Password" label="Password"
> >
<Forms.Input <Input
size="md" size="md"
type="password" type="password"
placeholder="Password" placeholder="Password"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment