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
525b367a
Commit
525b367a
authored
Dec 19, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Config.js generation, simple temp solution, first is default datasource
parent
a7c816c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
pkg/api/api_config.go
+18
-2
pkg/models/account.go
+1
-0
No files found.
pkg/api/api_config.go
View file @
525b367a
...
...
@@ -22,18 +22,34 @@ type configJsTmplModel struct {
DataSources
[]
*
m
.
DataSource
}
// TODO: cleanup this ugly code
func
renderConfig
(
data
*
configJsTmplModel
)
string
{
datasources
:=
make
(
map
[
string
]
interface
{})
for
_
,
ds
:=
range
data
.
DataSources
{
for
i
,
ds
:=
range
data
.
DataSources
{
url
:=
ds
.
Url
if
ds
.
Access
==
m
.
DS_ACCESS_PROXY
{
url
=
"/api/datasources/proxy/"
+
strconv
.
FormatInt
(
ds
.
Id
,
10
)
}
datasources
[
ds
.
Name
]
=
map
[
string
]
interface
{}{
var
dsMap
=
map
[
string
]
interface
{}{
"type"
:
ds
.
Type
,
"url"
:
url
,
}
// temp hack, first is always default
// TODO: implement default ds account setting
if
i
==
0
{
dsMap
[
"default"
]
=
true
}
datasources
[
ds
.
Name
]
=
dsMap
}
// add grafana backend data source
datasources
[
"grafana"
]
=
map
[
string
]
interface
{}{
"type"
:
"grafana"
,
"url"
:
""
,
"grafanaDB"
:
true
,
}
jsonObj
:=
map
[
string
]
interface
{}{
...
...
pkg/models/account.go
View file @
525b367a
...
...
@@ -19,6 +19,7 @@ var (
ErrAccountNotFound
=
errors
.
New
(
"Account not found"
)
)
// Projection from User -> other account given access to
type
OtherAccount
struct
{
Id
int64
Email
string
...
...
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