From fd0d2a194c66c62fdb1ecefe649148c9795b7983 Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Wed, 3 Mar 2021 15:34:57 +0300 Subject: [PATCH] remove callouts --- .../create_index_pattern_wizard.tsx | 3 +- .../application/components/index_pattern.js | 6 +- .../index_pattern_select/combo_box_select.tsx | 4 +- .../field_text_select.tsx | 4 +- .../index_pattern_select.tsx | 6 +- .../migration_callout.tsx | 92 ------------------- .../switch_mode_popover.tsx | 5 - .../lib/index_pattern_select/types.ts | 2 +- .../components/panel_config/gauge.js | 2 +- .../components/panel_config/markdown.js | 2 +- .../components/panel_config/metric.js | 2 +- .../components/panel_config/table.js | 2 +- .../components/panel_config/timeseries.js | 2 +- .../components/panel_config/top_n.js | 2 +- 14 files changed, 18 insertions(+), 116 deletions(-) delete mode 100644 src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/migration_callout.tsx diff --git a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx index 633906feb785b4..9ff26decc1c6e3 100644 --- a/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx +++ b/src/plugins/index_pattern_management/public/components/create_index_pattern_wizard/create_index_pattern_wizard.tsx @@ -57,11 +57,10 @@ export class CreateIndexPatternWizard extends Component< context.services.setBreadcrumbs(getCreateBreadcrumbs()); const type = new URLSearchParams(props.location.search).get('type') || undefined; - const indexPattern = new URLSearchParams(props.location.search).get('name') || ''; this.state = { step: 1, - indexPattern, + indexPattern: '', allIndices: [], remoteClustersExist: false, isInitiallyLoadingIndices: true, diff --git a/src/plugins/vis_type_timeseries/public/application/components/index_pattern.js b/src/plugins/vis_type_timeseries/public/application/components/index_pattern.js index a9bde15120dabd..4c91cb1b9e0362 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/index_pattern.js +++ b/src/plugins/vis_type_timeseries/public/application/components/index_pattern.js @@ -66,7 +66,7 @@ export const IndexPattern = ({ disabled, model: _model, allowLevelOfDetail, - allowSwitchUseKibanaIndexesMode, + allowIndexSwitchingMode, }) => { const config = getUISettings(); const timeFieldName = `${prefix}time_field`; @@ -183,7 +183,7 @@ export const IndexPattern = ({ onChange={onChange} defaultIndexPattern={model.default_index_pattern} disabled={disabled} - allowSwitchUseKibanaIndexesMode={allowSwitchUseKibanaIndexesMode} + allowIndexSwitchingMode={allowIndexSwitchingMode} /> @@ -334,5 +334,5 @@ IndexPattern.propTypes = { disabled: PropTypes.bool, className: PropTypes.string, allowLevelOfDetail: PropTypes.bool, - allowSwitchUseKibanaIndexesMode: PropTypes.bool, + allowIndexSwitchingMode: PropTypes.bool, }; diff --git a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/combo_box_select.tsx b/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/combo_box_select.tsx index 36aa76977c2a43..533fc14e595c5a 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/combo_box_select.tsx +++ b/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/combo_box_select.tsx @@ -46,7 +46,7 @@ export const ComboBoxSelect = ({ disabled, value, placeholder, - allowSwitchUseKibanaIndexesMode, + allowSwitchMode, 'data-test-subj': dataTestSubj, }: SelectIndexComponentProps) => { const [availableIndexes, setAvailableIndexes] = useState([]); @@ -75,7 +75,7 @@ export const ComboBoxSelect = ({ isDisabled={disabled} placeholder={placeholder} data-test-subj={dataTestSubj} - {...(allowSwitchUseKibanaIndexesMode && { + {...(allowSwitchMode && { append: ( ), diff --git a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/field_text_select.tsx b/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/field_text_select.tsx index 39724e31b4f467..7bed5244870680 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/field_text_select.tsx +++ b/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/field_text_select.tsx @@ -19,7 +19,7 @@ export const FieldTextSelect = ({ value, placeholder, onModeChange, - allowSwitchUseKibanaIndexesMode, + allowSwitchMode, 'data-test-subj': dataTestSubj, }: SelectIndexComponentProps) => { const textualValue = convertIndexPatternObjectToStringRepresentation(value); @@ -38,7 +38,7 @@ export const FieldTextSelect = ({ value={textualValue} placeholder={placeholder} data-test-subj={dataTestSubj} - {...(allowSwitchUseKibanaIndexesMode && { + {...(allowSwitchMode && { append: ( ), diff --git a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/index_pattern_select.tsx b/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/index_pattern_select.tsx index 86e26e6f700def..35512f76e45749 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/index_pattern_select.tsx +++ b/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/index_pattern_select.tsx @@ -21,7 +21,7 @@ interface IndexPatternSelectProps { defaultIndexPattern: string; onChange: Function; disabled?: boolean; - allowSwitchUseKibanaIndexesMode?: boolean; + allowIndexSwitchingMode?: boolean; } export const IndexPatternSelect = ({ @@ -30,7 +30,7 @@ export const IndexPatternSelect = ({ onChange, disabled, defaultIndexPattern, - allowSwitchUseKibanaIndexesMode, + allowIndexSwitchingMode, }: IndexPatternSelectProps) => { const panelModel = useContext(PanelModelContext); const useKibanaIndices = Boolean(panelModel?.[USE_KIBANA_INDEXES_KEY]); @@ -67,7 +67,7 @@ export const IndexPatternSelect = ({ placeholder={defaultIndexPattern} onIndexChange={setInputValue} onModeChange={onModeChange} - allowSwitchUseKibanaIndexesMode={allowSwitchUseKibanaIndexesMode} + allowSwitchMode={allowIndexSwitchingMode} /> ); }; diff --git a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/migration_callout.tsx b/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/migration_callout.tsx deleted file mode 100644 index 2cd9713bafe8a0..00000000000000 --- a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/migration_callout.tsx +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React, { useCallback } from 'react'; -import { EuiTextColor, EuiButton, EuiCallOut, EuiSpacer } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { i18n } from '@kbn/i18n'; -import { getCoreStart } from '../../../../services'; -import type { IndexPatternObject } from '../../../../../common/types'; - -interface LegacyModePopoverProps { - switchMode: () => void; - value: string; - matchedIndex?: IndexPatternObject; -} - -const getReadyToMigrateCallOut = ( - value: LegacyModePopoverProps['value'], - onModeChange: LegacyModePopoverProps['switchMode'] -) => ( - - {value}, - }} - /> - - - - -); - -const getNoMatchedIndicesCallOut = ( - value: LegacyModePopoverProps['value'], - onCreateIndexClick: () => void -) => ( - - {value}, - }} - /> - - - - -); - -export const MigrationCallout = ({ value, switchMode, matchedIndex }: LegacyModePopoverProps) => { - const navigateToCreateIndexPatterns = useCallback(() => { - getCoreStart().application.navigateToApp('management', { - path: `/kibana/indexPatterns/create?name=${value}`, - }); - }, [value]); - - return ( - <> - - {matchedIndex && getReadyToMigrateCallOut(value, switchMode)} - {!matchedIndex && getNoMatchedIndicesCallOut(value, navigateToCreateIndexPatterns)} - - ); -}; diff --git a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/switch_mode_popover.tsx b/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/switch_mode_popover.tsx index 89eb0eed542359..7ebea5aaba3b66 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/switch_mode_popover.tsx +++ b/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/switch_mode_popover.tsx @@ -19,7 +19,6 @@ import { i18n } from '@kbn/i18n'; import { Assign } from '@kbn/utility-types'; import { FormattedMessage } from '@kbn/i18n/react'; import { SelectIndexComponentProps } from './types'; -import { MigrationCallout } from './migration_callout'; import { isStringTypeIndexPattern } from '../../../../../common/index_patterns_utils'; import { IndexPatternObject } from '../../../../../common/types'; import { getDataStart } from '../../../../services'; @@ -99,7 +98,6 @@ export const SwitchModePopover = ({ - {value && isStringTypeIndexPattern(value) && ( - - )} ); diff --git a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/types.ts b/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/types.ts index d109d6ee5056ff..0a0e434ee1b771 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/types.ts +++ b/src/plugins/vis_type_timeseries/public/application/components/lib/index_pattern_select/types.ts @@ -14,5 +14,5 @@ export interface SelectIndexComponentProps { 'data-test-subj': string; placeholder?: string; disabled?: boolean; - allowSwitchUseKibanaIndexesMode?: boolean; + allowSwitchMode?: boolean; } diff --git a/src/plugins/vis_type_timeseries/public/application/components/panel_config/gauge.js b/src/plugins/vis_type_timeseries/public/application/components/panel_config/gauge.js index fce782eb0ad017..1180c0e3fe866d 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/panel_config/gauge.js +++ b/src/plugins/vis_type_timeseries/public/application/components/panel_config/gauge.js @@ -126,7 +126,7 @@ class GaugePanelConfigUi extends Component { fields={this.props.fields} model={this.props.model} onChange={this.props.onChange} - allowSwitchUseKibanaIndexesMode={true} + allowIndexSwitchingMode={true} /> diff --git a/src/plugins/vis_type_timeseries/public/application/components/panel_config/markdown.js b/src/plugins/vis_type_timeseries/public/application/components/panel_config/markdown.js index cfd5824b220063..023220c9ee5df3 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/panel_config/markdown.js +++ b/src/plugins/vis_type_timeseries/public/application/components/panel_config/markdown.js @@ -132,7 +132,7 @@ class MarkdownPanelConfigUi extends Component { fields={this.props.fields} model={this.props.model} onChange={this.props.onChange} - allowSwitchUseKibanaIndexesMode={true} + allowIndexSwitchingMode={true} /> diff --git a/src/plugins/vis_type_timeseries/public/application/components/panel_config/metric.js b/src/plugins/vis_type_timeseries/public/application/components/panel_config/metric.js index f0c00e65759d10..5e89745d28f7ba 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/panel_config/metric.js +++ b/src/plugins/vis_type_timeseries/public/application/components/panel_config/metric.js @@ -90,7 +90,7 @@ export class MetricPanelConfig extends Component { fields={this.props.fields} model={this.props.model} onChange={this.props.onChange} - allowSwitchUseKibanaIndexesMode={true} + allowIndexSwitchingMode={true} /> diff --git a/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js b/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js index 65c4a86753da0e..35830e637b9ee0 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js +++ b/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js @@ -217,7 +217,7 @@ export class TablePanelConfig extends Component { fields={this.props.fields} model={this.props.model} onChange={this.props.onChange} - allowSwitchUseKibanaIndexesMode={true} + allowIndexSwitchingMode={true} /> diff --git a/src/plugins/vis_type_timeseries/public/application/components/panel_config/timeseries.js b/src/plugins/vis_type_timeseries/public/application/components/panel_config/timeseries.js index 3e94110a9ec44c..9695483464845f 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/panel_config/timeseries.js +++ b/src/plugins/vis_type_timeseries/public/application/components/panel_config/timeseries.js @@ -183,7 +183,7 @@ class TimeseriesPanelConfigUi extends Component { model={this.props.model} onChange={this.props.onChange} allowLevelOfDetail={true} - allowSwitchUseKibanaIndexesMode={true} + allowIndexSwitchingMode={true} /> diff --git a/src/plugins/vis_type_timeseries/public/application/components/panel_config/top_n.js b/src/plugins/vis_type_timeseries/public/application/components/panel_config/top_n.js index 5b4fd47e9bf8b4..bca3f1a829ec5c 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/panel_config/top_n.js +++ b/src/plugins/vis_type_timeseries/public/application/components/panel_config/top_n.js @@ -116,7 +116,7 @@ export class TopNPanelConfig extends Component { fields={this.props.fields} model={this.props.model} onChange={this.props.onChange} - allowSwitchUseKibanaIndexesMode={true} + allowIndexSwitchingMode={true} />