diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx index 94a1c05eaaa..fe059064bfc 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx @@ -154,7 +154,7 @@ export class Select extends PureComponent> { onBlur={onBlur} openMenuOnFocus={openMenuOnFocus} maxMenuHeight={maxMenuHeight} - noOptionsMessage={() => noOptionsMessage} + noOptionsMessage={noOptionsMessage} isMulti={isMulti} backspaceRemovesValue={backspaceRemovesValue} menuIsOpen={isOpen} diff --git a/public/app/plugins/datasource/cloud-monitoring/components/MetricQueryEditor.tsx b/public/app/plugins/datasource/cloud-monitoring/components/MetricQueryEditor.tsx index 9ebc00e3880..4b23cc69353 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/MetricQueryEditor.tsx +++ b/public/app/plugins/datasource/cloud-monitoring/components/MetricQueryEditor.tsx @@ -24,8 +24,8 @@ export const defaultState: State = { labels: {}, }; -export const defaultQuery: MetricQuery = { - projectName: '', +export const defaultQuery: (dataSource: CloudMonitoringDatasource) => MetricQuery = dataSource => ({ + projectName: dataSource.getDefaultProject(), metricType: '', metricKind: '', valueType: '', @@ -36,7 +36,7 @@ export const defaultQuery: MetricQuery = { groupBys: [], filters: [], aliasBy: '', -}; +}); function Editor({ refId, diff --git a/public/app/plugins/datasource/cloud-monitoring/components/QueryEditor.tsx b/public/app/plugins/datasource/cloud-monitoring/components/QueryEditor.tsx index d07df06828a..02eb2041cc7 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/QueryEditor.tsx +++ b/public/app/plugins/datasource/cloud-monitoring/components/QueryEditor.tsx @@ -63,8 +63,8 @@ export class QueryEditor extends PureComponent { render() { const { datasource, query, onRunQuery, onChange } = this.props; - const metricQuery = { ...defaultQuery, ...query.metricQuery, projectName: datasource.getDefaultProject() }; - const sloQuery = { ...defaultSLOQuery, ...query.sloQuery, projectName: datasource.getDefaultProject() }; + const metricQuery = { ...defaultQuery(datasource), ...query.metricQuery }; + const sloQuery = { ...defaultSLOQuery(datasource), ...query.sloQuery }; const queryType = query.queryType || QueryType.METRICS; const meta = this.props.data?.series.length ? this.props.data?.series[0].meta : {}; const usedAlignmentPeriod = meta?.alignmentPeriod; diff --git a/public/app/plugins/datasource/cloud-monitoring/components/SLOQueryEditor.tsx b/public/app/plugins/datasource/cloud-monitoring/components/SLOQueryEditor.tsx index 87145878f88..30e6e5651a5 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/SLOQueryEditor.tsx +++ b/public/app/plugins/datasource/cloud-monitoring/components/SLOQueryEditor.tsx @@ -15,14 +15,14 @@ export interface Props { datasource: CloudMonitoringDatasource; } -export const defaultQuery: SLOQuery = { - projectName: '', +export const defaultQuery: (dataSource: CloudMonitoringDatasource) => SLOQuery = dataSource => ({ + projectName: dataSource.getDefaultProject(), alignmentPeriod: 'cloud-monitoring-auto', aliasBy: '', selectorName: 'select_slo_health', serviceId: '', sloId: '', -}; +}); export function SLOQueryEditor({ query, diff --git a/public/app/plugins/datasource/cloud-monitoring/partials/config.html b/public/app/plugins/datasource/cloud-monitoring/partials/config.html index b8e0124be79..df4e95a82ca 100644 --- a/public/app/plugins/datasource/cloud-monitoring/partials/config.html +++ b/public/app/plugins/datasource/cloud-monitoring/partials/config.html @@ -34,7 +34,7 @@

Detailed instructions on how to create a Service Account can be found - in the documentation.