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
a7897575
Commit
a7897575
authored
Sep 27, 2018
by
Erik Sundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stackdriver: remove not needed alignment option
parent
92f50ca3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
68 deletions
+4
-68
public/app/plugins/datasource/stackdriver/constants.ts
+0
-13
public/app/plugins/datasource/stackdriver/partials/query.aggregation.html
+2
-2
public/app/plugins/datasource/stackdriver/query_aggregation_ctrl.ts
+2
-24
public/app/plugins/datasource/stackdriver/specs/query_aggregation_ctrl.test.ts
+0
-29
No files found.
public/app/plugins/datasource/stackdriver/constants.ts
View file @
a7897575
...
...
@@ -17,19 +17,6 @@ export enum ValueTypes {
export
const
alignOptions
=
[
{
text
:
'none'
,
value
:
'ALIGN_NONE'
,
valueTypes
:
[
ValueTypes
.
INT64
,
ValueTypes
.
DOUBLE
,
ValueTypes
.
MONEY
,
ValueTypes
.
DISTRIBUTION
,
ValueTypes
.
BOOL
,
ValueTypes
.
STRING
,
],
metricKinds
:
[
MetricKind
.
GAUGE
,
MetricKind
.
DELTA
,
MetricKind
.
CUMULATIVE
,
MetricKind
.
METRIC_KIND_UNSPECIFIED
],
},
{
text
:
'delta'
,
value
:
'ALIGN_DELTA'
,
valueTypes
:
[
ValueTypes
.
INT64
,
ValueTypes
.
DOUBLE
,
ValueTypes
.
MONEY
],
...
...
public/app/plugins/datasource/stackdriver/partials/query.aggregation.html
View file @
a7897575
...
...
@@ -3,7 +3,7 @@
<label
class=
"gf-form-label query-keyword width-9"
>
Aggregation
</label>
<div
class=
"gf-form-select-wrapper gf-form-select-wrapper--caret-indent"
>
<select
class=
"gf-form-input width-12"
ng-model=
"target.aggregation.crossSeriesReducer"
ng-options=
"f.value as f.text for f in aggOptions"
ng-change=
"
onAggregationChange(target.aggregation.crossSeriesReducer
)"
></select>
ng-change=
"
refresh(
)"
></select>
</div>
</div>
<div
class=
"gf-form gf-form--grow"
>
...
...
@@ -21,7 +21,7 @@
<label
class=
"gf-form-label query-keyword width-12"
>
Aligner
</label>
<div
class=
"gf-form-select-wrapper gf-form-select-wrapper--caret-indent"
>
<select
class=
"gf-form-input width-14"
ng-model=
"target.aggregation.perSeriesAligner"
ng-options=
"f.value as f.text for f in alignOptions"
ng-change=
"
onAlignmentChange(target.aggregation.perSeriesAligner
)"
></select>
ng-change=
"
refresh(
)"
></select>
</div>
<div
class=
"gf-form gf-form--grow"
>
...
...
public/app/plugins/datasource/stackdriver/query_aggregation_ctrl.ts
View file @
a7897575
...
...
@@ -24,32 +24,10 @@ export class StackdriverAggregationCtrl {
this
.
setAggOptions
();
this
.
setAlignOptions
();
$scope
.
alignmentPeriods
=
options
.
alignmentPeriods
;
$scope
.
onAlignmentChange
=
this
.
onAlignmentChange
.
bind
(
this
);
$scope
.
onAggregationChange
=
this
.
onAggregationChange
.
bind
(
this
);
$scope
.
formatAlignmentText
=
this
.
formatAlignmentText
.
bind
(
this
);
$scope
.
$on
(
'metricTypeChanged'
,
this
.
setAlignOptions
.
bind
(
this
));
}
onAlignmentChange
(
newVal
:
string
)
{
if
(
newVal
===
'ALIGN_NONE'
)
{
this
.
$scope
.
target
.
aggregation
.
crossSeriesReducer
=
'REDUCE_NONE'
;
}
this
.
$scope
.
refresh
();
}
onAggregationChange
(
newVal
:
string
)
{
if
(
newVal
!==
'REDUCE_NONE'
&&
this
.
$scope
.
target
.
aggregation
.
perSeriesAligner
===
'ALIGN_NONE'
)
{
const
newAlignmentOption
=
options
.
alignOptions
.
find
(
o
=>
o
.
value
!==
'ALIGN_NONE'
&&
o
.
valueTypes
.
indexOf
(
this
.
$scope
.
target
.
valueType
)
!==
-
1
&&
o
.
metricKinds
.
indexOf
(
this
.
$scope
.
target
.
metricKind
)
!==
-
1
);
this
.
$scope
.
target
.
aggregation
.
perSeriesAligner
=
newAlignmentOption
?
newAlignmentOption
.
value
:
''
;
}
this
.
$scope
.
refresh
();
}
setAlignOptions
()
{
this
.
$scope
.
alignOptions
=
!
this
.
$scope
.
target
.
valueType
?
[]
...
...
@@ -60,8 +38,8 @@ export class StackdriverAggregationCtrl {
);
});
if
(
!
this
.
$scope
.
alignOptions
.
find
(
o
=>
o
.
value
===
this
.
$scope
.
target
.
aggregation
.
perSeriesAligner
))
{
const
newValue
=
this
.
$scope
.
alignOptions
.
find
(
o
=>
o
.
value
!==
'ALIGN_NONE'
);
this
.
$scope
.
target
.
aggregation
.
perSeriesAligner
=
newValue
?
newValue
.
value
:
''
;
this
.
$scope
.
target
.
aggregation
.
perSeriesAligner
=
this
.
$scope
.
alignOptions
.
length
>
0
?
this
.
$scope
.
alignOptions
[
0
]
.
value
:
''
;
}
}
...
...
public/app/plugins/datasource/stackdriver/specs/query_aggregation_ctrl.test.ts
View file @
a7897575
...
...
@@ -29,34 +29,5 @@ describe('StackdriverAggregationCtrl', () => {
});
});
});
describe
(
'when a user selects ALIGN_NONE and a reducer is selected'
,
()
=>
{
beforeEach
(
async
()
=>
{
ctrl
=
new
StackdriverAggregationCtrl
({
$on
:
()
=>
{},
refresh
:
()
=>
{},
target
:
{
aggregation
:
{
crossSeriesReducer
:
'RANDOM_REDUCER'
}
},
});
ctrl
.
onAlignmentChange
(
'ALIGN_NONE'
);
});
it
(
'should set REDUCE_NONE as selected aggregation'
,
()
=>
{
expect
(
ctrl
.
$scope
.
target
.
aggregation
.
crossSeriesReducer
).
toBe
(
'REDUCE_NONE'
);
});
});
describe
(
'when a user a user select a reducer and no alignment is selected'
,
()
=>
{
beforeEach
(
async
()
=>
{
ctrl
=
new
StackdriverAggregationCtrl
({
$on
:
()
=>
{},
refresh
:
()
=>
{},
target
:
{
aggregation
:
{
crossSeriesReducer
:
'REDUCE_NONE'
,
perSeriesAligner
:
'ALIGN_NONE'
}
},
});
ctrl
.
onAggregationChange
(
'ALIGN_NONE'
);
});
it
(
'should set an alignment'
,
()
=>
{
expect
(
ctrl
.
$scope
.
target
.
aggregation
.
perSeriesAligner
).
not
.
toBe
(
'ALIGN_NONE'
);
});
});
});
});
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