Form migrations: Switch to LegacyForms namespace (#23357)

* Move Switch to Legacy namespace

* Make story internal

* Fix import
This commit is contained in:
Tobias Skarhed
2020-04-07 08:50:54 +02:00
committed by GitHub
parent d6b8aaa7b0
commit 553f50e4f5
27 changed files with 52 additions and 42 deletions

View File

@@ -1,6 +1,7 @@
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, Switch } from '../index'; import { FormField } from '../index';
import { Switch } from '../Switch/Switch';
import { css } from 'emotion'; import { css } from 'emotion';
import { ThemeContext, stylesFactory } from '../../themes/index'; import { ThemeContext, stylesFactory } from '../../themes/index';
import { DataLinkInput } from './DataLinkInput'; import { DataLinkInput } from './DataLinkInput';

View File

@@ -21,7 +21,6 @@ export { SeriesColorPickerPopover, SeriesColorPickerPopoverWithTheme } from './C
export { PanelOptionsGroup } from './PanelOptionsGroup/PanelOptionsGroup'; export { PanelOptionsGroup } from './PanelOptionsGroup/PanelOptionsGroup';
export { PanelOptionsGrid } from './PanelOptionsGrid/PanelOptionsGrid'; export { PanelOptionsGrid } from './PanelOptionsGrid/PanelOptionsGrid';
export { LegacyValueMappingsEditor } from './ValueMappingsEditor/LegacyValueMappingsEditor'; export { LegacyValueMappingsEditor } from './ValueMappingsEditor/LegacyValueMappingsEditor';
export { Switch } from './Switch/Switch';
export { EmptySearchResult } from './EmptySearchResult/EmptySearchResult'; export { EmptySearchResult } from './EmptySearchResult/EmptySearchResult';
export { PieChart, PieChartType } from './PieChart/PieChart'; export { PieChart, PieChartType } from './PieChart/PieChart';
export { UnitPicker } from './UnitPicker/UnitPicker'; export { UnitPicker } from './UnitPicker/UnitPicker';
@@ -149,8 +148,8 @@ 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';
// Export these until Enterprise migrations have been merged
// export { Input, InputStatus} import { Switch } from './Switch/Switch';
const LegacyForms = { const LegacyForms = {
Select, Select,
@@ -159,6 +158,7 @@ const LegacyForms = {
NoOptionsMessage, NoOptionsMessage,
ButtonSelect, ButtonSelect,
Input, Input,
Switch,
}; };
export { Switch };
export { LegacyForms, LegacyInputStatus }; export { LegacyForms, LegacyInputStatus };

View File

@@ -13,8 +13,8 @@ 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, Switch, ValidationEvents } from '@grafana/ui'; import { DeleteButton, EventsWithValidation, FormLabel, LegacyForms, ValidationEvents } from '@grafana/ui';
const { Input } = 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';
import { store } from 'app/store/store'; import { store } from 'app/store/store';

View File

@@ -1,6 +1,6 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { Switch, LegacyForms } from '@grafana/ui'; import { LegacyForms } from '@grafana/ui';
const { Select } = LegacyForms; const { Select, Switch } = LegacyForms;
import { SelectableValue } from '@grafana/data'; import { SelectableValue } from '@grafana/data';
import { DashboardModel, PanelModel } from 'app/features/dashboard/state'; import { DashboardModel, PanelModel } from 'app/features/dashboard/state';
import { buildIframeHtml } from './utils'; import { buildIframeHtml } from './utils';

View File

@@ -1,6 +1,7 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver';
import { Button, Switch } from '@grafana/ui'; import { Button, LegacyForms } from '@grafana/ui';
const { Switch } = LegacyForms;
import { DashboardModel, PanelModel } from 'app/features/dashboard/state'; import { DashboardModel, PanelModel } from 'app/features/dashboard/state';
import { DashboardExporter } from 'app/features/dashboard/components/DashExportModal'; import { DashboardExporter } from 'app/features/dashboard/components/DashExportModal';
import { appEvents } from 'app/core/core'; import { appEvents } from 'app/core/core';

