diff --git a/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx b/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx
index 4ddf585ccce..e603c5581ab 100644
--- a/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx
+++ b/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx
@@ -115,62 +115,55 @@ export class StackdriverTemplateQueryComponent extends PureComponent
+ );
+
+ metricTypesPicker = (
+
+ );
+
+ labelPicker = (
+ ({ value: l, name: l }))}
+ onValueChange={this.onLabelKeyChange}
+ label={
+ this.state.selectedQueryType === MetricFindQueryTypes.ResourceLabels ? 'Resource Label Key' : 'Metric Label Key'
+ }
+ />
+ );
+
renderQueryTypeSwitch(queryType) {
switch (queryType) {
case MetricFindQueryTypes.MetricTypes:
- return (
-
- );
+ return this.servicePicker;
case MetricFindQueryTypes.MetricLabels:
case MetricFindQueryTypes.ResourceLabels:
case MetricFindQueryTypes.ResourceTypes:
return (
-
-
- ({ value: l, name: l }))}
- onValueChange={this.onLabelKeyChange}
- label={
- this.state.selectedQueryType === MetricFindQueryTypes.ResourceLabels
- ? 'Resource Label Key'
- : 'Metric Label Key'
- }
- />
+ {this.servicePicker}
+ {this.metricTypesPicker}
+ {queryType !== MetricFindQueryTypes.ResourceTypes && this.labelPicker}
);
case MetricFindQueryTypes.Alignerns:
case MetricFindQueryTypes.Aggregations:
return (
-
-
+ {this.servicePicker}
+ {this.metricTypesPicker}
);
default: