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
e081a5c5
Commit
e081a5c5
authored
Jan 11, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(apps): worked on pinning apps
parent
4da31291
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
39 deletions
+29
-39
pkg/api/dtos/index.go
+1
-0
pkg/api/index.go
+6
-8
pkg/plugins/app_plugin.go
+2
-3
pkg/plugins/queries.go
+5
-26
public/app/core/controllers/sidemenu_ctrl.js
+1
-0
public/app/features/apps/partials/list.html
+6
-1
public/app/partials/sidemenu.html
+4
-1
public/less/sidemenu.less
+4
-0
No files found.
pkg/api/dtos/index.go
View file @
e081a5c5
...
...
@@ -21,5 +21,6 @@ type PluginCss struct {
type
NavLink
struct
{
Text
string
`json:"text"`
Icon
string
`json:"icon"`
Img
string
`json:"img"`
Url
string
`json:"url"`
}
pkg/api/index.go
View file @
e081a5c5
...
...
@@ -82,14 +82,12 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
data
.
PluginCss
=
append
(
data
.
PluginCss
,
&
dtos
.
PluginCss
{
Light
:
plugin
.
Css
.
Light
,
Dark
:
plugin
.
Css
.
Dark
})
}
if
plugin
.
Pinned
&&
plugin
.
Page
!=
nil
{
if
c
.
HasUserRole
(
plugin
.
Page
.
ReqRole
)
{
data
.
MainNavLinks
=
append
(
data
.
MainNavLinks
,
&
dtos
.
NavLink
{
Text
:
plugin
.
Page
.
Text
,
Url
:
plugin
.
Page
.
Url
,
Icon
:
plugin
.
Page
.
Icon
,
})
}
if
plugin
.
Pinned
{
data
.
MainNavLinks
=
append
(
data
.
MainNavLinks
,
&
dtos
.
NavLink
{
Text
:
plugin
.
Name
,
Url
:
setting
.
AppSubUrl
+
"/apps/edit/"
+
plugin
.
Id
,
Img
:
plugin
.
Info
.
Logos
.
Small
,
})
}
}
...
...
pkg/plugins/app_plugin.go
View file @
e081a5c5
...
...
@@ -8,7 +8,6 @@ import (
type
AppPluginPage
struct
{
Text
string
`json:"text"`
Icon
string
`json:"icon"`
Url
string
`json:"url"`
ReqRole
models
.
RoleType
`json:"reqRole"`
}
...
...
@@ -20,8 +19,8 @@ type AppPluginCss struct {
type
AppPlugin
struct
{
FrontendPluginBase
Css
*
AppPluginCss
`json:"css"`
Page
*
AppPluginPage
`json:"page"`
Css
*
AppPluginCss
`json:"css"`
Page
[]
*
AppPluginPage
`json:"page"`
Pinned
bool
`json:"-"`
Enabled
bool
`json:"-"`
...
...
pkg/plugins/queries.go
View file @
e081a5c5
...
...
@@ -30,41 +30,20 @@ func GetEnabledPlugins(orgId int64) (*EnabledPlugins, error) {
seenPanels
:=
make
(
map
[
string
]
bool
)
seenApi
:=
make
(
map
[
string
]
bool
)
for
app
Type
,
installedApp
:=
range
Apps
{
for
app
Id
,
installedApp
:=
range
Apps
{
var
app
AppPlugin
app
=
*
installedApp
// check if the app is stored in the DB for this org and if so, use the
// state stored there.
if
b
,
ok
:=
orgApps
[
app
Type
];
ok
{
if
b
,
ok
:=
orgApps
[
app
Id
];
ok
{
app
.
Enabled
=
b
.
Enabled
app
.
Pinned
=
b
.
Pinned
}
// if app.Enabled {
// for _, d := range app.DatasourcePlugins {
// if ds, ok := DataSources[d]; ok {
// enabledPlugins.DataSourcePlugins[d] = ds
// }
// }
// for _, p := range app.PanelPlugins {
// if panel, ok := Panels[p]; ok {
// if _, ok := seenPanels[p]; !ok {
// seenPanels[p] = true
// enabledPlugins.PanelPlugins = append(enabledPlugins.PanelPlugins, panel)
// }
// }
// }
// for _, a := range app.ApiPlugins {
// if api, ok := ApiPlugins[a]; ok {
// if _, ok := seenApi[a]; !ok {
// seenApi[a] = true
// enabledPlugins.ApiPlugins = append(enabledPlugins.ApiPlugins, api)
// }
// }
// }
// enabledPlugins.AppPlugins = append(enabledPlugins.AppPlugins, &app)
// }
if
app
.
Enabled
{
enabledPlugins
.
Apps
=
append
(
enabledPlugins
.
Apps
,
&
app
)
}
}
// add all plugins that are not part of an App.
...
...
public/app/core/controllers/sidemenu_ctrl.js
View file @
e081a5c5
...
...
@@ -19,6 +19,7 @@ function (angular, _, $, coreModule, config) {
$scope
.
mainLinks
.
push
({
text
:
item
.
text
,
icon
:
item
.
icon
,
img
:
item
.
img
,
url
:
$scope
.
getUrl
(
item
.
url
)
});
});
...
...
public/app/features/apps/partials/list.html
View file @
e081a5c5
...
...
@@ -32,8 +32,13 @@
</a>
<span
class=
"label label-info"
ng-if=
"app.enabled"
>
e
nabled
E
nabled
</span>
<span
class=
"label label-info"
ng-if=
"app.pinned"
>
Pinned
</span>
</span>
<span
class=
"filter-list-card-status"
>
<span
class=
"filter-list-card-state"
>
Dashboards: 1
</span>
...
...
public/app/partials/sidemenu.html
View file @
e081a5c5
...
...
@@ -46,7 +46,10 @@
<li
ng-repeat=
"item in mainLinks"
>
<a
href=
"{{item.url}}"
class=
"sidemenu-item sidemenu-main-link"
target=
"{{item.target}}"
>
<span
class=
"icon-circle sidemenu-icon"
><i
class=
"{{item.icon}}"
></i></span>
<span
class=
"icon-circle sidemenu-icon"
>
<i
class=
"{{item.icon}}"
ng-show=
"item.icon"
></i>
<img
src=
"{{item.img}}"
ng-show=
"item.img"
>
</span>
<span
class=
"sidemenu-item-text"
>
{{item.text}}
</span>
</a>
</li>
...
...
public/less/sidemenu.less
View file @
e081a5c5
...
...
@@ -92,6 +92,10 @@
top: 5px;
font-size: 150%;
}
img {
left: 7px;
position: relative;
}
}
.sidemenu-item {
...
...
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