Add documentation for number field for plugins (#13800)
* Add example for release_notes_url * Add number field
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
918307e4fa
Коммит
1a82e3e575
@@ -34,6 +34,7 @@ const (
|
|||||||
Radio
|
Radio
|
||||||
Text
|
Text
|
||||||
LongText
|
LongText
|
||||||
|
Number
|
||||||
Username
|
Username
|
||||||
Custom
|
Custom
|
||||||
)
|
)
|
||||||
@@ -62,6 +63,8 @@ type PluginSetting struct {
|
|||||||
//
|
//
|
||||||
// "longtext" will result in a multi line string that can be typed in manually.
|
// "longtext" will result in a multi line string that can be typed in manually.
|
||||||
//
|
//
|
||||||
|
// "number" will result in in integer setting that can be typed in manually.
|
||||||
|
//
|
||||||
// "username" will result in a text setting that will autocomplete to a username.
|
// "username" will result in a text setting that will autocomplete to a username.
|
||||||
//
|
//
|
||||||
// "custom" will result in a custom defined setting and will load the custom component registered for the Web App System Console.
|
// "custom" will result in a custom defined setting and will load the custom component registered for the Web App System Console.
|
||||||
@@ -108,6 +111,7 @@ type PluginSettingsSchema struct {
|
|||||||
// "description": "This is my plugin",
|
// "description": "This is my plugin",
|
||||||
// "homepage_url": "https://example.com",
|
// "homepage_url": "https://example.com",
|
||||||
// "support_url": "https://example.com/support",
|
// "support_url": "https://example.com/support",
|
||||||
|
// "release_notes_url": "https://example.com/releases/v0.0.1",
|
||||||
// "icon_path": "assets/logo.svg",
|
// "icon_path": "assets/logo.svg",
|
||||||
// "version": "0.1.0",
|
// "version": "0.1.0",
|
||||||
// "min_server_version": "5.6.0",
|
// "min_server_version": "5.6.0",
|
||||||
@@ -414,6 +418,8 @@ func convertTypeToPluginSettingType(t string) (PluginSettingType, error) {
|
|||||||
return Radio, nil
|
return Radio, nil
|
||||||
case "text":
|
case "text":
|
||||||
return Text, nil
|
return Text, nil
|
||||||
|
case "number":
|
||||||
|
return Number, nil
|
||||||
case "longtext":
|
case "longtext":
|
||||||
return LongText, nil
|
return LongText, nil
|
||||||
case "username":
|
case "username":
|
||||||
|
|||||||
@@ -131,6 +131,14 @@ func TestSettingIsValid(t *testing.T) {
|
|||||||
Value: "value",
|
Value: "value",
|
||||||
},
|
},
|
||||||
}}, false},
|
}}, false},
|
||||||
|
{
|
||||||
|
"Valid number setting",
|
||||||
|
&PluginSetting{
|
||||||
|
Type: "number",
|
||||||
|
Default: 10,
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user