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} onBlur={onBlur}
openMenuOnFocus={openMenuOnFocus} openMenuOnFocus={openMenuOnFocus}
maxMenuHeight={maxMenuHeight} maxMenuHeight={maxMenuHeight}
noOptionsMessage={() => noOptionsMessage} noOptionsMessage={noOptionsMessage}
isMulti={isMulti} isMulti={isMulti}
backspaceRemovesValue={backspaceRemovesValue} backspaceRemovesValue={backspaceRemovesValue}
menuIsOpen={isOpen} menuIsOpen={isOpen}

View File

@ -24,8 +24,8 @@ export const defaultState: State = {
labels: {}, labels: {},
}; };
export const defaultQuery: MetricQuery = { export const defaultQuery: (dataSource: CloudMonitoringDatasource) => MetricQuery = dataSource => ({
projectName: '', projectName: dataSource.getDefaultProject(),
metricType: '', metricType: '',
metricKind: '', metricKind: '',
valueType: '', valueType: '',
@ -36,7 +36,7 @@ export const defaultQuery: MetricQuery = {
groupBys: [], groupBys: [],
filters: [], filters: [],
aliasBy: '', aliasBy: '',
}; });
function Editor({ function Editor({
refId, refId,

View File

@ -63,8 +63,8 @@ export class QueryEditor extends PureComponent<Props, State> {
render() { render() {
const { datasource, query, onRunQuery, onChange } = this.props; const { datasource, query, onRunQuery, onChange } = this.props;
const metricQuery = { ...defaultQuery, ...query.metricQuery, projectName: datasource.getDefaultProject() }; const metricQuery = { ...defaultQuery(datasource), ...query.metricQuery };
const sloQuery = { ...defaultSLOQuery, ...query.sloQuery, projectName: datasource.getDefaultProject() }; const sloQuery = { ...defaultSLOQuery(datasource), ...query.sloQuery };
const queryType = query.queryType || QueryType.METRICS; const queryType = query.queryType || QueryType.METRICS;
const meta = this.props.data?.series.length ? this.props.data?.series[0].meta : {}; const meta = this.props.data?.series.length ? this.props.data?.series[0].meta : {};
const usedAlignmentPeriod = meta?.alignmentPeriod; const usedAlignmentPeriod = meta?.alignmentPeriod;

View File

@ -15,14 +15,14 @@ export interface Props {
datasource: CloudMonitoringDatasource; datasource: CloudMonitoringDatasource;
} }
export const defaultQuery: SLOQuery = { export const defaultQuery: (dataSource: CloudMonitoringDatasource) => SLOQuery = dataSource => ({
projectName: '', projectName: dataSource.getDefaultProject(),
alignmentPeriod: 'cloud-monitoring-auto', alignmentPeriod: 'cloud-monitoring-auto',
aliasBy: '', aliasBy: '',
selectorName: 'select_slo_health', selectorName: 'select_slo_health',
serviceId: '', serviceId: '',
sloId: '', sloId: '',
}; });
export function SLOQueryEditor({ export function SLOQueryEditor({
query, query,

View File

@ -34,7 +34,7 @@
<p> <p>
Detailed instructions on how to create a Service Account can be found 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 >in the documentation.</a
> >
</p> </p>