refactor: use for-loop to replace reduce;

flashduty support uptime kuma plugin, so rename;
This commit is contained in:
guguji5 2023-09-04 10:37:36 +08:00
parent 6346e0db52
commit 7557073619
4 changed files with 5 additions and 9 deletions

View file

@ -63,12 +63,8 @@ class FlashDuty extends NotificationProvider {
resource: this.genMonitorUrl(monitorInfo), resource: this.genMonitorUrl(monitorInfo),
check: monitorInfo.name, check: monitorInfo.name,
}; };
if (monitorInfo?.tags?.length > 0) { for (let tag of monitorInfo.tags) {
labels = monitorInfo?.tags?.reduce( labels[tag.name] = tag.value;
(acc, item) => ({ ...acc,
[item.name]: item.value }),
labels
);
} }
const options = { const options = {
method: "POST", method: "POST",

View file

@ -797,7 +797,7 @@
"noGroupMonitorMsg": "Not Available. Create a Group Monitor First.", "noGroupMonitorMsg": "Not Available. Create a Group Monitor First.",
"Close": "Close", "Close": "Close",
"Request Body": "Request Body", "Request Body": "Request Body",
"wayToGetFlashDutyKey":"You can go to Channel -> (Select a Channel) -> Integrations -> Add a new integration' page, add a 'Custom Event' to get a push address, copy the Integration Key in the address. For more information, please visit", "wayToGetFlashDutyKey":"You can go to Channel -> (Select a Channel) -> Integrations -> Add a new integration' page, add a 'Uptime Kuma' to get a push address, copy the Integration Key in the address. For more information, please visit",
"FlashDuty Severity":"Severity", "FlashDuty Severity":"Severity",
"nostrRelays": "Nostr relays", "nostrRelays": "Nostr relays",
"nostrRelaysHelp": "One relay URL per line", "nostrRelaysHelp": "One relay URL per line",

View file

@ -99,6 +99,6 @@
"Add New Monitor": "新增監測器", "Add New Monitor": "新增監測器",
"Quick Stats": "綜合數據", "Quick Stats": "綜合數據",
"markdownSupported": "可以用 Markdown", "markdownSupported": "可以用 Markdown",
"wayToGetFlashDutyKey": "您可以进入 协作空间 -> (选择一个 协作空间) -> 集成数据 -> 新增一个集成 页面,添加“自定义事件”获得一个推送地址,复制地址中的 Integration Key更多信息前往{0}", "wayToGetFlashDutyKey": "您可以进入 协作空间 -> (选择一个 协作空间) -> 集成数据 -> 新增一个集成 页面,添加“Uptime Kuma”获得一个推送地址,复制地址中的 Integration Key更多信息前往{0}",
"FlashDuty Severity":"严重程度" "FlashDuty Severity":"严重程度"
} }

View file

@ -413,7 +413,7 @@
"smtpDkimheaderFieldNames": "包含在哈希计算对象内的 Header 列表(可选)", "smtpDkimheaderFieldNames": "包含在哈希计算对象内的 Header 列表(可选)",
"smtpDkimskipFields": "不包含在哈希计算对象内的 Header 列表(可选)", "smtpDkimskipFields": "不包含在哈希计算对象内的 Header 列表(可选)",
"wayToGetPagerDutyKey": "您可以在 Service -> Service Directory -> (选择一个 Service) -> Integrations -> Add integration 页面中搜索“Events API V2”以获取此 Integration Key更多信息请看{0}", "wayToGetPagerDutyKey": "您可以在 Service -> Service Directory -> (选择一个 Service) -> Integrations -> Add integration 页面中搜索“Events API V2”以获取此 Integration Key更多信息请看{0}",
"wayToGetFlashDutyKey": "您可以进入 协作空间 -> (选择一个 协作空间) -> 集成数据 -> 新增一个集成 页面,添加“自定义事件”获得一个推送地址,复制地址中的 Integration Key更多信息前往{0}", "wayToGetFlashDutyKey": "您可以进入 协作空间 -> (选择一个 协作空间) -> 集成数据 -> 新增一个集成 页面,添加“Uptime Kuma”获得一个推送地址,复制地址中的 Integration Key更多信息前往{0}",
"Integration Key": "集成密钥", "Integration Key": "集成密钥",
"Integration URL": "集成网址", "Integration URL": "集成网址",
"Auto resolve or acknowledged": "自动标记为已解决或已读", "Auto resolve or acknowledged": "自动标记为已解决或已读",