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
13864853
Commit
13864853
authored
Dec 03, 2015
by
woodsaj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support separate css files for light/dark themes.
parent
79d29db1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
7 deletions
+18
-7
pkg/api/dtos/index.go
+6
-1
pkg/api/index.go
+1
-1
pkg/plugins/models.go
+4
-2
public/views/index.html
+7
-3
No files found.
pkg/api/dtos/index.go
View file @
13864853
...
@@ -8,11 +8,16 @@ type IndexViewData struct {
...
@@ -8,11 +8,16 @@ type IndexViewData struct {
GoogleAnalyticsId
string
GoogleAnalyticsId
string
GoogleTagManagerId
string
GoogleTagManagerId
string
PluginCss
[]
string
PluginCss
[]
*
PluginCss
PluginJs
[]
string
PluginJs
[]
string
MainNavLinks
[]
*
NavLink
MainNavLinks
[]
*
NavLink
}
}
type
PluginCss
struct
{
Light
string
`json:"light"`
Dark
string
`json:"dark"`
}
type
NavLink
struct
{
type
NavLink
struct
{
Text
string
`json:"text"`
Text
string
`json:"text"`
Icon
string
`json:"icon"`
Icon
string
`json:"icon"`
...
...
pkg/api/index.go
View file @
13864853
...
@@ -67,7 +67,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
...
@@ -67,7 +67,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
data
.
PluginJs
=
append
(
data
.
PluginJs
,
js
.
Module
)
data
.
PluginJs
=
append
(
data
.
PluginJs
,
js
.
Module
)
}
}
for
_
,
css
:=
range
plugin
.
Css
{
for
_
,
css
:=
range
plugin
.
Css
{
data
.
PluginCss
=
append
(
data
.
PluginCss
,
css
.
Href
)
data
.
PluginCss
=
append
(
data
.
PluginCss
,
&
dtos
.
PluginCss
{
Light
:
css
.
Light
,
Dark
:
css
.
Dark
}
)
}
}
for
_
,
item
:=
range
plugin
.
MainNavLinks
{
for
_
,
item
:=
range
plugin
.
MainNavLinks
{
// only show menu items for the specified roles.
// only show menu items for the specified roles.
...
...
pkg/plugins/models.go
View file @
13864853
...
@@ -37,7 +37,8 @@ type ExternalPluginRoute struct {
...
@@ -37,7 +37,8 @@ type ExternalPluginRoute struct {
}
}
type
ExternalPluginJs
struct
{
type
ExternalPluginJs
struct
{
Module
string
`json:"module"`
Module
string
`json:"module"`
Directive
string
`json:"Directive"`
}
}
type
ExternalPluginNavLink
struct
{
type
ExternalPluginNavLink
struct
{
...
@@ -48,7 +49,8 @@ type ExternalPluginNavLink struct {
...
@@ -48,7 +49,8 @@ type ExternalPluginNavLink struct {
}
}
type
ExternalPluginCss
struct
{
type
ExternalPluginCss
struct
{
Href
string
`json:"href"`
Light
string
`json:"light"`
Dark
string
`json:"dark"`
}
}
type
ExternalPlugin
struct
{
type
ExternalPlugin
struct
{
...
...
public/views/index.html
View file @
13864853
...
@@ -10,13 +10,17 @@
...
@@ -10,13 +10,17 @@
[[if .User.LightTheme]]
[[if .User.LightTheme]]
<link
rel=
"stylesheet"
href=
"[[.AppSubUrl]]/css/grafana.light.min.css"
>
<link
rel=
"stylesheet"
href=
"[[.AppSubUrl]]/css/grafana.light.min.css"
>
[[ range $css := .PluginCss ]]
<link
rel=
"stylesheet"
href=
"[[$.AppSubUrl]]/[[ $css.Light ]]"
>
[[ end ]]
[[else]]
[[else]]
<link
rel=
"stylesheet"
href=
"[[.AppSubUrl]]/css/grafana.dark.min.css"
>
<link
rel=
"stylesheet"
href=
"[[.AppSubUrl]]/css/grafana.dark.min.css"
>
[[ range $css := .PluginCss ]]
<link
rel=
"stylesheet"
href=
"[[$.AppSubUrl]]/[[ $css.Dark ]]"
>
[[ end ]]
[[end]]
[[end]]
[[ range $css := .PluginCss ]]
<link
rel=
"stylesheet"
href=
"[[$.AppSubUrl]]/[[ $css ]]"
>
[[ end ]]
<link
rel=
"icon"
type=
"image/png"
href=
"[[.AppSubUrl]]/img/fav32.png"
>
<link
rel=
"icon"
type=
"image/png"
href=
"[[.AppSubUrl]]/img/fav32.png"
>
<base
href=
"[[.AppSubUrl]]/"
/>
<base
href=
"[[.AppSubUrl]]/"
/>
...
...
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