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
446104d1
Commit
446104d1
authored
Jun 22, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashfolders: allows phantomjs rendering for alerting
Makes the alerting user an admin when rendering a png for emails
parent
691ff32a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
pkg/components/renderer/renderer.go
+14
-9
pkg/services/alerting/notifier.go
+5
-4
No files found.
pkg/components/renderer/renderer.go
View file @
446104d1
...
...
@@ -21,14 +21,15 @@ import (
)
type
RenderOpts
struct
{
Path
string
Width
string
Height
string
Timeout
string
OrgId
int64
UserId
int64
OrgRole
models
.
RoleType
Timezone
string
Path
string
Width
string
Height
string
Timeout
string
OrgId
int64
UserId
int64
OrgRole
models
.
RoleType
Timezone
string
IsAlertContext
bool
}
var
rendererLog
log
.
Logger
=
log
.
New
(
"png-renderer"
)
...
...
@@ -75,7 +76,11 @@ func RenderToPng(params *RenderOpts) (string, error) {
pngPath
,
_
:=
filepath
.
Abs
(
filepath
.
Join
(
setting
.
ImagesDir
,
util
.
GetRandomString
(
20
)))
pngPath
=
pngPath
+
".png"
renderKey
:=
middleware
.
AddRenderAuthKey
(
params
.
OrgId
,
params
.
UserId
,
params
.
OrgRole
)
orgRole
:=
params
.
OrgRole
if
params
.
IsAlertContext
{
orgRole
=
models
.
ROLE_ADMIN
}
renderKey
:=
middleware
.
AddRenderAuthKey
(
params
.
OrgId
,
params
.
UserId
,
orgRole
)
defer
middleware
.
RemoveRenderAuthKey
(
renderKey
)
cmdArgs
:=
[]
string
{
...
...
pkg/services/alerting/notifier.go
View file @
446104d1
...
...
@@ -79,10 +79,11 @@ func (n *notificationService) uploadImage(context *EvalContext) (err error) {
}
renderOpts
:=
&
renderer
.
RenderOpts
{
Width
:
"800"
,
Height
:
"400"
,
Timeout
:
"30"
,
OrgId
:
context
.
Rule
.
OrgId
,
Width
:
"800"
,
Height
:
"400"
,
Timeout
:
"30"
,
OrgId
:
context
.
Rule
.
OrgId
,
IsAlertContext
:
true
,
}
if
slug
,
err
:=
context
.
GetDashboardSlug
();
err
!=
nil
{
...
...
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