Skip to content

Commit c42519c

Browse files
authored
Merge pull request #753 from hpcc-systems/yadhap/JM-notification-template
Updated notification templates to match the existing ASR notofications
2 parents 7f51b40 + a4c3401 commit c42519c

File tree

4 files changed

+245
-200
lines changed

4 files changed

+245
-200
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,169 @@
1-
<!-- Note :
2-
1. This is a sample email template, Use this template as a reference to create your own template.
3-
2. All variables passed into the function should be defined. If any variable is undefined, it should default to a predetermined value.
4-
3. All E-mail clients do not support external css file, Therefore we have to use inline css -
5-
although its repetitive and not a good practice.
6-
-->
71
<!DOCTYPE html>
82
<html>
9-
<head>
10-
<style>
11-
.container {
12-
margin: 10px;
13-
padding: 20px;
14-
}
153

16-
.section {
17-
margin-top: 15px;
18-
}
19-
.greeting {
20-
margin-bottom: 10px;
21-
}
22-
.signature {
23-
margin-top: 15px;
24-
}
25-
.footer {
26-
margin-top: 30px;
27-
font-size: 12px;
28-
color: #999;
29-
}
30-
</style>
31-
</head>
32-
<body>
33-
<div class="container">
34-
<div class="section">
35-
<div class="greeting">Hello,</div>
36-
<%= typeof jobName !== 'undefined' ? jobName :"____" %> is in <%= typeof
37-
state !== 'undefined' ? state : "____" %> state on <%= typeof
38-
clusterName !== 'undefined' ? clusterName: "____" %>. Please take below
39-
actions
40-
</div>
4+
<head>
5+
<style>
6+
.main_body {
7+
width: 100%
8+
}
419
42-
<!-- HTML Table -->
43-
<div class="section">
44-
<table
45-
style="
46-
border: 1px solid black;
47-
border-collapse: collapse;
48-
padding: 5px;
49-
"
50-
>
10+
.section {
11+
margin: 0 auto !important;
12+
width: 800px;
13+
border-collapse: collapse;
14+
font-family: Arial;
15+
font-size: 14px;
16+
}
17+
18+
.section-table-td {
19+
border: 1px solid #dddddd;
20+
text-align: left;
21+
padding: 5px;
22+
}
23+
24+
.section-footer {
25+
background: none;
26+
text-align: center;
27+
border-top: 1px solid #dddddd;
28+
font-size: 12px;
29+
}
30+
31+
.section-footer-td {
32+
padding-top: 50px;
33+
padding-bottom: 50px;
34+
color: #808080;
35+
}
36+
37+
.section-header {
38+
background: none !important;
39+
}
40+
41+
.section-header-td {
42+
padding-top: 30px;
43+
padding-bottom: 30px;
44+
}
45+
</style>
46+
</head>
47+
48+
<table class="main_body">
49+
<tbody>
50+
<tr>
51+
<td>
52+
<table class="section section-header">
5153
<tbody>
5254
<tr>
53-
<td style="border: 1px solid black">Row 1, Column 1</td>
54-
<td style="border: 1px solid black">Row 1, Column 2</td>
55-
<td style="border: 1px solid black">Row 1, Column 3</td>
56-
<td style="border: 1px solid black">Row 1, Column 4</td>
57-
<td style="border: 1px solid black">Row 1, Column 5</td>
55+
<td class="section-header-td">
56+
The job below is in Failed State. Please take necessary actions.
57+
</td>
58+
</tr>
59+
</tbody>
60+
</table>
61+
<table class="section section-table">
62+
<tbody>
63+
<tr class="section-table-td">
64+
<td class="section-table-td">Monitoring Name</td>
65+
<td class="section-table-td"><%= typeof monitoringName !== 'undefined' ? monitoringName : "NA" %></td>
66+
</tr>
67+
<tr class="section-table-td">
68+
<td class="section-table-td">Notification ID</td>
69+
<td class="section-table-td"><%= typeof notificationId !== 'undefined' ? notificationId : "NA" %></td>
70+
</tr>
71+
<tr class="section-table-td">
72+
<td class="section-table-td">Domain</td>
73+
<td class="section-table-td"><%= typeof domain !== 'undefined' ? domain : "NA" %></td>
74+
</tr>
75+
<tr class="section-table-td">
76+
<td class="section-table-td">Product</td>
77+
<td class="section-table-td"><%= typeof product !== 'undefined' ? product : "NA" %></td>
78+
</tr>
79+
<tr class="section-table-td">
80+
<td class="section-table-td">Issue</td>
81+
<td class="section-table-td"><%= typeof issue !== 'undefined' ? issue : "NA" %></td>
82+
</tr>
83+
<tr class="section-table-td">
84+
<td class="section-table-td">Host</td>
85+
<td class="section-table-td"><%= typeof host !== 'undefined' ? host : "NA" %></td>
86+
</tr>
87+
<tr class="section-table-td">
88+
<td class="section-table-td">Job Name Filter</td>
89+
<td class="section-table-td"><%= typeof jobNameFilter !== 'undefined' ? jobNameFilter : "NA" %></td>
5890
</tr>
91+
<tr class="section-table-td">
92+
<td class="section-table-td">Returned Job State</td>
93+
<td class="section-table-td"><%= typeof returnedJobState !== 'undefined' ? returnedJobState : "NA" %></td>
94+
</tr>
95+
<tr class="section-table-td">
96+
<td class="section-table-td">Returned Job WUID</td>
97+
<td class="section-table-td"><%= typeof returnedJobWuid !== 'undefined' ? returnedJobWuid : "NA" %></td>
98+
</tr>
99+
<tr class="section-table-td">
100+
<td class="section-table-td">Require Complete</td>
101+
<td class="section-table-td"><%= typeof requireComplete !== 'undefined' ? requireComplete : "NA" %></td>
102+
</tr>
103+
<tr class="section-table-td">
104+
<td class="section-table-td">Expected Start</td>
105+
<td class="section-table-td"><%= typeof expectedStart !== 'undefined' ? expectedStart : "NA" %></td>
106+
</tr>
107+
<tr class="section-table-td">
108+
<td class="section-table-td">Expected Completion</td>
109+
<td class="section-table-td"><%= typeof expectedCompletion !== 'undefined' ? expectedCompletion : "NA" %></td>
110+
</tr>
111+
<tr class="section-table-td">
112+
<td class="section-table-td">Severity Code</td>
113+
<td class="section-table-td"><%= typeof severity !== 'undefined' ? severity : "NA" %></td>
114+
</tr>
115+
<tr class="section-table-td">
116+
<td class="section-table-td">First Logged</td>
117+
<td class="section-table-td"><%= typeof firstLogged !== 'undefined' ? firstLogged : "NA" %></td>
118+
</tr>
119+
<tr class="section-table-td">
120+
<td class="section-table-td">Last Logged</td>
121+
<td class="section-table-td"><%= typeof lastLogged !== 'undefined' ? lastLogged : "NA" %></td>
122+
</tr>
123+
<tr class="section-table-td">
124+
<td class="section-table-td">Region</td>
125+
<td class="section-table-td"><%= typeof region !== 'undefined' ? region : "NA" %></td>
126+
</tr>
127+
<tr class="section-table-td">
128+
<td class="section-table-td">Business Unit</td>
129+
<td class="section-table-td"><%= typeof businessUnit !== 'undefined' ? businessUnit : "NA" %></td>
130+
</tr>
131+
<tr class="section-table-td">
132+
<td class="section-table-td">Teams Channel</td>
133+
<td class="section-table-td">
134+
<% if (typeof teamsChannel !== 'undefined') { %>
135+
<a href="<%= teamsChannel %>"><%= teamsChannel %></a>
136+
<% } else { %>
137+
NA
138+
<% } %>
139+
</td>
140+
</tr>
141+
<tr class="section-table-td">
142+
<td class="section-table-td">Remedy</td>
143+
<td class="section-table-td">
144+
<% if (typeof remedy !== 'undefined') { %>
145+
<div><%= remedy.instruction %></div>
146+
<div class="list"><span class="label"> Primary: </span> <%= remedy.primaryContact %></div>
147+
<div class="list"><span class="label">Secondary: </span> <%= remedy.secondaryContact %></div>
148+
<% } else { %>
149+
<p>NA</p>
150+
<% } %>
151+
</td>
152+
</tr>
153+
</tbody>
154+
</table>
155+
<table class="section section-footer">
156+
<tbody>
59157
<tr>
60-
<td style="border: 1px solid black">Row 2, Column 1</td>
61-
<td style="border: 1px solid black">Row 2, Column 2</td>
62-
<td style="border: 1px solid black">Row 2, Column 3</td>
63-
<td style="border: 1px solid black">Row 2, Column 4</td>
64-
<td style="border: 1px solid black">Row 2, Column 5</td>
158+
<td class="section-footer-td">
159+
This notification is sent by Tombolo because your email address is included in the job monitoring notification recipient list. If you wish to stop receiving these alerts, please contact the Tombolo administrator.
160+
</td>
65161
</tr>
66162
</tbody>
67163
</table>
68-
</div>
69-
70-
<!-- Mentions -->
71-
<div class="section">
72-
[MENTIONS]
73-
<at>email1@example.com</at>
74-
<at>email2@example.com</at>
75-
<at>email3@example.com</at>
76-
</div>
164+
</td>
165+
</tr>
166+
</tbody>
167+
</table>
77168

