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
1a32ab64
Commit
1a32ab64
authored
Sep 26, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(renderer): improve renderOpts names
parent
effd2098
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
pkg/api/render.go
+1
-1
pkg/components/renderer/renderer.go
+4
-4
pkg/services/alerting/notifier.go
+1
-1
No files found.
pkg/api/render.go
View file @
1a32ab64
...
...
@@ -14,7 +14,7 @@ func RenderToPng(c *middleware.Context) {
queryParams
:=
fmt
.
Sprintf
(
"?%s"
,
c
.
Req
.
URL
.
RawQuery
)
renderOpts
:=
&
renderer
.
RenderOpts
{
Url
:
c
.
Params
(
"*"
)
+
queryParams
,
Path
:
c
.
Params
(
"*"
)
+
queryParams
,
Width
:
queryReader
.
Get
(
"width"
,
"800"
),
Height
:
queryReader
.
Get
(
"height"
,
"400"
),
OrgId
:
c
.
OrgId
,
...
...
pkg/components/renderer/renderer.go
View file @
1a32ab64
...
...
@@ -18,7 +18,7 @@ import (
)
type
RenderOpts
struct
{
Url
string
Path
string
Width
string
Height
string
Timeout
string
...
...
@@ -28,14 +28,14 @@ type RenderOpts struct {
var
rendererLog
log
.
Logger
=
log
.
New
(
"png-renderer"
)
func
RenderToPng
(
params
*
RenderOpts
)
(
string
,
error
)
{
rendererLog
.
Info
(
"Rendering"
,
"
url"
,
params
.
Url
)
rendererLog
.
Info
(
"Rendering"
,
"
path"
,
params
.
Path
)
var
executable
=
"phantomjs"
if
runtime
.
GOOS
==
"windows"
{
executable
=
executable
+
".exe"
}
params
.
Url
=
fmt
.
Sprintf
(
"%s://localhost:%s/%s"
,
setting
.
Protocol
,
setting
.
HttpPort
,
params
.
Url
)
url
:=
fmt
.
Sprintf
(
"%s://localhost:%s/%s"
,
setting
.
Protocol
,
setting
.
HttpPort
,
params
.
Path
)
binPath
,
_
:=
filepath
.
Abs
(
filepath
.
Join
(
setting
.
PhantomDir
,
executable
))
scriptPath
,
_
:=
filepath
.
Abs
(
filepath
.
Join
(
setting
.
PhantomDir
,
"render.js"
))
...
...
@@ -48,7 +48,7 @@ func RenderToPng(params *RenderOpts) (string, error) {
cmdArgs
:=
[]
string
{
"--ignore-ssl-errors=true"
,
scriptPath
,
"url="
+
params
.
U
rl
,
"url="
+
u
rl
,
"width="
+
params
.
Width
,
"height="
+
params
.
Height
,
"png="
+
pngPath
,
...
...
pkg/services/alerting/notifier.go
View file @
1a32ab64
...
...
@@ -74,7 +74,7 @@ func (n *RootNotifier) uploadImage(context *EvalContext) (err error) {
if
slug
,
err
:=
context
.
GetDashboardSlug
();
err
!=
nil
{
return
err
}
else
{
renderOpts
.
Url
=
fmt
.
Sprintf
(
"dashboard-solo/db/%s?&panelId=%d"
,
slug
,
context
.
Rule
.
PanelId
)
renderOpts
.
Path
=
fmt
.
Sprintf
(
"dashboard-solo/db/%s?&panelId=%d"
,
slug
,
context
.
Rule
.
PanelId
)
}
if
imagePath
,
err
:=
renderer
.
RenderToPng
(
renderOpts
);
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