mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
* fix: secondary solid buttons for selecting metrics * fix: secondary solid buttons for selecting labels * fix: secondary solid buttons for adding filters
26 lines
740 B
TypeScript
26 lines
740 B
TypeScript
import React from 'react';
|
|
|
|
import { SceneObjectState, SceneObjectBase, SceneComponentProps } from '@grafana/scenes';
|
|
import { Button } from '@grafana/ui';
|
|
|
|
import { MetricSelectedEvent } from './shared';
|
|
|
|
export interface SelectMetricActionState extends SceneObjectState {
|
|
title: string;
|
|
metric: string;
|
|
}
|
|
|
|
export class SelectMetricAction extends SceneObjectBase<SelectMetricActionState> {
|
|
public onClick = () => {
|
|
this.publishEvent(new MetricSelectedEvent(this.state.metric), true);
|
|
};
|
|
|
|
public static Component = ({ model }: SceneComponentProps<SelectMetricAction>) => {
|
|
return (
|
|
<Button variant="secondary" size="sm" fill="solid" onClick={model.onClick}>
|
|
{model.state.title}
|
|
</Button>
|
|
);
|
|
};
|
|
}
|