* Automate CSS-inlining for default HTML email template
The original HTML email template was added in `template/email.html`.
It looks like the CSS was manually inlined. Most likely using the
premailer.dialect.ca web form, which is mentioned in the README for
the Mailgun transactional-email-templates project. The resulting HTML
with inlined CSS was then copied into `template/default.tmpl`. This
has resulted in `email.html` and `default.tmpl` diverging at times.
This commit adds build automation to inline the CSS automatically
using [juice][1]. The Go template containing the resulting HTML has
been moved into its own file to avoid the script that performs the CSS
inlining having to parse the `default.tmpl` file to insert it there.
Fixes#1939.
[1]: https://www.npmjs.com/package/juice
Signed-off-by: Brad Ison <bison@xvdf.io>
* Update asset/assets_vfsdata.go
Signed-off-by: Brad Ison <bison@xvdf.io>
Since it's impossible to create a string slice in a Go template by
default, add a function to work around this problem.
The use case is to make it easy to call KV.Remove with an arbitrary
slice inside a template.
Signed-off-by: Vincent Rischmann <vincent@rischmann.fr>
* do not split receiver by slash
I'm not sure why this was originally done, because a slash seems to be perfectly
valid in a receiver definition. The only issue i encountered was that linking
from a fired alert was not working, because of the splitting performed here.
Signed-off-by: Tim Reddehase <tim.reddehase@xing.com>
* urlquery escape Receiver by default for URL
If Receiver is allowed to contain slashes and other special characters
we need to percent encode them properly.
Signed-off-by: Tim Reddehase <tim.reddehase@xing.com>
* rerun make asset/assets_vfsdata.go
Signed-off-by: Tim Reddehase <tim.reddehase@xing.com>
* Migrate from go-bindata to vfsgen
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Ensure idempotent generation for vfsgen
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* asset: update generated files
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Fix asset paths for Windows platforms
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Regenerate assets
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Add vfs wrapper that returns constant mod time
This is identical to what we had with go-bindata and avoids the extra
step of storing the identity of the complete file system in another
location.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Additional cleanup
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Include Makefile.common
* Fix the bindata.go files to make the style target happy
* Inline `.PHONY` statements
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* WECHAT support by ybyang2/berlinsaint
* correct the whitespace
* add some TestFile and modify some naming errors by ybyang2/berlinsaint
* modify wechat retry test expect
* template error
* add newline
Signed-off-by: yb_home <berlinsaint@126.com>
* fmt some pr code
* use the @stuartnelson3 the test-ci-wechat bingdata.go
* notify go add wechat
* Update elm-tools/parser
* Improve filter UI
* Pressing backspace edits the last matcher
* Put escape char back into the output
* Allow editing the matcher
* Update bindata.go
* Const for key codes
* Use qualified imports
* Update bindata.go
* Commented the backspacePressed attribute
By passing "-modtime 1" flag into go-bindata command it uses the same
unix timestamp (1) for every file in the fake filesystem. Thereby every
execution of "make assets" results in the same asset outputs if the
inputs were the same. This forces us to set the "Cache-Control"
attribute to "no-cache".
* Export parsed configuration as JSON in /api/v1/status.
* Avoid exporting the XXX fields.
* Drop js-yaml library and use already parsed configuration.
* Go fmt + go-bindata
This fixes#559 by removing concurrent map writes to the matcher cache.
The cache was guarded by the Silence's main lock, which only used a
read-lock on queries.
The cache's get methods lazily loads data into the cache and thus
causing concurrent writes.
We just change the main lock to always write-lock, as we don't expect
high lock contention at this point and would have it in a dedicated
cache lock anyway.
Currently, even if all alerts within a group are silenced, the group
summary still appears. This can take up a lot of space when many alerts
are silenced.
If all alerts in a group are silenced and 'Hide silences' is checked,
hide the empty group.
bindata was updated by running:
make assets format
Add default VictorOpsAPIURL
Add VictorOps default config
Add VictorOpsConfig struct in notifiers
Add new template tags for victorops
Add notifications logic for victorops
Compiled template tags with make assets
Remove common labels from entity_id template
Set messageType default value to CRITICAL
Recovery messageType is not configurable anymore. Firing state only allows specific keys
Make assets
Using log.Debugf
EntityID should not be configureable
Remove entity_id from template
Use GroupKey(ctx) as entity_id
Improve debug logging
Fix type of entity_id
The pushover notification of resolved alerts can end up in an empty
message (only a newline). I've fixed the check for an empty message with
trimming the whitespace. But I also thought that adding the resolved
alerts to the message would be helpful.