File tree 3 files changed +21
-1
lines changed 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 28
28
# The following values are optional:
29
29
#image: true # Attach image to the notification?
30
30
#embed_image: true # Upload and embed the image into the message?
31
+ #details_tag: false # Use a <details> tag to include image (MSC2184)
31
32
#templates:
32
33
# Templates to use when rendering the notification, available placeholders:
33
34
# %TEMPLATES% - lib/grafana_matrix/templates
Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ def embed_image?
49
49
data . fetch ( :embed_image , true )
50
50
end
51
51
52
+ def details?
53
+ data . fetch ( :details_tag , false )
54
+ end
55
+
52
56
def msgtype
53
57
data . fetch ( :msgtype , config . default_msgtype )
54
58
end
Original file line number Diff line number Diff line change 1
1
< h4 > < a href ="<%= data [ 'ruleUrl' ] %> " style ="font-weight: bold; font-style: italic "> < font color ="<%= SEVERITY_COLOURS [ data [ 'state' ] . to_sym ] %> "> <%= data [ 'title' ] %> </ font > </ a > </ h4 >
2
- <%- unless data . fetch ( 'message' , '' ) . empty? -%>
2
+ <%- if data [ 'imageUrl' ] && rule . details? && data [ 'state' ] != 'ok' -%>
3
+ < details > < summary >
4
+ <%- unless data . fetch ( 'message' , '' ) . empty? -%>
5
+ <%= data [ 'message' ] %>
6
+ <%- end -%>
7
+ <%- else -%>
8
+ <%- unless data . fetch ( 'message' , '' ) . empty? -%>
3
9
< p > <%= data [ 'message' ] %> </ p >
10
+ <%- end -%>
4
11
<%- end -%>
5
12
<%- if data . key? 'error' -%>
6
13
< h5 > Error:</ h5 >
12
19
< b > <%= match [ 'metric' ] %> </ b > : <%= match [ 'value' ] %> < br />
13
20
<%- end -%>
14
21
<%- end -%>
22
+ <%- if data [ 'imageUrl' ] && rule . details? -%>
23
+ </ summary >
24
+ <%- end -%>
15
25
<%- if data [ 'imageUrl' ] && rule . image? -%>
26
+ <%- if !rule . details? -%>
16
27
< br />
28
+ <%- end -%>
17
29
<%- if rule . embed_image? -%>
18
30
< a href ="<%= data [ 'ruleUrl' ] %> "> < img src ="<%= data [ 'imageUrl' ] %> " alt ="<%= data [ 'ruleName' ] %> " /> </ a >
19
31
<%- else -%>
20
32
< a href ="<%= data [ 'imageUrl' ] %> "> Alert image</ a >
21
33
<%- end -%>
22
34
<%- end -%>
23
35
<%- end -%>
36
+ <%- if data [ 'imageUrl' ] && rule . details? -%>
37
+ </ details >
38
+ <%- end -%>
You can’t perform that action at this time.
0 commit comments