Alerting: UI changes required to support v3 and Auth in Kafka Contact Point (#61123)

This commit is contained in:
Ghazanfar 2023-01-14 04:15:43 +05:30 committed by GitHub
parent b289b8ac6e
commit d553a016cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 0 deletions

View File

@ -163,6 +163,7 @@ func GetAvailableNotifiers() []*NotifierPlugin {
Label: "Kafka REST Proxy",
Element: ElementTypeInput,
InputType: InputTypeText,
Description: "Hint: If you are directly using v3 APIs hosted on a Confluent Kafka Server, you must append /kafka to the URL here. Example: https://localhost:8082/kafka",
Placeholder: "http://localhost:8082",
PropertyName: "kafkaRestProxy",
Required: true,
@ -175,6 +176,53 @@ func GetAvailableNotifiers() []*NotifierPlugin {
PropertyName: "kafkaTopic",
Required: true,
},
{
Label: "Username",
Element: ElementTypeInput,
InputType: InputTypeText,
PropertyName: "username",
Required: false,
},
{
Label: "Password",
Element: ElementTypeInput,
InputType: InputTypePassword,
Description: "The password to use when making a call to the Kafka REST Proxy",
PropertyName: "password",
Required: false,
Secure: true,
},
{
Label: "API version",
Element: ElementTypeSelect,
InputType: InputTypeText,
Description: "The API version to use when contacting the Kafka REST Server. By default v2 will be used.",
PropertyName: "apiVersion",
Required: false,
SelectOptions: []SelectOption{
{
Value: "v2",
Label: "v2",
},
{
Value: "v3",
Label: "v3",
},
},
},
{
Label: "Cluster ID",
Element: ElementTypeInput,
InputType: InputTypeText,
Description: "v3 APIs require a clusterID to be specified.",
Placeholder: "lkc-abcde",
PropertyName: "kafkaClusterId",
Required: true,
ShowWhen: ShowWhen{
Field: "apiVersion",
Is: "v3",
},
},
{
Label: "Description",
Element: ElementTypeInput,

View File

@ -57,6 +57,8 @@ type SelectOption struct {
}
// ShowWhen holds information about when options are dependant on other options.
// Should be used when Element is ElementTypeSelect.
// Does not work for ElementTypeCheckbox.
type ShowWhen struct {
Field string `json:"field"`
Is string `json:"is"`