78-
<div class="signature">Tombolo</div>
79-
<div class="footer">
80-
You are receiving this message because you are part of the job
81-
monitoring notification list. To stop getting these alerts please
82-
contact the administrator.
83-
</div>
84-
</div>
85-
</body>
86-
</html>
169+
</html>
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,98 @@
1-
// This is a sample template for a Teams notification card.
1+
const generateJobMonitoringMessageCardTable = (tableData) => {
2+
return `
3+
<table >
4+
<tbody>
5+
<tr>
6+
<td style="padding: 10px;"><strong>Notification ID</strong></td>
7+
<td>${
8+
typeof tableData.notificationId !== "undefined"
9+
? notificationId
10+
: "NA"
11+
}</td>
12+
</tr>
13+
<tr>
14+
<td style="padding: 10px;"><strong>Product</strong></td>
15+
<td>${typeof tableData.product !== "undefined" ? product : "NA"}</td>
16+
</tr>
17+
<tr>
18+
<td style="padding: 10px;"><strong>Issue</strong></td>
19+
<td>${typeof tableData.issue !== "undefined" ? issue : "NA"}</td>
20+
</tr>
21+
<tr>
22+
<td style="padding: 10px;"><strong>Severity Code</strong></td>
23+
<td>${typeof tableData.severity !== "undefined" ? severity : "NA"}</td>
24+
</tr>
25+
<tr>
26+
<td style="padding: 10px;"><strong>First Logged</strong></td>
27+
<td>${
28+
typeof tableData.firstLogged !== "undefined" ? firstLogged : "NA"
29+
}</td>
30+
</tr>
31+
<tr>
32+
<td style="padding: 10px;"><strong>Last Logged</strong></td>
33+
<td>${
34+
typeof tableData.lastLogged !== "undefined" ? lastLogged : "NA"
35+
}</td>
36+
</tr>
37+
<tr>
38+
<td style="padding: 10px;"><strong>Remedy</strong></td>
39+
<td>
40+
Please contact one of the following to facilitate issue resolution:
41+
<ul>
42+
<li>Primary: ${
43+
typeof tableData.primaryContact !== "undefined"
44+
? tableData.primaryContact
45+
: "NA"
46+
}</li>
47+
<li>Secondary: ${
48+
typeof tableData.secondaryContact !== "undefined"
49+
? tableData.secondaryContact
50+
: "NA"
51+
}</li>
52+
</ul>
53+
</td>
54+
</tr>
55+
<tr>
56+
<td style="padding: 10px;"><strong>Region</strong></td>
57+
<td>${typeof tableData.region !== "undefined" ? region : "NA"}</td>
58+
</tr>
59+
<tr>
60+
<td style="padding: 10px;"><strong>Business Unit</strong></td>
61+
<td>${
62+
typeof tableData.businessUnit !== "undefined" ? businessUnit : "NA"
63+
}</td>
64+
</tr>
65+
</tbody>
66+
</table>`;
67+
};
268

