From c04e96b3ed9ef1b3d81e1c1a685f45af05c20519 Mon Sep 17 00:00:00 2001 From: Deepayan Mukherjee Date: Mon, 16 Oct 2023 15:57:42 +0530 Subject: [PATCH] Elasticsearch: Remove LegacyForms and gf-form from DataLink (#76397) * remove LegacyForms and gf-form references from ElasticSearch DataLink page Signed-off-by: Deepayan Mukherjee * fix breaking tests by adding label to inline switch Signed-off-by: Deepayan Mukherjee --------- Signed-off-by: Deepayan Mukherjee --- .../elasticsearch/configuration/DataLink.tsx | 127 ++++++++++-------- 1 file changed, 72 insertions(+), 55 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/configuration/DataLink.tsx b/public/app/plugins/datasource/elasticsearch/configuration/DataLink.tsx index dd4292cee11..37a0fab60b1 100644 --- a/public/app/plugins/datasource/elasticsearch/configuration/DataLink.tsx +++ b/public/app/plugins/datasource/elasticsearch/configuration/DataLink.tsx @@ -3,13 +3,20 @@ import React, { Dispatch, SetStateAction, useEffect, useState } from 'react'; import { usePrevious } from 'react-use'; import { DataSourceInstanceSettings, VariableSuggestion } from '@grafana/data'; -import { Button, LegacyForms, DataLinkInput, stylesFactory } from '@grafana/ui'; +import { + Button, + DataLinkInput, + stylesFactory, + InlineField, + InlineSwitch, + InlineFieldRow, + InlineLabel, + Input, +} from '@grafana/ui'; import { DataSourcePicker } from 'app/features/datasources/components/picker/DataSourcePicker'; import { DataLinkConfig } from '../types'; -const { FormField, Switch } = LegacyForms; - const getStyles = stylesFactory(() => ({ firstRow: css` display: flex; @@ -25,6 +32,7 @@ const getStyles = stylesFactory(() => ({ align-items: baseline; `, urlField: css` + display: flex; flex: 1; `, urlDisplayLabelField: css` @@ -53,18 +61,21 @@ export const DataLink = (props: Props) => { return (
-
- + + > + +
-
- - onChange({ - ...value, - url: newValue, - }) - } - suggestions={suggestions} - /> - } - className={styles.urlField} - /> - -
-
- { - if (showInternalLink) { + +
+ + {showInternalLink ? 'Query' : 'URL'} + + onChange({ ...value, - datasourceUid: undefined, - }); + url: newValue, + }) } - setShowInternalLink(!showInternalLink); - }} - /> + suggestions={suggestions} + /> +
+ +
+ + + +
+
+ +
+ + { + if (showInternalLink) { + onChange({ + ...value, + datasourceUid: undefined, + }); + } + setShowInternalLink(!showInternalLink); + }} + /> + {showInternalLink && (