Skip to content

Commit

Permalink
fix: locale mail support structural fixes,mail processing template an…
Browse files Browse the repository at this point in the history
…d rendering RFT
  • Loading branch information
zakhaev26 committed Jul 16, 2024
1 parent c4d1d2a commit 0dfeaef
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 161 deletions.
12 changes: 1 addition & 11 deletions src/processors/processMails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,4 @@ const subjectBuilder = <T extends string = string>(alertType: T) : string => {
default:
return 'Alert: Threshold Exceeded';
}
};

/**
const data = {
cumulativeOrSpikeVal,
threshold,
component,
incidentTime,
alertType
};
*/
};
74 changes: 0 additions & 74 deletions src/templ-generator/alerts/en/cumulativeAlert.html.twig

This file was deleted.

74 changes: 0 additions & 74 deletions src/templ-generator/alerts/en/spikeAlert.html.twig

This file was deleted.

75 changes: 75 additions & 0 deletions src/templ-generator/alerts/en/spikeOrCumulativeAlert.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Alert Notification</title>
<style>
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
background-color: #111;
margin: 0;
padding: 0;
color: #fff;
}
.container {
max-width: 600px;
margin: 20px auto;
background-color: #1a1a1a;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
.header {
background-color: #000;
color: #fff;
padding: 10px;
text-align: center;
border-radius: 8px 8px 0 0;
}
.content {
padding: 20px;
}
.content p {
margin: 0 0 15px;
}
.footer {
text-align: center;
padding: 10px;
font-size: 12px;
color: #888;
}
.button {
background-color: #007bff;
color: #fff;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
border-radius: 5px;
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>WatchdogCloud Alert</h1>
</div>
<div class="content">
<p>Dear recipient,</p>
<p>This is to notify you that the <strong>{{ component }}</strong> has exceeded the defined threshold.</p>
<p><strong>Alert Type:</strong> {{ alertType }}</p>
<p><strong>Component:</strong> {{ component }}</p>
<p><strong>Value:</strong> {{ cumulativeOrSpikeVal }}</p>
<p><strong>Threshold:</strong> {{ threshold }}</p>
<p><strong>Incident Time:</strong> {{ incidentTime }}</p>
<p>Please take the necessary actions to resolve this issue.</p>
<p>Sent from WatchdogCloud.</p>
<a href="https://your-action-link.com" class="button">Take Action</a>
</div>
<div class="footer">
<p>&copy; {{ "now"|date("Y") }} WatchdogCloud - A Free Software.</p>
</div>
</div>
</body>
</html>
3 changes: 2 additions & 1 deletion src/templ-generator/alerts/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Twig from 'twig';
import LocaleEnum from '../../constants/locales-support';
// import fs from 'fs';

// require.extensions['.twig'] = function (module, filename) {
Expand Down Expand Up @@ -90,7 +91,7 @@ const en = `<!DOCTYPE html>


export default {
en: Twig.twig({
[LocaleEnum.EN]: Twig.twig({
data: en,
}),
// more locales...
Expand Down
3 changes: 2 additions & 1 deletion src/templ-generator/forgotPass/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Twig from 'twig';
import LocaleEnum from '../../constants/locales-support';
// import fs from 'fs';

// require.extensions['.twig'] = function (module, filename) {
Expand Down Expand Up @@ -90,7 +91,7 @@ const en = `<!DOCTYPE html>


export default {
en: Twig.twig({
[LocaleEnum.EN]: Twig.twig({
data: en,
}),
// more locales...
Expand Down

0 comments on commit 0dfeaef

Please sign in to comment.