mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
34 lines
925 B
TypeScript
34 lines
925 B
TypeScript
import React, { SFC } from 'react';
|
|
import { extractServicesFromMetricDescriptors } from '../functions';
|
|
|
|
interface Props {
|
|
onServiceChange: any;
|
|
metricDescriptors: any[];
|
|
}
|
|
|
|
const ServiceSelector: SFC<Props> = props => {
|
|
const extractServices = () => {
|
|
return extractServicesFromMetricDescriptors(props.metricDescriptors).map(m => ({
|
|
value: m.service,
|
|
name: m.serviceShortName,
|
|
}));
|
|
};
|
|
|
|
return (
|
|
<div className="gf-form max-width-21">
|
|
<span className="gf-form-label width-7">Service</span>
|
|
<div className="gf-form-select-wrapper max-width-14">
|
|
<select className="gf-form-input" required onChange={props.onServiceChange}>
|
|
{extractServices().map((qt, i) => (
|
|
<option key={i} value={qt.value} ng-if="false">
|
|
{qt.name}
|
|
</option>
|
|
))}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default ServiceSelector;
|