diff --git a/pkg/api/app_plugin.go b/pkg/api/app_plugin.go
index c39acb4dba4..6bc0e5a4933 100644
--- a/pkg/api/app_plugin.go
+++ b/pkg/api/app_plugin.go
@@ -18,11 +18,11 @@ func GetAppPlugins(c *middleware.Context) Response {
installedAppsMap := make(map[string]*dtos.AppPlugin)
for t, a := range plugins.Apps {
installedAppsMap[t] = &dtos.AppPlugin{
- Type: a.Type,
- Enabled: a.Enabled,
- PinNavLinks: a.PinNavLinks,
- Module: a.Module,
- JsonData: make(map[string]interface{}),
+ Type: a.Type,
+ Enabled: a.Enabled,
+ Pinned: a.Pinned,
+ Module: a.Module,
+ JsonData: make(map[string]interface{}),
}
}
@@ -32,11 +32,11 @@ func GetAppPlugins(c *middleware.Context) Response {
for _, b := range query.Result {
if def, ok := installedAppsMap[b.Type]; ok {
result = append(result, &dtos.AppPlugin{
- Type: b.Type,
- Enabled: b.Enabled,
- PinNavLinks: b.PinNavLinks,
- Module: def.Module,
- JsonData: b.JsonData,
+ Type: b.Type,
+ Enabled: b.Enabled,
+ Pinned: b.Pinned,
+ Module: def.Module,
+ JsonData: b.JsonData,
})
seenApps[b.Type] = true
}
diff --git a/pkg/api/datasources.go b/pkg/api/datasources.go
index 8451a3e8c14..04fdca8242a 100644
--- a/pkg/api/datasources.go
+++ b/pkg/api/datasources.go
@@ -125,7 +125,7 @@ func GetDataSourcePlugins(c *middleware.Context) {
}
enabledPlugins := plugins.GetEnabledPlugins(orgApps.Result)
- for key, value := range enabledPlugins.DataSourcePlugins {
+ for key, value := range enabledPlugins.DataSources {
if !value.BuiltIn {
dsList[key] = value
}
diff --git a/pkg/api/dtos/app_plugin.go b/pkg/api/dtos/app_plugin.go
index d7eaf8f4140..741b17ab383 100644
--- a/pkg/api/dtos/app_plugin.go
+++ b/pkg/api/dtos/app_plugin.go
@@ -1,9 +1,9 @@
package dtos
type AppPlugin struct {
- Type string `json:"type"`
- Enabled bool `json:"enabled"`
- PinNavLinks bool `json:"pin_nav_links"`
- Module string `json:"module"`
- JsonData map[string]interface{} `json:"jsonData"`
+ Type string `json:"type"`
+ Enabled bool `json:"enabled"`
+ Pinned bool `json:"pinned"`
+ Module string `json:"module"`
+ JsonData map[string]interface{} `json:"jsonData"`
}
diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go
index 9d00576be06..9334b030201 100644
--- a/pkg/api/frontendsettings.go
+++ b/pkg/api/frontendsettings.go
@@ -34,6 +34,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
if err != nil {
return nil, err
}
+
enabledPlugins := plugins.GetEnabledPlugins(orgApps.Result)
for _, ds := range orgDataSources {
@@ -49,7 +50,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
"url": url,
}
- meta, exists := enabledPlugins.DataSourcePlugins[ds.Type]
+ meta, exists := enabledPlugins.DataSources[ds.Type]
if !exists {
log.Error(3, "Could not find plugin definition for data source: %v", ds.Type)
continue
@@ -117,7 +118,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
}
panels := map[string]interface{}{}
- for _, panel := range enabledPlugins.PanelPlugins {
+ for _, panel := range enabledPlugins.Panels {
panels[panel.Type] = map[string]interface{}{
"module": panel.Module,
"name": panel.Name,
diff --git a/pkg/api/index.go b/pkg/api/index.go
index 4874a24a6f6..af8dfcb99f1 100644
--- a/pkg/api/index.go
+++ b/pkg/api/index.go
@@ -52,7 +52,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{
Text: "Dashboards",
Icon: "fa fa-fw fa-th-large",
- Href: "/",
+ Url: "/",
})
orgApps := m.GetAppPluginsQuery{OrgId: c.OrgId}
@@ -73,7 +73,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
}
if plugin.Pinned && plugin.Page != nil {
- if c.userHasRole(plugin.Page.reqRole) {
+ if c.HasUserRole(plugin.Page.ReqRole) {
data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{
Text: plugin.Page.Text,
Url: plugin.Page.Url,
diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go
index 1debde98a0e..3c433728ba6 100644
--- a/pkg/cmd/web.go
+++ b/pkg/cmd/web.go
@@ -30,9 +30,9 @@ func newMacaron() *macaron.Macaron {
}
for _, route := range plugins.StaticRoutes {
- pluginRoute := path.Join("/public/plugins/", route.Url)
- log.Info("Plugin: Adding static route %s -> %s", pluginRoute, route.Path)
- mapStatic(m, route.Path, "", pluginRoute)
+ pluginRoute := path.Join("/public/plugins/", route.UrlFragment)
+ log.Info("Plugin: Adding static route %s -> %s", pluginRoute, route.Dir)
+ mapStatic(m, route.Dir, "", pluginRoute)
}
mapStatic(m, setting.StaticRootPath, "", "public")
diff --git a/pkg/middleware/middleware.go b/pkg/middleware/middleware.go
index d2da32b8ed7..9ad417606f5 100644
--- a/pkg/middleware/middleware.go
+++ b/pkg/middleware/middleware.go
@@ -254,6 +254,6 @@ func (ctx *Context) JsonApiErr(status int, message string, err error) {
ctx.JSON(status, resp)
}
-func (ctx *Context) hasUserRole(role m.RoleType) bool {
+func (ctx *Context) HasUserRole(role m.RoleType) bool {
return ctx.OrgRole.Includes(role)
}
diff --git a/pkg/plugins/models.go b/pkg/plugins/models.go
index 67172d952d7..15e48409144 100644
--- a/pkg/plugins/models.go
+++ b/pkg/plugins/models.go
@@ -44,7 +44,7 @@ type ApiPluginRoute struct {
type AppPluginPage struct {
Text string `json:"text"`
Icon string `json:"icon"`
- Href string `json:"url"`
+ Url string `json:"url"`
ReqRole models.RoleType `json:"reqRole"`
}
diff --git a/pkg/services/sqlstore/migrations/app_plugin.go b/pkg/services/sqlstore/migrations/app_plugin.go
index 8cd16ed22e1..7a1e67cf191 100644
--- a/pkg/services/sqlstore/migrations/app_plugin.go
+++ b/pkg/services/sqlstore/migrations/app_plugin.go
@@ -4,7 +4,7 @@ import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
func addAppPluginMigration(mg *Migrator) {
- var appPluginV1 = Table{
+ var appPluginV2 = Table{
Name: "app_plugin",
Columns: []*Column{
{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
@@ -20,8 +20,9 @@ func addAppPluginMigration(mg *Migrator) {
{Cols: []string{"org_id", "type"}, Type: UniqueIndex},
},
}
- mg.AddMigration("create app_plugin table v1", NewAddTableMigration(appPluginV1))
+
+ mg.AddMigration("create app_plugin table v2", NewAddTableMigration(appPluginV2))
//------- indexes ------------------
- addTableIndicesMigrations(mg, "v1", appPluginV1)
+ addTableIndicesMigrations(mg, "v2", appPluginV2)
}
diff --git a/public/app/features/org/appEditCtrl.js b/public/app/features/org/app_edit_ctrl.ts
similarity index 59%
rename from public/app/features/org/appEditCtrl.js
rename to public/app/features/org/app_edit_ctrl.ts
index 63f638a72fd..e04be09fc35 100644
--- a/public/app/features/org/appEditCtrl.js
+++ b/public/app/features/org/app_edit_ctrl.ts
@@ -1,14 +1,13 @@
-define([
- 'angular',
- 'lodash',
- 'app/core/config',
-],
-function (angular, _, config) {
- 'use strict';
+///