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
45f49c2e
Commit
45f49c2e
authored
Nov 09, 2018
by
Erik Sundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stackdriver: remove services query type
parent
209b1c02
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
24 deletions
+4
-24
public/app/plugins/datasource/stackdriver/StackdriverMetricFindQuery.ts
+1
-18
public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx
+3
-3
public/app/plugins/datasource/stackdriver/functions.ts
+0
-3
No files found.
public/app/plugins/datasource/stackdriver/StackdriverMetricFindQuery.ts
View file @
45f49c2e
...
@@ -2,12 +2,7 @@ import has from 'lodash/has';
...
@@ -2,12 +2,7 @@ import has from 'lodash/has';
import
isString
from
'lodash/isString'
;
import
isString
from
'lodash/isString'
;
import
{
alignmentPeriods
}
from
'./constants'
;
import
{
alignmentPeriods
}
from
'./constants'
;
import
{
MetricFindQueryTypes
}
from
'./types'
;
import
{
MetricFindQueryTypes
}
from
'./types'
;
import
{
import
{
getMetricTypesByService
,
getAlignmentOptionsByMetric
,
getAggregationOptionsByMetric
}
from
'./functions'
;
extractServicesFromMetricDescriptors
,
getMetricTypesByService
,
getAlignmentOptionsByMetric
,
getAggregationOptionsByMetric
,
}
from
'./functions'
;
export
default
class
StackdriverMetricFindQuery
{
export
default
class
StackdriverMetricFindQuery
{
constructor
(
private
datasource
)
{}
constructor
(
private
datasource
)
{}
...
@@ -15,8 +10,6 @@ export default class StackdriverMetricFindQuery {
...
@@ -15,8 +10,6 @@ export default class StackdriverMetricFindQuery {
async
query
(
query
:
any
)
{
async
query
(
query
:
any
)
{
try
{
try
{
switch
(
query
.
selectedQueryType
)
{
switch
(
query
.
selectedQueryType
)
{
case
MetricFindQueryTypes
.
Services
:
return
this
.
handleServiceQuery
();
case
MetricFindQueryTypes
.
MetricTypes
:
case
MetricFindQueryTypes
.
MetricTypes
:
return
this
.
handleMetricTypesQuery
(
query
);
return
this
.
handleMetricTypesQuery
(
query
);
case
MetricFindQueryTypes
.
MetricLabels
:
case
MetricFindQueryTypes
.
MetricLabels
:
...
@@ -39,16 +32,6 @@ export default class StackdriverMetricFindQuery {
...
@@ -39,16 +32,6 @@ export default class StackdriverMetricFindQuery {
}
}
}
}
async
handleServiceQuery
()
{
const
metricDescriptors
=
await
this
.
datasource
.
getMetricTypes
(
this
.
datasource
.
projectName
);
const
services
=
extractServicesFromMetricDescriptors
(
metricDescriptors
);
return
services
.
map
(
s
=>
({
text
:
s
.
serviceShortName
,
value
:
s
.
name
,
expandable
:
true
,
}));
}
async
handleMetricTypesQuery
({
selectedService
})
{
async
handleMetricTypesQuery
({
selectedService
})
{
if
(
!
selectedService
)
{
if
(
!
selectedService
)
{
return
[];
return
[];
...
...
public/app/plugins/datasource/stackdriver/components/TemplateQueryComponent.tsx
View file @
45f49c2e
import
React
,
{
PureComponent
}
from
'react'
;
import
React
,
{
PureComponent
}
from
'react'
;
import
uniqBy
from
'lodash/uniqBy'
;
import
{
TemplateQueryProps
}
from
'app/types/plugins'
;
import
{
TemplateQueryProps
}
from
'app/types/plugins'
;
import
SimpleSelect
from
'./SimpleSelect'
;
import
SimpleSelect
from
'./SimpleSelect'
;
import
{
getMetricTypes
,
extractServicesFromMetricDescriptors
}
from
'../functions'
;
import
{
getMetricTypes
}
from
'../functions'
;
import
{
MetricFindQueryTypes
,
TemplateQueryComponentData
}
from
'../types'
;
import
{
MetricFindQueryTypes
,
TemplateQueryComponentData
}
from
'../types'
;
export
class
StackdriverTemplateQueryComponent
extends
PureComponent
<
TemplateQueryProps
,
TemplateQueryComponentData
>
{
export
class
StackdriverTemplateQueryComponent
extends
PureComponent
<
TemplateQueryProps
,
TemplateQueryComponentData
>
{
queryTypes
:
Array
<
{
value
:
string
;
name
:
string
}
>
=
[
queryTypes
:
Array
<
{
value
:
string
;
name
:
string
}
>
=
[
{
value
:
MetricFindQueryTypes
.
Services
,
name
:
'Services'
},
{
value
:
MetricFindQueryTypes
.
MetricTypes
,
name
:
'Metric Types'
},
{
value
:
MetricFindQueryTypes
.
MetricTypes
,
name
:
'Metric Types'
},
{
value
:
MetricFindQueryTypes
.
MetricLabels
,
name
:
'Metric Labels'
},
{
value
:
MetricFindQueryTypes
.
MetricLabels
,
name
:
'Metric Labels'
},
{
value
:
MetricFindQueryTypes
.
ResourceLabels
,
name
:
'Resource Labels'
},
{
value
:
MetricFindQueryTypes
.
ResourceLabels
,
name
:
'Resource Labels'
},
...
@@ -38,7 +38,7 @@ export class StackdriverTemplateQueryComponent extends PureComponent<TemplateQue
...
@@ -38,7 +38,7 @@ export class StackdriverTemplateQueryComponent extends PureComponent<TemplateQue
async
componentDidMount
()
{
async
componentDidMount
()
{
const
metricDescriptors
=
await
this
.
props
.
datasource
.
getMetricTypes
(
this
.
props
.
datasource
.
projectName
);
const
metricDescriptors
=
await
this
.
props
.
datasource
.
getMetricTypes
(
this
.
props
.
datasource
.
projectName
);
const
services
=
extractServicesFromMetricDescriptors
(
metricDescriptors
).
map
(
m
=>
({
const
services
=
uniqBy
(
metricDescriptors
,
'service'
).
map
(
m
=>
({
value
:
m
.
service
,
value
:
m
.
service
,
name
:
m
.
serviceShortName
,
name
:
m
.
serviceShortName
,
}));
}));
...
...
public/app/plugins/datasource/stackdriver/functions.ts
View file @
45f49c2e
import
uniqBy
from
'lodash/uniqBy'
;
import
{
alignOptions
,
aggOptions
}
from
'./constants'
;
import
{
alignOptions
,
aggOptions
}
from
'./constants'
;
export
const
extractServicesFromMetricDescriptors
=
metricDescriptors
=>
uniqBy
(
metricDescriptors
,
'service'
);
export
const
getMetricTypesByService
=
(
metricDescriptors
,
service
)
=>
export
const
getMetricTypesByService
=
(
metricDescriptors
,
service
)
=>
metricDescriptors
.
filter
(
m
=>
m
.
service
===
service
);
metricDescriptors
.
filter
(
m
=>
m
.
service
===
service
);
...
...
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