|
|
|
|
@ -21,8 +21,21 @@ func init() { |
|
|
|
|
OptionsTemplate: ` |
|
|
|
|
<h3 class="page-heading">OpsGenie settings</h3> |
|
|
|
|
<div class="gf-form"> |
|
|
|
|
<span class="gf-form-label width-14">API Key</span> |
|
|
|
|
<input type="text" required class="gf-form-input max-width-22" ng-model="ctrl.model.settings.apiKey" placeholder="OpsGenie API Key"></input> |
|
|
|
|
<label class="gf-form-label max-width-14">API Key</label> |
|
|
|
|
<div class="gf-form gf-form--grow" ng-if="!ctrl.model.secureFields.apiKey"> |
|
|
|
|
<input type="text" |
|
|
|
|
required |
|
|
|
|
class="gf-form-input max-width-22" |
|
|
|
|
ng-init="ctrl.model.secureSettings.apiKey = ctrl.model.settings.apiKey || null; ctrl.model.settings.apiKey = null;" |
|
|
|
|
ng-model="ctrl.model.secureSettings.apiKey" |
|
|
|
|
placeholder="OpsGenie API Key" |
|
|
|
|
data-placement="right"> |
|
|
|
|
</input> |
|
|
|
|
</div> |
|
|
|
|
<div class="gf-form" ng-if="ctrl.model.secureFields.apiKey"> |
|
|
|
|
<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.apiKey = false">reset</a> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="gf-form"> |
|
|
|
|
<span class="gf-form-label width-14">Alert API Url</span> |
|
|
|
|
@ -87,7 +100,7 @@ var ( |
|
|
|
|
func NewOpsGenieNotifier(model *models.AlertNotification) (alerting.Notifier, error) { |
|
|
|
|
autoClose := model.Settings.Get("autoClose").MustBool(true) |
|
|
|
|
overridePriority := model.Settings.Get("overridePriority").MustBool(true) |
|
|
|
|
apiKey := model.Settings.Get("apiKey").MustString() |
|
|
|
|
apiKey := model.DecryptedValue("apiKey", model.Settings.Get("apiKey").MustString()) |
|
|
|
|
apiURL := model.Settings.Get("apiUrl").MustString() |
|
|
|
|
if apiKey == "" { |
|
|
|
|
return nil, alerting.ValidationError{Reason: "Could not find api key property in settings"} |
|
|
|
|
|