Alerting: Fix issue with Slack contact point validation (#47559)

* secureFields and secureSettings

* revert channelIndex

* readd lost code

* use specific return

* register secure fields and use not hard coded index

* fix for determineReadOnly

* fix lint error

* fix test suite

Co-authored-by: gillesdemey <gilles.de.mey@gmail.com>
This commit is contained in:
Peter Holmberg
2022-04-20 09:40:57 +02:00
committed by GitHub
co-authored by gillesdemey
parent e58a015baf
commit 39d3c8afd7
4 changed files with 53 additions and 26 deletions
@@ -383,7 +383,7 @@ func GetAvailableNotifiers() []*alerting.NotifierPlugin {
Description: "Specify channel, private group, or IM channel (can be an encoded ID or a name) - required unless you provide a webhook",
PropertyName: "recipient",
Required: true,
DependsOn: "secureSettings.url",
DependsOn: "url",
},
// Logically, this field should be required when not using a webhook, since the Slack API needs a token.
// However, since the UI doesn't allow to say that a field is required or not depending on another field,
@@ -397,7 +397,7 @@ func GetAvailableNotifiers() []*alerting.NotifierPlugin {
PropertyName: "token",
Secure: true,
Required: true,
DependsOn: "secureSettings.url",
DependsOn: "url",
},
{
Label: "Username",
@@ -463,7 +463,7 @@ func GetAvailableNotifiers() []*alerting.NotifierPlugin {
PropertyName: "url",
Secure: true,
Required: true,
DependsOn: "secureSettings.token",
DependsOn: "token",
},
{ // New in 8.4.
Label: "Endpoint URL",