feat(plugins): began refactoring AppSettings -> PluginSettings, and have the plugins list view and plugin edit view be common for all plugins

This commit is contained in:
Torkel Ödegaard
2016-02-25 14:55:31 +01:00
parent 30f3b55baf
commit 8db7cf49a6
21 changed files with 304 additions and 297 deletions
@@ -9,12 +9,12 @@ import (
)
var (
ErrAppSettingNotFound = errors.New("AppSetting not found")
ErrPluginSettingNotFound = errors.New("Plugin setting not found")
)
type AppSettings struct {
type PluginSetting struct {
Id int64
AppId string
PluginId string
OrgId int64
Enabled bool
Pinned bool
@@ -39,17 +39,17 @@ func (s SecureJsonData) Decrypt() map[string]string {
// COMMANDS
// Also acts as api DTO
type UpdateAppSettingsCmd struct {
type UpdatePluginSettingCmd struct {
Enabled bool `json:"enabled"`
Pinned bool `json:"pinned"`
JsonData map[string]interface{} `json:"jsonData"`
SecureJsonData map[string]string `json:"secureJsonData"`
AppId string `json:"-"`
OrgId int64 `json:"-"`
PluginId string `json:"-"`
OrgId int64 `json:"-"`
}
func (cmd *UpdateAppSettingsCmd) GetEncryptedJsonData() SecureJsonData {
func (cmd *UpdatePluginSettingCmd) GetEncryptedJsonData() SecureJsonData {
encrypted := make(SecureJsonData)
for key, data := range cmd.SecureJsonData {
encrypted[key] = util.Encrypt([]byte(data), setting.SecretKey)
@@ -59,13 +59,13 @@ func (cmd *UpdateAppSettingsCmd) GetEncryptedJsonData() SecureJsonData {
// ---------------------
// QUERIES
type GetAppSettingsQuery struct {
type GetPluginSettingsQuery struct {
OrgId int64
Result []*AppSettings
Result []*PluginSetting
}
type GetAppSettingByAppIdQuery struct {
AppId string
OrgId int64
Result *AppSettings
type GetPluginSettingByIdQuery struct {
PluginId string
OrgId int64
Result *PluginSetting
}