mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: ESlint import order (#44959)
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data';
|
||||
import { DataSourceHttpSettings, InlineFormLabel, Select } from '@grafana/ui';
|
||||
import React from 'react';
|
||||
|
||||
import { AlertManagerDataSourceJsonData, AlertManagerImplementation } from './types';
|
||||
|
||||
export type Props = DataSourcePluginOptionsEditorProps<AlertManagerDataSourceJsonData>;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { lastValueFrom, Observable, of } from 'rxjs';
|
||||
|
||||
import { DataQuery, DataQueryResponse, DataSourceApi, DataSourceInstanceSettings } from '@grafana/data';
|
||||
import { BackendSrvRequest, getBackendSrv } from '@grafana/runtime';
|
||||
|
||||
import { AlertManagerDataSourceJsonData, AlertManagerImplementation } from './types';
|
||||
|
||||
export type AlertManagerQuery = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { DataSourcePlugin } from '@grafana/data';
|
||||
|
||||
import { ConfigEditor } from './ConfigEditor';
|
||||
import { AlertManagerDatasource } from './DataSource';
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { isString } from 'lodash';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
|
||||
import { ALIGNMENT_PERIODS, SELECTORS } from './constants';
|
||||
import CloudMonitoringDatasource from './datasource';
|
||||
import { CloudMonitoringVariableQuery, MetricDescriptor, MetricFindQueryTypes, MetricKind, ValueTypes } from './types';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import {
|
||||
extractServicesFromMetricDescriptors,
|
||||
getAggregationOptionsByMetric,
|
||||
@@ -10,6 +11,7 @@ import {
|
||||
getLabelKeys,
|
||||
getMetricTypesByService,
|
||||
} from './functions';
|
||||
import { CloudMonitoringVariableQuery, MetricDescriptor, MetricFindQueryTypes, MetricKind, ValueTypes } from './types';
|
||||
|
||||
export default class CloudMonitoringMetricFindQuery {
|
||||
constructor(private datasource: CloudMonitoringDatasource) {}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { Select } from '@grafana/ui';
|
||||
import { Aggregation, Props } from './Aggregation';
|
||||
import { ValueTypes, MetricKind } from '../types';
|
||||
import React from 'react';
|
||||
import { TemplateSrvStub } from 'test/specs/helpers';
|
||||
|
||||
import { Select } from '@grafana/ui';
|
||||
|
||||
import { ValueTypes, MetricKind } from '../types';
|
||||
|
||||
import { Aggregation, Props } from './Aggregation';
|
||||
|
||||
const props: Props = {
|
||||
onChange: () => {},
|
||||
// @ts-ignore
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { Select } from '@grafana/ui';
|
||||
import React, { FC, useMemo } from 'react';
|
||||
|
||||
import { QueryEditorField } from '.';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { Select } from '@grafana/ui';
|
||||
|
||||
import { getAggregationOptionsByMetric } from '../functions';
|
||||
import { MetricDescriptor, MetricKind, ValueTypes } from '../types';
|
||||
|
||||
import { QueryEditorField } from '.';
|
||||
|
||||
export interface Props {
|
||||
refId: string;
|
||||
onChange: (metricDescriptor: string) => void;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { Input } from '@grafana/ui';
|
||||
import { debounce } from 'lodash';
|
||||
import React, { FunctionComponent, useState } from 'react';
|
||||
|
||||
import { QueryEditorRow } from '.';
|
||||
import { Input } from '@grafana/ui';
|
||||
|
||||
import { INPUT_WIDTH } from '../constants';
|
||||
|
||||
import { QueryEditorRow } from '.';
|
||||
|
||||
export interface Props {
|
||||
refId: string;
|
||||
onChange: (alias: any) => void;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import React, { FC } from 'react';
|
||||
|
||||
import { AlignmentFunction, AlignmentPeriod, AlignmentPeriodLabel, QueryEditorField, QueryEditorRow } from '.';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
|
||||
import { SELECT_WIDTH } from '../constants';
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
import { CustomMetaData, MetricQuery, SLOQuery } from '../types';
|
||||
|
||||
import { AlignmentFunction, AlignmentPeriod, AlignmentPeriodLabel, QueryEditorField, QueryEditorRow } from '.';
|
||||
|
||||
export interface Props {
|
||||
refId: string;
|
||||
onChange: (query: MetricQuery | SLOQuery) => void;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { FC, useMemo } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { Select } from '@grafana/ui';
|
||||
import React, { FC, useMemo } from 'react';
|
||||
|
||||
import { SELECT_WIDTH } from '../constants';
|
||||
import { getAlignmentPickerData } from '../functions';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { Select } from '@grafana/ui';
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { ALIGNMENT_PERIODS } from '../constants';
|
||||
import { MetricQuery, SLOQuery } from '../types';
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import React, { FC, useMemo } from 'react';
|
||||
|
||||
import { rangeUtil } from '@grafana/data';
|
||||
|
||||
import { ALIGNMENTS } from '../constants';
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
import { CustomMetaData } from '../types';
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import React from 'react';
|
||||
|
||||
import { SelectableValue, toOption } from '@grafana/data';
|
||||
import { TemplateSrv } from '@grafana/runtime';
|
||||
import { LegacyForms } from '@grafana/ui';
|
||||
import React from 'react';
|
||||
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
import { AnnotationTarget, EditorMode, MetricDescriptor, MetricKind } from '../types';
|
||||
|
||||
import { AnnotationsHelp, LabelFilter, Metrics, Project, QueryEditorRow } from './';
|
||||
|
||||
const { Input } = LegacyForms;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { QueryEditorHelpProps } from '@grafana/data';
|
||||
import { css } from '@emotion/css';
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
import { QueryEditorHelpProps } from '@grafana/data';
|
||||
|
||||
import { CloudMonitoringQuery } from '../types';
|
||||
|
||||
export default class CloudMonitoringCheatSheet extends PureComponent<
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
||||
import { CloudMonitoringOptions, CloudMonitoringSecureJsonData } from '../../types';
|
||||
import { ConnectionConfig } from '@grafana/google-sdk';
|
||||
|
||||
import { CloudMonitoringOptions, CloudMonitoringSecureJsonData } from '../../types';
|
||||
|
||||
export type Props = DataSourcePluginOptionsEditorProps<CloudMonitoringOptions, CloudMonitoringSecureJsonData>;
|
||||
|
||||
export class ConfigEditor extends PureComponent<Props> {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { css } from '@emotion/css';
|
||||
import React, { FC } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { HorizontalGroup, InlineField, InlineLabel, PopoverContent, Select } from '@grafana/ui';
|
||||
import React, { FC } from 'react';
|
||||
|
||||
import { INNER_LABEL_WIDTH, LABEL_WIDTH } from '../constants';
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { MultiSelect } from '@grafana/ui';
|
||||
import React, { FunctionComponent, useMemo } from 'react';
|
||||
|
||||
import { Aggregation, QueryEditorRow } from '.';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { MultiSelect } from '@grafana/ui';
|
||||
|
||||
import { INPUT_WIDTH, SYSTEM_LABELS } from '../constants';
|
||||
import { labelsToGroupedOptions } from '../functions';
|
||||
import { MetricDescriptor, MetricQuery } from '../types';
|
||||
|
||||
import { Aggregation, QueryEditorRow } from '.';
|
||||
|
||||
export interface Props {
|
||||
refId: string;
|
||||
variableOptionGroup: SelectableValue<string>;
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import { SelectableValue, toOption } from '@grafana/data';
|
||||
import { Button, HorizontalGroup, Select, VerticalGroup } from '@grafana/ui';
|
||||
import { CustomControlProps } from '@grafana/ui/src/components/Select/types';
|
||||
import { flatten } from 'lodash';
|
||||
import React, { FunctionComponent, useCallback, useMemo } from 'react';
|
||||
|
||||
import { QueryEditorRow } from '.';
|
||||
import { SelectableValue, toOption } from '@grafana/data';
|
||||
import { Button, HorizontalGroup, Select, VerticalGroup } from '@grafana/ui';
|
||||
import { CustomControlProps } from '@grafana/ui/src/components/Select/types';
|
||||
|
||||
import { SELECT_WIDTH } from '../constants';
|
||||
import { labelsToGroupedOptions, stringArrayToFilters } from '../functions';
|
||||
import { Filter } from '../types';
|
||||
|
||||
import { QueryEditorRow } from '.';
|
||||
|
||||
export interface Props {
|
||||
labels: { [key: string]: string[] };
|
||||
filters: string[];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
import { TextArea } from '@grafana/ui';
|
||||
|
||||
export interface Props {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { AliasBy, Project, VisualMetricQueryEditor } from '.';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
import { getAlignmentPickerData } from '../functions';
|
||||
import {
|
||||
@@ -15,8 +15,11 @@ import {
|
||||
SLOQuery,
|
||||
ValueTypes,
|
||||
} from '../types';
|
||||
|
||||
import { MQLQueryEditor } from './MQLQueryEditor';
|
||||
|
||||
import { AliasBy, Project, VisualMetricQueryEditor } from '.';
|
||||
|
||||
export interface Props {
|
||||
refId: string;
|
||||
customMetaData: CustomMetaData;
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
import { css } from '@emotion/css';
|
||||
import { GrafanaTheme2, SelectableValue } from '@grafana/data';
|
||||
import { TemplateSrv } from '@grafana/runtime';
|
||||
import { getSelectStyles, Select, useStyles2, useTheme2 } from '@grafana/ui';
|
||||
import { startCase, uniqBy } from 'lodash';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { QueryEditorField, QueryEditorRow } from '.';
|
||||
import { GrafanaTheme2, SelectableValue } from '@grafana/data';
|
||||
import { TemplateSrv } from '@grafana/runtime';
|
||||
import { getSelectStyles, Select, useStyles2, useTheme2 } from '@grafana/ui';
|
||||
|
||||
import { INNER_LABEL_WIDTH, LABEL_WIDTH, SELECT_WIDTH } from '../constants';
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
import { MetricDescriptor } from '../types';
|
||||
|
||||
import { QueryEditorField, QueryEditorRow } from '.';
|
||||
|
||||
export interface Props {
|
||||
refId: string;
|
||||
onChange: (metricDescriptor: MetricDescriptor) => void;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import React, { FunctionComponent, useMemo } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { RadioButtonGroup } from '@grafana/ui';
|
||||
import { MetricDescriptor, MetricKind, MetricQuery, PreprocessorType, ValueTypes } from '../types';
|
||||
|
||||
import { getAlignmentPickerData } from '../functions';
|
||||
import { MetricDescriptor, MetricKind, MetricQuery, PreprocessorType, ValueTypes } from '../types';
|
||||
|
||||
import { QueryEditorRow } from '.';
|
||||
|
||||
const NONE_OPTION = { label: 'None', value: PreprocessorType.None };
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { Select } from '@grafana/ui';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
import { QueryEditorRow } from '.';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { Select } from '@grafana/ui';
|
||||
|
||||
import { SELECT_WIDTH } from '../constants';
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
|
||||
import { QueryEditorRow } from '.';
|
||||
|
||||
export interface Props {
|
||||
refId: string;
|
||||
datasource: CloudMonitoringDatasource;
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
import { css } from '@emotion/css';
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
import { QueryEditorProps, toOption } from '@grafana/data';
|
||||
import { Button, Select } from '@grafana/ui';
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
import { QUERY_TYPES, SELECT_WIDTH } from '../constants';
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
import { CloudMonitoringQuery, EditorMode, MetricQuery, QueryType, SLOQuery, CloudMonitoringOptions } from '../types';
|
||||
import { MetricQueryEditor, QueryEditorRow, SLOQueryEditor } from './';
|
||||
|
||||
import { defaultQuery } from './MetricQueryEditor';
|
||||
import { defaultQuery as defaultSLOQuery } from './SLO/SLOQueryEditor';
|
||||
|
||||
import { MetricQueryEditor, QueryEditorRow, SLOQueryEditor } from './';
|
||||
|
||||
export type Props = QueryEditorProps<CloudMonitoringDatasource, CloudMonitoringQuery, CloudMonitoringOptions>;
|
||||
|
||||
export class QueryEditor extends PureComponent<Props> {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { Select } from '@grafana/ui';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { QueryEditorRow } from '..';
|
||||
import { SELECT_WIDTH } from '../../constants';
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import React from 'react';
|
||||
|
||||
import { Selector, Service, SLO } from '.';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
|
||||
import { AliasBy, AlignmentPeriod, AlignmentPeriodLabel, Project, QueryEditorRow } from '..';
|
||||
import { SELECT_WIDTH } from '../../constants';
|
||||
import CloudMonitoringDatasource from '../../datasource';
|
||||
import { AlignmentTypes, CustomMetaData, SLOQuery } from '../../types';
|
||||
|
||||
import { Selector, Service, SLO } from '.';
|
||||
|
||||
export interface Props {
|
||||
refId: string;
|
||||
customMetaData: CustomMetaData;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { Select } from '@grafana/ui';
|
||||
import React from 'react';
|
||||
|
||||
import { QueryEditorRow } from '..';
|
||||
import { SELECT_WIDTH, SELECTORS } from '../../constants';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { Select } from '@grafana/ui';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { QueryEditorRow } from '..';
|
||||
import { SELECT_WIDTH } from '../../constants';
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import React from 'react';
|
||||
// @ts-ignore
|
||||
import renderer from 'react-test-renderer';
|
||||
import { CloudMonitoringVariableQueryEditor, Props } from './VariableQueryEditor';
|
||||
import { CloudMonitoringVariableQuery, MetricFindQueryTypes } from '../types';
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
|
||||
import { VariableModel } from '@grafana/data';
|
||||
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
import { CloudMonitoringVariableQuery, MetricFindQueryTypes } from '../types';
|
||||
|
||||
import { CloudMonitoringVariableQueryEditor, Props } from './VariableQueryEditor';
|
||||
|
||||
jest.mock('../functions', () => ({
|
||||
getMetricTypes: (): any => ({ metricTypes: [], selectedMetricType: '' }),
|
||||
extractServicesFromMetricDescriptors: (): any[] => [],
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
import { getTemplateSrv } from '@grafana/runtime';
|
||||
import { QueryEditorProps } from '@grafana/data';
|
||||
import { getTemplateSrv } from '@grafana/runtime';
|
||||
|
||||
import { VariableQueryField } from './';
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
import { extractServicesFromMetricDescriptors, getLabelKeys, getMetricTypes } from '../functions';
|
||||
import {
|
||||
CloudMonitoringOptions,
|
||||
@@ -13,7 +13,8 @@ import {
|
||||
MetricFindQueryTypes,
|
||||
VariableQueryData,
|
||||
} from '../types';
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
|
||||
import { VariableQueryField } from './';
|
||||
|
||||
export type Props = QueryEditorProps<
|
||||
CloudMonitoringDatasource,
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import React from 'react';
|
||||
|
||||
import { Alignment, GroupBy, LabelFilter, Metrics, Preprocessor } from '.';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
|
||||
import CloudMonitoringDatasource from '../datasource';
|
||||
import { CustomMetaData, MetricDescriptor, MetricQuery, SLOQuery } from '../types';
|
||||
|
||||
import { Alignment, GroupBy, LabelFilter, Metrics, Preprocessor } from '.';
|
||||
|
||||
export interface Props {
|
||||
refId: string;
|
||||
customMetaData: CustomMetaData;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { MetricKind, QueryType, ValueTypes } from './types';
|
||||
import { GoogleAuthType } from '@grafana/google-sdk';
|
||||
|
||||
import { MetricKind, QueryType, ValueTypes } from './types';
|
||||
|
||||
// not super excited about using uneven numbers, but this makes it align perfectly with rows that has two fields
|
||||
export const INPUT_WIDTH = 71;
|
||||
export const LABEL_WIDTH = 19;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { chunk, flatten, isString, isArray } from 'lodash';
|
||||
import { from, lastValueFrom, Observable, of } from 'rxjs';
|
||||
import { map, mergeMap } from 'rxjs/operators';
|
||||
|
||||
import {
|
||||
DataQueryRequest,
|
||||
DataQueryResponse,
|
||||
@@ -9,9 +10,9 @@ import {
|
||||
SelectableValue,
|
||||
} from '@grafana/data';
|
||||
import { DataSourceWithBackend, getBackendSrv, toDataQueryResponse } from '@grafana/runtime';
|
||||
|
||||
import { getTemplateSrv, TemplateSrv } from 'app/features/templating/template_srv';
|
||||
import { getTimeSrv, TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||
import { getTemplateSrv, TemplateSrv } from 'app/features/templating/template_srv';
|
||||
|
||||
import {
|
||||
CloudMonitoringOptions,
|
||||
CloudMonitoringQuery,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { getTemplateSrv, TemplateSrv } from '@grafana/runtime';
|
||||
import { chunk, initial, startCase, uniqBy } from 'lodash';
|
||||
|
||||
import { getTemplateSrv, TemplateSrv } from '@grafana/runtime';
|
||||
|
||||
import { AGGREGATIONS, ALIGNMENTS, SYSTEM_LABELS } from './constants';
|
||||
import CloudMonitoringDatasource from './datasource';
|
||||
import { AlignmentTypes, MetricDescriptor, MetricKind, PreprocessorType, ValueTypes } from './types';
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { DataSourcePlugin } from '@grafana/data';
|
||||
import CloudMonitoringDatasource from './datasource';
|
||||
import { QueryEditor } from './components/QueryEditor';
|
||||
import { ConfigEditor } from './components/ConfigEditor/ConfigEditor';
|
||||
|
||||
import CloudMonitoringCheatSheet from './components/CloudMonitoringCheatSheet';
|
||||
import { CloudMonitoringAnnotationsQueryCtrl } from './annotations_query_ctrl';
|
||||
import CloudMonitoringCheatSheet from './components/CloudMonitoringCheatSheet';
|
||||
import { ConfigEditor } from './components/ConfigEditor/ConfigEditor';
|
||||
import { QueryEditor } from './components/QueryEditor';
|
||||
import { CloudMonitoringVariableQueryEditor } from './components/VariableQueryEditor';
|
||||
import CloudMonitoringDatasource from './datasource';
|
||||
import { CloudMonitoringQuery } from './types';
|
||||
|
||||
export const plugin = new DataSourcePlugin<CloudMonitoringDatasource, CloudMonitoringQuery>(CloudMonitoringDatasource)
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { DataSourceInstanceSettings, toUtc } from '@grafana/data';
|
||||
import { createFetchResponse } from 'test/helpers/createFetchResponse';
|
||||
|
||||
import CloudMonitoringDataSource from '../datasource';
|
||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||
import { CloudMonitoringOptions } from '../types';
|
||||
import { DataSourceInstanceSettings, toUtc } from '@grafana/data';
|
||||
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
|
||||
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||
import { CustomVariableModel } from '../../../../features/variables/types';
|
||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||
|
||||
import { initialCustomVariableModelState } from '../../../../features/variables/custom/reducer';
|
||||
import { createFetchResponse } from 'test/helpers/createFetchResponse';
|
||||
import { CustomVariableModel } from '../../../../features/variables/types';
|
||||
import CloudMonitoringDataSource from '../datasource';
|
||||
import { CloudMonitoringOptions } from '../types';
|
||||
|
||||
jest.mock('@grafana/runtime', () => ({
|
||||
...(jest.requireActual('@grafana/runtime') as unknown as object),
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { map, mergeMap } from 'rxjs/operators';
|
||||
|
||||
import { CustomVariableSupport, DataQueryRequest, DataQueryResponse } from '@grafana/data';
|
||||
|
||||
import CloudMonitoringDatasource from './datasource';
|
||||
import { CloudMonitoringVariableQuery } from './types';
|
||||
import CloudMonitoringMetricFindQuery from './CloudMonitoringMetricFindQuery';
|
||||
import { CloudMonitoringVariableQueryEditor } from './components/VariableQueryEditor';
|
||||
import CloudMonitoringDatasource from './datasource';
|
||||
import { CloudMonitoringVariableQuery } from './types';
|
||||
|
||||
export class CloudMonitoringVariableSupport extends CustomVariableSupport<
|
||||
CloudMonitoringDatasource,
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { dateTime } from '@grafana/data';
|
||||
import { setBackendSrv } from '@grafana/runtime';
|
||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||
import { initialCustomVariableModelState } from 'app/features/variables/custom/reducer';
|
||||
import { CustomVariableModel } from 'app/features/variables/types';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
import { TemplateSrvMock } from '../../../../features/templating/template_srv.mock';
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { monacoTypes } from '@grafana/ui';
|
||||
|
||||
import { Monaco } from '../../monarch/types';
|
||||
import * as SQLTestData from '../cloudwatch-sql-test-data';
|
||||
import * as MetricMathTestData from '../metric-math-test-data';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { defaultsDeep } from 'lodash';
|
||||
|
||||
import { CloudWatchAnnotationQuery } from './types';
|
||||
|
||||
export class CloudWatchAnnotationsQueryCtrl {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||
import { QueryEditorExpressionType } from '../expressions';
|
||||
import { SQLExpression } from '../types';
|
||||
|
||||
import {
|
||||
aggregationvariable,
|
||||
labelsVariable,
|
||||
@@ -15,6 +14,9 @@ import {
|
||||
createFunction,
|
||||
createProperty,
|
||||
} from '../__mocks__/sqlUtils';
|
||||
import { QueryEditorExpressionType } from '../expressions';
|
||||
import { SQLExpression } from '../types';
|
||||
|
||||
import SQLGenerator from './SQLGenerator';
|
||||
|
||||
describe('SQLGenerator', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getTemplateSrv, TemplateSrv } from 'app/features/templating/template_srv';
|
||||
import { SQLExpression } from '../types';
|
||||
|
||||
import {
|
||||
QueryEditorArrayExpression,
|
||||
QueryEditorExpression,
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
QueryEditorOperatorExpression,
|
||||
QueryEditorPropertyExpression,
|
||||
} from '../expressions';
|
||||
import { SQLExpression } from '../types';
|
||||
|
||||
export default class SQLGenerator {
|
||||
constructor(private templateSrv: TemplateSrv = getTemplateSrv()) {}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import type { Monaco, monacoTypes } from '@grafana/ui';
|
||||
import { uniq } from 'lodash';
|
||||
import { TRIGGER_SUGGEST } from '../../monarch/commands';
|
||||
|
||||
import { getTemplateSrv, TemplateSrv } from '@grafana/runtime';
|
||||
import type { Monaco, monacoTypes } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { CompletionItemProvider } from '../../monarch/CompletionItemProvider';
|
||||
import { LinkedToken } from '../../monarch/LinkedToken';
|
||||
import { TRIGGER_SUGGEST } from '../../monarch/commands';
|
||||
import { SuggestionKind, CompletionItemPriority, StatementPosition } from '../../monarch/types';
|
||||
import { SQLTokenTypes } from './types';
|
||||
import {
|
||||
BY,
|
||||
FROM,
|
||||
@@ -19,12 +23,11 @@ import {
|
||||
LOGICAL_OPERATORS,
|
||||
STATISTICS,
|
||||
} from '../language';
|
||||
import { getMetricNameToken, getNamespaceToken } from './tokenUtils';
|
||||
import { CompletionItemProvider } from '../../monarch/CompletionItemProvider';
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { getTemplateSrv, TemplateSrv } from '@grafana/runtime';
|
||||
|
||||
import { getStatementPosition } from './statementPosition';
|
||||
import { getSuggestionKinds } from './suggestionKind';
|
||||
import { getMetricNameToken, getNamespaceToken } from './tokenUtils';
|
||||
import { SQLTokenTypes } from './types';
|
||||
|
||||
type CompletionItem = monacoTypes.languages.CompletionItem;
|
||||
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import { monacoTypes } from '@grafana/ui';
|
||||
import MonacoMock from '../../__mocks__/monarch/Monaco';
|
||||
import TextModel from '../../__mocks__/monarch/TextModel';
|
||||
|
||||
import {
|
||||
multiLineFullQuery,
|
||||
singleLineFullQuery,
|
||||
singleLineEmptyQuery,
|
||||
singleLineTwoQueries,
|
||||
} from '../../__mocks__/cloudwatch-sql-test-data';
|
||||
import MonacoMock from '../../__mocks__/monarch/Monaco';
|
||||
import TextModel from '../../__mocks__/monarch/TextModel';
|
||||
import { linkedTokenBuilder } from '../../monarch/linkedTokenBuilder';
|
||||
import { StatementPosition } from '../../monarch/types';
|
||||
import { getStatementPosition } from './statementPosition';
|
||||
import cloudWatchSqlLanguageDefinition from '../definition';
|
||||
|
||||
import { getStatementPosition } from './statementPosition';
|
||||
import { SQLTokenTypes } from './types';
|
||||
|
||||
describe('statementPosition', () => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { AND, ASC, BY, DESC, EQUALS, FROM, GROUP, NOT_EQUALS, ORDER, SCHEMA, SELECT, WHERE } from '../language';
|
||||
import { LinkedToken } from '../../monarch/LinkedToken';
|
||||
import { StatementPosition } from '../../monarch/types';
|
||||
import { AND, ASC, BY, DESC, EQUALS, FROM, GROUP, NOT_EQUALS, ORDER, SCHEMA, SELECT, WHERE } from '../language';
|
||||
|
||||
import { SQLTokenTypes } from './types';
|
||||
|
||||
export function getStatementPosition(currentToken: LinkedToken | null): StatementPosition {
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
import { monacoTypes } from '@grafana/ui';
|
||||
import MonacoMock from '../../__mocks__/monarch/Monaco';
|
||||
import TextModel from '../../__mocks__/monarch/TextModel';
|
||||
|
||||
import {
|
||||
multiLineFullQuery,
|
||||
singleLineFullQuery,
|
||||
singleLineTwoQueries,
|
||||
multiLineIncompleteQueryWithoutNamespace,
|
||||
} from '../../__mocks__/cloudwatch-sql-test-data';
|
||||
import MonacoMock from '../../__mocks__/monarch/Monaco';
|
||||
import TextModel from '../../__mocks__/monarch/TextModel';
|
||||
import { LinkedToken } from '../../monarch/LinkedToken';
|
||||
import { linkedTokenBuilder } from '../../monarch/linkedTokenBuilder';
|
||||
import { SQLTokenTypes } from './types';
|
||||
import { getMetricNameToken, getNamespaceToken, getSelectStatisticToken, getSelectToken } from './tokenUtils';
|
||||
import { SELECT } from '../language';
|
||||
import cloudWatchSqlLanguageDefinition from '../definition';
|
||||
import { SELECT } from '../language';
|
||||
|
||||
import { getMetricNameToken, getNamespaceToken, getSelectStatisticToken, getSelectToken } from './tokenUtils';
|
||||
import { SQLTokenTypes } from './types';
|
||||
|
||||
const getToken = (
|
||||
query: string,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { LinkedToken } from '../../monarch/LinkedToken';
|
||||
import { FROM, SCHEMA, SELECT } from '../language';
|
||||
|
||||
import { SQLTokenTypes } from './types';
|
||||
|
||||
export const getSelectToken = (currentToken: LinkedToken | null) =>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { FunctionComponent, useState } from 'react';
|
||||
import { debounce } from 'lodash';
|
||||
import React, { FunctionComponent, useState } from 'react';
|
||||
|
||||
import { Input } from '@grafana/ui';
|
||||
|
||||
export interface Props {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React from 'react';
|
||||
import '@testing-library/jest-dom';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { setupMockedDataSource } from '../__mocks__/CloudWatchDataSource';
|
||||
import { CloudWatchAnnotationQuery } from '../types';
|
||||
|
||||
import { AnnotationQueryEditor } from './AnnotationQueryEditor';
|
||||
|
||||
const ds = setupMockedDataSource({
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import React, { ChangeEvent } from 'react';
|
||||
|
||||
import { PanelData } from '@grafana/data';
|
||||
import { EditorField, EditorHeader, EditorRow, InlineSelect, Space } from '@grafana/experimental';
|
||||
import { Input, Switch } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { useRegions } from '../hooks';
|
||||
import { CloudWatchAnnotationQuery, CloudWatchMetricsQuery } from '../types';
|
||||
|
||||
import { MetricStatEditor } from './MetricStatEditor';
|
||||
|
||||
export type Props = {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { CloudWatchLogsQuery } from '../types';
|
||||
import { PanelData } from '@grafana/data';
|
||||
import { Icon } from '@grafana/ui';
|
||||
|
||||
import { encodeUrl, AwsUrl } from '../aws_url';
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { CloudWatchLogsQuery } from '../types';
|
||||
|
||||
interface Props {
|
||||
query: CloudWatchLogsQuery;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
|
||||
import { AwsAuthType } from '@grafana/aws-sdk';
|
||||
|
||||
import { ConfigEditor, Props } from './ConfigEditor';
|
||||
|
||||
jest.mock('app/features/plugins/datasource_srv', () => ({
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
import React, { FC, useEffect, useState } from 'react';
|
||||
import { useDebounce } from 'react-use';
|
||||
import { Input, InlineField } from '@grafana/ui';
|
||||
|
||||
import { ConnectionConfig } from '@grafana/aws-sdk';
|
||||
import {
|
||||
rangeUtil,
|
||||
DataSourcePluginOptionsEditorProps,
|
||||
onUpdateDatasourceJsonDataOption,
|
||||
updateDatasourcePluginJsonDataOption,
|
||||
} from '@grafana/data';
|
||||
import { ConnectionConfig } from '@grafana/aws-sdk';
|
||||
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
import { store } from 'app/store/store';
|
||||
import { Input, InlineField } from '@grafana/ui';
|
||||
import { notifyApp } from 'app/core/actions';
|
||||
import { createWarningNotification } from 'app/core/copy/appNotification';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
import { store } from 'app/store/store';
|
||||
|
||||
import { CloudWatchJsonData, CloudWatchSecureJsonData } from '../types';
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { CloudWatchJsonData, CloudWatchSecureJsonData } from '../types';
|
||||
|
||||
import { XrayLinkConfig } from './XrayLinkConfig';
|
||||
|
||||
export type Props = DataSourcePluginOptionsEditorProps<CloudWatchJsonData, CloudWatchSecureJsonData>;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React from 'react';
|
||||
import { fireEvent, render, screen, within } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
|
||||
import { Dimensions } from '..';
|
||||
import { setupMockedDataSource } from '../../__mocks__/CloudWatchDataSource';
|
||||
import { CloudWatchMetricsQuery } from '../../types';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { Dimensions } from '..';
|
||||
|
||||
const ds = setupMockedDataSource({
|
||||
variables: [],
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { isEqual } from 'lodash';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { EditorList } from '@grafana/experimental';
|
||||
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { Dimensions as DimensionsType, DimensionsQuery } from '../../types';
|
||||
|
||||
import { FilterItem } from './FilterItem';
|
||||
|
||||
export interface Props {
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import React, { FunctionComponent, useMemo } from 'react';
|
||||
import { css, cx } from '@emotion/css';
|
||||
import React, { FunctionComponent, useMemo } from 'react';
|
||||
import { useAsyncFn } from 'react-use';
|
||||
|
||||
import { GrafanaTheme2, SelectableValue, toOption } from '@grafana/data';
|
||||
import { InputGroup, AccessoryButton } from '@grafana/experimental';
|
||||
import { Select, stylesFactory, useTheme2 } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { Dimensions, DimensionsQuery } from '../../types';
|
||||
import { appendTemplateVariables } from '../../utils/utils';
|
||||
|
||||
import { DimensionFilterCondition } from './Dimensions';
|
||||
|
||||
export interface Props {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React, { InputHTMLAttributes, FunctionComponent } from 'react';
|
||||
|
||||
import { InlineFormLabel } from '@grafana/ui';
|
||||
|
||||
export interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { stripIndent, stripIndents } from 'common-tags';
|
||||
import { QueryEditorHelpProps } from '@grafana/data';
|
||||
import Prism from 'prismjs';
|
||||
import tokenizer from '../syntax';
|
||||
import { flattenTokens } from '@grafana/ui/src/slate-plugins/slate-prism';
|
||||
import { css, cx } from '@emotion/css';
|
||||
import { stripIndent, stripIndents } from 'common-tags';
|
||||
import Prism from 'prismjs';
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
import { QueryEditorHelpProps } from '@grafana/data';
|
||||
import { flattenTokens } from '@grafana/ui/src/slate-plugins/slate-prism';
|
||||
|
||||
import tokenizer from '../syntax';
|
||||
import { CloudWatchQuery } from '../types';
|
||||
|
||||
interface QueryExample {
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
// Libraries
|
||||
import { css } from '@emotion/css';
|
||||
import React, { memo } from 'react';
|
||||
|
||||
// Types
|
||||
import { AbsoluteTimeRange, QueryEditorProps } from '@grafana/data';
|
||||
import { InlineFormLabel } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { CloudWatchJsonData, CloudWatchLogsQuery, CloudWatchQuery } from '../types';
|
||||
import { CloudWatchLogsQueryField } from './LogsQueryField';
|
||||
|
||||
import CloudWatchLink from './CloudWatchLink';
|
||||
import { css } from '@emotion/css';
|
||||
import { CloudWatchLogsQueryField } from './LogsQueryField';
|
||||
|
||||
type Props = QueryEditorProps<CloudWatchDatasource, CloudWatchQuery, CloudWatchJsonData> & {
|
||||
allowCustomValue?: boolean;
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { CloudWatchLogsQueryField } from './LogsQueryField';
|
||||
import { ExploreId } from '../../../../types';
|
||||
import { DescribeLogGroupsRequest } from '../types';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
// eslint-disable-next-line lodash/import-scope
|
||||
import _, { DebouncedFunc } from 'lodash';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import { shallow } from 'enzyme';
|
||||
import _, { DebouncedFunc } from 'lodash'; // eslint-disable-line lodash/import-scope
|
||||
import React from 'react';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
|
||||
import { ExploreId } from '../../../../types';
|
||||
import { setupMockedDataSource } from '../__mocks__/CloudWatchDataSource';
|
||||
import { DescribeLogGroupsRequest } from '../types';
|
||||
|
||||
import { CloudWatchLogsQueryField } from './LogsQueryField';
|
||||
|
||||
jest
|
||||
.spyOn(_, 'debounce')
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
// Libraries
|
||||
import React, { ReactNode } from 'react';
|
||||
import { css } from '@emotion/css';
|
||||
import { intersectionBy, debounce, unionBy } from 'lodash';
|
||||
import { LanguageMap, languages as prismLanguages } from 'prismjs';
|
||||
import React, { ReactNode } from 'react';
|
||||
import { Editor, Node, Plugin } from 'slate';
|
||||
|
||||
import { AbsoluteTimeRange, QueryEditorProps, SelectableValue } from '@grafana/data';
|
||||
import {
|
||||
BracesPlugin,
|
||||
LegacyForms,
|
||||
@@ -11,25 +14,18 @@ import {
|
||||
TypeaheadInput,
|
||||
TypeaheadOutput,
|
||||
} from '@grafana/ui';
|
||||
|
||||
// Utils & Services
|
||||
// dom also includes Element polyfills
|
||||
import { Editor, Node, Plugin } from 'slate';
|
||||
import syntax from '../syntax';
|
||||
|
||||
// Types
|
||||
import { AbsoluteTimeRange, QueryEditorProps, SelectableValue } from '@grafana/data';
|
||||
import { CloudWatchJsonData, CloudWatchLogsQuery, CloudWatchQuery } from '../types';
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { LanguageMap, languages as prismLanguages } from 'prismjs';
|
||||
import { CloudWatchLanguageProvider } from '../language_provider';
|
||||
import { css } from '@emotion/css';
|
||||
import { ExploreId } from 'app/types';
|
||||
import { dispatch } from 'app/store/store';
|
||||
import { InputActionMeta } from '@grafana/ui/src/components/Select/types';
|
||||
import { notifyApp } from 'app/core/actions';
|
||||
import { createErrorNotification } from 'app/core/copy/appNotification';
|
||||
import { InputActionMeta } from '@grafana/ui/src/components/Select/types';
|
||||
import { dispatch } from 'app/store/store';
|
||||
import { ExploreId } from 'app/types';
|
||||
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { CloudWatchLanguageProvider } from '../language_provider';
|
||||
import syntax from '../syntax';
|
||||
import { CloudWatchJsonData, CloudWatchLogsQuery, CloudWatchQuery } from '../types';
|
||||
import { getStatsGroups } from '../utils/query/getStatsGroups';
|
||||
|
||||
import QueryHeader from './QueryHeader';
|
||||
|
||||
export interface CloudWatchLogsQueryFieldProps
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import React, { useCallback, useRef } from 'react';
|
||||
import { CodeEditor, Monaco } from '@grafana/ui';
|
||||
import language from '../metric-math/definition';
|
||||
import { registerLanguage } from '../monarch/register';
|
||||
import type * as monacoType from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import { TRIGGER_SUGGEST } from '../monarch/commands';
|
||||
import React, { useCallback, useRef } from 'react';
|
||||
|
||||
import { CodeEditor, Monaco } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import language from '../metric-math/definition';
|
||||
import { TRIGGER_SUGGEST } from '../monarch/commands';
|
||||
import { registerLanguage } from '../monarch/register';
|
||||
|
||||
export interface Props {
|
||||
onChange: (query: string) => void;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { groupBy } from 'lodash';
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { MetadataInspectorProps } from '@grafana/data';
|
||||
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { CloudWatchQuery, CloudWatchJsonData } from '../types';
|
||||
import { groupBy } from 'lodash';
|
||||
|
||||
export type Props = MetadataInspectorProps<CloudWatchDatasource, CloudWatchQuery, CloudWatchJsonData>;
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React from 'react';
|
||||
import { fireEvent, render, screen, act, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import selectEvent from 'react-select-event';
|
||||
|
||||
import { MetricStatEditor } from '..';
|
||||
import { setupMockedDataSource } from '../../__mocks__/CloudWatchDataSource';
|
||||
import { CloudWatchMetricsQuery } from '../../types';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { MetricStatEditor } from '..';
|
||||
|
||||
const ds = setupMockedDataSource({
|
||||
variables: [],
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import React from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { EditorField, EditorFieldGroup, EditorRow, EditorRows } from '@grafana/experimental';
|
||||
import { Select, Switch } from '@grafana/ui';
|
||||
|
||||
import { Dimensions } from '..';
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { useDimensionKeys, useMetrics, useNamespaces } from '../../hooks';
|
||||
import { CloudWatchMetricsQuery } from '../../types';
|
||||
import { appendTemplateVariables, toOption } from '../../utils/utils';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
|
||||
export type Props = {
|
||||
query: CloudWatchMetricsQuery;
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
import { render, screen, act } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import selectEvent from 'react-select-event';
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
import { DataSourceInstanceSettings } from '@grafana/data';
|
||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||
import { MetricsQueryEditor, normalizeQuery, Props } from './MetricsQueryEditor';
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
|
||||
import { CustomVariableModel, initialVariableModelState } from '../../../../features/variables/types';
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { CloudWatchJsonData, MetricEditorMode, MetricQueryType } from '../types';
|
||||
|
||||
import { MetricsQueryEditor, normalizeQuery, Props } from './MetricsQueryEditor';
|
||||
|
||||
const setup = () => {
|
||||
const instanceSettings = {
|
||||
jsonData: { defaultRegion: 'us-east-1' },
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import React, { ChangeEvent, PureComponent } from 'react';
|
||||
|
||||
import { QueryEditorProps } from '@grafana/data';
|
||||
import { EditorField, EditorRow, Space } from '@grafana/experimental';
|
||||
import { Input } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { isMetricsQuery } from '../guards';
|
||||
import {
|
||||
@@ -11,9 +13,11 @@ import {
|
||||
MetricEditorMode,
|
||||
MetricQueryType,
|
||||
} from '../types';
|
||||
import { Alias, MathExpressionQueryField, MetricStatEditor, SQLBuilderEditor, SQLCodeEditor } from './';
|
||||
|
||||
import QueryHeader from './QueryHeader';
|
||||
|
||||
import { Alias, MathExpressionQueryField, MetricStatEditor, SQLBuilderEditor, SQLCodeEditor } from './';
|
||||
|
||||
export type Props = QueryEditorProps<CloudWatchDatasource, CloudWatchQuery, CloudWatchJsonData>;
|
||||
|
||||
interface State {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import { CloudWatchMetricsQuery, MetricEditorMode, MetricQueryType } from '../types';
|
||||
|
||||
import { setupMockedDataSource } from '../__mocks__/CloudWatchDataSource';
|
||||
import { CloudWatchMetricsQuery, MetricEditorMode, MetricQueryType } from '../types';
|
||||
|
||||
import MetricsQueryHeader from './MetricsQueryHeader';
|
||||
|
||||
const ds = setupMockedDataSource({
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { Button, ConfirmModal, RadioButtonGroup } from '@grafana/ui';
|
||||
import { InlineSelect, FlexItem } from '@grafana/experimental';
|
||||
import { Button, ConfirmModal, RadioButtonGroup } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { CloudWatchMetricsQuery, CloudWatchQuery, MetricEditorMode, MetricQueryType } from '../types';
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
import { QueryEditorProps, ExploreMode } from '@grafana/data';
|
||||
import { CloudWatchJsonData, CloudWatchQuery } from '../types';
|
||||
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { MetricsQueryEditor } from './MetricsQueryEditor';
|
||||
import { CloudWatchJsonData, CloudWatchQuery } from '../types';
|
||||
|
||||
import LogsQueryEditor from './LogsQueryEditor';
|
||||
import { MetricsQueryEditor } from './MetricsQueryEditor';
|
||||
|
||||
export type Props = QueryEditorProps<CloudWatchDatasource, CloudWatchQuery, CloudWatchJsonData>;
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import React from 'react';
|
||||
import { render, screen, waitFor, act } from '@testing-library/react';
|
||||
import { CloudWatchLogsQuery, CloudWatchMetricsQuery, MetricEditorMode, MetricQueryType } from '../types';
|
||||
import React from 'react';
|
||||
|
||||
import { setupMockedDataSource } from '../__mocks__/CloudWatchDataSource';
|
||||
import { CloudWatchLogsQuery, CloudWatchMetricsQuery, MetricEditorMode, MetricQueryType } from '../types';
|
||||
|
||||
import QueryHeader from './QueryHeader';
|
||||
|
||||
const ds = setupMockedDataSource({
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { ExploreMode, SelectableValue } from '@grafana/data';
|
||||
import { EditorHeader, InlineSelect } from '@grafana/experimental';
|
||||
import { pick } from 'lodash';
|
||||
import React from 'react';
|
||||
|
||||
import { ExploreMode, SelectableValue } from '@grafana/data';
|
||||
import { EditorHeader, InlineSelect } from '@grafana/experimental';
|
||||
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { useRegions } from '../hooks';
|
||||
import { CloudWatchQuery, CloudWatchQueryMode } from '../types';
|
||||
|
||||
import MetricsQueryHeader from './MetricsQueryHeader';
|
||||
|
||||
interface QueryHeaderProps {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React from 'react';
|
||||
import { SQLBuilderEditor } from '..';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import { CloudWatchMetricsQuery, MetricEditorMode, MetricQueryType, SQLExpression } from '../../types';
|
||||
import React from 'react';
|
||||
|
||||
import { SQLBuilderEditor } from '..';
|
||||
import { setupMockedDataSource } from '../../__mocks__/CloudWatchDataSource';
|
||||
import { QueryEditorExpressionType, QueryEditorPropertyType } from '../../expressions';
|
||||
import { CloudWatchMetricsQuery, MetricEditorMode, MetricQueryType, SQLExpression } from '../../types';
|
||||
|
||||
const { datasource } = setupMockedDataSource();
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { EditorField, EditorRow, EditorRows } from '@grafana/experimental';
|
||||
import { Input } from '@grafana/ui';
|
||||
|
||||
import SQLGenerator from '../../cloudwatch-sql/SQLGenerator';
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { CloudWatchMetricsQuery } from '../../types';
|
||||
|
||||
import SQLBuilderSelectRow from './SQLBuilderSelectRow';
|
||||
import SQLFilter from './SQLFilter';
|
||||
import SQLGroupBy from './SQLGroupBy';
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import React from 'react';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import { act, render, screen } from '@testing-library/react';
|
||||
import { CloudWatchMetricsQuery, MetricEditorMode, MetricQueryType, SQLExpression } from '../../types';
|
||||
import React from 'react';
|
||||
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
|
||||
import { setupMockedDataSource } from '../../__mocks__/CloudWatchDataSource';
|
||||
import { QueryEditorExpressionType, QueryEditorPropertyType } from '../../expressions';
|
||||
import { CloudWatchMetricsQuery, MetricEditorMode, MetricQueryType, SQLExpression } from '../../types';
|
||||
|
||||
import SQLBuilderSelectRow from './SQLBuilderSelectRow';
|
||||
|
||||
const { datasource } = setupMockedDataSource();
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
|
||||
import { SelectableValue, toOption } from '@grafana/data';
|
||||
import { EditorField, EditorFieldGroup } from '@grafana/experimental';
|
||||
import { Select, Switch } from '@grafana/ui';
|
||||
|
||||
import { STATISTICS } from '../../cloudwatch-sql/language';
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { useDimensionKeys, useMetrics, useNamespaces } from '../../hooks';
|
||||
import { CloudWatchMetricsQuery } from '../../types';
|
||||
import { appendTemplateVariables } from '../../utils/utils';
|
||||
|
||||
import {
|
||||
getMetricNameFromExpression,
|
||||
getNamespaceFromExpression,
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useAsyncFn } from 'react-use';
|
||||
|
||||
import { SelectableValue, toOption } from '@grafana/data';
|
||||
import { AccessoryButton, EditorList, InputGroup } from '@grafana/experimental';
|
||||
import { Select } from '@grafana/ui';
|
||||
|
||||
import { COMPARISON_OPERATORS, EQUALS } from '../../cloudwatch-sql/language';
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { QueryEditorExpressionType, QueryEditorOperatorExpression, QueryEditorPropertyType } from '../../expressions';
|
||||
import { useDimensionKeys } from '../../hooks';
|
||||
import { CloudWatchMetricsQuery } from '../../types';
|
||||
import { appendTemplateVariables } from '../../utils/utils';
|
||||
|
||||
import {
|
||||
getFlattenedFilters,
|
||||
getMetricNameFromExpression,
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import React from 'react';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import selectEvent from 'react-select-event';
|
||||
import { CloudWatchMetricsQuery, MetricEditorMode, MetricQueryType, SQLExpression } from '../../types';
|
||||
|
||||
import { setupMockedDataSource } from '../../__mocks__/CloudWatchDataSource';
|
||||
import { createArray, createGroupBy } from '../../__mocks__/sqlUtils';
|
||||
import { CloudWatchMetricsQuery, MetricEditorMode, MetricQueryType, SQLExpression } from '../../types';
|
||||
|
||||
import SQLGroupBy from './SQLGroupBy';
|
||||
|
||||
const { datasource } = setupMockedDataSource();
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import React, { useMemo, useState } from 'react';
|
||||
|
||||
import { SelectableValue, toOption } from '@grafana/data';
|
||||
import { AccessoryButton, EditorList, InputGroup } from '@grafana/experimental';
|
||||
import { Select } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { QueryEditorExpressionType, QueryEditorGroupByExpression, QueryEditorPropertyType } from '../../expressions';
|
||||
import { useDimensionKeys } from '../../hooks';
|
||||
import { CloudWatchMetricsQuery } from '../../types';
|
||||
|
||||
import {
|
||||
getFlattenedGroupBys,
|
||||
getMetricNameFromExpression,
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import React from 'react';
|
||||
|
||||
import { SelectableValue, toOption } from '@grafana/data';
|
||||
import { AccessoryButton, EditorField, EditorFieldGroup } from '@grafana/experimental';
|
||||
import { Select } from '@grafana/ui';
|
||||
|
||||
import { ASC, DESC, STATISTICS } from '../../cloudwatch-sql/language';
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { CloudWatchMetricsQuery } from '../../types';
|
||||
import { appendTemplateVariables } from '../../utils/utils';
|
||||
|
||||
import { setOrderBy, setSql } from './utils';
|
||||
|
||||
interface SQLBuilderSelectRowProps {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { SelectableValue } from './../../../../../../../packages/grafana-data/src/types/select';
|
||||
import { SCHEMA } from '../../cloudwatch-sql/language';
|
||||
import {
|
||||
QueryEditorExpressionType,
|
||||
@@ -10,6 +9,8 @@ import {
|
||||
} from '../../expressions';
|
||||
import { SQLExpression, CloudWatchMetricsQuery, Dimensions } from '../../types';
|
||||
|
||||
import { SelectableValue } from './../../../../../../../packages/grafana-data/src/types/select';
|
||||
|
||||
export function getMetricNameFromExpression(selectExpression: SQLExpression['select']): string | undefined {
|
||||
return selectExpression?.parameters?.[0].name;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import React, { FunctionComponent, useCallback, useEffect } from 'react';
|
||||
import type * as monacoType from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import React, { FunctionComponent, useCallback, useEffect } from 'react';
|
||||
|
||||
import { CodeEditor, Monaco } from '@grafana/ui';
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
|
||||
import language from '../cloudwatch-sql/definition';
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { TRIGGER_SUGGEST } from '../monarch/commands';
|
||||
import { registerLanguage } from '../monarch/register';
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { render, screen, waitFor, within } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { select } from 'react-select-event';
|
||||
import { Dimensions, VariableQueryType } from '../../types';
|
||||
|
||||
import { setupMockedDataSource } from '../../__mocks__/CloudWatchDataSource';
|
||||
import { Dimensions, VariableQueryType } from '../../types';
|
||||
|
||||
import { VariableQueryEditor, Props } from './VariableQueryEditor';
|
||||
|
||||
const defaultQuery = {
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import React from 'react';
|
||||
|
||||
import { QueryEditorProps, SelectableValue } from '@grafana/data';
|
||||
import { VariableTextField } from './VariableTextField';
|
||||
import { InlineField } from '@grafana/ui';
|
||||
|
||||
import { Dimensions } from '..';
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { useDimensionKeys, useMetrics, useNamespaces, useRegions } from '../../hooks';
|
||||
import { CloudWatchJsonData, CloudWatchQuery, VariableQuery, VariableQueryType } from '../../types';
|
||||
import { migrateVariableQuery } from '../../migrations';
|
||||
import { CloudWatchJsonData, CloudWatchQuery, VariableQuery, VariableQueryType } from '../../types';
|
||||
|
||||
import { VariableQueryField } from './VariableQueryField';
|
||||
import { Dimensions } from '..';
|
||||
import { InlineField } from '@grafana/ui';
|
||||
import { VariableTextField } from './VariableTextField';
|
||||
|
||||
export type Props = QueryEditorProps<CloudWatchDatasource, CloudWatchQuery, CloudWatchJsonData, VariableQuery>;
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { InlineField, Select } from '@grafana/ui';
|
||||
import React from 'react';
|
||||
|
||||
import { VariableQueryType } from '../../types';
|
||||
|
||||
const LABEL_WIDTH = 20;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { InlineField, Input } from '@grafana/ui';
|
||||
import React, { FC, useState } from 'react';
|
||||
|
||||
import { InlineField, Input } from '@grafana/ui';
|
||||
|
||||
const LABEL_WIDTH = 20;
|
||||
|
||||
interface VariableTextFieldProps {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import React from 'react';
|
||||
import { css } from '@emotion/css';
|
||||
import { Alert, InlineField, useStyles2 } from '@grafana/ui';
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
import React from 'react';
|
||||
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { DataSourcePicker } from '@grafana/runtime';
|
||||
import { Alert, InlineField, useStyles2 } from '@grafana/ui';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
|
||||
const getStyles = (theme: GrafanaTheme2) => ({
|
||||
infoText: css`
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { ArrayVector, DataFrame, dataFrameToJSON, dateTime, Field, MutableDataFrame } from '@grafana/data';
|
||||
import { setDataSourceSrv } from '@grafana/runtime';
|
||||
import { lastValueFrom, of } from 'rxjs';
|
||||
import { toArray } from 'rxjs/operators';
|
||||
|
||||
import { ArrayVector, DataFrame, dataFrameToJSON, dateTime, Field, MutableDataFrame } from '@grafana/data';
|
||||
import { setDataSourceSrv } from '@grafana/runtime';
|
||||
|
||||
import {
|
||||
labelsVariable,
|
||||
limitVariable,
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
import { cloneDeep, find, findLast, isEmpty, isString, set } from 'lodash';
|
||||
import React from 'react';
|
||||
import { from, lastValueFrom, merge, Observable, of, throwError, zip } from 'rxjs';
|
||||
import { catchError, concatMap, finalize, map, mergeMap, repeat, scan, share, takeWhile, tap } from 'rxjs/operators';
|
||||
|
||||
import {
|
||||
DataFrame,
|
||||
DataQueryError,
|
||||
@@ -25,10 +30,6 @@ import { getTemplateSrv, TemplateSrv } from 'app/features/templating/template_sr
|
||||
import { VariableWithMultiSupport } from 'app/features/variables/types';
|
||||
import { store } from 'app/store/store';
|
||||
import { AppNotificationTimeout } from 'app/types';
|
||||
import { cloneDeep, find, findLast, isEmpty, isString, set } from 'lodash';
|
||||
import React from 'react';
|
||||
import { from, lastValueFrom, merge, Observable, of, throwError, zip } from 'rxjs';
|
||||
import { catchError, concatMap, finalize, map, mergeMap, repeat, scan, share, takeWhile, tap } from 'rxjs/operators';
|
||||
|
||||
import { SQLCompletionItemProvider } from './cloudwatch-sql/completion/CompletionItemProvider';
|
||||
import { ThrottlingErrorMessage } from './components/ThrottlingErrorMessage';
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { SelectableValue, toOption } from '@grafana/data';
|
||||
import { appendTemplateVariables } from './utils/utils';
|
||||
import { Dimensions } from './types';
|
||||
import { CloudWatchDatasource } from './datasource';
|
||||
import { useDeepCompareEffect } from 'react-use';
|
||||
|
||||
import { SelectableValue, toOption } from '@grafana/data';
|
||||
|
||||
import { CloudWatchDatasource } from './datasource';
|
||||
import { Dimensions } from './types';
|
||||
import { appendTemplateVariables } from './utils/utils';
|
||||
|
||||
export const useRegions = (datasource: CloudWatchDatasource): [Array<SelectableValue<string>>, boolean] => {
|
||||
const [regionsIsLoading, setRegionsIsLoading] = useState<boolean>(false);
|
||||
const [regions, setRegions] = useState<Array<SelectableValue<string>>>([{ label: 'default', value: 'default' }]);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Value } from 'slate';
|
||||
import { TypeaheadOutput } from '@grafana/ui';
|
||||
import { CloudWatchDatasource } from './datasource';
|
||||
import { GetLogGroupFieldsResponse } from './types';
|
||||
import { CloudWatchLanguageProvider } from './language_provider';
|
||||
import Prism, { Token } from 'prismjs';
|
||||
import { Value } from 'slate';
|
||||
|
||||
import { TypeaheadOutput } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from './datasource';
|
||||
import { CloudWatchLanguageProvider } from './language_provider';
|
||||
import {
|
||||
AGGREGATION_FUNCTIONS_STATS,
|
||||
BOOLEAN_FUNCTIONS,
|
||||
@@ -14,6 +15,7 @@ import {
|
||||
STRING_FUNCTIONS,
|
||||
FIELD_AND_FILTER_FUNCTIONS,
|
||||
} from './syntax';
|
||||
import { GetLogGroupFieldsResponse } from './types';
|
||||
|
||||
const fields = ['field1', '@message'];
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { sortedUniq } from 'lodash';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import Prism, { Grammar } from 'prismjs';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
|
||||
import { AbsoluteTimeRange, HistoryItem, LanguageProvider } from '@grafana/data';
|
||||
import { CompletionItemGroup, SearchFunctionType, Token, TypeaheadInput, TypeaheadOutput } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from './datasource';
|
||||
import syntax, {
|
||||
AGGREGATION_FUNCTIONS_STATS,
|
||||
BOOLEAN_FUNCTIONS,
|
||||
@@ -15,7 +17,6 @@ import syntax, {
|
||||
STRING_FUNCTIONS,
|
||||
} from './syntax';
|
||||
import { CloudWatchQuery, TSDBResponse } from './types';
|
||||
import { CloudWatchDatasource } from './datasource';
|
||||
|
||||
export type CloudWatchHistoryItem = HistoryItem<CloudWatchQuery>;
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { getTemplateSrv } from '@grafana/runtime';
|
||||
import { Monaco, monacoTypes } from '@grafana/ui';
|
||||
|
||||
import * as MetricMathTestData from '../../__mocks__/metric-math-test-data';
|
||||
import MonacoMock from '../../__mocks__/monarch/Monaco';
|
||||
import TextModel from '../../__mocks__/monarch/TextModel';
|
||||
import { MetricMathCompletionItemProvider } from './CompletionItemProvider';
|
||||
import { getTemplateSrv } from '@grafana/runtime';
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import cloudWatchMetricMathLanguageDefinition from '../definition';
|
||||
import { Monaco, monacoTypes } from '@grafana/ui';
|
||||
import {
|
||||
METRIC_MATH_FNS,
|
||||
METRIC_MATH_KEYWORDS,
|
||||
@@ -12,7 +13,8 @@ import {
|
||||
METRIC_MATH_PERIODS,
|
||||
METRIC_MATH_STATISTIC_KEYWORD_STRINGS,
|
||||
} from '../language';
|
||||
import * as MetricMathTestData from '../../__mocks__/metric-math-test-data';
|
||||
|
||||
import { MetricMathCompletionItemProvider } from './CompletionItemProvider';
|
||||
|
||||
const getSuggestions = async (value: string, position: monacoTypes.IPosition) => {
|
||||
const setup = new MetricMathCompletionItemProvider(
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { getTemplateSrv, TemplateSrv } from '@grafana/runtime';
|
||||
import type { Monaco, monacoTypes } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { CompletionItemProvider } from '../../monarch/CompletionItemProvider';
|
||||
import { LinkedToken } from '../../monarch/LinkedToken';
|
||||
import { TRIGGER_SUGGEST } from '../../monarch/commands';
|
||||
import { SuggestionKind, CompletionItemPriority, StatementPosition } from '../../monarch/types';
|
||||
import { LinkedToken } from '../../monarch/LinkedToken';
|
||||
import {
|
||||
METRIC_MATH_FNS,
|
||||
METRIC_MATH_KEYWORDS,
|
||||
@@ -9,12 +13,10 @@ import {
|
||||
METRIC_MATH_PERIODS,
|
||||
METRIC_MATH_STATISTIC_KEYWORD_STRINGS,
|
||||
} from '../language';
|
||||
import { CompletionItemProvider } from '../../monarch/CompletionItemProvider';
|
||||
import { MetricMathTokenTypes } from './types';
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { getTemplateSrv, TemplateSrv } from '@grafana/runtime';
|
||||
|
||||
import { getStatementPosition } from './statementPosition';
|
||||
import { getSuggestionKinds } from './suggestionKind';
|
||||
import { MetricMathTokenTypes } from './types';
|
||||
|
||||
type CompletionItem = monacoTypes.languages.CompletionItem;
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { monacoTypes } from '@grafana/ui';
|
||||
|
||||
import * as MetricMathTestQueries from '../../__mocks__/metric-math-test-data';
|
||||
import MonacoMock from '../../__mocks__/monarch/Monaco';
|
||||
import TextModel from '../../__mocks__/monarch/TextModel';
|
||||
import * as MetricMathTestQueries from '../../__mocks__/metric-math-test-data';
|
||||
import { linkedTokenBuilder } from '../../monarch/linkedTokenBuilder';
|
||||
import { StatementPosition } from '../../monarch/types';
|
||||
import { getStatementPosition } from './statementPosition';
|
||||
import cloudWatchSqlLanguageDefinition from '../definition';
|
||||
|
||||
import { getStatementPosition } from './statementPosition';
|
||||
import { MetricMathTokenTypes } from './types';
|
||||
|
||||
describe('statementPosition', () => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { LinkedToken } from '../../monarch/LinkedToken';
|
||||
import { StatementPosition } from '../../monarch/types';
|
||||
|
||||
import { MetricMathTokenTypes } from './types';
|
||||
|
||||
export function getStatementPosition(currentToken: LinkedToken | null): StatementPosition {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { DataQuery } from '@grafana/data';
|
||||
|
||||
import {
|
||||
migrateMultipleStatsAnnotationQuery,
|
||||
migrateMultipleStatsMetricsQuery,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { AnnotationQuery, DataQuery } from '@grafana/data';
|
||||
import { getNextRefIdChar } from 'app/core/utils/query';
|
||||
|
||||
import {
|
||||
MetricEditorMode,
|
||||
CloudWatchAnnotationQuery,
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { DataSourcePlugin } from '@grafana/data';
|
||||
import { ConfigEditor } from './components/ConfigEditor';
|
||||
import { CloudWatchDatasource } from './datasource';
|
||||
|
||||
import { CloudWatchAnnotationsQueryCtrl } from './annotations_query_ctrl';
|
||||
import { CloudWatchJsonData, CloudWatchQuery } from './types';
|
||||
import { CloudWatchLogsQueryEditor } from './components/LogsQueryEditor';
|
||||
import { PanelQueryEditor } from './components/PanelQueryEditor';
|
||||
import { MetaInspector } from './components/MetaInspector';
|
||||
import { ConfigEditor } from './components/ConfigEditor';
|
||||
import LogsCheatSheet from './components/LogsCheatSheet';
|
||||
import { CloudWatchLogsQueryEditor } from './components/LogsQueryEditor';
|
||||
import { MetaInspector } from './components/MetaInspector';
|
||||
import { PanelQueryEditor } from './components/PanelQueryEditor';
|
||||
import { CloudWatchDatasource } from './datasource';
|
||||
import { CloudWatchJsonData, CloudWatchQuery } from './types';
|
||||
|
||||
export const plugin = new DataSourcePlugin<CloudWatchDatasource, CloudWatchQuery, CloudWatchJsonData>(
|
||||
CloudWatchDatasource
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import type { Monaco, monacoTypes } from '@grafana/ui';
|
||||
import { getTemplateSrv, TemplateSrv } from '@grafana/runtime';
|
||||
import type { Monaco, monacoTypes } from '@grafana/ui';
|
||||
|
||||
import { CloudWatchDatasource } from '../datasource';
|
||||
import { linkedTokenBuilder } from './linkedTokenBuilder';
|
||||
|
||||
import { LinkedToken } from './LinkedToken';
|
||||
import { linkedTokenBuilder } from './linkedTokenBuilder';
|
||||
import { LanguageDefinition } from './register';
|
||||
import { StatementPosition, SuggestionKind, TokenTypes } from './types';
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { monacoTypes } from '@grafana/ui';
|
||||
|
||||
import { TokenTypes } from './types';
|
||||
|
||||
export class LinkedToken {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user