column_options.html 8.9 KB

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