Form migrations: Final components to LegacyForms (#23707)

* FormField to LegacyForms

* FormLabel to InlineFormLabel

* Move SecretFormField to LeagcyForms
This commit is contained in:
Tobias Skarhed
2020-04-21 11:42:21 +02:00
committed by GitHub
parent b7809918f0
commit 7e4292508f
42 changed files with 155 additions and 138 deletions

View File

@@ -1,6 +1,6 @@
import React, { ChangeEvent, useContext } from 'react'; import React, { ChangeEvent, useContext } from 'react';
import { DataLink, VariableSuggestion, GrafanaTheme } from '@grafana/data'; import { DataLink, VariableSuggestion, GrafanaTheme } from '@grafana/data';
import { FormField } from '../index'; import { FormField } from '../FormField/FormField';
import { Switch } from '../Forms/Legacy/Switch/Switch'; import { Switch } from '../Forms/Legacy/Switch/Switch';
import { css } from 'emotion'; import { css } from 'emotion';
import { ThemeContext, stylesFactory } from '../../themes/index'; import { ThemeContext, stylesFactory } from '../../themes/index';

View File

@@ -4,7 +4,7 @@ import { FormField } from '../FormField/FormField';
import { Button } from '../Button/Button'; import { Button } from '../Button/Button';
import { css, cx } from 'emotion'; import { css, cx } from 'emotion';
interface Props extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onReset'> { export interface Props extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onReset'> {
// Function to use when reset is clicked. Means you have to reset the input value yourself as this is uncontrolled // Function to use when reset is clicked. Means you have to reset the input value yourself as this is uncontrolled
// component (or do something else if required). // component (or do something else if required).
onReset: (event: React.SyntheticEvent<HTMLButtonElement>) => void; onReset: (event: React.SyntheticEvent<HTMLButtonElement>) => void;

View File

@@ -12,11 +12,6 @@ export { ClipboardButton } from './ClipboardButton/ClipboardButton';
export { Cascader, CascaderOption } from './Cascader/Cascader'; export { Cascader, CascaderOption } from './Cascader/Cascader';
export { ButtonCascader } from './ButtonCascader/ButtonCascader'; export { ButtonCascader } from './ButtonCascader/ButtonCascader';
// Forms
export { FormLabel } from './FormLabel/FormLabel';
export { FormField } from './FormField/FormField';
export { SecretFormField } from './SecretFormField/SecretFormField';
export { LoadingPlaceholder } from './LoadingPlaceholder/LoadingPlaceholder'; export { LoadingPlaceholder } from './LoadingPlaceholder/LoadingPlaceholder';
export { ColorPicker, SeriesColorPicker } from './ColorPicker/ColorPicker'; export { ColorPicker, SeriesColorPicker } from './ColorPicker/ColorPicker';
export { SeriesColorPickerPopover, SeriesColorPickerPopoverWithTheme } from './ColorPicker/SeriesColorPickerPopover'; export { SeriesColorPickerPopover, SeriesColorPickerPopoverWithTheme } from './ColorPicker/SeriesColorPickerPopover';
@@ -153,6 +148,9 @@ export { TextArea } from './TextArea/TextArea';
// Legacy forms // Legacy forms
// Export this until we've figured out a good approach to inline form styles.
export { FormLabel as InlineFormLabel } from './FormLabel/FormLabel';
// Select // Select
import { Select, AsyncSelect } from './Forms/Legacy/Select/Select'; import { Select, AsyncSelect } from './Forms/Legacy/Select/Select';
import { IndicatorsContainer } from './Forms/Legacy/Select/IndicatorsContainer'; import { IndicatorsContainer } from './Forms/Legacy/Select/IndicatorsContainer';
@@ -161,10 +159,14 @@ import { ButtonSelect } from './Forms/Legacy/Select/ButtonSelect';
//Input //Input
import { Input, LegacyInputStatus } from './Forms/Legacy/Input/Input'; import { Input, LegacyInputStatus } from './Forms/Legacy/Input/Input';
import { FormField } from './FormField/FormField';
import { SecretFormField } from './SecretFormField/SecretFormField';
import { Switch } from './Forms/Legacy/Switch/Switch'; import { Switch } from './Forms/Legacy/Switch/Switch';
const LegacyForms = { const LegacyForms = {
SecretFormField,
FormField,
Select, Select,
AsyncSelect, AsyncSelect,
IndicatorsContainer, IndicatorsContainer,

View File

@@ -5,7 +5,7 @@ import React, { PureComponent } from 'react';
import { InputDatasource, describeDataFrame } from './InputDatasource'; import { InputDatasource, describeDataFrame } from './InputDatasource';
import { InputQuery, InputOptions } from './types'; import { InputQuery, InputOptions } from './types';
import { FormLabel, LegacyForms, TableInputCSV, Icon } from '@grafana/ui'; import { InlineFormLabel, LegacyForms, TableInputCSV, Icon } from '@grafana/ui';
const { Select } = LegacyForms; const { Select } = LegacyForms;
import { DataFrame, toCSV, SelectableValue, MutableDataFrame, QueryEditorProps } from '@grafana/data'; import { DataFrame, toCSV, SelectableValue, MutableDataFrame, QueryEditorProps } from '@grafana/data';
@@ -69,7 +69,7 @@ export class InputQueryEditor extends PureComponent<Props, State> {
return ( return (
<div> <div>
<div className="gf-form"> <div className="gf-form">
<FormLabel width={4}>Data</FormLabel> <InlineFormLabel width={4}>Data</InlineFormLabel>
<Select width={6} options={options} value={selected} onChange={this.onSourceChange} /> <Select width={6} options={options} value={selected} onChange={this.onSourceChange} />
<div className="btn btn-link"> <div className="btn btn-link">

View File

@@ -13,11 +13,12 @@ import {
DataLinksEditor, DataLinksEditor,
DataSourceHttpSettings, DataSourceHttpSettings,
GraphContextMenu, GraphContextMenu,
SecretFormField,
SeriesColorPickerPopoverWithTheme, SeriesColorPickerPopoverWithTheme,
UnitPicker, UnitPicker,
Icon, Icon,
LegacyForms,
} from '@grafana/ui'; } from '@grafana/ui';
const { SecretFormField } = LegacyForms;
import { FunctionEditor } from 'app/plugins/datasource/graphite/FunctionEditor'; import { FunctionEditor } from 'app/plugins/datasource/graphite/FunctionEditor';
import ReactProfileWrapper from 'app/features/profile/ReactProfileWrapper'; import ReactProfileWrapper from 'app/features/profile/ReactProfileWrapper';
import { LokiAnnotationsQueryEditor } from '../plugins/datasource/loki/components/AnnotationsQueryEditor'; import { LokiAnnotationsQueryEditor } from '../plugins/datasource/loki/components/AnnotationsQueryEditor';

View File

@@ -1,6 +1,6 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { FormLabel, LegacyForms } from '@grafana/ui'; import { InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Select } = LegacyForms; const { Select } = LegacyForms;
import { DashboardSearchHit, DashboardSearchHitType } from 'app/types'; import { DashboardSearchHit, DashboardSearchHitType } from 'app/types';
@@ -126,12 +126,12 @@ export class SharedPreferences extends PureComponent<Props, State> {
/> />
</div> </div>
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
width={11} width={11}
tooltip="Not finding dashboard you want? Star it first, then it should appear in this select box." tooltip="Not finding dashboard you want? Star it first, then it should appear in this select box."
> >
Home Dashboard Home Dashboard
</FormLabel> </InlineFormLabel>
<Select <Select
value={dashboards.find(dashboard => dashboard.id === homeDashboardId)} value={dashboards.find(dashboard => dashboard.id === homeDashboardId)}
getOptionValue={i => i.id} getOptionValue={i => i.id}

View File

@@ -2,7 +2,8 @@ import React, { PureComponent } 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 { NavModel } from '@grafana/data'; import { NavModel } from '@grafana/data';
import { FormField, Alert } from '@grafana/ui'; import { Alert, LegacyForms } from '@grafana/ui';
const { FormField } = LegacyForms;
import { getNavModel } from 'app/core/selectors/navModel'; import { getNavModel } from 'app/core/selectors/navModel';
import config from 'app/core/config'; import config from 'app/core/config';
import Page from 'app/core/components/Page/Page'; import Page from 'app/core/components/Page/Page';

View File

@@ -13,7 +13,14 @@ import ApiKeysAddedModal from './ApiKeysAddedModal';
import config from 'app/core/config'; import config from 'app/core/config';
import appEvents from 'app/core/app_events'; import appEvents from 'app/core/app_events';
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA'; import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
import { DeleteButton, EventsWithValidation, FormLabel, LegacyForms, ValidationEvents, IconButton } from '@grafana/ui'; import {
DeleteButton,
EventsWithValidation,
InlineFormLabel,
LegacyForms,
ValidationEvents,
IconButton,
} from '@grafana/ui';
const { Input, Switch } = LegacyForms; const { Input, Switch } = LegacyForms;
import { dateTime, isDateTime, NavModel } from '@grafana/data'; import { dateTime, isDateTime, NavModel } from '@grafana/data';
import { FilterInput } from 'app/core/components/FilterInput/FilterInput'; import { FilterInput } from 'app/core/components/FilterInput/FilterInput';
@@ -213,7 +220,7 @@ export class ApiKeysPage extends PureComponent<Props, any> {
</span> </span>
</div> </div>
<div className="gf-form max-width-21"> <div className="gf-form max-width-21">
<FormLabel tooltip={tooltipText}>Time to live</FormLabel> <InlineFormLabel tooltip={tooltipText}>Time to live</InlineFormLabel>
<Input <Input
type="text" type="text"
className="gf-form-input" className="gf-form-input"

View File

@@ -1,5 +1,5 @@
import React, { FC, ChangeEvent } from 'react'; import React, { FC, ChangeEvent } from 'react';
import { FormLabel, LegacyForms } from '@grafana/ui'; import { InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Input } = LegacyForms; const { Input } = LegacyForms;
interface Props { interface Props {
@@ -15,7 +15,7 @@ interface Props {
export const DataSourceOption: FC<Props> = ({ label, placeholder, name, value, onBlur, onChange, tooltipInfo }) => { export const DataSourceOption: FC<Props> = ({ label, placeholder, name, value, onBlur, onChange, tooltipInfo }) => {
return ( return (
<div className="gf-form gf-form--flex-end"> <div className="gf-form gf-form--flex-end">
<FormLabel tooltip={tooltipInfo}>{label}</FormLabel> <InlineFormLabel tooltip={tooltipInfo}>{label}</InlineFormLabel>
<Input <Input
type="text" type="text"
className="gf-form-input width-6" className="gf-form-input width-6"

View File

@@ -5,7 +5,7 @@ import React, { PureComponent, ChangeEvent, FocusEvent, ReactText } from 'react'
import { rangeUtil, DataSourceSelectItem } from '@grafana/data'; import { rangeUtil, DataSourceSelectItem } from '@grafana/data';
// Components // Components
import { EventsWithValidation, LegacyInputStatus, LegacyForms, ValidationEvents, FormLabel } from '@grafana/ui'; import { EventsWithValidation, LegacyInputStatus, LegacyForms, ValidationEvents, InlineFormLabel } from '@grafana/ui';
import { DataSourceOption } from './DataSourceOption'; import { DataSourceOption } from './DataSourceOption';
const { Input, Switch } = LegacyForms; const { Input, Switch } = LegacyForms;
@@ -188,7 +188,7 @@ export class QueryOptions extends PureComponent<Props, State> {
{this.renderOptions()} {this.renderOptions()}
<div className="gf-form"> <div className="gf-form">
<FormLabel>Relative time</FormLabel> <InlineFormLabel>Relative time</InlineFormLabel>
<Input <Input
type="text" type="text"
className="width-6" className="width-6"

View File

@@ -1,5 +1,5 @@
import React, { FC } from 'react'; import React, { FC } from 'react';
import { FormLabel, LegacyForms } from '@grafana/ui'; import { InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Input, Switch } = LegacyForms; const { Input, Switch } = LegacyForms;
import { e2e } from '@grafana/e2e'; import { e2e } from '@grafana/e2e';
@@ -15,14 +15,14 @@ const BasicSettings: FC<Props> = ({ dataSourceName, isDefault, onDefaultChange,
<div className="gf-form-group" aria-label="Datasource settings page basic settings"> <div className="gf-form-group" aria-label="Datasource settings page basic settings">
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form max-width-30" style={{ marginRight: '3px' }}> <div className="gf-form max-width-30" style={{ marginRight: '3px' }}>
<FormLabel <InlineFormLabel
tooltip={ tooltip={
'The name is used when you select the data source in panels. The Default data source is ' + 'The name is used when you select the data source in panels. The Default data source is ' +
'preselected in new panels.' 'preselected in new panels.'
} }
> >
Name Name
</FormLabel> </InlineFormLabel>
<Input <Input
className="gf-form-input max-width-23" className="gf-form-input max-width-23"
type="text" type="text"

View File

@@ -1,8 +1,8 @@
// Libraries // Libraries
import React, { PureComponent, ChangeEvent } from 'react'; import React, { PureComponent, ChangeEvent } from 'react';
import { FormLabel, LegacyForms, FormField } from '@grafana/ui'; import { InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Select } = LegacyForms; const { Select, FormField } = LegacyForms;
import { SelectableValue, ReducerID, QueryEditorProps } from '@grafana/data'; import { SelectableValue, ReducerID, QueryEditorProps } from '@grafana/data';
// Types // Types
@@ -131,7 +131,7 @@ export class ExpressionQueryEditor extends PureComponent<Props, State> {
<Select options={gelTypes} value={selected} onChange={this.onSelectGELType} /> <Select options={gelTypes} value={selected} onChange={this.onSelectGELType} />
{query.type === GELQueryType.reduce && ( {query.type === GELQueryType.reduce && (
<> <>
<FormLabel width={5}>Function:</FormLabel> <InlineFormLabel width={5}>Function:</InlineFormLabel>
<Select options={reducerTypes} value={reducer} onChange={this.onSelectReducer} /> <Select options={reducerTypes} value={reducer} onChange={this.onSelectReducer} />
<FormField label="Fields:" labelWidth={5} onChange={this.onExpressionChange} value={query.expression} /> <FormField label="Fields:" labelWidth={5} onChange={this.onExpressionChange} value={query.expression} />
</> </>
@@ -147,9 +147,9 @@ export class ExpressionQueryEditor extends PureComponent<Props, State> {
<FormField label="Rule:" labelWidth={5} onChange={this.onRuleChange} value={query.rule} /> <FormField label="Rule:" labelWidth={5} onChange={this.onRuleChange} value={query.rule} />
</div> </div>
<div> <div>
<FormLabel width={12}>Downsample Function:</FormLabel> <InlineFormLabel width={12}>Downsample Function:</InlineFormLabel>
<Select options={downsamplingTypes} value={downsampler} onChange={this.onSelectDownsampler} /> <Select options={downsamplingTypes} value={downsampler} onChange={this.onSelectDownsampler} />
<FormLabel width={12}>Upsample Function:</FormLabel> <InlineFormLabel width={12}>Upsample Function:</InlineFormLabel>
<Select options={upsamplingTypes} value={upsampler} onChange={this.onSelectUpsampler} /> <Select options={upsamplingTypes} value={upsampler} onChange={this.onSelectUpsampler} />
</div> </div>
</> </>

View File

@@ -1,5 +1,5 @@
import React, { PureComponent, ChangeEvent, MouseEvent } from 'react'; import React, { PureComponent, ChangeEvent, MouseEvent } from 'react';
import { Button, FormLabel, LegacyForms, Tooltip, Icon } from '@grafana/ui'; import { Button, InlineFormLabel, LegacyForms, Tooltip, Icon } from '@grafana/ui';
const { Input } = LegacyForms; const { Input } = LegacyForms;
import { User } from 'app/types'; import { User } from 'app/types';
import config from 'app/core/config'; import config from 'app/core/config';
@@ -59,11 +59,11 @@ export class UserProfileEditForm extends PureComponent<Props, State> {
<h3 className="page-sub-heading">Edit Profile</h3> <h3 className="page-sub-heading">Edit Profile</h3>
<form name="userForm" className="gf-form-group"> <form name="userForm" className="gf-form-group">
<div className="gf-form max-width-30"> <div className="gf-form max-width-30">
<FormLabel className="width-8">Name</FormLabel> <InlineFormLabel className="width-8">Name</InlineFormLabel>
<Input className="gf-form-input max-width-22" type="text" onChange={this.onNameChange} value={name} /> <Input className="gf-form-input max-width-22" type="text" onChange={this.onNameChange} value={name} />
</div> </div>
<div className="gf-form max-width-30"> <div className="gf-form max-width-30">
<FormLabel className="width-8">Email</FormLabel> <InlineFormLabel className="width-8">Email</InlineFormLabel>
<Input <Input
className="gf-form-input max-width-22" className="gf-form-input max-width-22"
type="text" type="text"
@@ -78,7 +78,7 @@ export class UserProfileEditForm extends PureComponent<Props, State> {
)} )}
</div> </div>
<div className="gf-form max-width-30"> <div className="gf-form max-width-30">
<FormLabel className="width-8">Username</FormLabel> <InlineFormLabel className="width-8">Username</InlineFormLabel>
<Input <Input
className="gf-form-input max-width-22" className="gf-form-input max-width-22"
type="text" type="text"

View File

@@ -1,7 +1,8 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import Page from 'app/core/components/Page/Page'; import Page from 'app/core/components/Page/Page';
import { hot } from 'react-hot-loader'; import { hot } from 'react-hot-loader';
import { FormField, Button } from '@grafana/ui'; import { Button, LegacyForms } from '@grafana/ui';
const { FormField } = LegacyForms;
import { NavModel } from '@grafana/data'; import { NavModel } from '@grafana/data';
import { getBackendSrv } from '@grafana/runtime'; import { getBackendSrv } from '@grafana/runtime';
import { updateLocation } from '../../core/actions'; import { updateLocation } from '../../core/actions';

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { FormLabel, LegacyForms } from '@grafana/ui'; import { InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Input } = LegacyForms; const { Input } = LegacyForms;
import { SharedPreferences } from 'app/core/components/SharedPreferences/SharedPreferences'; import { SharedPreferences } from 'app/core/components/SharedPreferences/SharedPreferences';
@@ -52,7 +52,7 @@ export class TeamSettings extends React.Component<Props, State> {
<h3 className="page-sub-heading">Team Settings</h3> <h3 className="page-sub-heading">Team Settings</h3>
<form name="teamDetailsForm" className="gf-form-group" onSubmit={this.onUpdate}> <form name="teamDetailsForm" className="gf-form-group" onSubmit={this.onUpdate}>
<div className="gf-form max-width-30"> <div className="gf-form max-width-30">
<FormLabel>Name</FormLabel> <InlineFormLabel>Name</InlineFormLabel>
<Input <Input
type="text" type="text"
required required
@@ -63,9 +63,9 @@ export class TeamSettings extends React.Component<Props, State> {
</div> </div>
<div className="gf-form max-width-30"> <div className="gf-form max-width-30">
<FormLabel tooltip="This is optional and is primarily used to set the team profile avatar (via gravatar service)"> <InlineFormLabel tooltip="This is optional and is primarily used to set the team profile avatar (via gravatar service)">
Email Email
</FormLabel> </InlineFormLabel>
<Input <Input
type="email" type="email"
className="gf-form-input max-width-22" className="gf-form-input max-width-22"

View File

@@ -3,7 +3,7 @@ import React, { ChangeEvent, FocusEvent, PureComponent } from 'react';
import { DataSourceVariableModel, VariableWithMultiSupport } from '../../templating/types'; import { DataSourceVariableModel, VariableWithMultiSupport } from '../../templating/types';
import { OnPropChangeArguments, VariableEditorProps } from '../editor/types'; import { OnPropChangeArguments, VariableEditorProps } from '../editor/types';
import { SelectionOptionsEditor } from '../editor/SelectionOptionsEditor'; import { SelectionOptionsEditor } from '../editor/SelectionOptionsEditor';
import { FormLabel } from '@grafana/ui'; import { InlineFormLabel } from '@grafana/ui';
import { VariableEditorState } from '../editor/reducer'; import { VariableEditorState } from '../editor/reducer';
import { DataSourceVariableEditorState } from './reducer'; import { DataSourceVariableEditorState } from './reducer';
import { initDataSourceVariableEditor } from './actions'; import { initDataSourceVariableEditor } from './actions';
@@ -87,7 +87,7 @@ export class DataSourceVariableEditorUnConnected extends PureComponent<Props> {
</div> </div>
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
width={12} width={12}
tooltip={ tooltip={
<div> <div>
@@ -100,7 +100,7 @@ export class DataSourceVariableEditorUnConnected extends PureComponent<Props> {
} }
> >
Instance name filter Instance name filter
</FormLabel> </InlineFormLabel>
<input <input
type="text" type="text"
className="gf-form-input max-width-18" className="gf-form-input max-width-18"

View File

@@ -1,7 +1,7 @@
import React, { ChangeEvent, FormEvent, PureComponent } from 'react'; import React, { ChangeEvent, FormEvent, PureComponent } from 'react';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import { AppEvents, VariableType } from '@grafana/data'; import { AppEvents, VariableType } from '@grafana/data';
import { FormLabel } from '@grafana/ui'; import { InlineFormLabel } from '@grafana/ui';
import { e2e } from '@grafana/e2e'; import { e2e } from '@grafana/e2e';
import { variableAdapters } from '../adapters'; import { variableAdapters } from '../adapters';
import { NEW_VARIABLE_ID, toVariablePayload, VariableIdentifier } from '../state/types'; import { NEW_VARIABLE_ID, toVariablePayload, VariableIdentifier } from '../state/types';
@@ -133,9 +133,9 @@ export class VariableEditorEditorUnConnected extends PureComponent<Props> {
/> />
</div> </div>
<div className="gf-form max-width-19"> <div className="gf-form max-width-19">
<FormLabel width={6} tooltip={variableAdapters.get(this.props.variable.type).description}> <InlineFormLabel width={6} tooltip={variableAdapters.get(this.props.variable.type).description}>
Type Type
</FormLabel> </InlineFormLabel>
<div className="gf-form-select-wrapper max-width-17"> <div className="gf-form-select-wrapper max-width-17">
<select <select
className="gf-form-input" className="gf-form-input"

View File

@@ -2,7 +2,7 @@ import React, { ChangeEvent, FocusEvent, PureComponent } from 'react';
import { IntervalVariableModel } from '../../templating/types'; import { IntervalVariableModel } from '../../templating/types';
import { VariableEditorProps } from '../editor/types'; import { VariableEditorProps } from '../editor/types';
import { FormLabel, LegacyForms } from '@grafana/ui'; import { InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Switch } = LegacyForms; const { Switch } = LegacyForms;
export interface Props extends VariableEditorProps<IntervalVariableModel> {} export interface Props extends VariableEditorProps<IntervalVariableModel> {}
@@ -78,12 +78,12 @@ export class IntervalVariableEditor extends PureComponent<Props> {
{this.props.variable.auto && ( {this.props.variable.auto && (
<> <>
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
width={9} width={9}
tooltip={'How many times should the current time range be divided to calculate the value'} tooltip={'How many times should the current time range be divided to calculate the value'}
> >
Step count Step count
</FormLabel> </InlineFormLabel>
<div className="gf-form-select-wrapper max-width-10"> <div className="gf-form-select-wrapper max-width-10">
<select <select
className="gf-form-input" className="gf-form-input"
@@ -99,9 +99,9 @@ export class IntervalVariableEditor extends PureComponent<Props> {
</div> </div>
</div> </div>
<div className="gf-form"> <div className="gf-form">
<FormLabel width={9} tooltip={'The calculated value will not go below this threshold'}> <InlineFormLabel width={9} tooltip={'The calculated value will not go below this threshold'}>
Min interval Min interval
</FormLabel> </InlineFormLabel>
<input <input
type="text" type="text"
className="gf-form-input max-width-10" className="gf-form-input max-width-10"

View File

@@ -1,6 +1,6 @@
import React, { ChangeEvent, PureComponent } from 'react'; import React, { ChangeEvent, PureComponent } from 'react';
import { e2e } from '@grafana/e2e'; import { e2e } from '@grafana/e2e';
import { FormLabel, LegacyForms } from '@grafana/ui'; import { InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Switch } = LegacyForms; const { Switch } = LegacyForms;
import templateSrv from '../../templating/template_srv'; import templateSrv from '../../templating/template_srv';
@@ -145,9 +145,9 @@ export class QueryVariableEditorUnConnected extends PureComponent<Props, State>
</div> </div>
<div className="gf-form max-width-22"> <div className="gf-form max-width-22">
<FormLabel width={10} tooltip={'When to update the values of this variable.'}> <InlineFormLabel width={10} tooltip={'When to update the values of this variable.'}>
Refresh Refresh
</FormLabel> </InlineFormLabel>
<div className="gf-form-select-wrapper width-15"> <div className="gf-form-select-wrapper width-15">
<select <select
className="gf-form-input" className="gf-form-input"
@@ -181,12 +181,12 @@ export class QueryVariableEditorUnConnected extends PureComponent<Props, State>
)} )}
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
width={10} width={10}
tooltip={'Optional, if you want to extract part of a series name or metric node segment.'} tooltip={'Optional, if you want to extract part of a series name or metric node segment.'}
> >
Regex Regex
</FormLabel> </InlineFormLabel>
<input <input
type="text" type="text"
className="gf-form-input" className="gf-form-input"
@@ -198,9 +198,9 @@ export class QueryVariableEditorUnConnected extends PureComponent<Props, State>
/> />
</div> </div>
<div className="gf-form max-width-21"> <div className="gf-form max-width-21">
<FormLabel width={10} tooltip={'How to sort the values of this variable.'}> <InlineFormLabel width={10} tooltip={'How to sort the values of this variable.'}>
Sort Sort
</FormLabel> </InlineFormLabel>
<div className="gf-form-select-wrapper max-width-14"> <div className="gf-form-select-wrapper max-width-14">
<select <select
className="gf-form-input" className="gf-form-input"

View File

@@ -1,5 +1,5 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { FormLabel, LegacyForms, Button } from '@grafana/ui'; import { InlineFormLabel, LegacyForms, Button } from '@grafana/ui';
const { Select, Input } = LegacyForms; const { Select, Input } = LegacyForms;
import { import {
DataSourcePluginOptionsEditorProps, DataSourcePluginOptionsEditorProps,
@@ -125,7 +125,7 @@ export class ConfigEditor extends PureComponent<Props, State> {
<div className="gf-form-group"> <div className="gf-form-group">
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-14">Auth Provider</FormLabel> <InlineFormLabel className="width-14">Auth Provider</InlineFormLabel>
<Select <Select
className="width-30" className="width-30"
value={authProviderOptions.find(authProvider => authProvider.value === options.jsonData.authType)} value={authProviderOptions.find(authProvider => authProvider.value === options.jsonData.authType)}
@@ -143,12 +143,12 @@ export class ConfigEditor extends PureComponent<Props, State> {
{options.jsonData.authType === 'credentials' && ( {options.jsonData.authType === 'credentials' && (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
className="width-14" className="width-14"
tooltip="Credentials profile name, as specified in ~/.aws/credentials, leave blank for default." tooltip="Credentials profile name, as specified in ~/.aws/credentials, leave blank for default."
> >
Credentials Profile Name Credentials Profile Name
</FormLabel> </InlineFormLabel>
<div className="width-30"> <div className="width-30">
<Input <Input
className="width-30" className="width-30"
@@ -165,7 +165,7 @@ export class ConfigEditor extends PureComponent<Props, State> {
{options.secureJsonFields.accessKey ? ( {options.secureJsonFields.accessKey ? (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-14">Access Key ID</FormLabel> <InlineFormLabel className="width-14">Access Key ID</InlineFormLabel>
<Input className="width-25" placeholder="Configured" disabled={true} /> <Input className="width-25" placeholder="Configured" disabled={true} />
</div> </div>
<div className="gf-form"> <div className="gf-form">
@@ -183,7 +183,7 @@ export class ConfigEditor extends PureComponent<Props, State> {
) : ( ) : (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-14">Access Key ID</FormLabel> <InlineFormLabel className="width-14">Access Key ID</InlineFormLabel>
<div className="width-30"> <div className="width-30">
<Input <Input
className="width-30" className="width-30"
@@ -197,7 +197,7 @@ export class ConfigEditor extends PureComponent<Props, State> {
{options.secureJsonFields.secretKey ? ( {options.secureJsonFields.secretKey ? (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-14">Secret Access Key</FormLabel> <InlineFormLabel className="width-14">Secret Access Key</InlineFormLabel>
<Input className="width-25" placeholder="Configured" disabled={true} /> <Input className="width-25" placeholder="Configured" disabled={true} />
</div> </div>
<div className="gf-form"> <div className="gf-form">
@@ -215,7 +215,7 @@ export class ConfigEditor extends PureComponent<Props, State> {
) : ( ) : (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-14">Secret Access Key</FormLabel> <InlineFormLabel className="width-14">Secret Access Key</InlineFormLabel>
<div className="width-30"> <div className="width-30">
<Input <Input
className="width-30" className="width-30"
@@ -231,9 +231,9 @@ export class ConfigEditor extends PureComponent<Props, State> {
{options.jsonData.authType === 'arn' && ( {options.jsonData.authType === 'arn' && (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-14" tooltip="ARN of Assume Role"> <InlineFormLabel className="width-14" tooltip="ARN of Assume Role">
Assume Role ARN Assume Role ARN
</FormLabel> </InlineFormLabel>
<div className="width-30"> <div className="width-30">
<Input <Input
className="width-30" className="width-30"
@@ -247,12 +247,12 @@ export class ConfigEditor extends PureComponent<Props, State> {
)} )}
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
className="width-14" className="width-14"
tooltip="Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region." tooltip="Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region."
> >
Default Region Default Region
</FormLabel> </InlineFormLabel>
<Select <Select
className="width-30" className="width-30"
value={regions.find(region => region.value === options.jsonData.defaultRegion)} value={regions.find(region => region.value === options.jsonData.defaultRegion)}
@@ -264,9 +264,9 @@ export class ConfigEditor extends PureComponent<Props, State> {
</div> </div>
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-14" tooltip="Namespaces of Custom Metrics."> <InlineFormLabel className="width-14" tooltip="Namespaces of Custom Metrics.">
Custom Metrics Custom Metrics
</FormLabel> </InlineFormLabel>
<Input <Input
className="width-30" className="width-30"
placeholder="Namespace1,Namespace2" placeholder="Namespace1,Namespace2"

View File

@@ -1,5 +1,5 @@
import React, { InputHTMLAttributes, FunctionComponent } from 'react'; import React, { InputHTMLAttributes, FunctionComponent } from 'react';
import { FormLabel } from '@grafana/ui'; import { InlineFormLabel } from '@grafana/ui';
export interface Props extends InputHTMLAttributes<HTMLInputElement> { export interface Props extends InputHTMLAttributes<HTMLInputElement> {
label: string; label: string;
@@ -9,9 +9,9 @@ export interface Props extends InputHTMLAttributes<HTMLInputElement> {
export const QueryField: FunctionComponent<Partial<Props>> = ({ label, tooltip, children }) => ( export const QueryField: FunctionComponent<Partial<Props>> = ({ label, tooltip, children }) => (
<> <>
<FormLabel width={8} className="query-keyword" tooltip={tooltip}> <InlineFormLabel width={8} className="query-keyword" tooltip={tooltip}>
{label} {label}
</FormLabel> </InlineFormLabel>
{children} {children}
</> </>
); );

View File

@@ -1,7 +1,8 @@
import React from 'react'; import React from 'react';
import { css } from 'emotion'; import { css } from 'emotion';
import { VariableSuggestion } from '@grafana/data'; import { VariableSuggestion } from '@grafana/data';
import { Button, FormField, DataLinkInput, stylesFactory } from '@grafana/ui'; import { Button, LegacyForms, DataLinkInput, stylesFactory } from '@grafana/ui';
const { FormField } = LegacyForms;
import { DataLinkConfig } from '../types'; import { DataLinkConfig } from '../types';
const getStyles = stylesFactory(() => ({ const getStyles = stylesFactory(() => ({

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { EventsWithValidation, FormField, regexValidation, LegacyForms } from '@grafana/ui'; import { EventsWithValidation, regexValidation, LegacyForms } from '@grafana/ui';
const { Select, Input } = LegacyForms; const { Select, Input, FormField } = LegacyForms;
import { ElasticsearchOptions } from '../types'; import { ElasticsearchOptions } from '../types';
import { DataSourceSettings, SelectableValue } from '@grafana/data'; import { DataSourceSettings, SelectableValue } from '@grafana/data';

View File

@@ -2,7 +2,8 @@ import React from 'react';
import { mount, shallow } from 'enzyme'; import { mount, shallow } from 'enzyme';
import { LogsConfig } from './LogsConfig'; import { LogsConfig } from './LogsConfig';
import { createDefaultConfigOptions } from './mocks'; import { createDefaultConfigOptions } from './mocks';
import { FormField } from '@grafana/ui'; import { LegacyForms } from '@grafana/ui';
const { FormField } = LegacyForms;
describe('ElasticDetails', () => { describe('ElasticDetails', () => {
it('should render without error', () => { it('should render without error', () => {

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { FormField } from '@grafana/ui'; import { LegacyForms } from '@grafana/ui';
const { FormField } = LegacyForms;
import { ElasticsearchOptions } from '../types'; import { ElasticsearchOptions } from '../types';
type Props = { type Props = {

View File

@@ -1,7 +1,7 @@
import React, { PureComponent, ChangeEvent } from 'react'; import React, { PureComponent, ChangeEvent } from 'react';
import { SelectableValue } from '@grafana/data'; import { SelectableValue } from '@grafana/data';
import { AzureCredentialsForm } from './AzureCredentialsForm'; import { AzureCredentialsForm } from './AzureCredentialsForm';
import { FormLabel, LegacyForms, Button } from '@grafana/ui'; import { InlineFormLabel, LegacyForms, Button } from '@grafana/ui';
const { Select, Switch } = LegacyForms; const { Select, Switch } = LegacyForms;
import { AzureDataSourceSettings } from '../types'; import { AzureDataSourceSettings } from '../types';
@@ -169,12 +169,12 @@ export class AnalyticsConfig extends PureComponent<Props, State> {
<div className="gf-form-group"> <div className="gf-form-group">
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
className="width-12" className="width-12"
tooltip="Choose the default/preferred Workspace for Azure Log Analytics queries." tooltip="Choose the default/preferred Workspace for Azure Log Analytics queries."
> >
Default Workspace Default Workspace
</FormLabel> </InlineFormLabel>
<div className="width-25"> <div className="width-25">
<Select <Select
value={workspaces.find(workspace => workspace.value === jsonData.logAnalyticsDefaultWorkspace)} value={workspaces.find(workspace => workspace.value === jsonData.logAnalyticsDefaultWorkspace)}

View File

@@ -1,6 +1,6 @@
import React, { ChangeEvent, PureComponent } from 'react'; import React, { ChangeEvent, PureComponent } from 'react';
import { SelectableValue } from '@grafana/data'; import { SelectableValue } from '@grafana/data';
import { FormLabel, LegacyForms, Button } from '@grafana/ui'; import { InlineFormLabel, LegacyForms, Button } from '@grafana/ui';
const { Select, Input } = LegacyForms; const { Select, Input } = LegacyForms;
export interface Props { export interface Props {
@@ -49,9 +49,9 @@ export class AzureCredentialsForm extends PureComponent<Props> {
{azureCloudOptions && ( {azureCloudOptions && (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-12" tooltip="Choose an Azure Cloud."> <InlineFormLabel className="width-12" tooltip="Choose an Azure Cloud.">
Azure Cloud Azure Cloud
</FormLabel> </InlineFormLabel>
<Select <Select
className="width-15" className="width-15"
value={azureCloudOptions.find(azureCloud => azureCloud.value === selectedAzureCloud)} value={azureCloudOptions.find(azureCloud => azureCloud.value === selectedAzureCloud)}
@@ -64,7 +64,7 @@ export class AzureCredentialsForm extends PureComponent<Props> {
)} )}
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-12">Directory (tenant) ID</FormLabel> <InlineFormLabel className="width-12">Directory (tenant) ID</InlineFormLabel>
<div className="width-15"> <div className="width-15">
<Input <Input
className="width-30" className="width-30"
@@ -77,7 +77,7 @@ export class AzureCredentialsForm extends PureComponent<Props> {
</div> </div>
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-12">Application (client) ID</FormLabel> <InlineFormLabel className="width-12">Application (client) ID</InlineFormLabel>
<div className="width-15"> <div className="width-15">
<Input <Input
className="width-30" className="width-30"
@@ -91,7 +91,7 @@ export class AzureCredentialsForm extends PureComponent<Props> {
{clientSecretConfigured ? ( {clientSecretConfigured ? (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-12">Client Secret</FormLabel> <InlineFormLabel className="width-12">Client Secret</InlineFormLabel>
<Input className="width-25" placeholder="configured" disabled={true} /> <Input className="width-25" placeholder="configured" disabled={true} />
</div> </div>
<div className="gf-form"> <div className="gf-form">
@@ -105,7 +105,7 @@ export class AzureCredentialsForm extends PureComponent<Props> {
) : ( ) : (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-12">Client Secret</FormLabel> <InlineFormLabel className="width-12">Client Secret</InlineFormLabel>
<div className="width-15"> <div className="width-15">
<Input <Input
className="width-30" className="width-30"
@@ -121,7 +121,7 @@ export class AzureCredentialsForm extends PureComponent<Props> {
<> <>
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-12">Default Subscription</FormLabel> <InlineFormLabel className="width-12">Default Subscription</InlineFormLabel>
<div className="width-25"> <div className="width-25">
<Select <Select
value={subscriptionOptions.find(subscription => subscription.value === selectedSubscription)} value={subscriptionOptions.find(subscription => subscription.value === selectedSubscription)}

View File

@@ -1,5 +1,5 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { FormLabel, Button, LegacyForms } from '@grafana/ui'; import { InlineFormLabel, Button, LegacyForms } from '@grafana/ui';
const { Input } = LegacyForms; const { Input } = LegacyForms;
import { AzureDataSourceSettings, AzureDataSourceJsonData, AzureDataSourceSecureJsonData } from '../types'; import { AzureDataSourceSettings, AzureDataSourceJsonData, AzureDataSourceSecureJsonData } from '../types';
@@ -27,7 +27,7 @@ export class InsightsConfig extends PureComponent<Props> {
{options.secureJsonFields.appInsightsApiKey ? ( {options.secureJsonFields.appInsightsApiKey ? (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-12">API Key</FormLabel> <InlineFormLabel className="width-12">API Key</InlineFormLabel>
<Input className="width-25" placeholder="configured" disabled={true} /> <Input className="width-25" placeholder="configured" disabled={true} />
</div> </div>
<div className="gf-form"> <div className="gf-form">
@@ -41,7 +41,7 @@ export class InsightsConfig extends PureComponent<Props> {
) : ( ) : (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-12">API Key</FormLabel> <InlineFormLabel className="width-12">API Key</InlineFormLabel>
<div className="width-15"> <div className="width-15">
<Input <Input
className="width-30" className="width-30"
@@ -55,7 +55,7 @@ export class InsightsConfig extends PureComponent<Props> {
)} )}
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-12">Application ID</FormLabel> <InlineFormLabel className="width-12">Application ID</InlineFormLabel>
<div className="width-15"> <div className="width-15">
<Input <Input
className="width-30" className="width-30"

View File

@@ -1,5 +1,5 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { DataSourceHttpSettings, FormLabel, LegacyForms } from '@grafana/ui'; import { DataSourceHttpSettings, InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Select, Switch } = LegacyForms; const { Select, Switch } = LegacyForms;
import { import {
DataSourcePluginOptionsEditorProps, DataSourcePluginOptionsEditorProps,
@@ -57,9 +57,9 @@ export class ConfigEditor extends PureComponent<Props> {
<div className="gf-form-group"> <div className="gf-form-group">
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel tooltip="This option controls what functions are available in the Graphite query editor."> <InlineFormLabel tooltip="This option controls what functions are available in the Graphite query editor.">
Version Version
</FormLabel> </InlineFormLabel>
<Select <Select
value={currentVersion} value={currentVersion}
options={graphiteVersions} options={graphiteVersions}
@@ -70,7 +70,7 @@ export class ConfigEditor extends PureComponent<Props> {
</div> </div>
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel tooltip={this.renderTypeHelp}>Type</FormLabel> <InlineFormLabel tooltip={this.renderTypeHelp}>Type</InlineFormLabel>
<Select <Select
options={graphiteTypes} options={graphiteTypes}
value={graphiteTypes.find(type => type.value === options.jsonData.graphiteType)} value={graphiteTypes.find(type => type.value === options.jsonData.graphiteType)}

View File

@@ -8,8 +8,8 @@ import {
onUpdateDatasourceJsonDataOptionSelect, onUpdateDatasourceJsonDataOptionSelect,
onUpdateDatasourceSecureJsonDataOption, onUpdateDatasourceSecureJsonDataOption,
} from '@grafana/data'; } from '@grafana/data';
import { DataSourceHttpSettings, FormLabel, SecretFormField, LegacyForms } from '@grafana/ui'; import { DataSourceHttpSettings, InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Select, Input } = LegacyForms; const { Select, Input, SecretFormField } = LegacyForms;
import { InfluxOptions, InfluxSecureJsonData } from '../types'; import { InfluxOptions, InfluxSecureJsonData } from '../types';
const httpModes = [ const httpModes = [
@@ -41,7 +41,7 @@ export class ConfigEditor extends PureComponent<Props> {
<div className="gf-form-group"> <div className="gf-form-group">
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-10">Database</FormLabel> <InlineFormLabel className="width-10">Database</InlineFormLabel>
<div className="width-20"> <div className="width-20">
<Input <Input
className="width-20" className="width-20"
@@ -53,7 +53,7 @@ export class ConfigEditor extends PureComponent<Props> {
</div> </div>
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="width-10">User</FormLabel> <InlineFormLabel className="width-10">User</InlineFormLabel>
<div className="width-10"> <div className="width-10">
<Input <Input
className="width-20" className="width-20"
@@ -78,14 +78,14 @@ export class ConfigEditor extends PureComponent<Props> {
</div> </div>
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
className="width-10" className="width-10"
tooltip="You can use either GET or POST HTTP method to query your InfluxDB database. The POST tooltip="You can use either GET or POST HTTP method to query your InfluxDB database. The POST
method allows you to perform heavy requests (with a lots of WHERE clause) while the GET method method allows you to perform heavy requests (with a lots of WHERE clause) while the GET method
will restrict you and return an error if the query is too large." will restrict you and return an error if the query is too large."
> >
HTTP Method HTTP Method
</FormLabel> </InlineFormLabel>
<Select <Select
className="width-10" className="width-10"
value={httpModes.find(httpMode => httpMode.value === options.jsonData.httpMode)} value={httpModes.find(httpMode => httpMode.value === options.jsonData.httpMode)}
@@ -112,13 +112,13 @@ export class ConfigEditor extends PureComponent<Props> {
<div className="gf-form-group"> <div className="gf-form-group">
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
className="width-10" className="width-10"
tooltip="A lower limit for the auto group by time interval. Recommended to be set to write frequency, tooltip="A lower limit for the auto group by time interval. Recommended to be set to write frequency,
for example 1m if your data is written every minute." for example 1m if your data is written every minute."
> >
Min time interval Min time interval
</FormLabel> </InlineFormLabel>
<div className="width-10"> <div className="width-10">
<Input <Input
className="width-10" className="width-10"

View File

@@ -2,7 +2,7 @@
import React, { memo } from 'react'; import React, { memo } from 'react';
// Types // Types
import { FormLabel } from '@grafana/ui'; import { InlineFormLabel } from '@grafana/ui';
export interface LokiExploreExtraFieldProps { export interface LokiExploreExtraFieldProps {
label: string; label: string;
@@ -19,7 +19,7 @@ export function LokiExploreExtraField(props: LokiExploreExtraFieldProps) {
return ( return (
<div className="gf-form-inline explore-input--ml"> <div className="gf-form-inline explore-input--ml">
<div className="gf-form"> <div className="gf-form">
<FormLabel width={6}>{label}</FormLabel> <InlineFormLabel width={6}>{label}</InlineFormLabel>
<input <input
type={type} type={type}
className="gf-form-input width-6" className="gf-form-input width-6"

View File

@@ -1,7 +1,8 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { css } from 'emotion'; import { css } from 'emotion';
import cx from 'classnames'; import cx from 'classnames';
import { FormField } from '@grafana/ui'; import { LegacyForms } from '@grafana/ui';
const { FormField } = LegacyForms;
import { DerivedFieldConfig } from '../types'; import { DerivedFieldConfig } from '../types';
import { getLinksFromLogsField } from '../../../../features/panel/panellinks/linkSuppliers'; import { getLinksFromLogsField } from '../../../../features/panel/panellinks/linkSuppliers';
import { ArrayVector, Field, FieldType, LinkModel } from '@grafana/data'; import { ArrayVector, Field, FieldType, LinkModel } from '@grafana/data';

View File

@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { css } from 'emotion'; import { css } from 'emotion';
import { Button, FormField, DataLinkInput, stylesFactory, LegacyForms } from '@grafana/ui'; import { Button, DataLinkInput, stylesFactory, LegacyForms } from '@grafana/ui';
const { Switch } = LegacyForms; const { Switch, FormField } = LegacyForms;
import { VariableSuggestion } from '@grafana/data'; import { VariableSuggestion } from '@grafana/data';
import { DataSourceSelectItem } from '@grafana/data'; import { DataSourceSelectItem } from '@grafana/data';

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { FormField } from '@grafana/ui'; import { LegacyForms } from '@grafana/ui';
const { FormField } = LegacyForms;
type Props = { type Props = {
value: string; value: string;

View File

@@ -1,5 +1,5 @@
import React, { SyntheticEvent } from 'react'; import React, { SyntheticEvent } from 'react';
import { FormLabel, LegacyForms } from '@grafana/ui'; import { InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Select, Input } = LegacyForms; const { Select, Input } = LegacyForms;
import { DataSourceSettings, SelectableValue } from '@grafana/data'; import { DataSourceSettings, SelectableValue } from '@grafana/data';
import { OpenTsdbOptions } from '../types'; import { OpenTsdbOptions } from '../types';
@@ -27,7 +27,7 @@ export const OpenTsdbDetails = (props: Props) => {
<> <>
<h5>OpenTSDB settings</h5> <h5>OpenTSDB settings</h5>
<div className="gf-form"> <div className="gf-form">
<FormLabel width={7}>Version</FormLabel> <InlineFormLabel width={7}>Version</InlineFormLabel>
<Select <Select
options={tsdbVersions} options={tsdbVersions}
value={tsdbVersions.find(version => version.value === value.jsonData.tsdbVersion) ?? tsdbVersions[0]} value={tsdbVersions.find(version => version.value === value.jsonData.tsdbVersion) ?? tsdbVersions[0]}
@@ -35,7 +35,7 @@ export const OpenTsdbDetails = (props: Props) => {
/> />
</div> </div>
<div className="gf-form"> <div className="gf-form">
<FormLabel width={7}>Resolution</FormLabel> <InlineFormLabel width={7}>Resolution</InlineFormLabel>
<Select <Select
options={tsdbResolutions} options={tsdbResolutions}
value={ value={
@@ -45,7 +45,7 @@ export const OpenTsdbDetails = (props: Props) => {
/> />
</div> </div>
<div className="gf-form"> <div className="gf-form">
<FormLabel width={7}>Lookup Limit</FormLabel> <InlineFormLabel width={7}>Lookup Limit</InlineFormLabel>
<Input <Input
type="number" type="number"
value={value.jsonData.lookupLimit ?? 1000} value={value.jsonData.lookupLimit ?? 1000}

View File

@@ -2,7 +2,7 @@
import React, { memo } from 'react'; import React, { memo } from 'react';
// Types // Types
import { FormLabel } from '@grafana/ui'; import { InlineFormLabel } from '@grafana/ui';
export interface PromExploreExtraFieldProps { export interface PromExploreExtraFieldProps {
label: string; label: string;
@@ -19,9 +19,9 @@ export function PromExploreExtraField(props: PromExploreExtraFieldProps) {
return ( return (
<div className="gf-form-inline explore-input--ml" aria-label="Prometheus extra field"> <div className="gf-form-inline explore-input--ml" aria-label="Prometheus extra field">
<div className="gf-form"> <div className="gf-form">
<FormLabel width={5} tooltip={hasTooltip ? tooltipContent : null}> <InlineFormLabel width={5} tooltip={hasTooltip ? tooltipContent : null}>
{label} {label}
</FormLabel> </InlineFormLabel>
<input <input
type={'text'} type={'text'}
className="gf-form-input width-4" className="gf-form-input width-4"

View File

@@ -2,7 +2,7 @@ import _ from 'lodash';
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
// Types // Types
import { FormLabel, LegacyForms, Select } from '@grafana/ui'; import { InlineFormLabel, LegacyForms, Select } from '@grafana/ui';
import { SelectableValue, QueryEditorProps } from '@grafana/data'; import { SelectableValue, QueryEditorProps } from '@grafana/data';
const { Switch } = LegacyForms; const { Switch } = LegacyForms;
@@ -112,13 +112,13 @@ export class PromQueryEditor extends PureComponent<Props, State> {
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
width={7} width={7}
tooltip="Controls the name of the time series, using name or pattern. For example tooltip="Controls the name of the time series, using name or pattern. For example
{{hostname}} will be replaced with label value for the label hostname." {{hostname}} will be replaced with label value for the label hostname."
> >
Legend Legend
</FormLabel> </InlineFormLabel>
<input <input
type="text" type="text"
className="gf-form-input" className="gf-form-input"
@@ -130,7 +130,7 @@ export class PromQueryEditor extends PureComponent<Props, State> {
</div> </div>
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
width={7} width={7}
tooltip={ tooltip={
<> <>
@@ -140,7 +140,7 @@ export class PromQueryEditor extends PureComponent<Props, State> {
} }
> >
Min step Min step
</FormLabel> </InlineFormLabel>
<input <input
type="text" type="text"
className="gf-form-input width-8" className="gf-form-input width-8"
@@ -172,13 +172,13 @@ export class PromQueryEditor extends PureComponent<Props, State> {
/> />
<Switch label="Instant" checked={instant} onChange={this.onInstantChange} /> <Switch label="Instant" checked={instant} onChange={this.onInstantChange} />
<FormLabel width={10} tooltip="Link to Graph in Prometheus"> <InlineFormLabel width={10} tooltip="Link to Graph in Prometheus">
<PromLink <PromLink
datasource={datasource} datasource={datasource}
query={this.query} // Use modified query query={this.query} // Use modified query
panelData={data} panelData={data}
/> />
</FormLabel> </InlineFormLabel>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,6 +1,6 @@
import React, { SyntheticEvent } from 'react'; import React, { SyntheticEvent } from 'react';
import { EventsWithValidation, FormField, FormLabel, regexValidation, LegacyForms } from '@grafana/ui'; import { EventsWithValidation, InlineFormLabel, regexValidation, LegacyForms } from '@grafana/ui';
const { Select, Input } = LegacyForms; const { Select, Input, FormField } = LegacyForms;
import { DataSourceSettings, SelectableValue } from '@grafana/data'; import { DataSourceSettings, SelectableValue } from '@grafana/data';
import { PromOptions } from '../types'; import { PromOptions } from '../types';
@@ -59,12 +59,12 @@ export const PromSettings = (props: Props) => {
</div> </div>
</div> </div>
<div className="gf-form"> <div className="gf-form">
<FormLabel <InlineFormLabel
width={13} width={13}
tooltip="Specify the HTTP Method to query Prometheus. (POST is only available in Prometheus >= v2.1.0)" tooltip="Specify the HTTP Method to query Prometheus. (POST is only available in Prometheus >= v2.1.0)"
> >
HTTP Method HTTP Method
</FormLabel> </InlineFormLabel>
<Select <Select
options={httpOptions} options={httpOptions}
value={httpOptions.find(o => o.value === value.jsonData.httpMethod)} value={httpOptions.find(o => o.value === value.jsonData.httpMethod)}

View File

@@ -1,5 +1,5 @@
import React, { InputHTMLAttributes, FunctionComponent } from 'react'; import React, { InputHTMLAttributes, FunctionComponent } from 'react';
import { FormLabel } from '@grafana/ui'; import { InlineFormLabel } from '@grafana/ui';
export interface Props extends InputHTMLAttributes<HTMLInputElement> { export interface Props extends InputHTMLAttributes<HTMLInputElement> {
label: string; label: string;
@@ -9,9 +9,9 @@ export interface Props extends InputHTMLAttributes<HTMLInputElement> {
export const QueryField: FunctionComponent<Partial<Props>> = ({ label, tooltip, children }) => ( export const QueryField: FunctionComponent<Partial<Props>> = ({ label, tooltip, children }) => (
<> <>
<FormLabel width={9} className="query-keyword" tooltip={tooltip}> <InlineFormLabel width={9} className="query-keyword" tooltip={tooltip}>
{label} {label}
</FormLabel> </InlineFormLabel>
{children} {children}
</> </>
); );

View File

@@ -6,7 +6,7 @@ import _ from 'lodash';
import { getBackendSrv } from '@grafana/runtime'; import { getBackendSrv } from '@grafana/runtime';
// Components // Components
import { FormLabel, LegacyForms } from '@grafana/ui'; import { InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Select } = LegacyForms; const { Select } = LegacyForms;
import { QueryEditorProps, SelectableValue } from '@grafana/data'; import { QueryEditorProps, SelectableValue } from '@grafana/data';
@@ -56,9 +56,9 @@ export class QueryEditor extends PureComponent<Props> {
return ( return (
<div className="gf-form-inline"> <div className="gf-form-inline">
<div className="gf-form"> <div className="gf-form">
<FormLabel className="query-keyword" width={7}> <InlineFormLabel className="query-keyword" width={7}>
Scenario Scenario
</FormLabel> </InlineFormLabel>
<Select options={options} value={current} onChange={this.onScenarioChange} /> <Select options={options} value={current} onChange={this.onScenarioChange} />
</div> </div>
</div> </div>

View File

@@ -2,12 +2,12 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
// Components // Components
import { LegacyForms, FormLabel, PanelOptionsGroup } from '@grafana/ui'; import { LegacyForms, InlineFormLabel, PanelOptionsGroup } from '@grafana/ui';
const { Select } = LegacyForms; const { Select, FormField } = LegacyForms;
// Types // Types
import { PanelEditorProps } from '@grafana/data'; import { PanelEditorProps } from '@grafana/data';
import { FormField, PieChartType } from '@grafana/ui'; import { PieChartType } from '@grafana/ui';
import { PieChartOptions } from './types'; import { PieChartOptions } from './types';
const labelWidth = 8; const labelWidth = 8;
@@ -29,7 +29,7 @@ export class PieChartOptionsBox extends PureComponent<PanelEditorProps<PieChartO
return ( return (
<PanelOptionsGroup title="PieChart"> <PanelOptionsGroup title="PieChart">
<div className="gf-form"> <div className="gf-form">
<FormLabel width={labelWidth}>Type</FormLabel> <InlineFormLabel width={labelWidth}>Type</InlineFormLabel>
<Select <Select
width={12} width={12}
options={pieChartOptions} options={pieChartOptions}