feat(plugin): add label ui option for switch config type
This commit is contained in:
@@ -54,6 +54,7 @@ func (cc *ConnectorController) ConnectorLoginDispatcher(ctx *gin.Context) {
|
||||
return nil
|
||||
})
|
||||
if c == nil {
|
||||
log.Errorf("connector %s not found", slugName)
|
||||
ctx.Redirect(http.StatusFound, "/50x")
|
||||
return
|
||||
}
|
||||
@@ -70,6 +71,7 @@ func (cc *ConnectorController) ConnectorRedirectDispatcher(ctx *gin.Context) {
|
||||
return nil
|
||||
})
|
||||
if c == nil {
|
||||
log.Errorf("connector %s not found", slugName)
|
||||
ctx.Redirect(http.StatusFound, "/50x")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ func (g *GetPluginConfigResp) SetConfigFields(ctx *gin.Context, fields []plugin.
|
||||
},
|
||||
}
|
||||
configField.UIOptions.Placeholder = field.UIOptions.Placeholder.Translate(ctx)
|
||||
configField.UIOptions.Label = field.UIOptions.Label.Translate(ctx)
|
||||
|
||||
for _, option := range field.Options {
|
||||
configField.Options = append(configField.Options, ConfigFieldOption{
|
||||
@@ -76,7 +77,7 @@ type ConfigField struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Required bool `json:"required"`
|
||||
Value string `json:"value"`
|
||||
Value any `json:"value"`
|
||||
UIOptions ConfigFieldUIOptions `json:"ui_options"`
|
||||
Options []ConfigFieldOption `json:"options,omitempty"`
|
||||
}
|
||||
@@ -85,6 +86,7 @@ type ConfigFieldUIOptions struct {
|
||||
Placeholder string `json:"placeholder,omitempty"`
|
||||
Rows string `json:"rows,omitempty"`
|
||||
InputType string `json:"input_type,omitempty"`
|
||||
Label string `json:"label,omitempty"`
|
||||
}
|
||||
|
||||
type ConfigFieldOption struct {
|
||||
|
||||
+2
-1
@@ -37,7 +37,7 @@ type ConfigField struct {
|
||||
Title Translator `json:"title"`
|
||||
Description Translator `json:"description"`
|
||||
Required bool `json:"required"`
|
||||
Value string `json:"value"`
|
||||
Value any `json:"value"`
|
||||
UIOptions ConfigFieldUIOptions `json:"ui_options"`
|
||||
Options []ConfigFieldOption `json:"options,omitempty"`
|
||||
}
|
||||
@@ -46,6 +46,7 @@ type ConfigFieldUIOptions struct {
|
||||
Placeholder Translator `json:"placeholder,omitempty"`
|
||||
Rows string `json:"rows,omitempty"`
|
||||
InputType InputType `json:"input_type,omitempty"`
|
||||
Label Translator `json:"label,omitempty"`
|
||||
}
|
||||
|
||||
type ConfigFieldOption struct {
|
||||
|
||||
Reference in New Issue
Block a user