The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/public/app/plugins/datasource/stackdriver/components/ServiceSelector.tsx

33 lines
859 B

import React, { SFC } from 'react';
import uniqBy from 'lodash/uniqBy';
interface Props {
onServiceChange: any;
metricDescriptors: any[];
}
const ServiceSelector: SFC<Props> = props => {
const extractServices = () =>
uniqBy(props.metricDescriptors, 'service').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;