1
0
mirror of https://github.com/nttgin/BGPalerter.git synced 2024-05-19 06:50:08 +00:00

better fix to make multiple paths handling transparent in templates

This commit is contained in:
Massimo Candela
2020-09-19 01:43:55 +02:00
parent 681b5f0046
commit 754dc3c316
3 changed files with 5 additions and 3 deletions

View File

@@ -104,7 +104,7 @@ export default class Report {
context.pathNumber = Math.min(this.params.showPaths, sortedPathIndex.length);
context.paths = sortedPathIndex
.slice(0, this.params.showPaths)
.map(i => i[0]).join("\n");
.map(i => i[0]).join(";");
} else {
context.pathNumber = "";
context.paths = "Disabled";

View File

@@ -110,7 +110,9 @@ export default class ReportEmail extends Report {
};
getEmailText = (channel, content) => {
return this.parseTemplate(this.templates[channel], this.getContext(channel, content));
const context = this.getContext(channel, content);
context.paths = context.paths.split(";").join("\n");
return this.parseTemplate(this.templates[channel], context);
};
_sendEmail = (email) => {

View File

@@ -64,7 +64,7 @@ export default class ReportHTTP extends Report {
const context = this.getContext(channel, content);
if (this.params.showPaths > 0 && context.pathNumber > 0) {
context.summary = `${context.summary}. Top ${context.pathNumber} most used AS paths: ${context.paths.split("\n").join(";")}.`;
context.summary = `${context.summary}. Top ${context.pathNumber} most used AS paths: ${context.paths}.`;
}
const blob = this.parseTemplate(this.params.templates[channel] || this.params.templates["default"], context);
this.axios({