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
d8d951c8
Commit
d8d951c8
authored
Aug 15, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(alerting): can now change reducer
parent
1418cbbd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
21 deletions
+32
-21
public/app/core/components/query_part/query_part_editor.ts
+1
-1
public/app/features/alerting/alert_tab_ctrl.ts
+27
-7
public/app/features/alerting/partials/alert_tab.html
+2
-9
public/app/plugins/datasource/influxdb/query_ctrl.ts
+2
-4
No files found.
public/app/core/components/query_part/query_part_editor.ts
View file @
d8d951c8
...
...
@@ -136,7 +136,7 @@ export function queryPartEditorDirective($compile, templateSrv) {
};
$scope
.
triggerPartAction
=
function
(
action
)
{
$scope
.
handleEvent
({
$event
:
{
name
:
'action
-'
+
action
.
value
}});
$scope
.
handleEvent
({
$event
:
{
name
:
'action
'
,
action
:
action
}});
};
function
addElementsAndCompile
()
{
...
...
public/app/features/alerting/alert_tab_ctrl.ts
View file @
d8d951c8
...
...
@@ -16,13 +16,12 @@ export class AlertTabCtrl {
conditionModels
:
any
;
evalFunctions
:
any
;
severityLevels
:
any
;
reducerTypes
:
any
;
addNotificationSegment
;
notifications
;
alertNotifications
;
/** @ngInject */
constructor
(
private
$scope
,
private
$timeout
,
private
backendSrv
,
private
dashboardSrv
,
private
uiSegmentSrv
)
{
constructor
(
private
$scope
,
private
$timeout
,
private
backendSrv
,
private
dashboardSrv
,
private
uiSegmentSrv
,
private
$q
)
{
this
.
panelCtrl
=
$scope
.
ctrl
;
this
.
panel
=
this
.
panelCtrl
.
panel
;
this
.
$scope
.
ctrl
=
this
;
...
...
@@ -30,7 +29,6 @@ export class AlertTabCtrl {
this
.
evalFunctions
=
alertDef
.
evalFunctions
;
this
.
conditionTypes
=
alertDef
.
conditionTypes
;
this
.
severityLevels
=
alertDef
.
severityLevels
;
this
.
reducerTypes
=
alertDef
.
reducerTypes
;
}
$onInit
()
{
...
...
@@ -156,12 +154,34 @@ export class AlertTabCtrl {
return
cm
;
}
queryPartUpdated
(
conditionModel
)
{
handleQueryPartEvent
(
conditionModel
,
evt
)
{
switch
(
evt
.
name
)
{
case
"action-remove-part"
:
{
break
;
}
case
"get-part-actions"
:
{
return
this
.
$q
.
when
([]);
}
}
}
changeReducerType
(
conditionModel
,
value
)
{
conditionModel
.
source
.
reducer
.
type
=
value
;
conditionModel
.
reducerPart
=
alertDef
.
createReducerPart
(
conditionModel
.
source
.
reducer
);
handleReducerPartEvent
(
conditionModel
,
evt
)
{
switch
(
evt
.
name
)
{
case
"action"
:
{
conditionModel
.
source
.
reducer
.
type
=
evt
.
action
.
value
;
conditionModel
.
reducerPart
=
alertDef
.
createReducerPart
(
conditionModel
.
source
.
reducer
);
break
;
}
case
"get-part-actions"
:
{
var
result
=
[];
for
(
var
type
of
alertDef
.
reducerTypes
)
{
if
(
type
.
value
!==
conditionModel
.
source
.
reducer
.
type
)
{
result
.
push
(
type
);
}
}
return
this
.
$q
.
when
(
result
);
}
}
}
addCondition
(
type
)
{
...
...
public/app/features/alerting/partials/alert_tab.html
View file @
d8d951c8
...
...
@@ -49,19 +49,12 @@
<span
class=
"gf-form-label query-keyword width-5"
ng-if=
"$index===0"
>
WHEN
</span>
</div>
<div
class=
"gf-form"
>
<query-part-editor
class=
"gf-form-label query-part"
part=
"conditionModel.queryPart"
part-updated=
"ctrl.queryPartUpdated(conditionModel
)"
>
<query-part-editor
class=
"gf-form-label query-part"
part=
"conditionModel.queryPart"
handle-event=
"ctrl.handleQueryPartEvent(conditionModel, $event
)"
>
</query-part-editor>
</div>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label"
>
Reducer
</span>
<query-part-editor
class=
"gf-form-label query-part"
part=
"conditionModel.reducerPart"
part-updated=
"ctrl.reducerPartUpdated(conditionModel)"
>
<query-part-editor-actions>
<ul
class=
"dropdown-menu"
>
<li
ng-repeat=
"reducer in ctrl.reducerTypes"
>
<a
ng-click=
"ctrl.changeReducerType(conditionModel, reducer.value)"
ng-hide=
"reducer.value === conditionModel.reducerPart.def.type"
>
{{reducer.text}}
</a>
</li>
</ul>
</query-part-editor-actions>
<query-part-editor
class=
"gf-form-label query-part"
part=
"conditionModel.reducerPart"
handle-event=
"ctrl.handleReducerPartEvent(conditionModel, $event)"
>
</query-part-editor>
</div>
<div
class=
"gf-form"
>
...
...
public/app/plugins/datasource/influxdb/query_ctrl.ts
View file @
d8d951c8
...
...
@@ -20,7 +20,6 @@ export class InfluxQueryCtrl extends QueryCtrl {
measurementSegment
:
any
;
removeTagFilterSegment
:
any
;
/** @ngInject **/
constructor
(
$scope
,
$injector
,
private
templateSrv
,
private
$q
,
private
uiSegmentSrv
)
{
super
(
$scope
,
$injector
);
...
...
@@ -123,7 +122,7 @@ export class InfluxQueryCtrl extends QueryCtrl {
this
.
panelCtrl
.
refresh
();
break
;
}
case
"action
-remove-part
"
:
{
case
"action"
:
{
this
.
queryModel
.
removeSelectPart
(
selectParts
,
part
);
this
.
panelCtrl
.
refresh
();
break
;
...
...
@@ -146,7 +145,7 @@ export class InfluxQueryCtrl extends QueryCtrl {
this
.
panelCtrl
.
refresh
();
break
;
}
case
"action
-remove-part
"
:
{
case
"action"
:
{
this
.
queryModel
.
removeGroupByPart
(
part
,
index
);
this
.
panelCtrl
.
refresh
();
break
;
...
...
@@ -335,4 +334,3 @@ export class InfluxQueryCtrl extends QueryCtrl {
return
this
.
queryModel
.
render
(
false
);
}
}
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