AzureMonitor: Use Field instead of InlineField (#75837)
Use Field instead of InlineField - Update labels
This commit is contained in:
+13
-37
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import { useEffectOnce } from 'react-use';
|
import { useEffectOnce } from 'react-use';
|
||||||
|
|
||||||
import { SelectableValue } from '@grafana/data';
|
import { SelectableValue } from '@grafana/data';
|
||||||
import { Alert, InlineField, Select } from '@grafana/ui';
|
import { Alert, Field, Select } from '@grafana/ui';
|
||||||
|
|
||||||
import DataSource from '../../datasource';
|
import DataSource from '../../datasource';
|
||||||
import { selectors } from '../../e2e/selectors';
|
import { selectors } from '../../e2e/selectors';
|
||||||
@@ -228,11 +228,7 @@ const VariableEditor = (props: Props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<InlineField
|
<Field label="Query Type" data-testid={selectors.components.variableEditor.queryType.input}>
|
||||||
label="Select query type"
|
|
||||||
labelWidth={20}
|
|
||||||
data-testid={selectors.components.variableEditor.queryType.input}
|
|
||||||
>
|
|
||||||
<Select
|
<Select
|
||||||
aria-label="select query type"
|
aria-label="select query type"
|
||||||
onChange={onQueryTypeChange}
|
onChange={onQueryTypeChange}
|
||||||
@@ -240,7 +236,7 @@ const VariableEditor = (props: Props) => {
|
|||||||
width={25}
|
width={25}
|
||||||
value={queryType}
|
value={queryType}
|
||||||
/>
|
/>
|
||||||
</InlineField>
|
</Field>
|
||||||
{query.queryType === AzureQueryType.LogAnalytics && (
|
{query.queryType === AzureQueryType.LogAnalytics && (
|
||||||
<>
|
<>
|
||||||
<LogsQueryEditor
|
<LogsQueryEditor
|
||||||
@@ -266,11 +262,7 @@ const VariableEditor = (props: Props) => {
|
|||||||
<GrafanaTemplateVariableFnInput query={query} updateQuery={props.onChange} datasource={datasource} />
|
<GrafanaTemplateVariableFnInput query={query} updateQuery={props.onChange} datasource={datasource} />
|
||||||
)}
|
)}
|
||||||
{requireSubscription && (
|
{requireSubscription && (
|
||||||
<InlineField
|
<Field label="Subscription" data-testid={selectors.components.variableEditor.subscription.input}>
|
||||||
label="Select subscription"
|
|
||||||
labelWidth={20}
|
|
||||||
data-testid={selectors.components.variableEditor.subscription.input}
|
|
||||||
>
|
|
||||||
<Select
|
<Select
|
||||||
aria-label="select subscription"
|
aria-label="select subscription"
|
||||||
onChange={onChangeSubscription}
|
onChange={onChangeSubscription}
|
||||||
@@ -278,14 +270,10 @@ const VariableEditor = (props: Props) => {
|
|||||||
width={25}
|
width={25}
|
||||||
value={query.subscription || null}
|
value={query.subscription || null}
|
||||||
/>
|
/>
|
||||||
</InlineField>
|
</Field>
|
||||||
)}
|
)}
|
||||||
{(requireResourceGroup || hasResourceGroup) && (
|
{(requireResourceGroup || hasResourceGroup) && (
|
||||||
<InlineField
|
<Field label="Resource Group" data-testid={selectors.components.variableEditor.resourceGroup.input}>
|
||||||
label="Select resource group"
|
|
||||||
labelWidth={20}
|
|
||||||
data-testid={selectors.components.variableEditor.resourceGroup.input}
|
|
||||||
>
|
|
||||||
<Select
|
<Select
|
||||||
aria-label="select resource group"
|
aria-label="select resource group"
|
||||||
onChange={onChangeResourceGroup}
|
onChange={onChangeResourceGroup}
|
||||||
@@ -298,14 +286,10 @@ const VariableEditor = (props: Props) => {
|
|||||||
value={query.resourceGroup || null}
|
value={query.resourceGroup || null}
|
||||||
placeholder={requireResourceGroup ? undefined : 'Optional'}
|
placeholder={requireResourceGroup ? undefined : 'Optional'}
|
||||||
/>
|
/>
|
||||||
</InlineField>
|
</Field>
|
||||||
)}
|
)}
|
||||||
{(requireNamespace || hasNamespace) && (
|
{(requireNamespace || hasNamespace) && (
|
||||||
<InlineField
|
<Field label="Namespace" data-testid={selectors.components.variableEditor.namespace.input}>
|
||||||
label="Select namespace"
|
|
||||||
labelWidth={20}
|
|
||||||
data-testid={selectors.components.variableEditor.namespace.input}
|
|
||||||
>
|
|
||||||
<Select
|
<Select
|
||||||
aria-label="select namespace"
|
aria-label="select namespace"
|
||||||
onChange={onChangeNamespace}
|
onChange={onChangeNamespace}
|
||||||
@@ -318,14 +302,10 @@ const VariableEditor = (props: Props) => {
|
|||||||
value={query.namespace || null}
|
value={query.namespace || null}
|
||||||
placeholder={requireNamespace ? undefined : 'Optional'}
|
placeholder={requireNamespace ? undefined : 'Optional'}
|
||||||
/>
|
/>
|
||||||
</InlineField>
|
</Field>
|
||||||
)}
|
)}
|
||||||
{hasRegion && (
|
{hasRegion && (
|
||||||
<InlineField
|
<Field label="Region" data-testid={selectors.components.variableEditor.region.input}>
|
||||||
label="Select region"
|
|
||||||
labelWidth={20}
|
|
||||||
data-testid={selectors.components.variableEditor.region.input}
|
|
||||||
>
|
|
||||||
<Select
|
<Select
|
||||||
aria-label="select region"
|
aria-label="select region"
|
||||||
onChange={onChangeRegion}
|
onChange={onChangeRegion}
|
||||||
@@ -334,14 +314,10 @@ const VariableEditor = (props: Props) => {
|
|||||||
value={query.region || null}
|
value={query.region || null}
|
||||||
placeholder="Optional"
|
placeholder="Optional"
|
||||||
/>
|
/>
|
||||||
</InlineField>
|
</Field>
|
||||||
)}
|
)}
|
||||||
{requireResource && (
|
{requireResource && (
|
||||||
<InlineField
|
<Field label="Resource" data-testid={selectors.components.variableEditor.resource.input}>
|
||||||
label="Select resource"
|
|
||||||
labelWidth={20}
|
|
||||||
data-testid={selectors.components.variableEditor.resource.input}
|
|
||||||
>
|
|
||||||
<Select
|
<Select
|
||||||
aria-label="select resource"
|
aria-label="select resource"
|
||||||
onChange={onChangeResource}
|
onChange={onChangeResource}
|
||||||
@@ -349,7 +325,7 @@ const VariableEditor = (props: Props) => {
|
|||||||
width={25}
|
width={25}
|
||||||
value={query.resource || null}
|
value={query.resource || null}
|
||||||
/>
|
/>
|
||||||
</InlineField>
|
</Field>
|
||||||
)}
|
)}
|
||||||
{query.queryType === AzureQueryType.AzureResourceGraph && (
|
{query.queryType === AzureQueryType.AzureResourceGraph && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user