mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
Emails: resurrect template notification (#18686)
* Emails: resurrect template notification * Phantomjs (oh yeah, there is another dev dep phantom :-) was failing for the generation of the html templates so I had to update the dependencies in order to fix it. While doing that I update the scripts field and docs for it as well. yarn.lock is included * Move splitting of the emails to separate helper function, since more services coming up that would need to use this functionality * Add support for enterprise specific email letters. Probably could be done in the better way, but it's not a priority right now
This commit is contained in:
parent
c5bca40566
commit
35b74a99a8
5
.gitignore
vendored
5
.gitignore
vendored
@ -10,6 +10,11 @@ awsconfig
|
||||
/public/views/index.html
|
||||
/public/views/error.html
|
||||
/emails/dist
|
||||
|
||||
# Enterprise emails
|
||||
/emails/templates/enterprise_*
|
||||
/public/emails/enterprise_*
|
||||
|
||||
/public_gen
|
||||
/public/vendor/npm
|
||||
/tmp
|
||||
|
@ -1,9 +1,15 @@
|
||||
## Prerequisites
|
||||
|
||||
- npm install
|
||||
- gem install premailer
|
||||
- grunt (default task will build new inlines email templates)
|
||||
- grunt watch (will build on source html or css change)
|
||||
|
||||
assembled email templates will be in dist/ and final
|
||||
inlined templates will be in ../public/emails/
|
||||
## Tasks
|
||||
|
||||
- npm run build (default task will build new inlines email templates)
|
||||
- npm start (will build on source html or css change)
|
||||
|
||||
## Result
|
||||
|
||||
Assembled email templates will be in `dist/` and final
|
||||
inlined templates will be in `../public/emails/`
|
||||
|
||||
|
@ -8,10 +8,15 @@
|
||||
"email": "delder@riester.com",
|
||||
"url": "https://github.com/dnnsldr"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "grunt",
|
||||
"start": "grunt watch"
|
||||
},
|
||||
|
||||
"devDependencies": {
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-premailer": "^0.2.10",
|
||||
"grunt-processhtml": "^0.3.3",
|
||||
"grunt-premailer": "^1.1.10",
|
||||
"grunt-processhtml": "^0.4.2",
|
||||
"grunt-uncss": "^0.3.7",
|
||||
"load-grunt-config": "^0.14.0",
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
|
3158
emails/yarn.lock
Normal file
3158
emails/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,11 +2,11 @@ package notifiers
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/alerting"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
@ -48,13 +48,7 @@ func NewEmailNotifier(model *models.AlertNotification) (alerting.Notifier, error
|
||||
}
|
||||
|
||||
// split addresses with a few different ways
|
||||
addresses := strings.FieldsFunc(addressesString, func(r rune) bool {
|
||||
switch r {
|
||||
case ',', ';', '\n':
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
addresses := util.SplitEmails(addressesString)
|
||||
|
||||
return &EmailNotifier{
|
||||
NotifierBase: NewNotifierBase(model),
|
||||
|
14
pkg/util/split_email.go
Normal file
14
pkg/util/split_email.go
Normal file
@ -0,0 +1,14 @@
|
||||
package util
|
||||
|
||||
import "strings"
|
||||
|
||||
// SplitEmails splits addresses with a few different ways
|
||||
func SplitEmails(emails string) []string {
|
||||
return strings.FieldsFunc(emails, func(r rune) bool {
|
||||
switch r {
|
||||
case ',', ';', '\n':
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user