Files
Brendan O'Handley f85470d652 Prometheus: Use the frontend package in Prometheus and remove feature toggle (#86080)
* add history links for monaco completion provider folder

* add history links for monaco query field folder

* add history links for components folder

* add history links for configuration folder

* add history links for dashboard json folder

* add history links for gcopypaste folder

* add history link for variableMigration

* add history link for querybuilder/components/metrics-modal folder

* add history link for querybuilder/components/promqail folder

* add history links for querybuilder/components folder

* add history links for querybuilder/hooks folder

* add history links for querybuilder/shared folder

* add history links for querybuilder folder

* add history links for querycache folder

* add history links for src folder

* use frontend package and custom auth in module.ts

* remove files and fix import issues

* remove usePrometheusFrontendPackage

* remove extra files

* update betterer

* remove extra files after rebase

* fix betterer for rebase

* fix e2e flakiness
2024-04-15 16:45:23 -05:00

51 lines
1.6 KiB
TypeScript

// Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/querybuilder/components/NestedQueryList.tsx
import React from 'react';
import { Stack } from '@grafana/ui';
import { PrometheusDatasource } from '../../datasource';
import { PromVisualQuery, PromVisualQueryBinary } from '../types';
import { NestedQuery } from './NestedQuery';
export interface NestedQueryListProps {
query: PromVisualQuery;
datasource: PrometheusDatasource;
onChange: (query: PromVisualQuery) => void;
onRunQuery: () => void;
showExplain: boolean;
}
export function NestedQueryList(props: NestedQueryListProps) {
const { query, datasource, onChange, onRunQuery, showExplain } = props;
const nestedQueries = query.binaryQueries ?? [];
const onNestedQueryUpdate = (index: number, update: PromVisualQueryBinary) => {
const updatedList = [...nestedQueries];
updatedList.splice(index, 1, update);
onChange({ ...query, binaryQueries: updatedList });
};
const onRemove = (index: number) => {
const updatedList = [...nestedQueries.slice(0, index), ...nestedQueries.slice(index + 1)];
onChange({ ...query, binaryQueries: updatedList });
};
return (
<Stack direction="column" gap={1}>
{nestedQueries.map((nestedQuery, index) => (
<NestedQuery
key={index.toString()}
nestedQuery={nestedQuery}
index={index}
onChange={onNestedQueryUpdate}
datasource={datasource}
onRemove={onRemove}
onRunQuery={onRunQuery}
showExplain={showExplain}
/>
))}
</Stack>
);
}