Migration: Edit notification channel (#25980)

* implement edit page

* connectWithCleanup

* remove angular related code

* use loadingindicator

* use the correct loading component

* handle secureFields

* fixed implementation of secure fields

* Keep secureFields after rerendering the form

* CollapsableSection and Page refactor

* use checkbox instead of switch

* fix comment

* add cursor to section

* Fixed issues after PR review

* Fix issue with some settings being undefined

* new reducer and start with test

* algorithm to migrate secure fields

* UX: Minor UI Tweaks

* Added field around checkboxes, and missing required field

* fixed test

* tests for util

* minor tweaks and changes

* define as records

* fix typ error

* forward invalid to textarea and inputcontrol

* merge formdata and redux data in test

* fix issue with creating channel

* do not figure out securefields in migration

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
Peter Holmberg
2020-09-09 12:46:19 +02:00
committed by GitHub
co-authored by Torkel Ödegaard
parent 1e2f3ca599
commit 400aafa3b3
45 changed files with 1297 additions and 1059 deletions
+1 -33
View File
@@ -15,39 +15,6 @@ func init() {
Description: "Sends HTTP POST request to a URL",
Heading: "Webhook settings",
Factory: NewWebHookNotifier,
OptionsTemplate: `
<h3 class="page-heading">Webhook settings</h3>
<div class="gf-form max-width-30">
<span class="gf-form-label width-8">Url</span>
<input type="text" required class="gf-form-input max-width-26" ng-model="ctrl.model.settings.url"></input>
</div>
<div class="gf-form max-width-30">
<span class="gf-form-label width-8">Http Method</span>
<div class="gf-form-select-wrapper max-width-30">
<select class="gf-form-input" ng-model="ctrl.model.settings.httpMethod" ng-options="t for t in ['POST', 'PUT']">
</select>
</div>
</div>
<div class="gf-form max-width-30">
<span class="gf-form-label width-8">Username</span>
<input type="text" class="gf-form-input max-width-30" ng-model="ctrl.model.settings.username"></input>
</div>
<div class="gf-form max-width-30">
<div class="gf-form gf-form--v-stretch"><label class="gf-form-label width-8">Password</label></div>
<div class="gf-form gf-form--grow" ng-if="!ctrl.model.secureFields.password">
<input type="text"
class="gf-form-input max-width-30"
ng-init="ctrl.model.secureSettings.password = ctrl.model.settings.password || null; ctrl.model.settings.password = null;"
ng-model="ctrl.model.secureSettings.password"
data-placement="right">
</input>
</div>
<div class="gf-form" ng-if="ctrl.model.secureFields.password">
<input type="text" class="gf-form-input max-width-18" disabled="disabled" value="configured" />
<a class="btn btn-secondary gf-form-btn" href="#" ng-click="ctrl.model.secureFields.password = false">reset</a>
</div>
</div>
`,
Options: []alerting.NotifierOption{
{
Label: "Url",
@@ -82,6 +49,7 @@ func init() {
Element: alerting.ElementTypeInput,
InputType: alerting.InputTypePassword,
PropertyName: "password",
Secure: true,
},
},
})