mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
- when instantiating a datasource, the datasource service checks if the plugin module exports Explore components, and if so, attaches them to the datasource - Explore component makes all major internal pluggable from a datasource `exploreComponents` property - Moved Prometheus query field to promehteus datasource and registered it as an exported Explore component - Added new Start page for Explore, also exported from the datasource
42 lines
967 B
TypeScript
42 lines
967 B
TypeScript
import { groupMetricsByPrefix, RECORDING_RULES_GROUP } from './PromQueryField';
|
|
|
|
describe('groupMetricsByPrefix()', () => {
|
|
it('returns an empty group for no metrics', () => {
|
|
expect(groupMetricsByPrefix([])).toEqual([]);
|
|
});
|
|
|
|
it('returns options grouped by prefix', () => {
|
|
expect(groupMetricsByPrefix(['foo_metric'])).toMatchObject([
|
|
{
|
|
value: 'foo',
|
|
children: [
|
|
{
|
|
value: 'foo_metric',
|
|
},
|
|
],
|
|
},
|
|
]);
|
|
});
|
|
|
|
it('returns options without prefix as toplevel option', () => {
|
|
expect(groupMetricsByPrefix(['metric'])).toMatchObject([
|
|
{
|
|
value: 'metric',
|
|
},
|
|
]);
|
|
});
|
|
|
|
it('returns recording rules grouped separately', () => {
|
|
expect(groupMetricsByPrefix([':foo_metric:'])).toMatchObject([
|
|
{
|
|
value: RECORDING_RULES_GROUP,
|
|
children: [
|
|
{
|
|
value: ':foo_metric:',
|
|
},
|
|
],
|
|
},
|
|
]);
|
|
});
|
|
});
|