mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CloudMonitoring: Update AnnotationQueryEditor to use experimental UI components (#51841)
This commit is contained in:
parent
401ce2b2f9
commit
689639cdb0
@ -2,6 +2,7 @@ import React, { useState } from 'react';
|
|||||||
import { useDebounce } from 'react-use';
|
import { useDebounce } from 'react-use';
|
||||||
|
|
||||||
import { QueryEditorProps, toOption } from '@grafana/data';
|
import { QueryEditorProps, toOption } from '@grafana/data';
|
||||||
|
import { EditorField, EditorRows, EditorRow } from '@grafana/experimental';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { Input } from '@grafana/ui';
|
import { Input } from '@grafana/ui';
|
||||||
|
|
||||||
@ -79,38 +80,52 @@ export const AnnotationQueryEditor = (props: Props) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<EditorRows>
|
||||||
{config.featureToggles.cloudMonitoringExperimentalUI ? (
|
{config.featureToggles.cloudMonitoringExperimentalUI ? (
|
||||||
<ExperimentalMetricQueryEditor
|
<>
|
||||||
refId={query.refId}
|
<ExperimentalMetricQueryEditor
|
||||||
variableOptionGroup={variableOptionGroup}
|
refId={query.refId}
|
||||||
customMetaData={customMetaData}
|
variableOptionGroup={variableOptionGroup}
|
||||||
onChange={handleQueryChange}
|
customMetaData={customMetaData}
|
||||||
onRunQuery={onRunQuery}
|
onChange={handleQueryChange}
|
||||||
datasource={datasource}
|
onRunQuery={onRunQuery}
|
||||||
query={metricQuery}
|
datasource={datasource}
|
||||||
/>
|
query={metricQuery}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<EditorRow>
|
||||||
|
<EditorField label="Title" htmlFor="annotation-query-title">
|
||||||
|
<Input id="annotation-query-title" value={title} onChange={handleTitleChange} />
|
||||||
|
</EditorField>
|
||||||
|
</EditorRow>
|
||||||
|
|
||||||
|
<EditorRow>
|
||||||
|
<EditorField label="Text" htmlFor="annotation-query-text">
|
||||||
|
<Input id="annotation-query-text" value={text} onChange={handleTextChange} />
|
||||||
|
</EditorField>
|
||||||
|
</EditorRow>
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<MetricQueryEditor
|
<>
|
||||||
refId={query.refId}
|
<MetricQueryEditor
|
||||||
variableOptionGroup={variableOptionGroup}
|
refId={query.refId}
|
||||||
customMetaData={customMetaData}
|
variableOptionGroup={variableOptionGroup}
|
||||||
onChange={handleQueryChange}
|
customMetaData={customMetaData}
|
||||||
onRunQuery={onRunQuery}
|
onChange={handleQueryChange}
|
||||||
datasource={datasource}
|
onRunQuery={onRunQuery}
|
||||||
query={metricQuery}
|
datasource={datasource}
|
||||||
/>
|
query={metricQuery}
|
||||||
|
/>
|
||||||
|
<QueryEditorRow label="Title" htmlFor="annotation-query-title">
|
||||||
|
<Input id="annotation-query-title" value={title} width={INPUT_WIDTH} onChange={handleTitleChange} />
|
||||||
|
</QueryEditorRow>
|
||||||
|
|
||||||
|
<QueryEditorRow label="Text" htmlFor="annotation-query-text">
|
||||||
|
<Input id="annotation-query-text" value={text} width={INPUT_WIDTH} onChange={handleTextChange} />
|
||||||
|
</QueryEditorRow>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<QueryEditorRow label="Title" htmlFor="annotation-query-title">
|
|
||||||
<Input id="annotation-query-title" value={title} width={INPUT_WIDTH} onChange={handleTitleChange} />
|
|
||||||
</QueryEditorRow>
|
|
||||||
|
|
||||||
<QueryEditorRow label="Text" htmlFor="annotation-query-text">
|
|
||||||
<Input id="annotation-query-text" value={text} width={INPUT_WIDTH} onChange={handleTextChange} />
|
|
||||||
</QueryEditorRow>
|
|
||||||
|
|
||||||
<AnnotationsHelp />
|
<AnnotationsHelp />
|
||||||
</>
|
</EditorRows>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user