summaryrefslogtreecommitdiffstats
path: root/model/manifest.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-11-08 11:39:30 -0500
committerGitHub <noreply@github.com>2017-11-08 11:39:30 -0500
commit5ef72775213884f427e170ab6cc960f9544ae6cc (patch)
tree3b60bb3dacd49672ddb1179373f0c6eaff39904a /model/manifest.go
parent1d1998c6686e969a6d3fdfcdfa0592ea5945bb9c (diff)
downloadchat-5ef72775213884f427e170ab6cc960f9544ae6cc.tar.gz
chat-5ef72775213884f427e170ab6cc960f9544ae6cc.tar.bz2
chat-5ef72775213884f427e170ab6cc960f9544ae6cc.zip
PLT-7709 Add UI settings to plugin manifest (#7794)
* Add UI settings to plugin manifest * Add another test case * Add options field to setting * Updates per feedback * Report diagnostics on if plugins have settings set * Add regenerate_help_text field
Diffstat (limited to 'model/manifest.go')
-rw-r--r--model/manifest.go43
1 files changed, 36 insertions, 7 deletions
diff --git a/model/manifest.go b/model/manifest.go
index 4352a2bd2..501153982 100644
--- a/model/manifest.go
+++ b/model/manifest.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
+// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
@@ -13,13 +13,42 @@ import (
"gopkg.in/yaml.v2"
)
+const (
+ PLUGIN_CONFIG_TYPE_TEXT = "text"
+ PLUGIN_CONFIG_TYPE_BOOL = "bool"
+ PLUGIN_CONFIG_TYPE_RADIO = "radio"
+ PLUGIN_CONFIG_TYPE_DROPDOWN = "dropdown"
+ PLUGIN_CONFIG_TYPE_GENERATED = "generated"
+)
+
+type PluginOption struct {
+ DisplayName string `json:"display_name" yaml:"display_name"`
+ Value string `json:"value" yaml:"value"`
+}
+
+type PluginSetting struct {
+ DisplayName string `json:"display_name" yaml:"display_name"`
+ Type string `json:"type" yaml:"type"`
+ HelpText string `json:"help_text" yaml:"help_text"`
+ RegenerateHelpText string `json:"regenerate_help_text,omitempty" yaml:"regenerate_help_text,omitempty"`
+ Default interface{} `json:"default" yaml:"default"`
+ Options []*PluginOption `json:"options,omitempty" yaml:"options,omitempty"`
+}
+
+type PluginSettingsSchema struct {
+ Header string `json:"header" yaml:"header"`
+ Footer string `json:"footer" yaml:"footer"`
+ Settings map[string]*PluginSetting `json:"settings" yaml:"settings"`
+}
+
type Manifest struct {
- Id string `json:"id" yaml:"id"`
- Name string `json:"name,omitempty" yaml:"name,omitempty"`
- Description string `json:"description,omitempty" yaml:"description,omitempty"`
- Version string `json:"version" yaml:"version"`
- Backend *ManifestBackend `json:"backend,omitempty" yaml:"backend,omitempty"`
- Webapp *ManifestWebapp `json:"webapp,omitempty" yaml:"webapp,omitempty"`
+ Id string `json:"id" yaml:"id"`
+ Name string `json:"name,omitempty" yaml:"name,omitempty"`
+ Description string `json:"description,omitempty" yaml:"description,omitempty"`
+ Version string `json:"version" yaml:"version"`
+ Backend *ManifestBackend `json:"backend,omitempty" yaml:"backend,omitempty"`
+ Webapp *ManifestWebapp `json:"webapp,omitempty" yaml:"webapp,omitempty"`
+ SettingsSchema *PluginSettingsSchema `json:"settings_schema,omitempty" yaml:"settings_schema,omitempty"`
}
type ManifestBackend struct {