From 3c1cf214bc342020951bd3b5402e5a92ff1dad1c Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Wed, 31 Oct 2018 10:57:24 +0100 Subject: [PATCH] stackdriver: replace components with basic stateless select --- .../components/MetricTypePicker.tsx | 40 ------------------- .../stackdriver/components/ServicePicker.tsx | 38 ------------------ .../components/TemplateQueryComponent.tsx | 29 +++++--------- 3 files changed, 9 insertions(+), 98 deletions(-) delete mode 100644 public/app/plugins/datasource/stackdriver/components/MetricTypePicker.tsx delete mode 100644 public/app/plugins/datasource/stackdriver/components/ServicePicker.tsx diff --git a/public/app/plugins/datasource/stackdriver/components/MetricTypePicker.tsx b/public/app/plugins/datasource/stackdriver/components/MetricTypePicker.tsx deleted file mode 100644 index 9d0ad751c56..00000000000 --- a/public/app/plugins/datasource/stackdriver/components/MetricTypePicker.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React, { SFC } from 'react'; -import { getMetricTypesByService } from '../functions'; - -interface Props { - onMetricTypeChange: any; - selectedService: string; - selectedMetricType: string; - metricDescriptors: any[]; - metricTypes: any[]; -} - -const MetricTypePicker: SFC = props => { - const filterMetricTypes = () => { - if (!props.selectedService) { - return []; - } - - return getMetricTypesByService(props.metricDescriptors, props.selectedService).map(m => ({ - value: m.type, - name: m.displayName, - })); - }; - - return ( -
- Metric Types -
- -
-
- ); -}; - -export default MetricTypePicker; diff --git a/public/app/plugins/datasource/stackdriver/components/ServicePicker.tsx b/public/app/plugins/datasource/stackdriver/components/ServicePicker.tsx deleted file mode 100644 index 85320dc3465..00000000000 --- a/public/app/plugins/datasource/stackdriver/components/ServicePicker.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React, { SFC } from 'react'; -import { extractServicesFromMetricDescriptors } from '../functions'; - -interface Props { - selectedService: string; - onServiceChange: any; - metricDescriptors: any[]; -} - -const ServicePicker: SFC = props => { - const extractServices = () => { - return extractServicesFromMetricDescriptors(props.metricDescriptors).map(m => ({ - value: m.service, - name: m.serviceShortName, - })); - }; - - return ( -
- Service -
- -
-
- ); -}; - -export default ServicePicker; diff --git a/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx b/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx index 751cadbf511..311c4c9a149 100644 --- a/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx +++ b/public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx @@ -107,7 +107,7 @@ export class StackdriverTemplateQueryComponent extends PureComponent {this.state.labels.join(',')} @@ -162,7 +162,7 @@ export class StackdriverTemplateQueryComponent extends PureComponent - {dropdown} + {labelSelect} ); case MetricFindQueryTypes.Alignerns: @@ -191,23 +191,12 @@ export class StackdriverTemplateQueryComponent extends PureComponent -
- Query Type -
- -
-
+ {this.renderQueryTypeSwitch(this.state.type)} );