mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 01:19:57 +08:00

* Update backend * Update frontend * Keep old plugin id * Update docs * Place doc images to a new directory * Legacy support for stackdriver-auto alignment * Consistent plugin name * Apply suggestions from code review Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com> Co-authored-by: Tobias Skarhed <1438972+tskarhed@users.noreply.github.com> * Update docs * Update public/app/plugins/datasource/cloud-monitoring/README.md Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com> * Add reference to the data source formerly being named Stackdriver * Update pkg/models/datasource.go Co-authored-by: Carl Bergquist <carl@grafana.com> * Fix gofmt Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com> Co-authored-by: Tobias Skarhed <1438972+tskarhed@users.noreply.github.com> Co-authored-by: Carl Bergquist <carl@grafana.com>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import { SelectableValue } from '@grafana/data';
|
|
import { SegmentAsync } from '@grafana/ui';
|
|
import CloudMonitoringDatasource from '../datasource';
|
|
|
|
export interface Props {
|
|
datasource: CloudMonitoringDatasource;
|
|
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>
|
|
);
|
|
}
|