Stackdriver: fix project name change regression (#27909)

* Update stackdriver query editor not to overwrite project name

* Fix legacy select form no options didn't show

* Update config link to docs
This commit is contained in:
Zoltán Bedi 2020-10-03 11:55:09 +02:00 committed by GitHub
parent b00755a2d9
commit b1186d693a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 10 deletions

View File

@ -154,7 +154,7 @@ export class Select<T> extends PureComponent<LegacySelectProps<T>> {
onBlur={onBlur}
openMenuOnFocus={openMenuOnFocus}
maxMenuHeight={maxMenuHeight}
noOptionsMessage={() => noOptionsMessage}
noOptionsMessage={noOptionsMessage}
isMulti={isMulti}
backspaceRemovesValue={backspaceRemovesValue}
menuIsOpen={isOpen}

View File

@ -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,

View File

@ -63,8 +63,8 @@ export class QueryEditor extends PureComponent<Props, State> {
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;

View File

@ -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,

View File

@ -34,7 +34,7 @@
<p>
Detailed instructions on how to create a Service Account can be found
<a class="external-link" target="_blank" href="http://docs.grafana.org/datasources/cloudmonitoring/"
<a class="external-link" target="_blank" href="https://grafana.com/docs/grafana/latest/datasources/cloudmonitoring/"
>in the documentation.</a
>
</p>