mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Registry: add a reusable function registry (#17047)
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
// Components
|
||||
import { Select, SelectOptionItem } from '@grafana/ui';
|
||||
import { Select } from '@grafana/ui';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
|
||||
// Types
|
||||
import { DataSourceSelectItem } from '@grafana/ui';
|
||||
@@ -28,7 +29,7 @@ export class DataSourcePicker extends PureComponent<Props> {
|
||||
super(props);
|
||||
}
|
||||
|
||||
onChange = (item: SelectOptionItem<string>) => {
|
||||
onChange = (item: SelectableValue<string>) => {
|
||||
const ds = this.props.datasources.find(ds => ds.name === item.value);
|
||||
this.props.onChange(ds);
|
||||
};
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import React from 'react';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { Select, SelectOptionItem } from '@grafana/ui';
|
||||
import { Select } from '@grafana/ui';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { Variable } from 'app/types/templates';
|
||||
|
||||
export interface Props {
|
||||
onChange: (value: string) => void;
|
||||
options: Array<SelectOptionItem<string>>;
|
||||
options: Array<SelectableValue<string>>;
|
||||
isSearchable: boolean;
|
||||
value: string;
|
||||
placeholder?: string;
|
||||
@@ -15,7 +16,7 @@ export interface Props {
|
||||
}
|
||||
|
||||
interface State {
|
||||
options: Array<SelectOptionItem<string>>;
|
||||
options: Array<SelectableValue<string>>;
|
||||
}
|
||||
|
||||
export class MetricSelect extends React.Component<Props, State> {
|
||||
|
||||
Reference in New Issue
Block a user