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/Project.tsx

37 lines
1.1 KiB

import React from 'react';
import { SelectableValue } from '@grafana/data';
import { SegmentAsync } from '@grafana/ui';
import StackdriverDatasource from '../datasource';
export interface Props {
datasource: StackdriverDatasource;
onChange: (projectName: string) => void;
templateVariableOptions: Array<SelectableValue<string>>;
projectName: string;
}
export function Project({ projectName, datasource, onChange, templateVariableOptions }: Props) {
return (
<div className="gf-form-inline">
<span className="gf-form-label width-9 query-keyword">Project</span>
<SegmentAsync
allowCustomValue
onChange={({ value }) => onChange(value!)}
loadOptions={() =>
datasource.getProjects().then(projects => [
{
label: 'Template Variables',
options: templateVariableOptions,
},
...projects,
])
}
value={projectName}
placeholder="Select Project"
/>
<div className="gf-form gf-form--grow">
<div className="gf-form-label gf-form-label--grow" />
</div>
</div>
);
}