editor.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <div ng-controller="AnnotationsEditorCtrl">
  2. <div class="page-action-bar">
  3. <h3 class="dashboard-settings__header">
  4. <a ng-click="ctrl.backToList()">Annotations</a>
  5. <span ng-show="ctrl.mode === 'new'">&gt; New</span>
  6. <span ng-show="ctrl.mode === 'edit'">&gt; Edit</span>
  7. </h3>
  8. <div class="page-action-bar__spacer"></div>
  9. <a
  10. type="button"
  11. class="btn btn-primary"
  12. ng-click="ctrl.setupNew();"
  13. ng-if="ctrl.annotations.length > 1"
  14. ng-hide="ctrl.mode === 'edit' || ctrl.mode === 'new'">
  15. New
  16. </a
  17. >
  18. </div>
  19. <div ng-if="ctrl.mode === 'list'">
  20. <table class="filter-table filter-table--hover">
  21. <thead>
  22. <tr>
  23. <th>Query name</th>
  24. <th>Data source</th>
  25. <th colspan="3"></th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. <tr ng-repeat="annotation in ctrl.annotations track by annotation.name">
  30. <td style="width:90%" ng-hide="annotation.builtIn" class="pointer" ng-click="ctrl.edit(annotation)">
  31. <i class="fa fa-comment" style="color:{{ annotation.iconColor }}"></i> &nbsp;
  32. {{ annotation.name }}
  33. </td>
  34. <td style="width:90%" ng-show="annotation.builtIn" class="pointer" ng-click="ctrl.edit(annotation)">
  35. <i class="gicon gicon-annotation"></i> &nbsp;
  36. <em class="muted">{{ annotation.name }} (Built-in)</em>
  37. </td>
  38. <td class="pointer" ng-click="ctrl.edit(annotation)">
  39. {{ annotation.datasource || 'Default' }}
  40. </td>
  41. <td style="width: 1%">
  42. <i ng-click="ctrl.move($index,-1)" ng-hide="$first" class="pointer fa fa-arrow-up"></i>
  43. </td>
  44. <td style="width: 1%">
  45. <i ng-click="ctrl.move($index,1)" ng-hide="$last" class="pointer fa fa-arrow-down"></i>
  46. </td>
  47. <td style="width: 1%">
  48. <a
  49. ng-click="ctrl.removeAnnotation(annotation)"
  50. class="btn btn-danger btn-small"
  51. ng-hide="annotation.builtIn"
  52. >
  53. <i class="fa fa-remove"></i>
  54. </a>
  55. </td>
  56. </tr>
  57. </tbody>
  58. </table>
  59. <!-- empty list cta, there is always one built in query -->
  60. <div ng-if="ctrl.annotations.length === 1" class="p-t-2">
  61. <div class="empty-list-cta">
  62. <div class="empty-list-cta__title">There are no custom annotation queries added yet</div>
  63. <a ng-click="ctrl.setupNew()" class="empty-list-cta__button btn btn-large btn-primary">
  64. <i class="gicon gicon-annotation"></i>
  65. Add Annotation Query
  66. </a>
  67. <div class="grafana-info-box">
  68. <h5>What are Annotations?</h5>
  69. <p>
  70. Annotations provide a way to integrate event data into your graphs. They are visualized as vertical lines
  71. and icons on all graph panels. When you hover over an annotation icon you can get event text &amp; tags for
  72. the event. You can add annotation events directly from grafana by holding CTRL or CMD + click on graph (or
  73. drag region). These will be stored in Grafana's annotation database.
  74. </p>
  75. Checkout the
  76. <a class="external-link" target="_blank" href="http://docs.grafana.org/reference/annotations/"
  77. >Annotations documentation</a
  78. >
  79. for more information.
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="annotations-basic-settings" ng-if="ctrl.mode === 'edit' || ctrl.mode === 'new'">
  85. <div class="gf-form-group">
  86. <h5 class="section-heading">General</h5>
  87. <div class="gf-form-inline">
  88. <div class="gf-form">
  89. <span class="gf-form-label width-7">Name</span>
  90. <input type="text" class="gf-form-input width-20" ng-model="ctrl.currentAnnotation.name" placeholder="name" />
  91. </div>
  92. <div class="gf-form">
  93. <span class="gf-form-label width-7">Data source</span>
  94. <div class="gf-form-select-wrapper">
  95. <select
  96. class="gf-form-input"
  97. ng-model="ctrl.currentAnnotation.datasource"
  98. ng-options="f.name as f.name for f in ctrl.datasources"
  99. ng-change="ctrl.datasourceChanged()"
  100. ></select>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <div class="gf-form-group">
  106. <div class="gf-form-inline">
  107. <gf-form-switch class="gf-form" label="Enabled" checked="ctrl.currentAnnotation.enable" label-class="width-7">
  108. </gf-form-switch>
  109. <gf-form-switch
  110. class="gf-form"
  111. label="Hidden"
  112. tooltip="Hides the annotation query toggle from showing at the top of the dashboard"
  113. checked="ctrl.currentAnnotation.hide"
  114. label-class="width-7"
  115. >
  116. </gf-form-switch>
  117. <div class="gf-form">
  118. <label class="gf-form-label width-9">Color</label>
  119. <span class="gf-form-label">
  120. <color-picker color="ctrl.currentAnnotation.iconColor" onChange="ctrl.onColorChange"></color-picker>
  121. </span>
  122. </div>
  123. </div>
  124. </div>
  125. <h5 class="section-heading">Query</h5>
  126. <rebuild-on-change property="ctrl.currentDatasource">
  127. <plugin-component type="annotations-query-ctrl"> </plugin-component>
  128. </rebuild-on-change>
  129. <div class="gf-form">
  130. <div class="gf-form-button-row p-y-0">
  131. <button
  132. ng-show="ctrl.mode === 'new'"
  133. type="button"
  134. class="btn gf-form-button btn-primary"
  135. ng-click="ctrl.add()"
  136. >
  137. Add
  138. </button>
  139. <button ng-show="ctrl.mode === 'edit'" type="button" class="btn btn-primary pull-left" ng-click="ctrl.update()">
  140. Update
  141. </button>
  142. </div>
  143. </div>
  144. </div>
  145. </div>