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
4b6fd675
Unverified
Commit
4b6fd675
authored
Mar 28, 2018
by
Daniel Lee
Committed by
GitHub
Mar 28, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11390 from bergquist/notifiers_default_value
Default value for uploading images in alert notifiers
parents
d37e8df9
d29563ff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
pkg/services/alerting/notifiers/base.go
+5
-1
pkg/services/alerting/notifiers/base_test.go
+24
-0
public/app/features/alerting/notification_edit_ctrl.ts
+2
-1
No files found.
pkg/services/alerting/notifiers/base.go
View file @
4b6fd675
...
...
@@ -15,7 +15,11 @@ type NotifierBase struct {
}
func
NewNotifierBase
(
id
int64
,
isDefault
bool
,
name
,
notifierType
string
,
model
*
simplejson
.
Json
)
NotifierBase
{
uploadImage
:=
model
.
Get
(
"uploadImage"
)
.
MustBool
(
false
)
uploadImage
:=
true
value
,
exist
:=
model
.
CheckGet
(
"uploadImage"
)
if
exist
{
uploadImage
=
value
.
MustBool
()
}
return
NotifierBase
{
Id
:
id
,
...
...
pkg/services/alerting/notifiers/base_test.go
View file @
4b6fd675
...
...
@@ -4,6 +4,7 @@ import (
"context"
"testing"
"github.com/grafana/grafana/pkg/components/simplejson"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/alerting"
.
"github.com/smartystreets/goconvey/convey"
...
...
@@ -11,6 +12,29 @@ import (
func
TestBaseNotifier
(
t
*
testing
.
T
)
{
Convey
(
"Base notifier tests"
,
t
,
func
()
{
Convey
(
"default constructor for notifiers"
,
func
()
{
bJson
:=
simplejson
.
New
()
Convey
(
"can parse false value"
,
func
()
{
bJson
.
Set
(
"uploadImage"
,
false
)
base
:=
NewNotifierBase
(
1
,
false
,
"name"
,
"email"
,
bJson
)
So
(
base
.
UploadImage
,
ShouldBeFalse
)
})
Convey
(
"can parse true value"
,
func
()
{
bJson
.
Set
(
"uploadImage"
,
true
)
base
:=
NewNotifierBase
(
1
,
false
,
"name"
,
"email"
,
bJson
)
So
(
base
.
UploadImage
,
ShouldBeTrue
)
})
Convey
(
"default value should be true for backwards compatibility"
,
func
()
{
base
:=
NewNotifierBase
(
1
,
false
,
"name"
,
"email"
,
bJson
)
So
(
base
.
UploadImage
,
ShouldBeTrue
)
})
})
Convey
(
"should notify"
,
func
()
{
Convey
(
"pending -> ok"
,
func
()
{
context
:=
alerting
.
NewEvalContext
(
context
.
TODO
(),
&
alerting
.
Rule
{
...
...
public/app/features/alerting/notification_edit_ctrl.ts
View file @
4b6fd675
...
...
@@ -43,6 +43,7 @@ export class AlertNotificationEditCtrl {
return
this
.
backendSrv
.
get
(
`/api/alert-notifications/
${
this
.
$routeParams
.
id
}
`
).
then
(
result
=>
{
this
.
navModel
.
breadcrumbs
.
push
({
text
:
result
.
name
});
this
.
navModel
.
node
=
{
text
:
result
.
name
};
result
.
settings
=
_
.
defaults
(
result
.
settings
,
this
.
defaults
.
settings
);
return
result
;
});
})
...
...
@@ -89,7 +90,7 @@ export class AlertNotificationEditCtrl {
}
typeChanged
()
{
this
.
model
.
settings
=
{}
;
this
.
model
.
settings
=
_
.
defaults
({},
this
.
defaults
.
settings
)
;
this
.
notifierTemplateId
=
this
.
getNotifierTemplateId
(
this
.
model
.
type
);
}
...
...
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