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
3bb20dbf
Commit
3bb20dbf
authored
Jan 08, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(plugins): changed plugin schema, pluginType -> type, type -> id
parent
7a8b3c41
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
79 additions
and
203 deletions
+79
-203
pkg/api/app_plugin.go
+1
-1
pkg/api/frontendsettings.go
+1
-1
pkg/plugins/models.go
+12
-9
pkg/plugins/plugins.go
+18
-35
pkg/plugins/plugins_test.go
+1
-1
public/app/plugins/datasource/cloudwatch/plugin.json
+2
-2
public/app/plugins/datasource/elasticsearch/plugin.json
+2
-2
public/app/plugins/datasource/grafana/plugin.json
+3
-2
public/app/plugins/datasource/graphite/plugin.json
+2
-2
public/app/plugins/datasource/influxdb/plugin.json
+2
-2
public/app/plugins/datasource/mixed/plugin.json
+3
-2
public/app/plugins/datasource/opentsdb/plugin.json
+2
-3
public/app/plugins/datasource/prometheus/plugin.json
+2
-2
public/app/plugins/datasource/sql/datasource.js
+0
-18
public/app/plugins/datasource/sql/partials/config.html
+0
-53
public/app/plugins/datasource/sql/partials/query.editor.html
+0
-17
public/app/plugins/datasource/sql/plugin.json_
+0
-16
public/app/plugins/panels/dashlist/plugin.json
+2
-3
public/app/plugins/panels/graph/plugin.json
+2
-3
public/app/plugins/panels/singlestat/plugin.json
+2
-3
public/app/plugins/panels/table/plugin.json
+2
-3
public/app/plugins/panels/text/plugin.json
+2
-3
tests/app-plugin-json/plugin.json
+18
-20
No files found.
pkg/api/app_plugin.go
View file @
3bb20dbf
...
...
@@ -22,7 +22,7 @@ func GetAppPlugins(c *middleware.Context) Response {
Enabled
:
app
.
Enabled
,
Pinned
:
app
.
Pinned
,
Module
:
app
.
Module
,
Info
:
app
.
Info
,
Info
:
&
app
.
Info
,
}
}
...
...
pkg/api/frontendsettings.go
View file @
3bb20dbf
...
...
@@ -119,7 +119,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
panels
:=
map
[
string
]
interface
{}{}
for
_
,
panel
:=
range
enabledPlugins
.
Panels
{
panels
[
panel
.
Type
]
=
map
[
string
]
interface
{}{
panels
[
panel
.
Id
]
=
map
[
string
]
interface
{}{
"module"
:
panel
.
Module
,
"name"
:
panel
.
Name
,
}
...
...
pkg/plugins/models.go
View file @
3bb20dbf
...
...
@@ -4,6 +4,13 @@ import (
"github.com/grafana/grafana/pkg/models"
)
type
PluginCommon
struct
{
Type
string
`json:"type"`
Name
string
`json:"name"`
Id
string
`json:"id"`
Info
PluginInfo
`json:"info"`
}
type
PluginInfo
struct
{
Author
PluginInfoLink
`json:"author"`
Description
string
`json:"description"`
...
...
@@ -22,10 +29,9 @@ type PluginLogos struct {
}
type
DataSourcePlugin
struct
{
Type
string
`json:"type"`
Name
string
`json:"name"`
ServiceName
string
`json:"serviceName"`
PluginCommon
Module
string
`json:"module"`
ServiceName
string
`json:"serviceName"`
Partials
map
[
string
]
interface
{}
`json:"partials"`
DefaultMatchFormat
string
`json:"defaultMatchFormat"`
Annotations
bool
`json:"annotations"`
...
...
@@ -36,8 +42,7 @@ type DataSourcePlugin struct {
}
type
PanelPlugin
struct
{
Type
string
`json:"type"`
Name
string
`json:"name"`
PluginCommon
Module
string
`json:"module"`
PublicContent
*
PublicContent
`json:"public"`
App
string
`json:"app"`
...
...
@@ -71,21 +76,19 @@ type AppPluginCss struct {
}
type
ApiPlugin
struct
{
Type
string
`json:"type"`
PluginCommon
Routes
[]
*
ApiPluginRoute
`json:"routes"`
App
string
`json:"app"`
}
type
AppPlugin
struct
{
Type
string
`json:"type"`
Name
string
`json:"name"`
PluginCommon
Enabled
bool
`json:"enabled"`
Pinned
bool
`json:"pinned"`
Module
string
`json:"module"`
Css
*
AppPluginCss
`json:"css"`
Page
*
AppPluginPage
`json:"page"`
PublicContent
*
PublicContent
`json:"public"`
Info
*
PluginInfo
`json:"info"`
}
type
EnabledPlugins
struct
{
...
...
pkg/plugins/plugins.go
View file @
3bb20dbf
...
...
@@ -121,7 +121,7 @@ func addPublicContent(public *PublicContent, currentDir string) {
}
}
func
interpolatePluginJson
(
reader
io
.
Reader
)
(
io
.
Reader
,
error
)
{
func
interpolatePluginJson
(
reader
io
.
Reader
,
pluginCommon
*
PluginCommon
)
(
io
.
Reader
,
error
)
{
buf
:=
new
(
bytes
.
Buffer
)
buf
.
ReadFrom
(
reader
)
jsonStr
:=
buf
.
String
()
//
...
...
@@ -132,7 +132,7 @@ func interpolatePluginJson(reader io.Reader) (io.Reader, error) {
}
data
:=
map
[
string
]
interface
{}{
"PluginPublicRoot"
:
"
HAHAHA"
,
"PluginPublicRoot"
:
"
public/plugins/"
+
pluginCommon
.
Id
,
}
var
resultBuffer
bytes
.
Buffer
...
...
@@ -153,76 +153,59 @@ func (scanner *PluginScanner) loadPluginJson(pluginJsonFilePath string) error {
defer
reader
.
Close
()
jsonParser
:=
json
.
NewDecoder
(
reader
)
plugin
Json
:=
make
(
map
[
string
]
interface
{})
if
err
:=
jsonParser
.
Decode
(
&
plugin
Js
on
);
err
!=
nil
{
plugin
Common
:=
PluginCommon
{}
if
err
:=
jsonParser
.
Decode
(
&
plugin
Comm
on
);
err
!=
nil
{
return
err
}
pluginType
,
exists
:=
pluginJson
[
"pluginType"
]
if
!
exists
{
return
errors
.
New
(
"Did not find pluginType property in plugin.json"
)
if
pluginCommon
.
Id
==
""
||
pluginCommon
.
Type
==
""
{
return
errors
.
New
(
"Did not find type and id property in plugin.json"
)
}
reader
.
Seek
(
0
,
0
)
if
newReader
,
err
:=
interpolatePluginJson
(
reader
);
err
!=
nil
{
if
newReader
,
err
:=
interpolatePluginJson
(
reader
,
&
pluginCommon
);
err
!=
nil
{
return
err
}
else
{
jsonParser
=
json
.
NewDecoder
(
newReader
)
}
if
pluginType
==
"datasource"
{
switch
pluginCommon
.
Type
{
case
"datasource"
:
p
:=
DataSourcePlugin
{}
if
err
:=
jsonParser
.
Decode
(
&
p
);
err
!=
nil
{
return
err
}
if
p
.
Type
==
""
{
return
errors
.
New
(
"Did not find type property in plugin.json"
)
}
DataSources
[
p
.
Type
]
=
&
p
DataSources
[
p
.
Id
]
=
&
p
addPublicContent
(
p
.
PublicContent
,
currentDir
)
}
if
pluginType
==
"panel"
{
case
"panel"
:
p
:=
PanelPlugin
{}
reader
.
Seek
(
0
,
0
)
if
err
:=
jsonParser
.
Decode
(
&
p
);
err
!=
nil
{
return
err
}
if
p
.
Type
==
""
{
return
errors
.
New
(
"Did not find type property in plugin.json"
)
}
Panels
[
p
.
Type
]
=
&
p
Panels
[
p
.
Id
]
=
&
p
addPublicContent
(
p
.
PublicContent
,
currentDir
)
}
if
pluginType
==
"api"
{
case
"api"
:
p
:=
ApiPlugin
{}
reader
.
Seek
(
0
,
0
)
if
err
:=
jsonParser
.
Decode
(
&
p
);
err
!=
nil
{
return
err
}
if
p
.
Type
==
""
{
return
errors
.
New
(
"Did not find type property in plugin.json"
)
}
ApiPlugins
[
p
.
Type
]
=
&
p
}
if
pluginType
==
"app"
{
ApiPlugins
[
p
.
Id
]
=
&
p
case
"app"
:
p
:=
AppPlugin
{}
reader
.
Seek
(
0
,
0
)
if
err
:=
jsonParser
.
Decode
(
&
p
);
err
!=
nil
{
return
err
}
if
p
.
Type
==
""
{
return
errors
.
New
(
"Did not find type property in plugin.json"
)
}
Apps
[
p
.
Type
]
=
&
p
Apps
[
p
.
Id
]
=
&
p
addPublicContent
(
p
.
PublicContent
,
currentDir
)
default
:
return
errors
.
New
(
"Unkown plugin type "
+
pluginCommon
.
Type
)
}
return
nil
...
...
pkg/plugins/plugins_test.go
View file @
3bb20dbf
...
...
@@ -29,7 +29,7 @@ func TestPluginScans(t *testing.T) {
So
(
err
,
ShouldBeNil
)
So
(
len
(
Apps
),
ShouldBeGreaterThan
,
0
)
So
(
Apps
[
"app-test"
]
.
Info
.
Logos
.
Large
,
ShouldEqual
,
"p
lugins/app-exampl/img
/logo_large.png"
)
So
(
Apps
[
"app-test"
]
.
Info
.
Logos
.
Large
,
ShouldEqual
,
"p
ublic/plugins/app-test
/logo_large.png"
)
})
}
public/app/plugins/datasource/cloudwatch/plugin.json
View file @
3bb20dbf
{
"
pluginT
ype"
:
"datasource"
,
"
t
ype"
:
"datasource"
,
"name"
:
"CloudWatch"
,
"id"
:
"cloudwatch"
,
"type"
:
"cloudwatch"
,
"serviceName"
:
"CloudWatchDatasource"
,
"module"
:
"app/plugins/datasource/cloudwatch/datasource"
,
...
...
public/app/plugins/datasource/elasticsearch/plugin.json
View file @
3bb20dbf
{
"
pluginT
ype"
:
"datasource"
,
"
t
ype"
:
"datasource"
,
"name"
:
"Elasticsearch"
,
"id"
:
"elasticsearch"
,
"type"
:
"elasticsearch"
,
"serviceName"
:
"ElasticDatasource"
,
"module"
:
"app/plugins/datasource/elasticsearch/datasource"
,
...
...
public/app/plugins/datasource/grafana/plugin.json
View file @
3bb20dbf
{
"
pluginT
ype"
:
"datasource"
,
"
t
ype"
:
"datasource"
,
"name"
:
"Grafana"
,
"id"
:
"grafana"
,
"builtIn"
:
true
,
"type"
:
"grafana"
,
"serviceName"
:
"GrafanaDatasource"
,
"module"
:
"app/plugins/datasource/grafana/datasource"
,
...
...
public/app/plugins/datasource/graphite/plugin.json
View file @
3bb20dbf
{
"pluginType"
:
"datasource"
,
"name"
:
"Graphite"
,
"type"
:
"graphite"
,
"type"
:
"datasource"
,
"id"
:
"graphite"
,
"serviceName"
:
"GraphiteDatasource"
,
"module"
:
"app/plugins/datasource/graphite/datasource"
,
...
...
public/app/plugins/datasource/influxdb/plugin.json
View file @
3bb20dbf
{
"
pluginT
ype"
:
"datasource"
,
"
t
ype"
:
"datasource"
,
"name"
:
"InfluxDB 0.9.x"
,
"id"
:
"influxdb"
,
"type"
:
"influxdb"
,
"serviceName"
:
"InfluxDatasource"
,
"module"
:
"app/plugins/datasource/influxdb/datasource"
,
...
...
public/app/plugins/datasource/mixed/plugin.json
View file @
3bb20dbf
{
"
pluginT
ype"
:
"datasource"
,
"
t
ype"
:
"datasource"
,
"name"
:
"Mixed datasource"
,
"id"
:
"mixed"
,
"builtIn"
:
true
,
"mixed"
:
true
,
"type"
:
"mixed"
,
"serviceName"
:
"MixedDatasource"
,
"module"
:
"app/plugins/datasource/mixed/datasource"
,
...
...
public/app/plugins/datasource/opentsdb/plugin.json
View file @
3bb20dbf
{
"
pluginT
ype"
:
"datasource"
,
"
t
ype"
:
"datasource"
,
"name"
:
"OpenTSDB"
,
"id"
:
"opentsdb"
,
"type"
:
"opentsdb"
,
"serviceName"
:
"OpenTSDBDatasource"
,
"module"
:
"app/plugins/datasource/opentsdb/datasource"
,
"partials"
:
{
...
...
public/app/plugins/datasource/prometheus/plugin.json
View file @
3bb20dbf
{
"
pluginT
ype"
:
"datasource"
,
"
t
ype"
:
"datasource"
,
"name"
:
"Prometheus"
,
"id"
:
"prometheus"
,
"type"
:
"prometheus"
,
"serviceName"
:
"PrometheusDatasource"
,
"module"
:
"app/plugins/datasource/prometheus/datasource"
,
...
...
public/app/plugins/datasource/sql/datasource.js
deleted
100644 → 0
View file @
7a8b3c41
define
([
'angular'
,
],
function
(
angular
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.services'
);
module
.
factory
(
'SqlDatasource'
,
function
()
{
function
SqlDatasource
()
{
}
return
SqlDatasource
;
});
});
public/app/plugins/datasource/sql/partials/config.html
deleted
100644 → 0
View file @
7a8b3c41
<h2>
SQL Options
</h2>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 80px"
>
DB Type
</li>
<li>
<select
class=
"input-medium tight-form-input"
ng-model=
"current.jsonData.dbType"
ng-options=
"f for f in ['sqlite3','mysql','postgres']"
></select>
</li>
<li
class=
"tight-form-item"
style=
"width: 80px"
>
Host
</li>
<li>
<input
type=
"text"
class=
"tight-form-input input-medium"
ng-model=
'current.jsonData.host'
placeholder=
"localhost:3306"
>
</li>
<li
class=
"tight-form-item"
ng-if=
"current.jsonData.dbType === 'postgres'"
>
SSL
<input
class=
"cr1"
id=
"jsonData.ssl"
type=
"checkbox"
ng-model=
"current.jsonData.ssl"
ng-checked=
"current.jsonData.ssl"
>
<label
for=
"jsonData.ssl"
class=
"cr1"
></label>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 80px"
>
Database
</li>
<li>
<input
type=
"text"
class=
"tight-form-input input-medium"
ng-model=
'current.database'
placeholder=
""
>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 80px"
>
User
</li>
<li>
<input
type=
"text"
class=
"tight-form-input input-medium"
ng-model=
'current.user'
placeholder=
""
>
</li>
<li
class=
"tight-form-item"
style=
"width: 80px"
>
Password
</li>
<li>
<input
type=
"password"
class=
"tight-form-input input-medium"
ng-model=
'current.password'
placeholder=
""
>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
public/app/plugins/datasource/sql/partials/query.editor.html
deleted
100644 → 0
View file @
7a8b3c41
<div
class=
"fluid-row"
style=
"margin-top: 20px"
>
<div
class=
"span2"
></div>
<div
class=
"grafana-info-box span8"
>
<h5>
Test graph
</h5>
<p>
This is just a test data source that generates random walk series. If this is your only data source
open the left side menu and navigate to the data sources admin screen and add your data sources. You can change
data source using the button to the left of the
<strong>
Add query
</strong>
button.
</p>
</div>
<div
class=
"span2"
></div>
<div
class=
"clearfix"
></div>
</div>
public/app/plugins/datasource/sql/plugin.json_
deleted
100644 → 0
View file @
7a8b3c41
{
"pluginType": "datasource",
"name": "Generic SQL (prototype)",
"type": "generic_sql",
"serviceName": "SqlDatasource",
"module": "app/plugins/datasource/sql/datasource",
"partials": {
"config": "app/plugins/datasource/sql/partials/config.html",
"query": "app/plugins/datasource/sql/partials/query.editor.html"
},
"metrics": true
}
public/app/plugins/panels/dashlist/plugin.json
View file @
3bb20dbf
{
"pluginType"
:
"panel"
,
"type"
:
"panel"
,
"name"
:
"Dashboard list"
,
"
type
"
:
"dashlist"
,
"
id
"
:
"dashlist"
,
"module"
:
"app/plugins/panels/dashlist/module"
}
public/app/plugins/panels/graph/plugin.json
View file @
3bb20dbf
{
"pluginType"
:
"panel"
,
"type"
:
"panel"
,
"name"
:
"Graph"
,
"
type
"
:
"graph"
,
"
id
"
:
"graph"
,
"module"
:
"app/plugins/panels/graph/module"
}
public/app/plugins/panels/singlestat/plugin.json
View file @
3bb20dbf
{
"pluginType"
:
"panel"
,
"type"
:
"panel"
,
"name"
:
"Singlestat"
,
"
type
"
:
"singlestat"
,
"
id
"
:
"singlestat"
,
"module"
:
"app/plugins/panels/singlestat/module"
}
public/app/plugins/panels/table/plugin.json
View file @
3bb20dbf
{
"pluginType"
:
"panel"
,
"type"
:
"panel"
,
"name"
:
"Table"
,
"
type
"
:
"table"
,
"
id
"
:
"table"
,
"module"
:
"app/plugins/panels/table/module"
}
public/app/plugins/panels/text/plugin.json
View file @
3bb20dbf
{
"pluginType"
:
"panel"
,
"type"
:
"panel"
,
"name"
:
"Text"
,
"
type
"
:
"text"
,
"
id
"
:
"text"
,
"module"
:
"app/plugins/panels/text/module"
}
tests/app-plugin-json/plugin.json
View file @
3bb20dbf
{
"pluginType"
:
"app"
,
"name"
:
"App Example"
,
"type"
:
"app-test"
,
"plugins"
:
[],
"css"
:
{
"light"
:
"plugin.dark.css"
,
"dark"
:
"plugin.light.css"
},
"module"
:
"app"
,
"pages"
:
[
{
"name"
:
"Example1"
,
"url"
:
"/app-example"
,
"reqRole"
:
"Editor"
}
],
"public"
:
{
"urlFragment"
:
"app-example"
,
"path"
:
"./public"
},
"id"
:
"app-test"
,
"type"
:
"app"
,
"info"
:
{
"description"
:
"Example Grafana App"
,
...
...
@@ -40,6 +22,22 @@
"updated"
:
"2015-02-10"
},
"css"
:
{
"light"
:
"plugin.dark.css"
,
"dark"
:
"plugin.light.css"
},
"module"
:
"app"
,
"pages"
:
[
{
"name"
:
"Example1"
,
"url"
:
"/app-example"
,
"reqRole"
:
"Editor"
}
],
"public"
:
{
"urlFragment"
:
"app-example"
,
"path"
:
"./public"
},
"dependencies"
:
{
"grafanaVersion"
:
"2.6.x"
,
"plugins"
:
[
...
...
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