mirror of
https://github.com/nttgin/BGPalerter.git
synced 2024-05-19 06:50:08 +00:00
fixed bug with default user group name
This commit is contained in:
@@ -107,7 +107,7 @@ export default class ReportAlerta extends Report {
|
||||
if (this.enabled){
|
||||
let groups = content.data.map(i => i.matchedRule.group).filter(i => i != null);
|
||||
|
||||
groups = (groups.length) ? [...new Set(groups)] : [this.getUserGroup("default")];
|
||||
groups = (groups.length) ? [...new Set(groups)] : ["default"];
|
||||
|
||||
for (let group of groups) {
|
||||
const url = this.getUserGroup(group);
|
||||
|
@@ -63,7 +63,7 @@ export default class ReportEmail extends Report {
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(this.templates).length) {
|
||||
if (Object.keys(this.templates).length === 0) {
|
||||
this.enabled = false;
|
||||
this.logger.log({
|
||||
level: 'error',
|
||||
@@ -148,7 +148,6 @@ export default class ReportEmail extends Report {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -93,7 +93,7 @@ export default class ReportHTTP extends Report {
|
||||
if (this.enabled) {
|
||||
let groups = content.data.map(i => i.matchedRule.group).filter(i => i != null);
|
||||
|
||||
groups = (groups.length) ? [...new Set(groups)] : [this.getUserGroup("default")];
|
||||
groups = (groups.length) ? [...new Set(groups)] : ["default"];
|
||||
|
||||
for (let group of groups) {
|
||||
this._sendHTTPMessage(group, channel, content);
|
||||
|
@@ -101,16 +101,14 @@ export default class ReportPullAPI extends Report {
|
||||
}
|
||||
|
||||
getUserGroup = (group) => {
|
||||
const groups = this.params.hooks || this.params.userGroups;
|
||||
|
||||
return groups[group] || groups["default"];
|
||||
return null;
|
||||
};
|
||||
|
||||
report = (channel, content) => {
|
||||
if (this.enabled) {
|
||||
let groups = content.data.map(i => i.matchedRule.group).filter(i => i != null);
|
||||
|
||||
groups = (groups.length) ? [...new Set(groups)] : [this.getUserGroup("default")];
|
||||
groups = (groups.length) ? [...new Set(groups)] : ["default"];
|
||||
content.hash = md5(content.id);
|
||||
|
||||
for (let group of groups) {
|
||||
|
@@ -56,7 +56,7 @@ export default class ReportWebex extends Report {
|
||||
_sendWebexMessage = (url, message, content) => {
|
||||
|
||||
this.axios({
|
||||
url: url,
|
||||
url,
|
||||
method: "POST",
|
||||
resposnseType: "json",
|
||||
data: {
|
||||
@@ -75,11 +75,12 @@ export default class ReportWebex extends Report {
|
||||
if (this.enabled){
|
||||
let groups = content.data.map(i => i.matchedRule.group).filter(i => i != null);
|
||||
|
||||
groups = (groups.length) ? [...new Set(groups)] : [this.getUserGroup("default")];
|
||||
groups = (groups.length) ? [...new Set(groups)] : ["default"];
|
||||
|
||||
for (let group of groups) {
|
||||
if (this.params.hooks[group]) {
|
||||
this._sendWebexMessage(this.params.hooks[group], message, content);
|
||||
const url = this.getUserGroup(group);
|
||||
if (url) {
|
||||
this._sendWebexMessage(url, message, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user