datatrails: refactor: move related code to trails/MetricSelect subdir (#88262)

refactor: move related code to trails/MetricSelect subdir
This commit is contained in:
Darren Janeczek 2024-05-24 13:45:21 -04:00 committed by GitHub
parent f0ab501075
commit 5c29052219
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 18 additions and 17 deletions

View File

@ -15,7 +15,7 @@ import {
} from '@grafana/scenes';
import { Stack } from '@grafana/ui';
import { SelectMetricAction } from '../SelectMetricAction';
import { SelectMetricAction } from '../MetricSelect/SelectMetricAction';
import { LOGS_METRIC, VAR_LOGS_DATASOURCE, VAR_LOGS_DATASOURCE_EXPR } from '../shared';
interface LogsSceneState extends SceneObjectState {

View File

@ -1,4 +1,4 @@
import { MetricSelectScene } from '../MetricSelectScene';
import { MetricSelectScene } from '../MetricSelect/MetricSelectScene';
export function buildRelatedMetricsScene() {
return new MetricSelectScene({});

View File

@ -7,7 +7,7 @@ import { activateFullSceneTree } from '../dashboard-scene/utils/test-utils';
import { DataTrail } from './DataTrail';
import { MetricScene } from './MetricScene';
import { MetricSelectScene } from './MetricSelectScene';
import { MetricSelectScene } from './MetricSelect/MetricSelectScene';
import { MetricSelectedEvent, VAR_FILTERS } from './shared';
describe('DataTrail', () => {

View File

@ -29,7 +29,7 @@ import { useStyles2 } from '@grafana/ui';
import { DataTrailSettings } from './DataTrailSettings';
import { DataTrailHistory } from './DataTrailsHistory';
import { MetricScene } from './MetricScene';
import { MetricSelectScene } from './MetricSelectScene';
import { MetricSelectScene } from './MetricSelect/MetricSelectScene';
import { MetricsHeader } from './MetricsHeader';
import { getTrailStore } from './TrailStore/TrailStore';
import { MetricDatasourceHelper } from './helpers/MetricDatasourceHelper';

View File

@ -22,13 +22,10 @@ import {
import { VariableHide } from '@grafana/schema';
import { Input, InlineSwitch, Field, Alert, Icon, useStyles2 } from '@grafana/ui';
import { getPreviewPanelFor } from './AutomaticMetricQueries/previewPanel';
import { MetricScene } from './MetricScene';
import { SelectMetricAction } from './SelectMetricAction';
import { StatusWrapper } from './StatusWrapper';
import { getMetricDescription } from './helpers/MetricDatasourceHelper';
import { reportExploreMetrics } from './interactions';
import { sortRelatedMetrics } from './relatedMetrics';
import { MetricScene } from '../MetricScene';
import { StatusWrapper } from '../StatusWrapper';
import { getMetricDescription } from '../helpers/MetricDatasourceHelper';
import { reportExploreMetrics } from '../interactions';
import {
getVariablesWithMetricConstant,
MetricSelectedEvent,
@ -36,8 +33,12 @@ import {
VAR_DATASOURCE,
VAR_FILTERS_EXPR,
VAR_METRIC_NAMES,
} from './shared';
import { getFilters, getTrailFor } from './utils';
} from '../shared';
import { getFilters, getTrailFor } from '../utils';
import { SelectMetricAction } from './SelectMetricAction';
import { getPreviewPanelFor } from './previewPanel';
import { sortRelatedMetrics } from './relatedMetrics';
interface MetricPanel {
name: string;

View File

@ -3,7 +3,7 @@ import React from 'react';
import { SceneObjectState, SceneObjectBase, SceneComponentProps } from '@grafana/scenes';
import { Button } from '@grafana/ui';
import { MetricSelectedEvent } from './shared';
import { MetricSelectedEvent } from '../shared';
export interface SelectMetricActionState extends SceneObjectState {
title: string;

View File

@ -1,12 +1,12 @@
import { PromQuery } from '@grafana/prometheus';
import { SceneCSSGridItem, SceneQueryRunner, SceneVariableSet } from '@grafana/scenes';
import { SelectMetricAction } from '../SelectMetricAction';
import { hideEmptyPreviews } from '../hideEmptyPreviews';
import { getAutoQueriesForMetric } from '../AutomaticMetricQueries/AutoQueryEngine';
import { getVariablesWithMetricConstant, trailDS } from '../shared';
import { getColorByIndex } from '../utils';
import { getAutoQueriesForMetric } from './AutoQueryEngine';
import { SelectMetricAction } from './SelectMetricAction';
import { hideEmptyPreviews } from './hideEmptyPreviews';
export function getPreviewPanelFor(metric: string, index: number, currentFilterCount: number, description?: string) {
const autoQuery = getAutoQueriesForMetric(metric);