column_options.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <div class="edit-tab-content" ng-repeat="style in editor.panel.styles">
  2. <div class="section gf-form-group">
  3. <h5 class="section-heading">Options</h5>
  4. <div class="gf-form-inline">
  5. <div class="gf-form">
  6. <label class="gf-form-label width-12">Apply to columns named</label>
  7. <input type="text" placeholder="Name or regex" class="gf-form-input width-13" ng-model="style.pattern" bs-tooltip="'Specify regex using /my.*regex/ syntax'"
  8. bs-typeahead="editor.getColumnNames" ng-blur="editor.render()" data-min-length=0 data-items=100 ng-model-onblur
  9. data-placement="right">
  10. </div>
  11. </div>
  12. <div class="gf-form" ng-if="style.type !== 'hidden'">
  13. <label class="gf-form-label width-12">Column Header</label>
  14. <input type="text" class="gf-form-input width-12" ng-model="style.alias" ng-change="editor.render()" ng-model-onblur placeholder="Override header label">
  15. </div>
  16. <gf-form-switch class="gf-form" label-class="width-12" label="Render value as link" checked="style.link" change="editor.render()"></gf-form-switch>
  17. </div>
  18. <div class="section gf-form-group">
  19. <h5 class="section-heading">Type</h5>
  20. <div class="gf-form">
  21. <label class="gf-form-label width-10">Type</label>
  22. <div class="gf-form-select-wrapper width-16">
  23. <select class="gf-form-input" ng-model="style.type" ng-options="c.value as c.text for c in editor.columnTypes" ng-change="editor.render()"></select>
  24. </div>
  25. </div>
  26. <div class="gf-form" ng-if="style.type === 'date'">
  27. <label class="gf-form-label width-10">Date Format</label>
  28. <gf-form-dropdown model="style.dateFormat" css-class="gf-form-input width-16" lookup-text="true"
  29. get-options="editor.dateFormats" on-change="editor.render()" allow-custom="true">
  30. </gf-form-dropdown>
  31. </div>
  32. <div ng-if="style.type === 'string'">
  33. <gf-form-switch class="gf-form" label-class="width-10" ng-if="style.type === 'string'" label="Sanitize HTML" checked="style.sanitize"
  34. change="editor.render()"></gf-form-switch>
  35. </div>
  36. <div ng-if="style.type === 'string'">
  37. <gf-form-switch class="gf-form" label-class="width-10" ng-if="style.type === 'string'" label="Preserve Formatting" checked="style.preserveFormat"
  38. change="editor.render()"></gf-form-switch>
  39. </div>
  40. <div ng-if="style.type === 'number'">
  41. <div class="gf-form">
  42. <label class="gf-form-label width-10">Unit</label>
  43. <div class="gf-form-dropdown-typeahead width-16" ng-model="style.unit" dropdown-typeahead2="editor.unitFormats" dropdown-typeahead-on-select="editor.setUnitFormat(style, $subItem)"></div>
  44. </div>
  45. <div class="gf-form">
  46. <label class="gf-form-label width-10">Decimals</label>
  47. <input type="number" class="gf-form-input width-4" data-placement="right" ng-model="style.decimals" ng-change="editor.render()"
  48. ng-model-onblur>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="section gf-form-group" ng-if="style.type === 'string'">
  53. <h5 class="section-heading">Value Mappings</h5>
  54. <div class="editor-row">
  55. <div class="gf-form-group">
  56. <div class="gf-form">
  57. <span class="gf-form-label">
  58. Type
  59. </span>
  60. <div class="gf-form-select-wrapper">
  61. <select class="gf-form-input" ng-model="style.mappingType"
  62. ng-options="c.value as c.text for c in editor.mappingTypes" ng-change="editor.render()"></select>
  63. </div>
  64. </div>
  65. <div class="gf-form-group" ng-if="style.mappingType==1">
  66. <div class="gf-form" ng-repeat="map in style.valueMaps">
  67. <span class="gf-form-label">
  68. <i class="fa fa-remove pointer" ng-click="editor.removeValueMap(style, $index)"></i>
  69. </span>
  70. <input type="text" class="gf-form-input max-width-6" ng-model="map.value" placeholder="Value" ng-blur="editor.render()">
  71. <label class="gf-form-label">
  72. <i class="fa fa-arrow-right"></i>
  73. </label>
  74. <input type="text" class="gf-form-input max-width-8" ng-model="map.text" placeholder="Text" ng-blur="editor.render()">
  75. </div>
  76. <div class="gf-form">
  77. <label class="gf-form-label">
  78. <a class="pointer" ng-click="editor.addValueMap(style)"><i class="fa fa-plus"></i></a>
  79. </label>
  80. </div>
  81. </div>
  82. <div class="gf-form-group" ng-if="style.mappingType==2">
  83. <div class="gf-form" ng-repeat="rangeMap in style.rangeMaps">
  84. <span class="gf-form-label">
  85. <i class="fa fa-remove pointer" ng-click="editor.removeRangeMap(style, $index)"></i>
  86. </span>
  87. <span class="gf-form-label">From</span>
  88. <input type="text" ng-model="rangeMap.from" class="gf-form-input max-width-6" ng-blur="editor.render()">
  89. <span class="gf-form-label">To</span>
  90. <input type="text" ng-model="rangeMap.to" class="gf-form-input max-width-6" ng-blur="editor.render()">
  91. <span class="gf-form-label">Text</span>
  92. <input type="text" ng-model="rangeMap.text" class="gf-form-input max-width-8" ng-blur="editor.render()">
  93. </div>
  94. <div class="gf-form">
  95. <label class="gf-form-label">
  96. <a class="pointer" ng-click="editor.addRangeMap(style)"><i class="fa fa-plus"></i></a>
  97. </label>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="section gf-form-group" ng-if="['number', 'string'].indexOf(style.type) !== -1">
  104. <h5 class="section-heading">Thresholds</h5>
  105. <div class="gf-form">
  106. <label class="gf-form-label width-8">Thresholds
  107. <tip>Comma separated values</tip>
  108. </label>
  109. <input type="text" class="gf-form-input width-10" ng-model="style.thresholds" placeholder="50,80" ng-blur="editor.render()"
  110. array-join>
  111. </div>
  112. <div class="gf-form">
  113. <label class="gf-form-label width-8">Color Mode</label>
  114. <div class="gf-form-select-wrapper width-10">
  115. <select class="gf-form-input" ng-model="style.colorMode" ng-options="c.value as c.text for c in editor.colorModes" ng-change="editor.render()"></select>
  116. </div>
  117. </div>
  118. <div class="gf-form">
  119. <label class="gf-form-label width-8">Colors</label>
  120. <span class="gf-form-label">
  121. <color-picker color="style.colors[0]" onChange="editor.onColorChange($index, 0)"></color-picker>
  122. </span>
  123. <span class="gf-form-label">
  124. <color-picker color="style.colors[1]" onChange="editor.onColorChange($index, 1)"></color-picker>
  125. </span>
  126. <span class="gf-form-label">
  127. <color-picker color="style.colors[2]" onChange="editor.onColorChange($index, 2)"></color-picker>
  128. </span>
  129. <div class="gf-form-label">
  130. <a class="pointer" ng-click="editor.invertColorOrder($index)">Invert</a>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="section gf-form-group" ng-if="style.link">
  135. <h5 class="section-heading">Link</h5>
  136. <div class="gf-form">
  137. <label class="gf-form-label width-9">
  138. Url
  139. <info-popover mode="right-normal">
  140. <p>Specify an URL (relative or absolute)</p>
  141. <span>
  142. Use special variables to specify cell values:
  143. <br>
  144. <em>${__cell}</em> refers to current cell value
  145. <br>
  146. <em>${__cell_n}</em> refers to Nth column value in current row. Column indexes are started from 0. For instance,
  147. <em>${__cell_1}</em> refers to second column's value.
  148. <br>
  149. <em>${__cell:raw}</em> syntax. By default values are URI encoded. If the value is a complete URL you can disable all encoding using
  150. </span>
  151. </info-popover>
  152. </label>
  153. <input type="text" class="gf-form-input width-29" ng-model="style.linkUrl" ng-blur="editor.render()" ng-model-onblur data-placement="right">
  154. </div>
  155. <div class="gf-form">
  156. <label class="gf-form-label width-9">
  157. Tooltip
  158. <info-popover mode="right-normal">
  159. <p>Specify text for link tooltip.</p>
  160. <span>
  161. This title appears when user hovers pointer over the cell with link. Use the same variables as for URL.
  162. </span>
  163. </info-popover>
  164. </label>
  165. <input type="text" class="gf-form-input width-29" ng-model="style.linkTooltip" ng-blur="editor.render()" ng-model-onblur
  166. data-placement="right">
  167. </div>
  168. <gf-form-switch class="gf-form" label-class="width-9" label="Open in new tab" checked="style.linkTargetBlank"></gf-form-switch>
  169. </div>
  170. <div class="clearfix"></div>
  171. <div class="gf-form-group">
  172. <button class="btn btn-danger btn-small" ng-click="editor.removeColumnStyle(style)">
  173. <i class="fa fa-trash"></i> Remove Rule
  174. </button>
  175. </div>
  176. <hr>
  177. </div>
  178. <div class="gf-form-button-row">
  179. <button class="btn btn-inverse" ng-click="editor.addColumnStyle()">
  180. <i class="fa fa-plus"></i>&nbsp;Add column style
  181. </button>
  182. </div>