Skip to content

Commit 4766dba

Browse files
committed
modify default template
1 parent f9d326b commit 4766dba

3 files changed

Lines changed: 25 additions & 7 deletions

File tree

flashduty/en/1. On-call/4. Configure On-call/4.7 Templates.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,15 @@ Below are specific instructions for each notification channel.
293293
You need to configure `Integration Center-Instant Message-Feishu` integration first to send message cards. If custom content is not set, the system default template will be used, rendering all label information:
294294

295295
```go
296-
{{if .Description}}**description** :{{toHtml .Labels.body_text .Description}}{{end}}
297-
{{if .Labels.resource}}**resource** : {{toHtml (joinAlertLabels . "resource" ", ")}}{{end}}
296+
{{if .Labels.body_text}}{{.Labels.body_text}}{{else if .Description}}{{.Description}}{{end}}
297+
{{if .Labels.resource}}**resource** : {{(joinAlertLabels . "resource" ", ")}}{{end}}
298298
{{range $k, $v := .Labels}}
299-
{{if not (in $k "resource" "body_text")}}**{{$k}}** : {{toHtml $v}}{{end}}{{end}}
299+
{{if not (in $k "resource" "body_text" "body_text_with_table")}}**{{$k}}** : {{$v}}{{end}}{{end}}
300+
{{ $root := . }}
301+
{{ range $i, $v := .Images }}
302+
{{ $transferURL := transferImage $root $v.Src }}
303+
{{ if $transferURL }}![]({{$transferURL}}){{ end }}
304+
{{ end }}
300305
```
301306

302307
As shown below:
@@ -343,6 +348,10 @@ You need to configure `Integration Center-Instant Message-Dingtalk` integration
343348
{{if .Labels.resource}}**resource** : {{toHtml (joinAlertLabels . "resource" ", ")}}{{end}}
344349
{{range $k, $v := .Labels}}
345350
{{if not (in $k "resource" "body_text")}}**{{$k}}** : {{toHtml $v}}{{end}}{{end}}
351+
{{ $root := . }}
352+
{{ range $i, $v := .Images }}
353+
{{ $imageURL := imageSrcToURL $root $v.Src }}
354+
{{ if $imageURL }}![]({{$imageURL}}){{ end }}{{ end }}
346355
```
347356
348357
As shown below:

flashduty/zh/1. On-call/3. 配置管理/4.13 通知机器人.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ FlashDuty 支持多种通知渠道,包括手机短信、邮件、语音通话
215215
/inc connect flashduty 系统会返回应用连接信息。
216216
- 复制返回信息中的 Endpoint 地址(如:https://integrations.zoom.us/chat/webhooks/incomingwebhook/V9S5as-zTXOSUdgMITNEwA),将其填写到通知渠道的 Zoom 机器人 Webhook 地址或 Token 字段中。
217217
- 复制返回信息中的 Verification Token,填写到通知渠道的 Zoom 机器人 Verify Token 字段中。
218-
- 如需使用 @ 功能,需保证 Zoom 和 Flashduty 中的邮箱一致。管理员可在 Zoom 控制后台获取 zoom 的 user_id,并在 Flashduty 的集成中心-映射数据中创建映射表(源标签填写 email,结果标签填写 zoom_jid),最后在协作空间-分派策略中关联对应 Zoom 机器人和 映射表。
218+
- 如需使用 @ 功能,管理员可在 Zoom 控制后台获取 zoom 的 user_id,并在 Flashduty 的集成中心-映射数据中创建映射表(源标签填写 email,结果标签填写 zoom_jid),最后在协作空间-分派策略中关联对应 Zoom 机器人和 映射表。
219219

220220
3. **完成集成**
221221
- 复制生成的 webhook 地址

flashduty/zh/1. On-call/3. 配置管理/4.7 配置通知模板.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,15 @@ CloseTime | int64 | 否 | 关闭时间,EndTime 为告警恢复时间,CloseTi
295295
您需要预先配置 `集成中心-即时消息-飞书` 集成,才能发送消息卡片。如果不设置自定义内容,将采用系统默认模板,渲染全部标签信息:
296296

297297
```go
298-
{{if .Description}}**description** :{{toHtml .Labels.body_text .Description}}{{end}}
299-
{{if .Labels.resource}}**resource** : {{toHtml (joinAlertLabels . "resource" ", ")}}{{end}}
298+
{{if .Labels.body_text}}{{.Labels.body_text}}{{else if .Description}}{{.Description}}{{end}}
299+
{{if .Labels.resource}}**resource** : {{(joinAlertLabels . "resource" ", ")}}{{end}}
300300
{{range $k, $v := .Labels}}
301-
{{if not (in $k "resource" "body_text")}}**{{$k}}** : {{toHtml $v}}{{end}}{{end}}
301+
{{if not (in $k "resource" "body_text" "body_text_with_table")}}**{{$k}}** : {{$v}}{{end}}{{end}}
302+
{{ $root := . }}
303+
{{ range $i, $v := .Images }}
304+
{{ $transferURL := transferImage $root $v.Src }}
305+
{{ if $transferURL }}![]({{$transferURL}}){{ end }}
306+
{{ end }}
302307
```
303308

304309
如下图所示:
@@ -345,6 +350,10 @@ CloseTime | int64 | 否 | 关闭时间,EndTime 为告警恢复时间,CloseTi
345350
{{if .Labels.resource}}**resource** : {{toHtml (joinAlertLabels . "resource" ", ")}}{{end}}
346351
{{range $k, $v := .Labels}}
347352
{{if not (in $k "resource" "body_text")}}**{{$k}}** : {{toHtml $v}}{{end}}{{end}}
353+
{{ $root := . }}
354+
{{ range $i, $v := .Images }}
355+
{{ $imageURL := imageSrcToURL $root $v.Src }}
356+
{{ if $imageURL }}![]({{$imageURL}}){{ end }}{{ end }}
348357
```
349358

350359
如下图所示:

0 commit comments

Comments
 (0)