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
2a6aec72
Commit
2a6aec72
authored
Nov 02, 2018
by
Erik Sundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stackdriver: make it possible to use aggregation template variable
parent
a951e577
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
9 deletions
+25
-9
public/app/plugins/datasource/stackdriver/partials/query.aggregation.html
+4
-2
public/app/plugins/datasource/stackdriver/query_aggregation_ctrl.ts
+2
-2
public/app/plugins/datasource/stackdriver/specs/query_aggregation_ctrl.test.ts
+19
-5
No files found.
public/app/plugins/datasource/stackdriver/partials/query.aggregation.html
View file @
2a6aec72
...
@@ -20,8 +20,10 @@
...
@@ -20,8 +20,10 @@
<div
class=
"gf-form offset-width-9"
>
<div
class=
"gf-form offset-width-9"
>
<label
class=
"gf-form-label query-keyword width-12"
>
Aligner
</label>
<label
class=
"gf-form-label query-keyword width-12"
>
Aligner
</label>
<div
class=
"gf-form-select-wrapper gf-form-select-wrapper--caret-indent"
>
<div
class=
"gf-form-select-wrapper gf-form-select-wrapper--caret-indent"
>
<select
class=
"gf-form-input width-14"
ng-model=
"ctrl.target.aggregation.perSeriesAligner"
ng-options=
"f.value as f.text for f in ctrl.alignOptions"
<gf-form-dropdown
model=
"ctrl.target.aggregation.perSeriesAligner"
get-options=
"ctrl.alignOptions"
class=
"gf-form width-12"
ng-change=
"refresh()"
></select>
disabled
type=
"text"
allow-custom=
"true"
lookup-text=
"true"
css-class=
"min-width-12"
on-change=
"refresh()"
></gf-form-dropdown>
<!-- <select class="gf-form-input width-14" ng-model="ctrl.target.aggregation.perSeriesAligner" ng-options="f.value as f.text for f in ctrl.alignOptions"
ng-change="refresh()"></select> -->
</div>
</div>
<div
class=
"gf-form gf-form--grow"
>
<div
class=
"gf-form gf-form--grow"
>
...
...
public/app/plugins/datasource/stackdriver/query_aggregation_ctrl.ts
View file @
2a6aec72
...
@@ -26,7 +26,7 @@ export class StackdriverAggregationCtrl {
...
@@ -26,7 +26,7 @@ export class StackdriverAggregationCtrl {
target
:
any
;
target
:
any
;
/** @ngInject */
/** @ngInject */
constructor
(
private
$scope
)
{
constructor
(
private
$scope
,
private
templateSrv
)
{
this
.
$scope
.
ctrl
=
this
;
this
.
$scope
.
ctrl
=
this
;
this
.
target
=
$scope
.
target
;
this
.
target
=
$scope
.
target
;
this
.
alignmentPeriods
=
options
.
alignmentPeriods
;
this
.
alignmentPeriods
=
options
.
alignmentPeriods
;
...
@@ -51,7 +51,7 @@ export class StackdriverAggregationCtrl {
...
@@ -51,7 +51,7 @@ export class StackdriverAggregationCtrl {
setAggOptions
()
{
setAggOptions
()
{
this
.
aggOptions
=
getAggregationOptionsByMetric
(
this
.
target
.
valueType
,
this
.
target
.
metricKind
);
this
.
aggOptions
=
getAggregationOptionsByMetric
(
this
.
target
.
valueType
,
this
.
target
.
metricKind
);
if
(
!
this
.
aggOptions
.
find
(
o
=>
o
.
value
===
this
.
t
arget
.
aggregation
.
crossSeriesReducer
))
{
if
(
!
this
.
aggOptions
.
find
(
o
=>
o
.
value
===
this
.
t
emplateSrv
.
replace
(
this
.
target
.
aggregation
.
crossSeriesReducer
)
))
{
this
.
deselectAggregationOption
(
'REDUCE_NONE'
);
this
.
deselectAggregationOption
(
'REDUCE_NONE'
);
}
}
...
...
public/app/plugins/datasource/stackdriver/specs/query_aggregation_ctrl.test.ts
View file @
2a6aec72
...
@@ -6,10 +6,19 @@ describe('StackdriverAggregationCtrl', () => {
...
@@ -6,10 +6,19 @@ describe('StackdriverAggregationCtrl', () => {
describe
(
'when new query result is returned from the server'
,
()
=>
{
describe
(
'when new query result is returned from the server'
,
()
=>
{
describe
(
'and result is double and gauge and no group by is used'
,
()
=>
{
describe
(
'and result is double and gauge and no group by is used'
,
()
=>
{
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
ctrl
=
new
StackdriverAggregationCtrl
({
ctrl
=
new
StackdriverAggregationCtrl
(
{
$on
:
()
=>
{},
$on
:
()
=>
{},
target
:
{
valueType
:
'DOUBLE'
,
metricKind
:
'GAUGE'
,
aggregation
:
{
crossSeriesReducer
:
''
,
groupBys
:
[]
}
},
target
:
{
});
valueType
:
'DOUBLE'
,
metricKind
:
'GAUGE'
,
aggregation
:
{
crossSeriesReducer
:
''
,
groupBys
:
[]
},
},
},
{
replace
:
s
=>
s
,
}
);
});
});
it
(
'should populate all aggregate options except two'
,
()
=>
{
it
(
'should populate all aggregate options except two'
,
()
=>
{
...
@@ -31,14 +40,19 @@ describe('StackdriverAggregationCtrl', () => {
...
@@ -31,14 +40,19 @@ describe('StackdriverAggregationCtrl', () => {
describe
(
'and result is double and gauge and a group by is used'
,
()
=>
{
describe
(
'and result is double and gauge and a group by is used'
,
()
=>
{
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
ctrl
=
new
StackdriverAggregationCtrl
({
ctrl
=
new
StackdriverAggregationCtrl
(
{
$on
:
()
=>
{},
$on
:
()
=>
{},
target
:
{
target
:
{
valueType
:
'DOUBLE'
,
valueType
:
'DOUBLE'
,
metricKind
:
'GAUGE'
,
metricKind
:
'GAUGE'
,
aggregation
:
{
crossSeriesReducer
:
'REDUCE_NONE'
,
groupBys
:
[
'resource.label.projectid'
]
},
aggregation
:
{
crossSeriesReducer
:
'REDUCE_NONE'
,
groupBys
:
[
'resource.label.projectid'
]
},
},
},
});
},
{
replace
:
s
=>
s
,
}
);
});
});
it
(
'should populate all aggregate options except three'
,
()
=>
{
it
(
'should populate all aggregate options except three'
,
()
=>
{
...
...
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