mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
support separate css files for light/dark themes.
This commit is contained in:
parent
79d29db18b
commit
13864853a8
@ -8,11 +8,16 @@ type IndexViewData struct {
|
||||
GoogleAnalyticsId string
|
||||
GoogleTagManagerId string
|
||||
|
||||
PluginCss []string
|
||||
PluginCss []*PluginCss
|
||||
PluginJs []string
|
||||
MainNavLinks []*NavLink
|
||||
}
|
||||
|
||||
type PluginCss struct {
|
||||
Light string `json:"light"`
|
||||
Dark string `json:"dark"`
|
||||
}
|
||||
|
||||
type NavLink struct {
|
||||
Text string `json:"text"`
|
||||
Icon string `json:"icon"`
|
||||
|
@ -67,7 +67,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
|
||||
data.PluginJs = append(data.PluginJs, js.Module)
|
||||
}
|
||||
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 {
|
||||
// only show menu items for the specified roles.
|
||||
|
@ -37,7 +37,8 @@ type ExternalPluginRoute struct {
|
||||
}
|
||||
|
||||
type ExternalPluginJs struct {
|
||||
Module string `json:"module"`
|
||||
Module string `json:"module"`
|
||||
Directive string `json:"Directive"`
|
||||
}
|
||||
|
||||
type ExternalPluginNavLink struct {
|
||||
@ -48,7 +49,8 @@ type ExternalPluginNavLink struct {
|
||||
}
|
||||
|
||||
type ExternalPluginCss struct {
|
||||
Href string `json:"href"`
|
||||
Light string `json:"light"`
|
||||
Dark string `json:"dark"`
|
||||
}
|
||||
|
||||
type ExternalPlugin struct {
|
||||
|
@ -10,13 +10,17 @@
|
||||
|
||||
[[if .User.LightTheme]]
|
||||
<link rel="stylesheet" href="[[.AppSubUrl]]/css/grafana.light.min.css">
|
||||
[[ range $css := .PluginCss ]]
|
||||
<link rel="stylesheet" href="[[$.AppSubUrl]]/[[ $css.Light ]]">
|
||||
[[ end ]]
|
||||
[[else]]
|
||||
<link rel="stylesheet" href="[[.AppSubUrl]]/css/grafana.dark.min.css">
|
||||
[[ range $css := .PluginCss ]]
|
||||
<link rel="stylesheet" href="[[$.AppSubUrl]]/[[ $css.Dark ]]">
|
||||
[[ end ]]
|
||||
[[end]]
|
||||
|
||||
[[ range $css := .PluginCss ]]
|
||||
<link rel="stylesheet" href="[[$.AppSubUrl]]/[[ $css ]]">
|
||||
[[ end ]]
|
||||
|
||||
|
||||
<link rel="icon" type="image/png" href="[[.AppSubUrl]]/img/fav32.png">
|
||||
<base href="[[.AppSubUrl]]/" />
|
||||
|
Loading…
Reference in New Issue
Block a user