Add placeholder field and user_autocomplete type to plugin manifest (#7817)

* Add placholder field and user_autocomplete type to plugin manifest

* user_autocomplete -> username
Этот коммит содержится в:
Joram Wilander
2017-11-13 11:38:16 -05:00
коммит произвёл Harrison Healey
родитель ae8fd37332
Коммит 7304a61ef5
2 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@@ -19,6 +19,7 @@ const (
PLUGIN_CONFIG_TYPE_RADIO = "radio" PLUGIN_CONFIG_TYPE_RADIO = "radio"
PLUGIN_CONFIG_TYPE_DROPDOWN = "dropdown" PLUGIN_CONFIG_TYPE_DROPDOWN = "dropdown"
PLUGIN_CONFIG_TYPE_GENERATED = "generated" PLUGIN_CONFIG_TYPE_GENERATED = "generated"
PLUGIN_CONFIG_TYPE_USERNAME = "username"
) )
type PluginOption struct { type PluginOption struct {
@@ -47,6 +48,8 @@ type PluginSetting struct {
// of pre-defined options. // of pre-defined options.
// //
// "text" will result in a string setting that can be typed in manually. // "text" will result in a string setting that can be typed in manually.
//
// "username" will result in a text setting that will autocomplete to a username.
Type string `json:"type" yaml:"type"` Type string `json:"type" yaml:"type"`
// The help text to display to the user. // The help text to display to the user.
@@ -55,6 +58,9 @@ type PluginSetting struct {
// The help text to display alongside the "Regenerate" button for settings of the "generated" type. // The help text to display alongside the "Regenerate" button for settings of the "generated" type.
RegenerateHelpText string `json:"regenerate_help_text,omitempty" yaml:"regenerate_help_text,omitempty"` RegenerateHelpText string `json:"regenerate_help_text,omitempty" yaml:"regenerate_help_text,omitempty"`
// The placeholder to display for "text", "generated" and "username" types when blank.
Placeholder string `json:"placeholder" yaml:"placeholder"`
// The default value of the setting. // The default value of the setting.
Default interface{} `json:"default" yaml:"default"` Default interface{} `json:"default" yaml:"default"`

Просмотреть файл

@@ -76,6 +76,7 @@ func TestManifestUnmarshal(t *testing.T) {
Type: PLUGIN_CONFIG_TYPE_DROPDOWN, Type: PLUGIN_CONFIG_TYPE_DROPDOWN,
HelpText: "thehelptext", HelpText: "thehelptext",
RegenerateHelpText: "theregeneratehelptext", RegenerateHelpText: "theregeneratehelptext",
Placeholder: "theplaceholder",
Options: []*PluginOption{ Options: []*PluginOption{
&PluginOption{ &PluginOption{
DisplayName: "theoptiondisplayname", DisplayName: "theoptiondisplayname",
@@ -104,6 +105,7 @@ settings_schema:
type: dropdown type: dropdown
help_text: thehelptext help_text: thehelptext
regenerate_help_text: theregeneratehelptext regenerate_help_text: theregeneratehelptext
placeholder: theplaceholder
options: options:
- display_name: theoptiondisplayname - display_name: theoptiondisplayname
value: thevalue value: thevalue
@@ -129,6 +131,7 @@ settings_schema:
"type": "dropdown", "type": "dropdown",
"help_text": "thehelptext", "help_text": "thehelptext",
"regenerate_help_text": "theregeneratehelptext", "regenerate_help_text": "theregeneratehelptext",
"placeholder": "theplaceholder",
"options": [ "options": [
{ {
"display_name": "theoptiondisplayname", "display_name": "theoptiondisplayname",
@@ -178,6 +181,7 @@ func TestManifestJson(t *testing.T) {
Type: PLUGIN_CONFIG_TYPE_DROPDOWN, Type: PLUGIN_CONFIG_TYPE_DROPDOWN,
HelpText: "thehelptext", HelpText: "thehelptext",
RegenerateHelpText: "theregeneratehelptext", RegenerateHelpText: "theregeneratehelptext",
Placeholder: "theplaceholder",
Options: []*PluginOption{ Options: []*PluginOption{
&PluginOption{ &PluginOption{
DisplayName: "theoptiondisplayname", DisplayName: "theoptiondisplayname",
@@ -241,6 +245,7 @@ func TestManifestClientManifest(t *testing.T) {
Type: PLUGIN_CONFIG_TYPE_DROPDOWN, Type: PLUGIN_CONFIG_TYPE_DROPDOWN,
HelpText: "thehelptext", HelpText: "thehelptext",
RegenerateHelpText: "theregeneratehelptext", RegenerateHelpText: "theregeneratehelptext",
Placeholder: "theplaceholder",
Options: []*PluginOption{ Options: []*PluginOption{
&PluginOption{ &PluginOption{
DisplayName: "theoptiondisplayname", DisplayName: "theoptiondisplayname",