mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Move query components to unified folder (#34587)
This commit is contained in:
parent
91657dad18
commit
dcef87fd79
@ -11,13 +11,16 @@ import {
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { Button, HorizontalGroup, Icon, stylesFactory, Tooltip } from '@grafana/ui';
|
||||
import { config } from '@grafana/runtime';
|
||||
import { AlertingQueryRows } from './AlertingQueryRows';
|
||||
import { dataSource as expressionDatasource, ExpressionDatasourceUID } from '../../expressions/ExpressionDatasource';
|
||||
import { QueryRows } from './QueryRows';
|
||||
import {
|
||||
dataSource as expressionDatasource,
|
||||
ExpressionDatasourceUID,
|
||||
} from 'app/features/expressions/ExpressionDatasource';
|
||||
import { getNextRefIdChar } from 'app/core/utils/query';
|
||||
import { defaultCondition } from '../../expressions/utils/expressionTypes';
|
||||
import { ExpressionQueryType } from '../../expressions/types';
|
||||
import { defaultCondition } from 'app/features/expressions/utils/expressionTypes';
|
||||
import { ExpressionQueryType } from 'app/features/expressions/types';
|
||||
import { GrafanaQuery } from 'app/types/unified-alerting-dto';
|
||||
import { AlertingQueryRunner } from '../state/AlertingQueryRunner';
|
||||
import { AlertingQueryRunner } from '../../state/AlertingQueryRunner';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
import { isExpressionQuery } from 'app/features/expressions/guards';
|
||||
|
||||
@ -29,7 +32,7 @@ interface Props {
|
||||
interface State {
|
||||
panelDataByRefId: Record<string, PanelData>;
|
||||
}
|
||||
export class AlertingQueryEditor extends PureComponent<Props, State> {
|
||||
export class QueryEditor extends PureComponent<Props, State> {
|
||||
private runner: AlertingQueryRunner;
|
||||
|
||||
constructor(props: Props) {
|
||||
@ -160,7 +163,7 @@ export class AlertingQueryEditor extends PureComponent<Props, State> {
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<AlertingQueryRows
|
||||
<QueryRows
|
||||
data={panelDataByRefId}
|
||||
queries={value}
|
||||
onQueriesChange={this.props.onChange}
|
@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
|
||||
import { DragDropContext, Droppable, DropResult } from 'react-beautiful-dnd';
|
||||
import { DataQuery, DataSourceInstanceSettings, PanelData, RelativeTimeRange } from '@grafana/data';
|
||||
import { getDataSourceSrv } from '@grafana/runtime';
|
||||
import { AlertingQueryWrapper } from './AlertingQueryWrapper';
|
||||
import { QueryWrapper } from './QueryWrapper';
|
||||
import { GrafanaQuery } from 'app/types/unified-alerting-dto';
|
||||
|
||||
interface Props {
|
||||
@ -20,7 +20,7 @@ interface State {
|
||||
dataPerQuery: Record<string, PanelData>;
|
||||
}
|
||||
|
||||
export class AlertingQueryRows extends PureComponent<Props, State> {
|
||||
export class QueryRows extends PureComponent<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
@ -148,7 +148,7 @@ export class AlertingQueryRows extends PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
return (
|
||||
<AlertingQueryWrapper
|
||||
<QueryWrapper
|
||||
index={index}
|
||||
key={`${query.refId}-${index}`}
|
||||
dsSettings={dsSettings}
|
@ -4,7 +4,7 @@ import { Field, InputControl } from '@grafana/ui';
|
||||
import { ExpressionEditor } from './ExpressionEditor';
|
||||
import { RuleEditorSection } from './RuleEditorSection';
|
||||
import { RuleFormType, RuleFormValues } from '../../types/rule-form';
|
||||
import { AlertingQueryEditor } from '../../../components/AlertingQueryEditor';
|
||||
import { QueryEditor } from './QueryEditor';
|
||||
|
||||
export const QueryStep: FC = () => {
|
||||
const {
|
||||
@ -35,7 +35,7 @@ export const QueryStep: FC = () => {
|
||||
>
|
||||
<InputControl
|
||||
name="queries"
|
||||
render={({ field: { ref, ...field } }) => <AlertingQueryEditor {...field} />}
|
||||
render={({ field: { ref, ...field } }) => <QueryEditor {...field} />}
|
||||
control={control}
|
||||
rules={{
|
||||
validate: (queries) => Array.isArray(queries) && !!queries.length,
|
||||
|
@ -9,9 +9,9 @@ import {
|
||||
getDefaultRelativeTimeRange,
|
||||
} from '@grafana/data';
|
||||
import { useStyles2, RelativeTimeRangePicker } from '@grafana/ui';
|
||||
import { QueryEditorRow } from '../../query/components/QueryEditorRow';
|
||||
import { VizWrapper } from '../unified/components/rule-editor/VizWrapper';
|
||||
import { isExpressionQuery } from '../../expressions/guards';
|
||||
import { QueryEditorRow } from '../../../../query/components/QueryEditorRow';
|
||||
import { VizWrapper } from './VizWrapper';
|
||||
import { isExpressionQuery } from '../../../../expressions/guards';
|
||||
import { GrafanaQuery } from 'app/types/unified-alerting-dto';
|
||||
import { cloneDeep } from 'lodash';
|
||||
|
||||
@ -29,7 +29,7 @@ interface Props {
|
||||
index: number;
|
||||
}
|
||||
|
||||
export const AlertingQueryWrapper: FC<Props> = ({
|
||||
export const QueryWrapper: FC<Props> = ({
|
||||
data,
|
||||
dsSettings,
|
||||
index,
|
@ -14,7 +14,7 @@ import { FetchResponse, toDataQueryError } from '@grafana/runtime';
|
||||
import { BackendSrv, getBackendSrv } from 'app/core/services/backend_srv';
|
||||
import { preProcessPanelData } from 'app/features/query/state/runRequest';
|
||||
import { GrafanaQuery } from 'app/types/unified-alerting-dto';
|
||||
import { getTimeRangeForExpression } from '../unified/utils/timeRange';
|
||||
import { getTimeRangeForExpression } from '../utils/timeRange';
|
||||
import { isExpressionQuery } from 'app/features/expressions/guards';
|
||||
import { setStructureRevision } from 'app/features/query/state/processing/revision';
|
||||
import { cancelNetworkRequestsOnUnsubscribe } from 'app/features/query/state/processing/canceler';
|
Loading…
Reference in New Issue
Block a user