definition_details.hbs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. {{!
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. }}
  18. {{#if view.isLoaded}}
  19. <div id="alert-definition-details">
  20. <div class="row-fluid">
  21. {{! Left column }}
  22. <div class="span9">
  23. <div class="definition-name row-fluid">
  24. {{#if controller.editing.label.isEditing}}
  25. <div {{bindAttr class="controller.editing.label.isError:error :span5 :name-text-field :control-group"}}>
  26. {{view Em.TextField valueBinding="controller.editing.label.value"}}
  27. </div>
  28. <div class="edit-buttons">
  29. <button {{action cancelEdit controller.editing.label target="controller"}} class="btn">{{t common.cancel}}</button>
  30. <button {{bindAttr disabled="controller.editing.label.isError"}} {{action saveEdit controller.editing.label target="controller"}}
  31. class="btn btn-primary">{{t common.save}}
  32. </button>
  33. </div>
  34. {{else}}
  35. <span>
  36. {{controller.content.label}}
  37. </span>
  38. {{/if}}
  39. {{#unless controller.editing.label.isEditing}}
  40. {{#isAccessible ADMIN}}
  41. <a {{action edit controller.editing.label target="controller"}} class="edit-description-button"><i class="icon-pencil"></i></a>
  42. {{/isAccessible}}
  43. {{/unless}}
  44. </div>
  45. <div><a href="javascript:void(null)" data-toggle="modal" {{action back}}><i class="icon-arrow-left"></i>&nbsp;{{t common.back}}</a></div>
  46. <div class="definition-details-block">
  47. <strong>{{t common.description}}</strong>
  48. {{#unless controller.editing.description.isEditing}}
  49. {{#isAccessible ADMIN}}
  50. <a {{action edit controller.editing.description target="controller"}} class="pull-right edit-link">
  51. <strong>{{t common.edit}}</strong>
  52. </a>
  53. {{/isAccessible}}
  54. {{/unless}}
  55. <hr>
  56. {{#if controller.editing.description.isEditing}}
  57. <div {{bindAttr class="controller.editing.description.isError:error :control-group :text-area-edit"}}>
  58. {{view Em.TextArea valueBinding="controller.editing.description.value"}}
  59. </div>
  60. <div class="edit-buttons">
  61. <button {{action cancelEdit controller.editing.description target="controller"}} class="btn">{{t common.cancel}}</button>
  62. <button {{bindAttr disabled="controller.editing.description.isError"}} {{action saveEdit controller.editing.description target="controller"}}
  63. class="btn btn-primary">{{t common.save}}
  64. </button>
  65. </div>
  66. {{else}}
  67. <div class="multiline-text">
  68. {{controller.content.description}}
  69. </div>
  70. {{/if}}
  71. </div>
  72. <div class="definition-details-block">
  73. <strong>{{t common.configuration}}</strong>
  74. {{#isAccessible ADMIN}}
  75. {{#unless App.router.mainAlertDefinitionConfigsController.canEdit}}
  76. <a {{action editConfigs target="App.router.mainAlertDefinitionConfigsController"}} class="pull-right edit-link">
  77. <strong>{{t common.edit}}</strong>
  78. </a>
  79. {{/unless}}
  80. {{/isAccessible}}
  81. <hr>
  82. {{view App.AlertDefinitionConfigsView contentBinding="view.controller.content" alertDefinitionTypeBinding="view.controller.content.type" canEdit=false}}
  83. {{#if App.router.mainAlertDefinitionConfigsController.canEdit}}
  84. <div class="edit-buttons">
  85. <button {{action cancelEditConfigs target="App.router.mainAlertDefinitionConfigsController"}} class="btn">{{t common.cancel}}</button>
  86. <button {{bindAttr disabled="controller.editing.thresholds.isError"}} {{action saveConfigs target="App.router.mainAlertDefinitionConfigsController"}}
  87. class="btn btn-primary">{{t common.save}}
  88. </button>
  89. </div>
  90. {{/if}}
  91. </div>
  92. </div>
  93. {{! Left column end }}
  94. {{! Right column }}
  95. <div class="span3 right-column">
  96. <div class="status">
  97. {{{controller.content.status}}}
  98. </div>
  99. <div class="buttons-block">
  100. {{#isAccessible ADMIN}}
  101. {{#if controller.content.enabled}}
  102. <button {{action toggleState target="controller"}} class="btn btn-danger"><i
  103. class="icon-power-off"></i>&nbsp;{{t alerts.definition.details.disable}}</button>
  104. {{else}}
  105. <button {{action toggleState target="controller"}} class="btn btn-success"><i
  106. class="icon-power-off"></i>&nbsp;{{t alerts.definition.details.enable}}</button>
  107. {{/if}}
  108. <button {{action deleteAlertDefinition target="controller"}} class="btn"><i
  109. class="icon-trash"></i>&nbsp;{{t common.delete}}</button>
  110. {{/isAccessible}}
  111. </div>
  112. <div class="properties-list">
  113. {{#if controller.content.service.displayName}}
  114. <div class="row-fluid">
  115. <div class="span4 property-name">{{t common.service}}:</div>
  116. <div class="span8"><span>{{controller.content.service.displayName}}</span></div>
  117. </div>
  118. {{/if}}
  119. {{#if controller.content.componentNameFormatted}}
  120. <div class="row-fluid">
  121. <div class="span4 property-name">{{t common.component}}:</div>
  122. <div class="span8">{{controller.content.componentNameFormatted}}</div>
  123. </div>
  124. {{/if}}
  125. <div class="row-fluid">
  126. <div class="span4 property-name">{{t common.type}}:</div>
  127. <div class="span8"> {{controller.content.type}}</div>
  128. </div>
  129. {{#if controller.groupsList.length}}
  130. <div class="row-fluid">
  131. <div class="span4 property-name">{{t alerts.definition.details.groups}}:</div>
  132. <div class="span8">
  133. <ul>
  134. {{#each groupName in controller.groupsList}}
  135. <li>{{groupName}}</li>
  136. {{/each}}
  137. </ul>
  138. </div>
  139. </div>
  140. {{/if}}
  141. <div class="row-fluid">
  142. <div class="span4 property-name">{{t alerts.table.header.lastTrigger}}:</div>
  143. <div class="span8">{{controller.content.lastTriggeredFormatted}}</div>
  144. </div>
  145. </div>
  146. </div>
  147. </div>
  148. {{! Right column end }}
  149. {{! List of alerts }}
  150. <div class="definition-details-block">
  151. <span>
  152. <strong>{{t alerts.definition.details.instances}}</strong>
  153. </span>
  154. <hr>
  155. <div>
  156. {{#if App.router.mainAlertInstancesController.isLoaded}}
  157. <table class="table table-bordered table-striped alerts-table" id="alert-instances-table">
  158. <thead>
  159. <tr>
  160. <th class="first">{{t common.status}}</th>
  161. <th>{{t alerts.definition.details.serviceHost}}</th>
  162. <th>{{t alerts.table.header.lastTriggered}}</th>
  163. <th>{{t alerts.definition.details.24-hour}}</th>
  164. <th>{{t alerts.definition.details.notification}}</th>
  165. </tr>
  166. </thead>
  167. <tbody>
  168. {{#if view.pageContent}}
  169. {{#each instance in view.pageContent}}
  170. <tr>
  171. <td class="first">{{{instance.status}}}</td>
  172. <td>
  173. <a {{action goToService instance.service target="controller"}} href="#">{{instance.service.displayName}}</a>
  174. {{#if instance.host.hostName}}
  175. {{#if instance.service.displayName}}
  176. &nbsp;/&nbsp;
  177. {{/if}}
  178. <a {{action goToHostAlerts instance.host target="controller"}} href="#">{{instance.host.hostName}}</a>
  179. {{/if}}
  180. </td>
  181. <td><time class="timeago" {{bindAttr data-original-title="instance.lastTriggered"}}>{{instance.lastTriggeredAgoFormatted}}</time></td>
  182. <td>{{view view.lastDayCount hostBinding="instance.host"}}</td>
  183. <td class="last">Admins</td>
  184. </tr>
  185. {{/each}}
  186. {{else}}
  187. <tr>
  188. <td colspan="5">
  189. {{t alerts.definition.details.noAlerts}}
  190. </td>
  191. </tr>
  192. {{/if}}
  193. </tbody>
  194. </table>
  195. {{else}}
  196. <div class="spinner"></div>
  197. {{/if}}
  198. </div>
  199. </div>
  200. {{! List of alerts end }}
  201. </div>
  202. {{else}}
  203. <div class="spinner"></div>
  204. {{/if}}