From f9380a2634862e911426ea51af9ed4fd77b2fcf5 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Wed, 2 Jan 2019 09:36:32 +0100 Subject: [PATCH] add help text component --- .../components/AnnotationQueryEditor.tsx | 12 ++++- .../components/AnnotationsHelp.tsx | 44 +++++++++++++++++++ .../partials/annotations.editor.html | 35 --------------- 3 files changed, 54 insertions(+), 37 deletions(-) create mode 100644 public/app/plugins/datasource/stackdriver/components/AnnotationsHelp.tsx diff --git a/public/app/plugins/datasource/stackdriver/components/AnnotationQueryEditor.tsx b/public/app/plugins/datasource/stackdriver/components/AnnotationQueryEditor.tsx index 6c501d45eda..057fd5fe35b 100644 --- a/public/app/plugins/datasource/stackdriver/components/AnnotationQueryEditor.tsx +++ b/public/app/plugins/datasource/stackdriver/components/AnnotationQueryEditor.tsx @@ -4,6 +4,7 @@ import _ from 'lodash'; import { Metrics } from './Metrics'; import { Filter } from './Filter'; import { AnnotationTarget } from '../types'; +import { AnnotationsHelp } from './AnnotationsHelp'; export interface Props { onQueryChange: (target: AnnotationTarget) => void; @@ -57,7 +58,7 @@ export class AnnotationQueryEditor extends React.Component { } render() { - const { defaultProject, metricType, filters, refId, title } = this.state; + const { defaultProject, metricType, filters, refId, title, text } = this.state; const { datasource } = this.props; return ( @@ -95,12 +96,19 @@ export class AnnotationQueryEditor extends React.Component {
Text - + this.handleChange('text', e.target.value)} + />
+ + {/* */} ); diff --git a/public/app/plugins/datasource/stackdriver/components/AnnotationsHelp.tsx b/public/app/plugins/datasource/stackdriver/components/AnnotationsHelp.tsx new file mode 100644 index 00000000000..71c54fe5f76 --- /dev/null +++ b/public/app/plugins/datasource/stackdriver/components/AnnotationsHelp.tsx @@ -0,0 +1,44 @@ +import React, { SFC } from 'react'; + +export const AnnotationsHelp: SFC = () => { + return ( +
+
+        
Annotation Query Format
+

+ An annotation is an event that is overlaid on top of graphs. Annotation rendering is expensive so it is + important to limit the number of rows returned.{' '} +

+

+ The Title and Text fields support templating and can use data returned from the query. For example, the Title + field could have the following text: +

+ + {`${'{{metric.type}}'}`} has value: {`${'{{metric.value}}'}`} + +

+ Example Result: monitoring.googleapis.com/uptime_check/http_status has this value: 502 +

+ +

+ {`${'{{metric.value}}'}`} = value of the metric/point +

+

+ {`${'{{metric.type}}'}`} = metric type e.g. compute.googleapis.com/instance/cpu/usage_time +

+

+ {`${'{{metric.name}}'}`} = name part of metric e.g. instance/cpu/usage_time +

+

+ {`${'{{metric.service}}'}`} = service part of metric e.g. compute +

+

+ {`${'{{metric.label.label_name}}'}`} = Metric label metadata e.g. metric.label.instance_name +

+

+ {`${'{{resource.label.label_name}}'}`} = Resource label metadata e.g. resource.label.zone +

+
+
+ ); +}; diff --git a/public/app/plugins/datasource/stackdriver/partials/annotations.editor.html b/public/app/plugins/datasource/stackdriver/partials/annotations.editor.html index 41d4be493de..5495ed234e5 100644 --- a/public/app/plugins/datasource/stackdriver/partials/annotations.editor.html +++ b/public/app/plugins/datasource/stackdriver/partials/annotations.editor.html @@ -1,40 +1,5 @@ - - - - -
-
Annotation Query Format
-An annotation is an event that is overlaid on top of graphs. Annotation rendering is expensive so it is important to limit the number of rows returned. - -The Title and Text fields support templating and can use data returned from the query. For example, the Title field could have the following text: - -{{metric.type}} has value: {{metric.value}} - -Example Result: monitoring.googleapis.com/uptime_check/http_status has this value: 502 - - -{{metric.value}} = value of the metric/point -{{metric.type}} = metric type e.g. compute.googleapis.com/instance/cpu/usage_time -{{metric.name}} = name part of metric e.g. instance/cpu/usage_time -{{metric.service}} = service part of metric e.g. compute - -{{metric.label.label_name}} = Metric label metadata e.g. metric.label.instance_name -{{resource.label.label_name}} = Resource label metadata e.g. resource.label.zone -
-