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
90ae59cc
Commit
90ae59cc
authored
Dec 01, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed png rending
parent
ff6a2d01
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
82 deletions
+14
-82
.bra.toml
+1
-1
main.go
+0
-3
pkg/cmd/web.go
+2
-1
pkg/components/phantom_renderer.go
+0
-73
pkg/dto/queries.go
+9
-0
pkg/middleware/auth.go
+1
-1
pkg/stores/sqlstore/sqlstore_dashboards.go
+1
-3
No files found.
.bra.toml
View file @
90ae59cc
...
...
@@ -9,6 +9,6 @@ watch_dirs = [
watch_exts
=
[
".go"
,
".ini"
]
build_delay
=
1500
cmds
=
[
[
"go"
,
"build"
,
"./pkg/cmd/grafana-pro"
],
[
"go"
,
"build"
],
[
"./grafana-pro"
,
"web"
]
]
main.go
View file @
90ae59cc
...
...
@@ -4,7 +4,6 @@ import (
"os"
"runtime"
"github.com/torkelo/grafana-pro/pkg/bus"
"github.com/torkelo/grafana-pro/pkg/cmd"
"github.com/codegangsta/cli"
...
...
@@ -17,8 +16,6 @@ func init() {
}
func
main
()
{
bus
.
InitBus
()
app
:=
cli
.
NewApp
()
app
.
Name
=
"Grafana Pro"
app
.
Usage
=
"Grafana Pro Service"
...
...
pkg/cmd/web.go
View file @
90ae59cc
...
...
@@ -67,9 +67,10 @@ func runWeb(*cli.Context) {
setting
.
NewConfigContext
()
setting
.
InitServices
()
sqlstore
.
Init
()
social
.
NewOAuthService
()
sqlstore
.
Init
()
// init database
sqlstore
.
LoadModelsConfig
()
if
err
:=
sqlstore
.
NewEngine
();
err
!=
nil
{
...
...
pkg/components/phantom_renderer.go
deleted
100644 → 0
View file @
ff6a2d01
package
components
import
(
"crypto/md5"
"encoding/hex"
"io"
"os"
"os/exec"
"path/filepath"
"time"
log
"github.com/alecthomas/log4go"
)
type
PhantomRenderer
struct
{
ImagesDir
string
PhantomDir
string
}
type
RenderOpts
struct
{
Url
string
Width
string
Height
string
}
func
(
self
*
PhantomRenderer
)
RenderToPng
(
params
*
RenderOpts
)
(
string
,
error
)
{
log
.
Info
(
"PhantomRenderer::renderToPng url %v"
,
params
.
Url
)
binPath
,
_
:=
filepath
.
Abs
(
filepath
.
Join
(
self
.
PhantomDir
,
"phantomjs"
))
scriptPath
,
_
:=
filepath
.
Abs
(
filepath
.
Join
(
self
.
PhantomDir
,
"render.js"
))
pngPath
,
_
:=
filepath
.
Abs
(
filepath
.
Join
(
self
.
ImagesDir
,
getHash
(
params
.
Url
)))
pngPath
=
pngPath
+
".png"
cmd
:=
exec
.
Command
(
binPath
,
scriptPath
,
"url="
+
params
.
Url
,
"width="
+
params
.
Width
,
"height="
+
params
.
Height
,
"png="
+
pngPath
)
stdout
,
err
:=
cmd
.
StdoutPipe
()
if
err
!=
nil
{
return
""
,
err
}
stderr
,
err
:=
cmd
.
StderrPipe
()
if
err
!=
nil
{
return
""
,
err
}
err
=
cmd
.
Start
()
if
err
!=
nil
{
return
""
,
err
}
go
io
.
Copy
(
os
.
Stdout
,
stdout
)
go
io
.
Copy
(
os
.
Stdout
,
stderr
)
done
:=
make
(
chan
error
)
go
func
()
{
cmd
.
Wait
()
close
(
done
)
}()
select
{
case
<-
time
.
After
(
10
*
time
.
Second
)
:
if
err
:=
cmd
.
Process
.
Kill
();
err
!=
nil
{
log
.
Error
(
"failed to kill: %v"
,
err
)
}
case
<-
done
:
}
return
pngPath
,
nil
}
func
getHash
(
text
string
)
string
{
hasher
:=
md5
.
New
()
hasher
.
Write
([]
byte
(
text
))
return
hex
.
EncodeToString
(
hasher
.
Sum
(
nil
))
}
pkg/dto/queries.go
0 → 100644
View file @
90ae59cc
package
dto
type
GetDashboardQuery
struct
{
Id
int64
Resp
GetDashboardQueryResp
}
type
GetDashboardQueryResp
struct
{
}
pkg/middleware/auth.go
View file @
90ae59cc
...
...
@@ -15,7 +15,7 @@ func authGetRequestAccountId(c *Context, sess session.Store) (int64, error) {
urlQuery
:=
c
.
Req
.
URL
.
Query
()
if
len
(
urlQuery
[
"render"
])
>
0
{
accId
,
_
:=
strconv
.
Atoi
(
urlQuery
[
"accountId"
][
0
]
)
accId
,
_
:=
strconv
.
ParseInt
(
urlQuery
[
"accountId"
][
0
],
10
,
64
)
sess
.
Set
(
"accountId"
,
accId
)
accountId
=
accId
}
...
...
pkg/stores/sqlstore/sqlstore_dashboards.go
View file @
90ae59cc
package
sqlstore
import
(
"github.com/torkelo/grafana-pro/pkg/models"
)
import
"github.com/torkelo/grafana-pro/pkg/models"
func
SaveDashboard
(
dash
*
models
.
Dashboard
)
error
{
var
err
error
...
...
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