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
f38c9546
Commit
f38c9546
authored
Jul 19, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(alerting): more work on alert conditions
parent
29d308e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
41 deletions
+46
-41
public/app/plugins/panel/graph/alert_tab_ctrl.ts
+5
-5
public/app/plugins/panel/graph/partials/tab_alerting.html
+41
-36
No files found.
public/app/plugins/panel/graph/alert_tab_ctrl.ts
View file @
f38c9546
...
...
@@ -32,7 +32,9 @@ export class AlertTabCtrl {
handlers
=
[{
text
:
'Grafana'
,
value
:
1
},
{
text
:
'External'
,
value
:
0
}];
conditionTypes
=
[
{
text
:
'Query'
,
value
:
'query'
},
{
text
:
'Alert state'
,
value
:
'alert_state'
},
{
text
:
'Other alert'
,
value
:
'other_alert'
},
{
text
:
'Time of day'
,
value
:
'time_of_day'
},
{
text
:
'Day of week'
,
value
:
'day_of_week'
},
];
alert
:
any
;
conditionModels
:
any
;
...
...
@@ -68,10 +70,6 @@ export class AlertTabCtrl {
initModel
()
{
var
alert
=
this
.
alert
=
this
.
panel
.
alert
=
this
.
panel
.
alert
||
{};
// set threshold defaults
alert
.
warn
=
this
.
getThresholdWithDefaults
(
alert
.
warn
);
alert
.
crit
=
this
.
getThresholdWithDefaults
(
alert
.
crit
);
alert
.
conditions
=
alert
.
conditions
||
[];
if
(
alert
.
conditions
.
length
===
0
)
{
alert
.
conditions
.
push
(
this
.
buildDefaultCondition
());
...
...
@@ -102,6 +100,8 @@ export class AlertTabCtrl {
to
:
'now'
,
reducer
:
'avg'
,
reducerParams
:
[],
warn
:
this
.
getThresholdWithDefaults
({}),
crit
:
this
.
getThresholdWithDefaults
({}),
};
}
...
...
public/app/plugins/panel/graph/partials/tab_alerting.html
View file @
f38c9546
<
div
ng-if=
"!ctrl.alert.enabled"
>
<div
class=
"gf-form-group"
>
<h5
class=
"section-heading"
>
Visual Thresholds
</h5
>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label"
>
<i
class=
"icon-gf icon-gf-warn alert-icon-critical"
></i
>
Critcal if
</span
>
<metric-segment-model
property=
"ctrl.alert.crit.op"
options=
"ctrl.operatorList"
custom=
"false"
css-class=
"query-segment-operator"
on-change=
"ctrl.thresholdsUpdated()"
></metric-segment-model
>
<input
class=
"gf-form-input max-width-7"
type=
"number"
ng-model=
"ctrl.alert.crit.value"
ng-change=
"ctrl.thresholdsUpdated()"
></input
>
</div
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label"
>
<i
class=
"icon-gf icon-gf-warn alert-icon-warn"
></i
>
Warn if
</span
>
<metric-segment-model
property=
"ctrl.alert.warn.op"
options=
"ctrl.operatorList"
custom=
"false"
css-class=
"query-segment-operator"
on-change=
"ctrl.thresholdsUpdated()"
></metric-segment-model
>
<input
class=
"gf-form-input max-width-7"
type=
"number"
ng-model=
"ctrl.alert.warn.value"
ng-change=
"ctrl.thresholdsUpdated()"
></input
>
</div
>
</div
>
</div
>
<
/div
>
<
!-- <div ng-if="!ctrl.alert.enabled"> --
>
<!-- <div class="gf-form-group"> --
>
<!-- <h5 class="section-heading">Visual Thresholds</h5> --
>
<!-- <div class="gf-form-inline"> --
>
<!-- <div class="gf-form"> --
>
<!-- <span class="gf-form-label"> --
>
<!-- <i class="icon-gf icon-gf-warn alert-icon-critical"></i> --
>
<!-- Critcal if -->
<!-- </span> --
>
<!-- <metric-segment-model property="ctrl.alert.crit.op" options="ctrl.operatorList" custom="false" css-class="query-segment-operator" on-change="ctrl.thresholdsUpdated()"></metric-segment-model> --
>
<!-- <input class="gf-form-input max-width-7" type="number" ng-model="ctrl.alert.crit.value" ng-change="ctrl.thresholdsUpdated()"></input> --
>
<!-- </div> --
>
<!-- <div class="gf-form"> --
>
<!-- <span class="gf-form-label"> --
>
<!-- <i class="icon-gf icon-gf-warn alert-icon-warn"></i> --
>
<!-- Warn if -->
<!-- </span> --
>
<!-- <metric-segment-model property="ctrl.alert.warn.op" options="ctrl.operatorList" custom="false" css-class="query-segment-operator" on-change="ctrl.thresholdsUpdated()"></metric-segment-model> --
>
<!-- <input class="gf-form-input max-width-7" type="number" ng-model="ctrl.alert.warn.value" ng-change="ctrl.thresholdsUpdated()"></input> --
>
<!-- </div> --
>
<!-- </div> --
>
<!-- </div> --
>
<
!-- </div> --
>
<div
ng-if=
"ctrl.alert.enabled"
>
<div
class=
"gf-form-group"
>
...
...
@@ -69,7 +69,7 @@
</query-part-editor>
</div>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label"
>
Reduce
</span>
<span
class=
"gf-form-label"
>
Reduce
r
</span>
<query-part-editor
class=
"gf-form-label query-part"
part=
"conditionModel.reducerPart"
...
...
@@ -102,24 +102,29 @@
</div>
<div
class=
"gf-form-group"
>
<div
class=
"dropdown"
>
<button
class=
"btn btn-inverse dropdown-toggle gf-form-btn"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-plus"
></i>
Add Condition
</button>
<div
class=
"gf-form-button-row"
>
<div
class=
"dropdown pull-left"
ng-if=
"ctrl.alert.enabled"
>
<button
class=
"btn btn-inverse dropdown-toggle"
data-toggle=
"dropdown"
>
<i
class=
"fa fa-plus"
></i>
Add Condition
</button>
<ul
class=
"dropdown-menu"
role=
"menu"
>
<li
ng-repeat=
"ct in ctrl.conditionTypes"
role=
"menuitem"
>
<a
ng-click=
"ctrl.addCondition(ct.value);"
>
{{ct.text}}
</a>
</li>
</ul>
<ul
class=
"dropdown-menu"
role=
"menu"
>
<li
ng-repeat=
"ct in ctrl.conditionTypes"
role=
"menuitem"
>
<a
ng-click=
"ctrl.addCondition(ct.value);"
>
{{ct.text}}
</a>
</li>
</ul>
</div>
<button
class=
"btn btn-inverse"
ng-click=
"ctrl.delete()"
>
Delete Alert
</button>
</div>
</div>
</div>
<div
class=
"
editor-row
"
>
<div
class=
"
gf-form-group"
ng-if=
"!ctrl.alert.enabled
"
>
<div
class=
"gf-form-button-row"
>
<button
class=
"btn btn-danger"
ng-click=
"ctrl.delete()"
ng-show=
"ctrl.alert.enabled"
>
Delete
</button>
<button
class=
"btn btn-inverse"
ng-click=
"ctrl.enable()"
ng-hide=
"ctrl.alert.enabled"
>
<button
class=
"btn btn-inverse"
ng-click=
"ctrl.enable()"
>
<i
class=
"icon-gf icon-gf-alert"
></i>
Create Alert
</button>
...
...
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