View File

@@ -1,7 +1,7 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { e2e } from '@grafana/e2e'; import { e2e } from '@grafana/e2e';
import { Switch, LegacyForms, ClipboardButton } from '@grafana/ui'; import { LegacyForms, ClipboardButton } from '@grafana/ui';
const { Select } = LegacyForms; const { Select, Switch } = LegacyForms;
import { SelectableValue, PanelModel, AppEvents } from '@grafana/data'; import { SelectableValue, PanelModel, AppEvents } from '@grafana/data';
import { DashboardModel } from 'app/features/dashboard/state'; import { DashboardModel } from 'app/features/dashboard/state';
import { buildImageUrl, buildShareUrl } from './utils'; import { buildImageUrl, buildShareUrl } from './utils';

View File

@@ -1,5 +1,6 @@
import React, { FunctionComponent, useEffect, useState } from 'react'; import React, { FunctionComponent, useEffect, useState } from 'react';
import { Switch } from '@grafana/ui'; import { LegacyForms } from '@grafana/ui';
const { Switch } = LegacyForms;
interface Props { interface Props {
annotations: any[]; annotations: any[];

View File

@@ -5,9 +5,9 @@ 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, Switch, ValidationEvents, FormLabel } from '@grafana/ui'; import { EventsWithValidation, LegacyInputStatus, LegacyForms, ValidationEvents, FormLabel } from '@grafana/ui';
import { DataSourceOption } from './DataSourceOption'; import { DataSourceOption } from './DataSourceOption';
const { Input } = LegacyForms; const { Input, Switch } = LegacyForms;
// Types // Types
import { PanelModel } from '../state'; import { PanelModel } from '../state';

View File

@@ -1,6 +1,6 @@
import React, { FC } from 'react'; import React, { FC } from 'react';
import { FormLabel, LegacyForms, Switch } from '@grafana/ui'; import { FormLabel, LegacyForms } from '@grafana/ui';
const { Input } = LegacyForms; const { Input, Switch } = LegacyForms;
import { e2e } from '@grafana/e2e'; import { e2e } from '@grafana/e2e';
export interface Props { export interface Props {

View File

@@ -15,7 +15,8 @@ import {
LinkModel, LinkModel,
Field, Field,
} from '@grafana/data'; } from '@grafana/data';
import { Switch, LogLabels, ToggleButtonGroup, ToggleButton, LogRows } from '@grafana/ui'; import { LegacyForms, LogLabels, ToggleButtonGroup, ToggleButton, LogRows } from '@grafana/ui';
const { Switch } = LegacyForms;
import store from 'app/core/store'; import store from 'app/core/store';
import { ExploreGraphPanel } from './ExploreGraphPanel'; import { ExploreGraphPanel } from './ExploreGraphPanel';

View File

@@ -1,5 +1,6 @@
import React, { FunctionComponent, useCallback } from 'react'; import React, { FunctionComponent, useCallback } from 'react';
import { Switch } from '@grafana/ui'; import { LegacyForms } from '@grafana/ui';
const { Switch } = LegacyForms;
import { e2e } from '@grafana/e2e'; import { e2e } from '@grafana/e2e';
import { VariableWithMultiSupport } from '../../templating/types'; import { VariableWithMultiSupport } from '../../templating/types';

View File

@@ -2,7 +2,8 @@ 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, Switch } from '@grafana/ui'; import { FormLabel, LegacyForms } from '@grafana/ui';
const { Switch } = LegacyForms;
export interface Props extends VariableEditorProps<IntervalVariableModel> {} export interface Props extends VariableEditorProps<IntervalVariableModel> {}

View File

@@ -1,6 +1,7 @@
import React, { ChangeEvent, PureComponent } from 'react'; import React, { ChangeEvent, PureComponent } from 'react';
import { e2e } from '@grafana/e2e'; import { e2e } from '@grafana/e2e';
import { FormLabel, Switch } from '@grafana/ui'; import { FormLabel, LegacyForms } from '@grafana/ui';
const { Switch } = LegacyForms;
import templateSrv from '../../templating/template_srv'; import templateSrv from '../../templating/template_srv';
import { SelectionOptionsEditor } from '../editor/SelectionOptionsEditor'; import { SelectionOptionsEditor } from '../editor/SelectionOptionsEditor';

View File

@@ -1,5 +1,6 @@
import React, { ChangeEvent } from 'react'; import React, { ChangeEvent } from 'react';
import { Switch } from '@grafana/ui'; import { LegacyForms } from '@grafana/ui';
const { Switch } = LegacyForms;
import { PanelData } from '@grafana/data'; import { PanelData } from '@grafana/data';
import { CloudWatchQuery, AnnotationQuery } from '../types'; import { CloudWatchQuery, AnnotationQuery } from '../types';
import CloudWatchDatasource from '../datasource'; import CloudWatchDatasource from '../datasource';

View File

@@ -1,7 +1,7 @@
import React, { PureComponent, ChangeEvent } from 'react'; import React, { PureComponent, ChangeEvent } from 'react';
import { ExploreQueryFieldProps } from '@grafana/data'; import { ExploreQueryFieldProps } from '@grafana/data';
import { LegacyForms, ValidationEvents, EventsWithValidation, Switch } from '@grafana/ui'; import { LegacyForms, ValidationEvents, EventsWithValidation } from '@grafana/ui';
const { Input } = LegacyForms; const { Input, Switch } = LegacyForms;
import isEmpty from 'lodash/isEmpty'; import isEmpty from 'lodash/isEmpty';
import { CloudWatchQuery } from '../types'; import { CloudWatchQuery } from '../types';
import CloudWatchDatasource from '../datasource'; import CloudWatchDatasource from '../datasource';

View File

@@ -1,8 +1,8 @@
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 { Switch, FormLabel, LegacyForms, Button } from '@grafana/ui'; import { FormLabel, LegacyForms, Button } from '@grafana/ui';
const { Select } = LegacyForms; const { Select, Switch } = LegacyForms;
import { AzureDataSourceSettings } from '../types'; import { AzureDataSourceSettings } from '../types';
export interface State { export interface State {

View File

@@ -1,6 +1,6 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { DataSourceHttpSettings, FormLabel, LegacyForms, Switch } from '@grafana/ui'; import { DataSourceHttpSettings, FormLabel, LegacyForms } from '@grafana/ui';
const { Select } = LegacyForms; const { Select, Switch } = LegacyForms;
import { import {
DataSourcePluginOptionsEditorProps, DataSourcePluginOptionsEditorProps,
onUpdateDatasourceJsonDataOptionSelect, onUpdateDatasourceJsonDataOptionSelect,

View File

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

View File

@@ -2,10 +2,10 @@ import _ from 'lodash';
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
// Types // Types
import { FormLabel, LegacyForms, Switch } from '@grafana/ui'; import { FormLabel, LegacyForms } from '@grafana/ui';
import { SelectableValue, QueryEditorProps } from '@grafana/data'; import { SelectableValue, QueryEditorProps } from '@grafana/data';
const { Select } = LegacyForms; const { Select, Switch } = LegacyForms;
import { PrometheusDatasource } from '../datasource'; import { PrometheusDatasource } from '../datasource';
import { PromQuery, PromOptions } from '../types'; import { PromQuery, PromOptions } from '../types';

View File

@@ -2,7 +2,8 @@
import React, { PureComponent, ChangeEvent } from 'react'; import React, { PureComponent, ChangeEvent } from 'react';
// Components // Components
import { PanelOptionsGroup, PanelOptionsGrid, Switch, FormField, FormLabel } from '@grafana/ui'; import { PanelOptionsGroup, PanelOptionsGrid, FormField, FormLabel, LegacyForms } from '@grafana/ui';
const { Switch } = LegacyForms;
import { PanelEditorProps, toIntegerOrUndefined, toNumberString } from '@grafana/data'; import { PanelEditorProps, toIntegerOrUndefined, toNumberString } from '@grafana/data';

View File

@@ -7,13 +7,12 @@ import {
PanelOptionsGroup, PanelOptionsGroup,
FormLabel, FormLabel,
LegacyForms, LegacyForms,
Switch,
FieldPropertiesEditor, FieldPropertiesEditor,
ThresholdsEditor, ThresholdsEditor,
LegacyValueMappingsEditor, LegacyValueMappingsEditor,
DataLinksEditor, DataLinksEditor,
} from '@grafana/ui'; } from '@grafana/ui';
const { Select } = LegacyForms; const { Select, Switch } = LegacyForms;
import { import {
DataLink, DataLink,
FieldConfig, FieldConfig,

View File

@@ -3,13 +3,14 @@ import React, { PureComponent } from 'react';
import { import {
PanelOptionsGrid, PanelOptionsGrid,
FieldDisplayEditor, FieldDisplayEditor,
Switch, LegacyForms,
PanelOptionsGroup, PanelOptionsGroup,
FieldPropertiesEditor, FieldPropertiesEditor,
ThresholdsEditor, ThresholdsEditor,
LegacyValueMappingsEditor, LegacyValueMappingsEditor,
DataLinksEditor, DataLinksEditor,
} from '@grafana/ui'; } from '@grafana/ui';
const { Switch } = LegacyForms;
import { import {
PanelEditorProps, PanelEditorProps,
ReduceDataOptions, ReduceDataOptions,

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { LegendOptions, PanelOptionsGroup, Switch, LegacyForms, StatsPicker } from '@grafana/ui'; import { LegendOptions, PanelOptionsGroup, LegacyForms, StatsPicker } from '@grafana/ui';
const { Input } = LegacyForms; const { Input, Switch } = LegacyForms;
export interface GraphLegendEditorLegendOptions extends LegendOptions { export interface GraphLegendEditorLegendOptions extends LegendOptions {
stats?: string[]; stats?: string[];

View File

@@ -5,7 +5,6 @@ import React, { PureComponent } from 'react';
// Types // Types
import { FieldConfig, PanelEditorProps } from '@grafana/data'; import { FieldConfig, PanelEditorProps } from '@grafana/data';
import { import {
Switch,
LegendOptions, LegendOptions,
GraphTooltipOptions, GraphTooltipOptions,
PanelOptionsGrid, PanelOptionsGrid,
@@ -13,7 +12,7 @@ import {
LegacyForms, LegacyForms,
FieldPropertiesEditor, FieldPropertiesEditor,
} from '@grafana/ui'; } from '@grafana/ui';
const { Select } = LegacyForms; const { Select, Switch } = LegacyForms;
import { Options, GraphOptions } from './types'; import { Options, GraphOptions } from './types';
import { GraphLegendEditor } from './GraphLegendEditor'; import { GraphLegendEditor } from './GraphLegendEditor';
import { NewPanelEditorContext } from 'app/features/dashboard/components/PanelEditor/PanelEditor'; import { NewPanelEditorContext } from 'app/features/dashboard/components/PanelEditor/PanelEditor';

View File

@@ -1,7 +1,7 @@
// Libraries // Libraries
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { Switch, PanelOptionsGrid, PanelOptionsGroup, FormLabel, LegacyForms } from '@grafana/ui'; import { PanelOptionsGrid, PanelOptionsGroup, FormLabel, LegacyForms } from '@grafana/ui';
const { Select } = LegacyForms; const { Select, Switch } = LegacyForms;
// Types // Types
import { Options } from './types'; import { Options } from './types';

View File

@@ -4,7 +4,8 @@ import React, { PureComponent } from 'react';
// Types // Types
import { PanelEditorProps } from '@grafana/data'; import { PanelEditorProps } from '@grafana/data';
import { Switch } from '@grafana/ui'; import { LegacyForms } from '@grafana/ui';
const { Switch } = LegacyForms;
import { Options } from './types'; import { Options } from './types';
export class TablePanelEditor extends PureComponent<PanelEditorProps<Options>> { export class TablePanelEditor extends PureComponent<PanelEditorProps<Options>> {