query.editor.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <query-editor-row query-ctrl="ctrl" can-collapse="false">
  2. <div class="gf-form-inline">
  3. <div class="gf-form max-width-25">
  4. <label class="gf-form-label query-keyword width-8">
  5. Metric
  6. <label class="gf-form-label" bs-tooltip="ctrl.errors.metric" style="color: rgb(229, 189, 28)" ng-show="ctrl.errors.metric">
  7. <icon name="'exclamation-triangle'"></icon>
  8. </label>
  9. </label>
  10. <input type="text" class="gf-form-input" ng-model="ctrl.target.metric"
  11. spellcheck='false' bs-typeahead="ctrl.suggestMetrics" placeholder="metric name" data-min-length=0 data-items=100
  12. ng-blur="ctrl.targetBlur()">
  13. </input>
  14. </div>
  15. <div class="gf-form">
  16. <label class="gf-form-label query-keyword">
  17. Aggregator
  18. <a bs-tooltip="ctrl.errors.aggregator" style="color: rgb(229, 189, 28)" ng-show="ctrl.errors.aggregator">
  19. <icon name="'exclamation-triangle'"></icon>
  20. </a>
  21. </label>
  22. <div class="gf-form-select-wrapper max-width-15">
  23. <select aria-label="Metric aggregator"
  24. ng-model="ctrl.target.aggregator" class="gf-form-input"
  25. ng-options="agg for agg in ctrl.aggregators"
  26. ng-change="ctrl.targetBlur()">
  27. </select>
  28. </div>
  29. </div>
  30. <div class="gf-form max-width-20">
  31. <label class="gf-form-label query-keyword width-6">
  32. Alias:
  33. <info-popover mode="right-normal">
  34. Use patterns like $tag_tagname to replace part of the alias for a tag value
  35. </info-popover>
  36. </label>
  37. <input type="text" class="gf-form-input"
  38. ng-model="ctrl.target.alias"
  39. spellcheck='false'
  40. placeholder="series alias"
  41. data-min-length=0 data-items=100
  42. ng-blur="ctrl.targetBlur()"></input>
  43. </div>
  44. <div class="gf-form gf-form--grow">
  45. <div class="gf-form-label gf-form-label--grow"></div>
  46. </div>
  47. </div>
  48. <div class="gf-form-inline">
  49. <div class="gf-form max-width-25">
  50. <label class="gf-form-label query-keyword width-8">Down sample</label>
  51. <input type="text" class="gf-form-input gf-form-input--has-help-icon"
  52. ng-model="ctrl.target.downsampleInterval"
  53. ng-model-onblur
  54. ng-change="ctrl.targetBlur()"
  55. placeholder="interval"></input>
  56. <info-popover mode="right-absolute">
  57. blank for auto, or for example <code>1m</code>
  58. </info-popover>
  59. </div>
  60. <div class="gf-form">
  61. <label class="gf-form-label query-keyword">Aggregator</label>
  62. <div class="gf-form-select-wrapper">
  63. <select aria-label="Downsample aggregator"
  64. ng-model="ctrl.target.downsampleAggregator" class="gf-form-input"
  65. ng-options="agg for agg in ctrl.aggregators"
  66. ng-change="ctrl.targetBlur()">
  67. </select>
  68. </div>
  69. </div>
  70. <div class="gf-form" ng-if="ctrl.tsdbVersion >= 2">
  71. <label class="gf-form-label query-keyword width-6">Fill</label>
  72. <div class="gf-form-select-wrapper">
  73. <select ng-model="ctrl.target.downsampleFillPolicy" class="gf-form-input"
  74. ng-options="agg for agg in ctrl.fillPolicies"
  75. ng-change="ctrl.targetBlur()">
  76. </select>
  77. </div>
  78. </div>
  79. <gf-form-switch class="gf-form"
  80. label="Disable downsampling"
  81. label-class="query-keyword"
  82. checked="ctrl.target.disableDownsampling"
  83. on-change="ctrl.targetBlur()">
  84. </gf-form-switch>
  85. <div class="gf-form gf-form--grow">
  86. <div class="gf-form-label gf-form-label--grow"></div>
  87. </div>
  88. </div>
  89. <div class="gf-form-inline" ng-if="ctrl.tsdbVersion >= 2">
  90. <div class="gf-form">
  91. <label class="gf-form-label query-keyword width-8">
  92. Filters
  93. <info-popover mode="right-normal">
  94. Filters does not work with tags, either of the two will work but not both.
  95. </info-popover>
  96. </label>
  97. <div ng-repeat="fil in ctrl.target.filters track by $index" class="gf-form-label">
  98. {{fil.tagk}}&nbsp;=&nbsp;{{fil.type}}&#40;{{fil.filter}}&#41;&nbsp;&#44&nbsp;groupBy&nbsp;=&nbsp;{{fil.groupBy}}
  99. <a ng-click="ctrl.editFilter(fil, $index)">
  100. <icon name="'pen'"></icon>
  101. </a>
  102. <a ng-click="ctrl.removeFilter($index)">
  103. <icon name="'times'"></icon>
  104. </a>
  105. </div>
  106. <label class="gf-form-label query-keyword" ng-hide="ctrl.addFilterMode">
  107. <a ng-click="ctrl.addFilter()">
  108. <icon name="'plus'"></icon>
  109. </a>
  110. </label>
  111. </div>
  112. <div class="gf-form-inline" ng-show="ctrl.addFilterMode">
  113. <div class="gf-form">
  114. <input type="text" class="gf-form-input" spellcheck='false'
  115. bs-typeahead="ctrl.suggestTagKeys" data-min-length=0 data-items=100
  116. ng-model="ctrl.target.currentFilterKey" placeholder="key">
  117. </input>
  118. </div>
  119. <div class="gf-form">
  120. <label class="gf-form-label query-keyword">Type</label>
  121. <div class="gf-form-select-wrapper">
  122. <select ng-model="ctrl.target.currentFilterType" class="gf-form-input" ng-options="filType for filType in ctrl.filterTypes">
  123. </select>
  124. </div>
  125. </div>
  126. <div class="gf-form">
  127. <input type="text" class="gf-form-input" spellcheck='false' bs-typeahead="ctrl.suggestTagValues" data-min-length=0 data-items=100 ng-model="ctrl.target.currentFilterValue" placeholder="filter">
  128. </input>
  129. </div>
  130. <gf-form-switch class="gf-form"
  131. label="Group by"
  132. label-class="query-keyword"
  133. checked="ctrl.target.currentFilterGroupBy"
  134. on-change="ctrl.targetBlur()">
  135. </gf-form-switch>
  136. <div class="gf-form" ng-show="ctrl.addFilterMode">
  137. <label class="gf-form-label" ng-show="ctrl.errors.filters">
  138. <a bs-tooltip="ctrl.errors.filters" style="color: rgb(229, 189, 28)" >
  139. <icon name="'exclamation-triangle'"></icon>
  140. </a>
  141. </label>
  142. <label class="gf-form-label">
  143. <a ng-click="ctrl.addFilter()" ng-hide="ctrl.errors.filters">add filter</a>
  144. <a ng-click="ctrl.closeAddFilterMode()">
  145. <icon name="'times'"></icon>
  146. </a>
  147. </label>
  148. </div>
  149. </div>
  150. <div class="gf-form gf-form--grow">
  151. <div class="gf-form-label gf-form-label--grow"></div>
  152. </div>
  153. </div>
  154. <div class="gf-form-inline">
  155. <div class="gf-form">
  156. <label class="gf-form-label query-keyword width-8">
  157. Tags
  158. <info-popover mode="right-normal" ng-if="ctrl.tsdbVersion >= 2">
  159. Please use filters, tags are deprecated in opentsdb 2.2
  160. </info-popover>
  161. </label>
  162. </div>
  163. <div class="gf-form" ng-repeat="(key, value) in ctrl.target.tags track by $index" class="gf-form">
  164. <label class="gf-form-label">
  165. {{key}}&nbsp;=&nbsp;{{value}}
  166. <a ng-click="ctrl.editTag(key, value)">
  167. <icon name="'pen'"></icon>
  168. </a>
  169. <a ng-click="ctrl.removeTag(key)">
  170. <icon name="'times'"></icon>
  171. </a>
  172. </label>
  173. </div>
  174. <div class="gf-form" ng-hide="ctrl.addTagMode">
  175. <label class="gf-form-label query-keyword">
  176. <a ng-click="ctrl.addTag()"><icon name="'plus'"></icon></a>
  177. </label>
  178. </div>
  179. <div class="gf-form" ng-show="ctrl.addTagMode">
  180. <input type="text"
  181. class="gf-form-input" spellcheck='false'
  182. bs-typeahead="ctrl.suggestTagKeys" data-min-length=0 data-items=100
  183. ng-model="ctrl.target.currentTagKey" placeholder="key">
  184. </input>
  185. <input type="text" class="gf-form-input"
  186. spellcheck='false' bs-typeahead="ctrl.suggestTagValues"
  187. data-min-length=0 data-items=100 ng-model="ctrl.target.currentTagValue" placeholder="value">
  188. </input>
  189. <label class="gf-form-label" ng-show="ctrl.errors.tags">
  190. <a bs-tooltip="ctrl.errors.tags" style="color: rgb(229, 189, 28)" >
  191. <icon name="'exclamation-triangle'"></icon>
  192. </a>
  193. </label>
  194. <label class="gf-form-label" >
  195. <a ng-click="ctrl.addTag()" ng-hide="ctrl.errors.tags">add tag</a>
  196. <a ng-click="ctrl.closeAddTagMode()"><icon name="'times'" size="'sm'"></icon></a>
  197. </label>
  198. </div>
  199. <div class="gf-form gf-form--grow">
  200. <div class="gf-form-label gf-form-label--grow"></div>
  201. </div>
  202. </div>
  203. <div class="gf-form-inline">
  204. <gf-form-switch class="gf-form" label="Rate" label-class="width-8 query-keyword" checked="ctrl.target.shouldComputeRate" on-change="ctrl.targetBlur()">
  205. </gf-form-switch>
  206. <gf-form-switch ng-hide="!ctrl.target.shouldComputeRate"
  207. class="gf-form" label="Counter" label-class="query-keyword" checked="ctrl.target.isCounter" on-change="ctrl.targetBlur()">
  208. </gf-form-switch>
  209. <div class="gf-form" ng-hide="!ctrl.target.isCounter || !ctrl.target.shouldComputeRate">
  210. <label class="gf-form-label query-keyword">Counter Max</label>
  211. <input type="text" class="gf-form-input"
  212. ng-disabled="!ctrl.target.shouldComputeRate"
  213. ng-model="ctrl.target.counterMax" spellcheck='false'
  214. placeholder="max value" ng-model-onblur
  215. ng-blur="ctrl.targetBlur()">
  216. </input>
  217. <label class="gf-form-label query-keyword">Reset Value</label>
  218. <input type="text" class="tight-form-input input-small"
  219. ng-disabled="!ctrl.target.shouldComputeRate"
  220. ng-model="ctrl.target.counterResetValue" spellcheck='false'
  221. placeholder="reset value" ng-model-onblur
  222. ng-blur="ctrl.targetBlur()">
  223. </input>
  224. </div>
  225. <div class="gf-form" ng-if="ctrl.tsdbVersion > 2">
  226. <gf-form-switch class="gf-form" label="Explicit tags" label-class="width-8 query-keyword" checked="ctrl.target.explicitTags" on-change="ctrl.targetBlur()">
  227. </gf-form-switch>
  228. </div>
  229. <div class="gf-form gf-form--grow">
  230. <div class="gf-form-label gf-form-label--grow"></div>
  231. </div>
  232. </div>
  233. </query-editor-row>