Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
21940c2c
Commit
21940c2c
authored
Nov 01, 2018
by
Erik Sundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stackdriver: revert refactoring
parent
2780ef27
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
24 deletions
+33
-24
public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx
+33
-24
No files found.
public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx
View file @
21940c2c
...
...
@@ -105,7 +105,7 @@ export class StackdriverTemplateQueryComponent extends PureComponent<TemplateQue
async
getLabels
(
selectedMetricType
,
selectedQueryType
=
this
.
state
.
selectedQueryType
)
{
let
result
=
{
labels
:
this
.
state
.
labels
,
labelKey
:
this
.
state
.
labelKey
};
if
(
this
.
isLabelQuery
(
selectedQueryType
))
{
if
(
selectedMetricType
&&
this
.
isLabelQuery
(
selectedQueryType
))
{
const
refId
=
'StackdriverTemplateQueryComponent'
;
const
response
=
await
this
.
props
.
datasource
.
getLabels
(
selectedMetricType
,
refId
);
const
labels
=
Object
.
keys
(
response
.
meta
[
selectedQueryType
]);
...
...
@@ -115,7 +115,10 @@ export class StackdriverTemplateQueryComponent extends PureComponent<TemplateQue
return
result
;
}
servicePicker
=
(
renderQueryTypeSwitch
(
queryType
)
{
switch
(
queryType
)
{
case
MetricFindQueryTypes
.
MetricTypes
:
return
(
<
SimpleSelect
value=
{
this
.
state
.
selectedService
}
options=
{
this
.
state
.
services
}
...
...
@@ -123,47 +126,53 @@ export class StackdriverTemplateQueryComponent extends PureComponent<TemplateQue
label=
"Services"
/>
);
metricTypesPicker
=
(
case
MetricFindQueryTypes
.
MetricLabels
:
case
MetricFindQueryTypes
.
ResourceLabels
:
case
MetricFindQueryTypes
.
ResourceTypes
:
return
(
<
React
.
Fragment
>
<
SimpleSelect
value=
{
this
.
state
.
selectedService
}
options=
{
this
.
state
.
services
}
onValueChange=
{
this
.
onServiceChange
}
label=
"Services"
/>
<
SimpleSelect
value=
{
this
.
state
.
selectedMetricType
}
options=
{
this
.
state
.
metricTypes
}
onValueChange=
{
this
.
onMetricTypeChange
}
label=
"Metric Types"
/>
);
labelPicker
=
(
{
queryType
!==
MetricFindQueryTypes
.
ResourceTypes
&&
(
<
SimpleSelect
value=
{
this
.
state
.
labelKey
}
options=
{
this
.
state
.
labels
.
map
(
l
=>
({
value
:
l
,
name
:
l
}))
}
onValueChange=
{
this
.
onLabelKeyChange
}
label=
{
this
.
state
.
selectedQueryType
===
MetricFindQueryTypes
.
ResourceLabels
?
'Resource Label Key'
:
'Metric Label Key'
this
.
state
.
selectedQueryType
===
MetricFindQueryTypes
.
ResourceLabels
?
'Resource Label Key'
:
'Metric Label Key'
}
/>
);
renderQueryTypeSwitch
(
queryType
)
{
switch
(
queryType
)
{
case
MetricFindQueryTypes
.
MetricTypes
:
return
this
.
servicePicker
;
case
MetricFindQueryTypes
.
MetricLabels
:
case
MetricFindQueryTypes
.
ResourceLabels
:
case
MetricFindQueryTypes
.
ResourceTypes
:
return
(
<
React
.
Fragment
>
{
this
.
servicePicker
}
{
this
.
metricTypesPicker
}
{
queryType
!==
MetricFindQueryTypes
.
ResourceTypes
&&
this
.
labelPicker
}
)
}
</
React
.
Fragment
>
);
case
MetricFindQueryTypes
.
Alignerns
:
case
MetricFindQueryTypes
.
Aggregations
:
return
(
<
React
.
Fragment
>
{
this
.
servicePicker
}
{
this
.
metricTypesPicker
}
<
SimpleSelect
value=
{
this
.
state
.
selectedService
}
options=
{
this
.
state
.
services
}
onValueChange=
{
this
.
onServiceChange
}
label=
"Services"
/>
<
SimpleSelect
value=
{
this
.
state
.
selectedMetricType
}
options=
{
this
.
state
.
metricTypes
}
onValueChange=
{
this
.
onMetricTypeChange
}
label=
"Metric Types"
/>
</
React
.
Fragment
>
);
default
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment