template.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. {{template "main" .}}
  2. <!-- Navbar -->
  3. <nav class="main-header navbar navbar-expand navbar-white navbar-light">
  4. <!-- Left navbar links -->
  5. <ul class="navbar-nav">
  6. <li class="nav-item">
  7. <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
  8. </li>
  9. <li class="nav-item d-none d-sm-inline-block">
  10. <a href="/template" class="nav-link">模版管理</a>
  11. </li>
  12. </ul>
  13. </nav>
  14. <!-- /.navbar -->
  15. <!-- Content Wrapper. Contains page content -->
  16. <div class="content-wrapper">
  17. <!-- Content Header (Page header) -->
  18. <section class="content-header">
  19. <div class="container-fluid">
  20. <div class="row mb-2">
  21. <div class="col-sm-6">
  22. <h1>自定义模版管理</h1>
  23. </div>
  24. <div class="col-sm-6">
  25. <ol class="breadcrumb float-sm-right">
  26. <a href="/template/add" class="btn btn-default bg-warning">
  27. <i class="fas fa-file mr-2"></i> 添加模版
  28. </a>
  29. </ol>
  30. </div>
  31. </div>
  32. </div><!-- /.container-fluid -->
  33. </section>
  34. <!-- Main content -->
  35. <section class="content">
  36. <!-- Default box -->
  37. <div class="card">
  38. <div class="card-header">
  39. <h3 class="card-title"></h3>
  40. <div class="card-tools">
  41. <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
  42. <i class="fas fa-minus"></i>
  43. </button>
  44. <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
  45. <i class="fas fa-times"></i>
  46. </button>
  47. </div>
  48. </div>
  49. <div class="card-body">
  50. <table class="table table-hover">
  51. <thead>
  52. <tr>
  53. <!--<th>Id</th>-->
  54. <th>名称</th>
  55. <th>模版类型</th>
  56. <th>模版用途</th>
  57. <th>路径</th>
  58. <th>创建时间</th>
  59. <!--<th>模版测试</th>-->
  60. <th>模版编辑</th>
  61. <th>模版删除</th>
  62. </tr>
  63. </thead>
  64. <tbody id="tpllist" >
  65. {{range .Template}}
  66. <tr>
  67. <!--<th>{{.Id}}</th>-->
  68. <th>{{.Tplname}}</th>
  69. <th>
  70. {{if eq .Tpltype "dd"}}钉钉{{end}}
  71. {{if eq .Tpltype "wx"}}企业微信{{end}}
  72. {{if eq .Tpltype "workwechat"}}企业微信应用{{end}}
  73. {{if eq .Tpltype "fs"}}飞书{{end}}
  74. {{if eq .Tpltype "webhook"}}WebHook{{end}}
  75. {{if eq .Tpltype "txdx"}}腾讯云短信{{end}}
  76. {{if eq .Tpltype "txdh"}}腾讯云电话{{end}}
  77. {{if eq .Tpltype "alydx"}}阿里云短信{{end}}
  78. {{if eq .Tpltype "alydh"}}阿里云电话{{end}}
  79. {{if eq .Tpltype "hwdx"}}华为云短信{{end}}
  80. {{if eq .Tpltype "bddx"}}百度云短信{{end}}
  81. {{if eq .Tpltype "rlydh"}}容联云电话{{end}}
  82. {{if eq .Tpltype "7moordx"}}七陌短信{{end}}
  83. {{if eq .Tpltype "7moordh"}}七陌语音电话{{end}}
  84. {{if eq .Tpltype "email"}}Email{{end}}
  85. {{if eq .Tpltype "tg"}}Telegram{{end}}
  86. {{if eq .Tpltype "rl"}}百度Hi(如流){{end}}
  87. {{if eq .Tpltype "bark"}}Bark(iPhone推送){{end}}
  88. {{if eq .Tpltype "voice"}}语音播报{{end}}
  89. {{if eq .Tpltype "fsapp"}}飞书机器人应用{{end}}
  90. </th>
  91. <th>{{if eq .Tpluse "ALiYun"}}阿里云-云监控{{else}}{{.Tpluse}}{{end}}</th>
  92. <th>
  93. /prometheusalert?type={{.Tpltype}}&tpl={{.Tplname}}{{if eq .Tpluse "ALiYun"}}&from=aliyun{{end}}{{if eq .Tpltype "dd"}}&ddurl=钉钉机器人地址&at=18888888888{{else}}{{if eq .Tpltype "wx"}}&wxurl=微信机器人地址&at=zhangsan{{else}}{{if eq .Tpltype "fs"}}&fsurl=飞书机器人地址&at=zhangsan@xxx.com{{else}}{{if eq .Tpltype "webhook"}}&webhookurl=WebHook地址{{else}}{{if eq .Tpltype "email"}}&email=Email地址{{else}}{{if eq .Tpltype "rl"}}&groupid=百度Hi(如流)群id{{else}}{{if eq .Tpltype "workwechat"}}&wxuser=接受用户&wxparty=接受部门&wxtag=接受标签{{else}}{{if eq .Tpltype "fsapp"}}&at=飞书 用户open_id、user_id、union_ids、部门open_department_id{{else}}{{if eq .Tpltype "voice"}}{{else}}&phone=手机号{{end}}{{end}}{{end}}{{end}}{{end}}{{end}}{{end}}{{end}}{{end}}
  94. </th>
  95. <th>{{.Created.Format "2006-01-02 15:04:05 UTC"}}</th>
  96. <!--<th><a href="/template/test?id={{.Id}}" class="glyphicon glyphicon-send"></a></th>-->
  97. <th>
  98. <a href="/template/edit?id={{.Id}}" class="btn btn-default bg-success">
  99. <i class="fa fa-edit"></i> Edit
  100. </a>
  101. </th>
  102. <th>
  103. <a href="javascript:if(confirm('确实要删除吗?'))location='/template/del?id={{.Id}}'" class="btn btn-default bg-danger">
  104. <i class="fa fa-trash"></i> Delete
  105. </a>
  106. </th>
  107. </tr>
  108. {{end}}
  109. </tbody>
  110. </table>
  111. </div>
  112. <!-- /.card-body -->
  113. <div class="card-footer">
  114. 特别提醒:自定义模板仅支持 /prometheusalert 接口,其他接口均为固定模版接口,不支持自定义模板
  115. </div>
  116. <!-- /.card-footer-->
  117. </div>
  118. <!-- /.card -->
  119. </section>
  120. <!-- /.content -->
  121. </div>
  122. <!-- /.content-wrapper -->
  123. {{template "endhtml"}}
  124. <script>
  125. var td_array=new Array();
  126. var td_length=document.getElementById("tpllist");
  127. var myurl=window.location.origin;
  128. for(var m=0;m<td_length.rows.length;m++){
  129. td_length.rows[m].cells[3].innerHTML=(myurl+td_length.rows[m].cells[3].innerHTML).replace(/\s/gi,'');
  130. //uresturl.innerHTML=myurl+uresturl.innerHTML;
  131. }
  132. //uresturl.innerHTML=myurl+uresturl.innerHTML;
  133. //console.log(uresturl.innerHTML);
  134. </script>
  135. {{template "jshtml"}}