grafana/public/app/features/explore/QueryRows.tsx

33 lines
976 B
TypeScript
Raw Normal View History

2019-01-17 10:59:47 -06:00
// Libraries
import React, { PureComponent } from 'react';
2019-01-17 10:59:47 -06:00
// Components
import QueryRow from './QueryRow';
// Types
2018-11-23 08:12:20 -06:00
import { Emitter } from 'app/core/utils/emitter';
2019-01-17 10:59:47 -06:00
import { DataQuery } from '@grafana/ui/src/types';
import { ExploreId } from 'app/types/explore';
interface QueryRowsProps {
2018-10-24 07:55:56 -05:00
className?: string;
2018-11-23 08:12:20 -06:00
exploreEvents: Emitter;
exploreId: ExploreId;
initialQueries: DataQuery[];
}
2019-01-17 10:59:47 -06:00
2018-10-24 07:55:56 -05:00
export default class QueryRows extends PureComponent<QueryRowsProps> {
render() {
const { className = '', exploreEvents, exploreId, initialQueries } = this.props;
return (
<div className={className}>
2019-02-04 04:07:32 -06:00
{initialQueries.map((query, index) => {
// using query.key will introduce infinite loop because QueryEditor#53
const key = query.datasource ? `${query.datasource}-${index}` : query.key;
return <QueryRow key={key} exploreEvents={exploreEvents} exploreId={exploreId} index={index} />;
})}
</div>
);
}
}