column_options.html 9.5 KB

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