mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
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:
parent
b00755a2d9
commit
b1186d693a
@ -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}
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user