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
0b3ccaff
Commit
0b3ccaff
authored
Mar 15, 2016
by
Carl Bergquist
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4361 from bergquist/remove_staticRoot
plugin.json: remove staticRoot field
parents
82eb32a7
e905c2c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
pkg/plugins/frontend_plugin.go
+9
-6
pkg/plugins/models.go
+8
-10
No files found.
pkg/plugins/frontend_plugin.go
View file @
0b3ccaff
...
@@ -3,9 +3,9 @@ package plugins
...
@@ -3,9 +3,9 @@ package plugins
import
(
import
(
"net/url"
"net/url"
"path"
"path"
"path/filepath"
"strings"
"strings"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util"
)
)
...
@@ -14,10 +14,9 @@ type FrontendPluginBase struct {
...
@@ -14,10 +14,9 @@ type FrontendPluginBase struct {
}
}
func
(
fp
*
FrontendPluginBase
)
initFrontendPlugin
()
{
func
(
fp
*
FrontendPluginBase
)
initFrontendPlugin
()
{
if
fp
.
StaticRoot
!=
""
{
if
isInternalPlugin
(
fp
.
PluginDir
)
{
fp
.
StaticRootAbs
=
filepath
.
Join
(
fp
.
PluginDir
,
fp
.
StaticRoot
)
StaticRoutes
=
append
(
StaticRoutes
,
&
PluginStaticRoute
{
StaticRoutes
=
append
(
StaticRoutes
,
&
PluginStaticRoute
{
Directory
:
fp
.
StaticRootAbs
,
Directory
:
fp
.
PluginDir
,
PluginId
:
fp
.
Id
,
PluginId
:
fp
.
Id
,
})
})
}
}
...
@@ -41,7 +40,7 @@ func getPluginLogoUrl(path, baseUrl string) string {
...
@@ -41,7 +40,7 @@ func getPluginLogoUrl(path, baseUrl string) string {
}
}
func
(
fp
*
FrontendPluginBase
)
setPathsBasedOnApp
(
app
*
AppPlugin
)
{
func
(
fp
*
FrontendPluginBase
)
setPathsBasedOnApp
(
app
*
AppPlugin
)
{
appSubPath
:=
strings
.
Replace
(
fp
.
PluginDir
,
app
.
StaticRootAbs
,
""
,
1
)
appSubPath
:=
strings
.
Replace
(
fp
.
PluginDir
,
app
.
PluginDir
,
""
,
1
)
fp
.
IncludedInAppId
=
app
.
Id
fp
.
IncludedInAppId
=
app
.
Id
fp
.
BaseUrl
=
app
.
BaseUrl
fp
.
BaseUrl
=
app
.
BaseUrl
fp
.
Module
=
util
.
JoinUrlFragments
(
"plugins/"
+
app
.
Id
,
appSubPath
)
+
"/module"
fp
.
Module
=
util
.
JoinUrlFragments
(
"plugins/"
+
app
.
Id
,
appSubPath
)
+
"/module"
...
@@ -49,7 +48,7 @@ func (fp *FrontendPluginBase) setPathsBasedOnApp(app *AppPlugin) {
...
@@ -49,7 +48,7 @@ func (fp *FrontendPluginBase) setPathsBasedOnApp(app *AppPlugin) {
func
(
fp
*
FrontendPluginBase
)
handleModuleDefaults
()
{
func
(
fp
*
FrontendPluginBase
)
handleModuleDefaults
()
{
if
fp
.
StaticRoot
!=
""
{
if
isInternalPlugin
(
fp
.
PluginDir
)
{
fp
.
Module
=
path
.
Join
(
"plugins"
,
fp
.
Id
,
"module"
)
fp
.
Module
=
path
.
Join
(
"plugins"
,
fp
.
Id
,
"module"
)
fp
.
BaseUrl
=
path
.
Join
(
"public/plugins"
,
fp
.
Id
)
fp
.
BaseUrl
=
path
.
Join
(
"public/plugins"
,
fp
.
Id
)
return
return
...
@@ -59,6 +58,10 @@ func (fp *FrontendPluginBase) handleModuleDefaults() {
...
@@ -59,6 +58,10 @@ func (fp *FrontendPluginBase) handleModuleDefaults() {
fp
.
BaseUrl
=
path
.
Join
(
"public/app/plugins"
,
fp
.
Type
,
fp
.
Id
)
fp
.
BaseUrl
=
path
.
Join
(
"public/app/plugins"
,
fp
.
Type
,
fp
.
Id
)
}
}
func
isInternalPlugin
(
pluginDir
string
)
bool
{
return
!
strings
.
Contains
(
pluginDir
,
setting
.
StaticRootPath
)
}
func
evalRelativePluginUrlPath
(
pathStr
string
,
baseUrl
string
)
string
{
func
evalRelativePluginUrlPath
(
pathStr
string
,
baseUrl
string
)
string
{
if
pathStr
==
""
{
if
pathStr
==
""
{
return
""
return
""
...
...
pkg/plugins/models.go
View file @
0b3ccaff
...
@@ -30,16 +30,14 @@ type PluginLoader interface {
...
@@ -30,16 +30,14 @@ type PluginLoader interface {
}
}
type
PluginBase
struct
{
type
PluginBase
struct
{
Type
string
`json:"type"`
Type
string
`json:"type"`
Name
string
`json:"name"`
Name
string
`json:"name"`
Id
string
`json:"id"`
Id
string
`json:"id"`
Info
PluginInfo
`json:"info"`
Info
PluginInfo
`json:"info"`
Dependencies
PluginDependencies
`json:"dependencies"`
Dependencies
PluginDependencies
`json:"dependencies"`
Includes
[]
*
PluginInclude
`json:"includes"`
Includes
[]
*
PluginInclude
`json:"includes"`
Module
string
`json:"module"`
Module
string
`json:"module"`
BaseUrl
string
`json:"baseUrl"`
BaseUrl
string
`json:"baseUrl"`
StaticRoot
string
`json:"staticRoot"`
StaticRootAbs
string
`json:"-"`
IncludedInAppId
string
`json:"-"`
IncludedInAppId
string
`json:"-"`
PluginDir
string
`json:"-"`
PluginDir
string
`json:"-"`
...
...
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