mirror of
				https://github.com/grafana/grafana.git
				synced 2025-02-25 18:55:37 -06:00 
			
		
		
		
	Form migrations: Switch to LegacyForms namespace (#23357)
* Move Switch to Legacy namespace * Make story internal * Fix import
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
import React, { ChangeEvent, useContext } from 'react';
 | 
			
		||||
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 { ThemeContext, stylesFactory } from '../../themes/index';
 | 
			
		||||
import { DataLinkInput } from './DataLinkInput';
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,6 @@ export { SeriesColorPickerPopover, SeriesColorPickerPopoverWithTheme } from './C
 | 
			
		||||
export { PanelOptionsGroup } from './PanelOptionsGroup/PanelOptionsGroup';
 | 
			
		||||
export { PanelOptionsGrid } from './PanelOptionsGrid/PanelOptionsGrid';
 | 
			
		||||
export { LegacyValueMappingsEditor } from './ValueMappingsEditor/LegacyValueMappingsEditor';
 | 
			
		||||
export { Switch } from './Switch/Switch';
 | 
			
		||||
export { EmptySearchResult } from './EmptySearchResult/EmptySearchResult';
 | 
			
		||||
export { PieChart, PieChartType } from './PieChart/PieChart';
 | 
			
		||||
export { UnitPicker } from './UnitPicker/UnitPicker';
 | 
			
		||||
@@ -149,8 +148,8 @@ import { ButtonSelect } from './Forms/Legacy/Select/ButtonSelect';
 | 
			
		||||
 | 
			
		||||
//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 = {
 | 
			
		||||
  Select,
 | 
			
		||||
@@ -159,6 +158,7 @@ const LegacyForms = {
 | 
			
		||||
  NoOptionsMessage,
 | 
			
		||||
  ButtonSelect,
 | 
			
		||||
  Input,
 | 
			
		||||
  Switch,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export { Switch };
 | 
			
		||||
export { LegacyForms, LegacyInputStatus };
 | 
			
		||||
 
 | 
			
		||||
@@ -13,8 +13,8 @@ import ApiKeysAddedModal from './ApiKeysAddedModal';
 | 
			
		||||
import config from 'app/core/config';
 | 
			
		||||
import appEvents from 'app/core/app_events';
 | 
			
		||||
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
 | 
			
		||||
import { DeleteButton, EventsWithValidation, FormLabel, LegacyForms, Switch, ValidationEvents } from '@grafana/ui';
 | 
			
		||||
const { Input } = LegacyForms;
 | 
			
		||||
import { DeleteButton, EventsWithValidation, FormLabel, LegacyForms, ValidationEvents } from '@grafana/ui';
 | 
			
		||||
const { Input, Switch } = LegacyForms;
 | 
			
		||||
import { dateTime, isDateTime, NavModel } from '@grafana/data';
 | 
			
		||||
import { FilterInput } from 'app/core/components/FilterInput/FilterInput';
 | 
			
		||||
import { store } from 'app/store/store';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import React, { PureComponent } from 'react';
 | 
			
		||||
import { Switch, LegacyForms } from '@grafana/ui';
 | 
			
		||||
const { Select } = LegacyForms;
 | 
			
		||||
import { LegacyForms } from '@grafana/ui';
 | 
			
		||||
const { Select, Switch } = LegacyForms;
 | 
			
		||||
import { SelectableValue } from '@grafana/data';
 | 
			
		||||
import { DashboardModel, PanelModel } from 'app/features/dashboard/state';
 | 
			
		||||
import { buildIframeHtml } from './utils';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
import React, { PureComponent } from 'react';
 | 
			
		||||
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 { DashboardExporter } from 'app/features/dashboard/components/DashExportModal';
 | 
			
		||||
import { appEvents } from 'app/core/core';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import React, { PureComponent } from 'react';
 | 
			
		||||
import { e2e } from '@grafana/e2e';
 | 
			
		||||
import { Switch, LegacyForms, ClipboardButton } from '@grafana/ui';
 | 
			
		||||
const { Select } = LegacyForms;
 | 
			
		||||
import { LegacyForms, ClipboardButton } from '@grafana/ui';
 | 
			
		||||
const { Select, Switch } = LegacyForms;
 | 
			
		||||
import { SelectableValue, PanelModel, AppEvents } from '@grafana/data';
 | 
			
		||||
import { DashboardModel } from 'app/features/dashboard/state';
 | 
			
		||||
import { buildImageUrl, buildShareUrl } from './utils';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
import React, { FunctionComponent, useEffect, useState } from 'react';
 | 
			
		||||
import { Switch } from '@grafana/ui';
 | 
			
		||||
import { LegacyForms } from '@grafana/ui';
 | 
			
		||||
const { Switch } = LegacyForms;
 | 
			
		||||
 | 
			
		||||
interface Props {
 | 
			
		||||
  annotations: any[];
 | 
			
		||||
 
 | 
			
		||||
@@ -5,9 +5,9 @@ import React, { PureComponent, ChangeEvent, FocusEvent, ReactText } from 'react'
 | 
			
		||||
import { rangeUtil, DataSourceSelectItem } from '@grafana/data';
 | 
			
		||||
 | 
			
		||||
// Components
 | 
			
		||||
import { EventsWithValidation, LegacyInputStatus, LegacyForms, Switch, ValidationEvents, FormLabel } from '@grafana/ui';
 | 
			
		||||
import { EventsWithValidation, LegacyInputStatus, LegacyForms, ValidationEvents, FormLabel } from '@grafana/ui';
 | 
			
		||||
import { DataSourceOption } from './DataSourceOption';
 | 
			
		||||
const { Input } = LegacyForms;
 | 
			
		||||
const { Input, Switch } = LegacyForms;
 | 
			
		||||
 | 
			
		||||
// Types
 | 
			
		||||
import { PanelModel } from '../state';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import React, { FC } from 'react';
 | 
			
		||||
import { FormLabel, LegacyForms, Switch } from '@grafana/ui';
 | 
			
		||||
const { Input } = LegacyForms;
 | 
			
		||||
import { FormLabel, LegacyForms } from '@grafana/ui';
 | 
			
		||||
const { Input, Switch } = LegacyForms;
 | 
			
		||||
import { e2e } from '@grafana/e2e';
 | 
			
		||||
 | 
			
		||||
export interface Props {
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,8 @@ import {
 | 
			
		||||
  LinkModel,
 | 
			
		||||
  Field,
 | 
			
		||||
} 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 { ExploreGraphPanel } from './ExploreGraphPanel';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
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 { VariableWithMultiSupport } from '../../templating/types';
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,8 @@ import React, { ChangeEvent, FocusEvent, PureComponent } from 'react';
 | 
			
		||||
 | 
			
		||||
import { IntervalVariableModel } from '../../templating/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> {}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
import React, { ChangeEvent, PureComponent } from 'react';
 | 
			
		||||
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 { SelectionOptionsEditor } from '../editor/SelectionOptionsEditor';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
import React, { ChangeEvent } from 'react';
 | 
			
		||||
import { Switch } from '@grafana/ui';
 | 
			
		||||
import { LegacyForms } from '@grafana/ui';
 | 
			
		||||
const { Switch } = LegacyForms;
 | 
			
		||||
import { PanelData } from '@grafana/data';
 | 
			
		||||
import { CloudWatchQuery, AnnotationQuery } from '../types';
 | 
			
		||||
import CloudWatchDatasource from '../datasource';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import React, { PureComponent, ChangeEvent } from 'react';
 | 
			
		||||
import { ExploreQueryFieldProps } from '@grafana/data';
 | 
			
		||||
import { LegacyForms, ValidationEvents, EventsWithValidation, Switch } from '@grafana/ui';
 | 
			
		||||
const { Input } = LegacyForms;
 | 
			
		||||
import { LegacyForms, ValidationEvents, EventsWithValidation } from '@grafana/ui';
 | 
			
		||||
const { Input, Switch } = LegacyForms;
 | 
			
		||||
import isEmpty from 'lodash/isEmpty';
 | 
			
		||||
import { CloudWatchQuery } from '../types';
 | 
			
		||||
import CloudWatchDatasource from '../datasource';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
import React, { PureComponent, ChangeEvent } from 'react';
 | 
			
		||||
import { SelectableValue } from '@grafana/data';
 | 
			
		||||
import { AzureCredentialsForm } from './AzureCredentialsForm';
 | 
			
		||||
import { Switch, FormLabel, LegacyForms, Button } from '@grafana/ui';
 | 
			
		||||
const { Select } = LegacyForms;
 | 
			
		||||
import { FormLabel, LegacyForms, Button } from '@grafana/ui';
 | 
			
		||||
const { Select, Switch } = LegacyForms;
 | 
			
		||||
import { AzureDataSourceSettings } from '../types';
 | 
			
		||||
 | 
			
		||||
export interface State {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import React, { PureComponent } from 'react';
 | 
			
		||||
import { DataSourceHttpSettings, FormLabel, LegacyForms, Switch } from '@grafana/ui';
 | 
			
		||||
const { Select } = LegacyForms;
 | 
			
		||||
import { DataSourceHttpSettings, FormLabel, LegacyForms } from '@grafana/ui';
 | 
			
		||||
const { Select, Switch } = LegacyForms;
 | 
			
		||||
import {
 | 
			
		||||
  DataSourcePluginOptionsEditorProps,
 | 
			
		||||
  onUpdateDatasourceJsonDataOptionSelect,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
import React, { useState } from 'react';
 | 
			
		||||
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 { DataSourceSelectItem } from '@grafana/data';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,10 +2,10 @@ import _ from 'lodash';
 | 
			
		||||
import React, { PureComponent } from 'react';
 | 
			
		||||
 | 
			
		||||
// Types
 | 
			
		||||
import { FormLabel, LegacyForms, Switch } from '@grafana/ui';
 | 
			
		||||
import { FormLabel, LegacyForms } from '@grafana/ui';
 | 
			
		||||
import { SelectableValue, QueryEditorProps } from '@grafana/data';
 | 
			
		||||
 | 
			
		||||
const { Select } = LegacyForms;
 | 
			
		||||
const { Select, Switch } = LegacyForms;
 | 
			
		||||
 | 
			
		||||
import { PrometheusDatasource } from '../datasource';
 | 
			
		||||
import { PromQuery, PromOptions } from '../types';
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,8 @@
 | 
			
		||||
import React, { PureComponent, ChangeEvent } from 'react';
 | 
			
		||||
 | 
			
		||||
// 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';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,13 +7,12 @@ import {
 | 
			
		||||
  PanelOptionsGroup,
 | 
			
		||||
  FormLabel,
 | 
			
		||||
  LegacyForms,
 | 
			
		||||
  Switch,
 | 
			
		||||
  FieldPropertiesEditor,
 | 
			
		||||
  ThresholdsEditor,
 | 
			
		||||
  LegacyValueMappingsEditor,
 | 
			
		||||
  DataLinksEditor,
 | 
			
		||||
} from '@grafana/ui';
 | 
			
		||||
const { Select } = LegacyForms;
 | 
			
		||||
const { Select, Switch } = LegacyForms;
 | 
			
		||||
import {
 | 
			
		||||
  DataLink,
 | 
			
		||||
  FieldConfig,
 | 
			
		||||
 
 | 
			
		||||
@@ -3,13 +3,14 @@ import React, { PureComponent } from 'react';
 | 
			
		||||
import {
 | 
			
		||||
  PanelOptionsGrid,
 | 
			
		||||
  FieldDisplayEditor,
 | 
			
		||||
  Switch,
 | 
			
		||||
  LegacyForms,
 | 
			
		||||
  PanelOptionsGroup,
 | 
			
		||||
  FieldPropertiesEditor,
 | 
			
		||||
  ThresholdsEditor,
 | 
			
		||||
  LegacyValueMappingsEditor,
 | 
			
		||||
  DataLinksEditor,
 | 
			
		||||
} from '@grafana/ui';
 | 
			
		||||
const { Switch } = LegacyForms;
 | 
			
		||||
import {
 | 
			
		||||
  PanelEditorProps,
 | 
			
		||||
  ReduceDataOptions,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import { LegendOptions, PanelOptionsGroup, Switch, LegacyForms, StatsPicker } from '@grafana/ui';
 | 
			
		||||
const { Input } = LegacyForms;
 | 
			
		||||
import { LegendOptions, PanelOptionsGroup, LegacyForms, StatsPicker } from '@grafana/ui';
 | 
			
		||||
const { Input, Switch } = LegacyForms;
 | 
			
		||||
 | 
			
		||||
export interface GraphLegendEditorLegendOptions extends LegendOptions {
 | 
			
		||||
  stats?: string[];
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,6 @@ import React, { PureComponent } from 'react';
 | 
			
		||||
// Types
 | 
			
		||||
import { FieldConfig, PanelEditorProps } from '@grafana/data';
 | 
			
		||||
import {
 | 
			
		||||
  Switch,
 | 
			
		||||
  LegendOptions,
 | 
			
		||||
  GraphTooltipOptions,
 | 
			
		||||
  PanelOptionsGrid,
 | 
			
		||||
@@ -13,7 +12,7 @@ import {
 | 
			
		||||
  LegacyForms,
 | 
			
		||||
  FieldPropertiesEditor,
 | 
			
		||||
} from '@grafana/ui';
 | 
			
		||||
const { Select } = LegacyForms;
 | 
			
		||||
const { Select, Switch } = LegacyForms;
 | 
			
		||||
import { Options, GraphOptions } from './types';
 | 
			
		||||
import { GraphLegendEditor } from './GraphLegendEditor';
 | 
			
		||||
import { NewPanelEditorContext } from 'app/features/dashboard/components/PanelEditor/PanelEditor';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
// Libraries
 | 
			
		||||
import React, { PureComponent } from 'react';
 | 
			
		||||
import { Switch, PanelOptionsGrid, PanelOptionsGroup, FormLabel, LegacyForms } from '@grafana/ui';
 | 
			
		||||
const { Select } = LegacyForms;
 | 
			
		||||
import { PanelOptionsGrid, PanelOptionsGroup, FormLabel, LegacyForms } from '@grafana/ui';
 | 
			
		||||
const { Select, Switch } = LegacyForms;
 | 
			
		||||
 | 
			
		||||
// Types
 | 
			
		||||
import { Options } from './types';
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,8 @@ import React, { PureComponent } from 'react';
 | 
			
		||||
 | 
			
		||||
// Types
 | 
			
		||||
import { PanelEditorProps } from '@grafana/data';
 | 
			
		||||
import { Switch } from '@grafana/ui';
 | 
			
		||||
import { LegacyForms } from '@grafana/ui';
 | 
			
		||||
const { Switch } = LegacyForms;
 | 
			
		||||
import { Options } from './types';
 | 
			
		||||
 | 
			
		||||
export class TablePanelEditor extends PureComponent<PanelEditorProps<Options>> {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user