3-
const sampleOrigin = ({teamsData}) => {
4-
return {
69+
const teamsCardData = ({ data }) => {
70+
const tableString = generateJobMonitoringMessageCardTable((data = {}));
71+
const cardData = {
572
"@type": "MessageCard",
673
"@context": "http://schema.org/extensions",
7-
themeColor: "0076D7",
8-
summary: "Test Summary",
74+
summary:
75+
typeof data.monitoringName !== "undefined"
76+
? `This alert is generated by ${data.monitoringName}`
77+
: "Job Monitoring Alert",
978
sections: [
1079
{
11-
activityTitle: "Lorem ipsum dolor sit amet",
12-
activitySubtitle:
13-
"Tconsectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud",
14-
text: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.",
15-
potentialAction: [
16-
{
17-
"@type": "ActionCard",
18-
name: "Comment",
19-
inputs: [
20-
{
21-
"@type": "TextInput",
22-
id: "comment",
23-
isMultiline: true,
24-
title: "Enter your comment",
25-
},
26-
],
27-
actions: [
28-
{
29-
"@type": "HttpPOST",
30-
name: "OK",
31-
target: "http://...",
32-
},
33-
],
34-
},
35-
{
36-
"@type": "ActionCard",
37-
name: "Change Status",
38-
inputs: [
39-
{
40-
"@type": "MultichoiceInput",
41-
id: "list",
42-
title: "Change the status to",
43-
isMultiSelect: "false",
44-
choices: [
45-
{ display: "In Progress", value: "in_progress" },
46-
{ display: "Done", value: "done" },
47-
],
48-
},
49-
],
50-
actions: [
51-
{
52-
"@type": "HttpPOST",
53-
name: "OK",
54-
target: "http://...",
55-
},
56-
],
57-
},
58-
],
80+
activityTitle:
81+
typeof data.monitoringName !== "undefined"
82+
? `This alert is generated by ${data.monitoringName}`
83+
: "Job Monitoring Alert",
84+
activitySubtitle: "",
85+
activityImage: "",
86+
facts: [],
87+
markdown: true,
88+
},
89+
{
90+
startGroup: true,
91+
text: tableString,
5992
},
6093
],
6194
};
95+
return cardData;
6296
};
6397

64-
module.exports = sampleOrigin;
98+
module.exports = teamsCardData;

0 commit comments

Comments
 (0)