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
dac8b35a
Commit
dac8b35a
authored
Jun 13, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(alerting): renamed scheduler to handler
parent
7f22b9eb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
47 deletions
+25
-47
pkg/models/alert.go
+1
-1
pkg/services/alerting/extractor.go
+1
-1
pkg/services/alerting/extractor_test.go
+5
-5
pkg/services/sqlstore/migrations/alert_mig.go
+1
-1
public/app/plugins/panel/graph/alert_handle.ts
+0
-7
public/app/plugins/panel/graph/alert_tab_ctrl.ts
+4
-19
public/app/plugins/panel/graph/partials/tab_alerting.html
+13
-13
No files found.
pkg/models/alert.go
View file @
dac8b35a
...
...
@@ -14,7 +14,7 @@ type Alert struct {
Name
string
Description
string
State
string
Scheduler
int64
Handler
int64
Enabled
bool
Created
time
.
Time
...
...
pkg/services/alerting/extractor.go
View file @
dac8b35a
...
...
@@ -69,7 +69,7 @@ func (e *DashAlertExtractor) GetAlerts() ([]*m.Alert, error) {
PanelId
:
panel
.
Get
(
"id"
)
.
MustInt64
(),
Id
:
jsonAlert
.
Get
(
"id"
)
.
MustInt64
(),
Name
:
jsonAlert
.
Get
(
"name"
)
.
MustString
(),
Scheduler
:
jsonAlert
.
Get
(
"schedu
ler"
)
.
MustInt64
(),
Handler
:
jsonAlert
.
Get
(
"hand
ler"
)
.
MustInt64
(),
Enabled
:
jsonAlert
.
Get
(
"enabled"
)
.
MustBool
(),
Description
:
jsonAlert
.
Get
(
"description"
)
.
MustString
(),
}
...
...
pkg/services/alerting/extractor_test.go
View file @
dac8b35a
...
...
@@ -39,7 +39,7 @@ func TestAlertRuleExtraction(t *testing.T) {
"alert": {
"name": "name1",
"description": "desc1",
"
schedu
ler": 1,
"
hand
ler": 1,
"enabled": true,
"critical": {
"level": 20,
...
...
@@ -74,7 +74,7 @@ func TestAlertRuleExtraction(t *testing.T) {
"alert": {
"name": "name2",
"description": "desc2",
"
schedu
ler": 0,
"
hand
ler": 0,
"enabled": true,
"critical": {
"level": 20,
...
...
@@ -197,9 +197,9 @@ func TestAlertRuleExtraction(t *testing.T) {
So
(
v
.
Description
,
ShouldNotBeEmpty
)
}
Convey
(
"should extract
schedu
ler property"
,
func
()
{
So
(
alerts
[
0
]
.
Schedu
ler
,
ShouldEqual
,
1
)
So
(
alerts
[
1
]
.
Schedu
ler
,
ShouldEqual
,
0
)
Convey
(
"should extract
hand
ler property"
,
func
()
{
So
(
alerts
[
0
]
.
Hand
ler
,
ShouldEqual
,
1
)
So
(
alerts
[
1
]
.
Hand
ler
,
ShouldEqual
,
0
)
})
Convey
(
"should extract panel idc"
,
func
()
{
...
...
pkg/services/sqlstore/migrations/alert_mig.go
View file @
dac8b35a
...
...
@@ -17,7 +17,7 @@ func addAlertMigrations(mg *Migrator) {
{
Name
:
"description"
,
Type
:
DB_NVarchar
,
Length
:
255
,
Nullable
:
false
},
{
Name
:
"state"
,
Type
:
DB_NVarchar
,
Length
:
255
,
Nullable
:
false
},
{
Name
:
"settings"
,
Type
:
DB_Text
,
Nullable
:
false
},
{
Name
:
"
schedu
ler"
,
Type
:
DB_BigInt
,
Nullable
:
false
},
{
Name
:
"
hand
ler"
,
Type
:
DB_BigInt
,
Nullable
:
false
},
{
Name
:
"enabled"
,
Type
:
DB_Bool
,
Nullable
:
false
},
{
Name
:
"created"
,
Type
:
DB_DateTime
,
Nullable
:
false
},
{
Name
:
"updated"
,
Type
:
DB_DateTime
,
Nullable
:
false
},
...
...
public/app/plugins/panel/graph/alert_handle.ts
View file @
dac8b35a
...
...
@@ -58,15 +58,11 @@ export class AlertHandleManager {
isMoving
=
false
;
// calculate graph level
var
graphLevel
=
plot
.
c2p
({
left
:
0
,
top
:
posTop
}).
y
;
console
.
log
(
'canvasPos:'
+
posTop
+
' Graph level: '
+
graphLevel
);
graphLevel
=
parseInt
(
graphLevel
.
toFixed
(
0
));
levelModel
.
level
=
graphLevel
;
console
.
log
(
levelModel
);
var
levelCanvasPos
=
plot
.
p2c
({
x
:
0
,
y
:
graphLevel
});
console
.
log
(
'canvas pos'
,
levelCanvasPos
);
console
.
log
(
'stopped'
);
handleElem
.
off
(
"mousemove"
,
dragging
);
handleElem
.
off
(
"mouseup"
,
dragging
);
...
...
@@ -80,7 +76,6 @@ export class AlertHandleManager {
isMoving
=
true
;
lastY
=
null
;
posTop
=
handleElem
.
position
().
top
;
console
.
log
(
'start pos'
,
posTop
);
handleElem
.
on
(
"mousemove"
,
dragging
);
handleElem
.
on
(
"mouseup"
,
stopped
);
...
...
@@ -109,12 +104,10 @@ export class AlertHandleManager {
}
if
(
handleElem
.
length
===
0
)
{
console
.
log
(
'creating handle'
);
handleElem
=
$
(
this
.
getFullHandleHtml
(
type
,
model
.
op
,
levelStr
));
this
.
placeholder
.
append
(
handleElem
);
this
.
setupDragging
(
handleElem
,
model
);
}
else
{
console
.
log
(
'reusing handle!'
);
handleElem
.
html
(
this
.
getHandleInnerHtml
(
type
,
model
.
op
,
levelStr
));
}
...
...
public/app/plugins/panel/graph/alert_tab_ctrl.ts
View file @
dac8b35a
...
...
@@ -23,7 +23,7 @@ export class AlertTabCtrl {
panel
:
any
;
panelCtrl
:
any
;
metricTargets
=
[{
refId
:
'- select query -'
}
];
schedu
lers
=
[{
text
:
'Grafana'
,
value
:
1
},
{
text
:
'External'
,
value
:
0
}];
hand
lers
=
[{
text
:
'Grafana'
,
value
:
1
},
{
text
:
'External'
,
value
:
0
}];
transforms
=
[
{
text
:
'Aggregation'
,
...
...
@@ -49,7 +49,7 @@ export class AlertTabCtrl {
frequency
:
'60s'
,
notify
:
[],
enabled
:
false
,
schedu
ler
:
1
,
hand
ler
:
1
,
warn
:
{
op
:
'>'
,
level
:
undefined
},
critical
:
{
op
:
'>'
,
level
:
undefined
},
query
:
{
...
...
@@ -104,7 +104,6 @@ export class AlertTabCtrl {
// init the query part components model
this
.
query
=
new
QueryPart
(
this
.
queryParams
,
alertQueryDef
);
this
.
convertThresholdsToAlertThresholds
();
this
.
transformDef
=
_
.
findWhere
(
this
.
transforms
,
{
type
:
this
.
alert
.
transform
.
type
});
this
.
panelCtrl
.
editingAlert
=
true
;
...
...
@@ -136,22 +135,8 @@ export class AlertTabCtrl {
}
}
convertThresholdsToAlertThresholds
()
{
// if (this.panel.grid
// && this.panel.grid.threshold1
// && this.alert.warnLevel === undefined
// ) {
// this.alert.warning.op = '>';
// this.alert.warning.level = this.panel.grid.threshold1;
// }
//
// if (this.panel.grid
// && this.panel.grid.threshold2
// && this.alert.critical.level === undefined
// ) {
// this.alert.critical.op = '>';
// this.alert.critical.level = this.panel.grid.threshold2;
// }
operatorChanged
()
{
this
.
panelCtrl
.
render
();
}
delete
()
{
...
...
public/app/plugins/panel/graph/partials/tab_alerting.html
View file @
dac8b35a
...
...
@@ -41,22 +41,22 @@
<div
class=
"gf-form-group section"
>
<h5
class=
"section-heading"
>
Levels
</h5>
<div
class=
"gf-form-inline"
>
<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.levelOpList"
custom=
"false"
css-class=
"query-segment-operator"
></metric-segment-model>
<input
class=
"gf-form-input max-width-7"
type=
"number"
ng-model=
"ctrl.alert.warn.level"
ng-change=
"ctrl.levelsUpdated()"
></input>
</div>
<div
class=
"gf-form"
>
<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.critical.op"
options=
"ctrl.levelOpList"
custom=
"false"
css-class=
"query-segment-operator"
></metric-segment-model>
<metric-segment-model
property=
"ctrl.alert.critical.op"
options=
"ctrl.levelOpList"
custom=
"false"
css-class=
"query-segment-operator"
on-change=
"ctrl.operatorChanged()"
></metric-segment-model>
<input
class=
"gf-form-input max-width-7"
type=
"number"
ng-model=
"ctrl.alert.critical.level"
ng-change=
"ctrl.levelsUpdated()"
></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.levelOpList"
custom=
"false"
css-class=
"query-segment-operator"
on-change=
"ctrl.operatorChanged()"
></metric-segment-model>
<input
class=
"gf-form-input max-width-7"
type=
"number"
ng-model=
"ctrl.alert.warn.level"
ng-change=
"ctrl.levelsUpdated()"
></input>
</div>
</div>
</div>
</div>
...
...
@@ -66,11 +66,11 @@
<h5
class=
"section-heading"
>
Execution
</h5>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label"
>
Schedu
ler
</span>
<span
class=
"gf-form-label"
>
Hand
ler
</span>
<div
class=
"gf-form-select-wrapper"
>
<select
class=
"gf-form-input"
ng-model=
"ctrl.alert.
schedu
ler"
ng-options=
"f.value as f.text for f in ctrl.
schedu
lers"
>
ng-model=
"ctrl.alert.
hand
ler"
ng-options=
"f.value as f.text for f in ctrl.
hand
lers"
>
</select>
</div>
</div>
...
...
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