diff --git a/pkg/api/dtos/plugins.go b/pkg/api/dtos/plugins.go
index 3692b4b2667..6286832e352 100644
--- a/pkg/api/dtos/plugins.go
+++ b/pkg/api/dtos/plugins.go
@@ -1,13 +1,10 @@
package dtos
-import (
- "github.com/grafana/grafana/pkg/models"
- "github.com/grafana/grafana/pkg/plugins"
-)
+import "github.com/grafana/grafana/pkg/plugins"
type PluginSetting struct {
Name string `json:"name"`
- AppId string `json:"appId"`
+ PluginId string `json:"pluginId"`
Enabled bool `json:"enabled"`
Pinned bool `json:"pinned"`
Module string `json:"module"`
@@ -26,24 +23,3 @@ type PluginListItem struct {
Pinned bool `json:"pinned"`
Info *plugins.PluginInfo `json:"info"`
}
-
-func NewPluginSettingDto(def *plugins.AppPlugin, data *models.PluginSetting) *PluginSetting {
- dto := &PluginSetting{
- AppId: def.Id,
- Name: def.Name,
- Info: &def.Info,
- Module: def.Module,
- BaseUrl: def.BaseUrl,
- Pages: def.Pages,
- Includes: def.Includes,
- }
-
- if data != nil {
- dto.Enabled = data.Enabled
- dto.Pinned = data.Pinned
- dto.Info = &def.Info
- dto.JsonData = data.JsonData
- }
-
- return dto
-}
diff --git a/pkg/api/index.go b/pkg/api/index.go
index 9edbdda7c96..df752109530 100644
--- a/pkg/api/index.go
+++ b/pkg/api/index.go
@@ -72,7 +72,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{
Text: "Plugins",
Icon: "icon-gf icon-gf-apps",
- Url: setting.AppSubUrl + "/apps",
+ Url: setting.AppSubUrl + "/plugins",
})
}
diff --git a/pkg/api/plugin_setting.go b/pkg/api/plugin_setting.go
index 2a2e6ba3f55..dde75c95729 100644
--- a/pkg/api/plugin_setting.go
+++ b/pkg/api/plugin_setting.go
@@ -38,15 +38,34 @@ func GetPluginList(c *middleware.Context) Response {
func GetPluginSettingById(c *middleware.Context) Response {
pluginId := c.Params(":pluginId")
- if pluginDef, exists := plugins.Apps[pluginId]; !exists {
- return ApiError(404, "PluginId not found, no installed plugin with that id", nil)
+ if def, exists := plugins.Plugins[pluginId]; !exists {
+ return ApiError(404, "Plugin not found, no installed plugin with that id", nil)
} else {
- query := m.GetPluginSettingByIdQuery{PluginId: pluginId, OrgId: c.OrgId}
- if err := bus.Dispatch(&query); err != nil {
- return ApiError(500, "Failed to get login settings", nil)
+ dto := &dtos.PluginSetting{
+ PluginId: def.Id,
+ Name: def.Name,
+ Info: &def.Info,
}
- return Json(200, dtos.NewPluginSettingDto(pluginDef, query.Result))
+ if app, exists := plugins.Apps[pluginId]; exists {
+ dto.Pages = app.Pages
+ dto.Includes = app.Includes
+ dto.BaseUrl = app.BaseUrl
+ dto.Module = app.Module
+ }
+
+ query := m.GetPluginSettingByIdQuery{PluginId: pluginId, OrgId: c.OrgId}
+ if err := bus.Dispatch(&query); err != nil {
+ if err != m.ErrPluginSettingNotFound {
+ return ApiError(500, "Failed to get login settings", nil)
+ }
+ } else {
+ dto.Enabled = query.Result.Enabled
+ dto.Pinned = query.Result.Pinned
+ dto.JsonData = query.Result.JsonData
+ }
+
+ return Json(200, dto)
}
}
diff --git a/public/app/features/admin/partials/edit_org.html b/public/app/features/admin/partials/edit_org.html
index de92cd3adf5..b08d0c49a45 100644
--- a/public/app/features/admin/partials/edit_org.html
+++ b/public/app/features/admin/partials/edit_org.html
@@ -1,5 +1,8 @@
| Name | -Url | +name | +url | diff --git a/public/app/features/plugins/partials/edit.html b/public/app/features/plugins/partials/edit.html index 7def9a3c96e..d93d76b1fc9 100644 --- a/public/app/features/plugins/partials/edit.html +++ b/public/app/features/plugins/partials/edit.html @@ -1,108 +1,112 @@ - |
|---|