column_options.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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'" bs-typeahead="editor.getColumnNames" ng-blur="editor.render()" data-min-length=0 data-items=100 ng-model-onblur data-placement="right">
  21. </div>
  22. </div>
  23. <div class="gf-form" ng-if="style.type !== 'hidden'">
  24. <label class="gf-form-label width-13">Column Header</label>
  25. <input type="text" class="gf-form-input width-13" ng-model="style.alias" ng-change="editor.render()" ng-model-onblur placeholder="Override header label">
  26. </div>
  27. <gf-form-switch class="gf-form" label-class="width-13" label="Render value as link" checked="style.link" change="editor.render()"></gf-form-switch>
  28. </div>
  29. <div class="section gf-form-group">
  30. <h5 class="section-heading">Type</h5>
  31. <div class="gf-form">
  32. <label class="gf-form-label width-11">Type</label>
  33. <div class="gf-form-select-wrapper width-10">
  34. <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>
  35. </div>
  36. </div>
  37. <div class="gf-form" ng-if="style.type === 'date'">
  38. <label class="gf-form-label width-11">Date Format</label>
  39. <metric-segment-model property="style.dateFormat" options="editor.dateFormats" on-change="editor.render()" custom="true"></metric-segment-model>
  40. </div>
  41. <div ng-if="style.type === 'string'">
  42. <gf-form-switch class="gf-form" label-class="width-11" ng-if="style.type === 'string'" label="Sanitize HTML" checked="style.sanitize" change="editor.render()"></gf-form-switch>
  43. </div>
  44. <div ng-if="style.type === 'string'">
  45. <gf-form-switch class="gf-form" label-class="width-11" ng-if="style.type === 'string'" label="Preserve Formatting" checked="style.preserveFormat" change="editor.render()"></gf-form-switch>
  46. </div>
  47. <div ng-if="style.type === 'number'">
  48. <div class="gf-form">
  49. <label class="gf-form-label width-11">Unit</label>
  50. <div class="gf-form-dropdown-typeahead width-10" ng-model="style.unit" dropdown-typeahead2="editor.unitFormats" dropdown-typeahead-on-select="editor.setUnitFormat(style, $subItem)"></div>
  51. </div>
  52. <div class="gf-form">
  53. <label class="gf-form-label width-11">Decimals</label>
  54. <input type="number" class="gf-form-input width-4" data-placement="right" ng-model="style.decimals" ng-change="editor.render()" ng-model-onblur>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="section gf-form-group" ng-if="style.type === 'number'">
  59. <h5 class="section-heading">Thresholds</h5>
  60. <div class="gf-form">
  61. <label class="gf-form-label width-8">Thresholds<tip>Comma separated values</tip></label>
  62. <input type="text" class="gf-form-input width-10" ng-model="style.thresholds" placeholder="50,80" ng-blur="editor.render()" array-join ng-model-onblur>
  63. </div>
  64. <div class="gf-form">
  65. <label class="gf-form-label width-8">Color Mode</label>
  66. <div class="gf-form-select-wrapper width-10">
  67. <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>
  68. </div>
  69. </div>
  70. <div class="gf-form">
  71. <label class="gf-form-label width-8">Colors</label>
  72. <span class="gf-form-label">
  73. <spectrum-picker ng-model="style.colors[0]" ng-change="editor.render()"></spectrum-picker>
  74. </span>
  75. <span class="gf-form-label">
  76. <spectrum-picker ng-model="style.colors[1]" ng-change="editor.render()"></spectrum-picker>
  77. </span>
  78. <span class="gf-form-label">
  79. <spectrum-picker ng-model="style.colors[2]" ng-change="editor.render()"></spectrum-picker>
  80. </span>
  81. <div class="gf-form-label">
  82. <a class="pointer" ng-click="editor.invertColorOrder($index)">Invert</a>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="section gf-form-group" ng-if="style.link">
  87. <h5 class="section-heading">Link</h5>
  88. <div class="gf-form">
  89. <label class="gf-form-label width-9">Url</label>
  90. <input type="text" class="gf-form-input width-29" ng-model="style.linkUrl" ng-blur="editor.render()" ng-model-onblur data-placement="right">
  91. <info-popover mode="right-absolute">
  92. <p>Specify an URL (relative or absolute)</p>
  93. <span>
  94. Use special variables to specify cell values: <br>
  95. <em>$__cell</em> refers to current cell value <br>
  96. <em>$__cell_n</em> refers to Nth column value in current row. Column indexes are started from 0. For instance,
  97. <em>$__cell_1</em> refers to second column's value.
  98. </span>
  99. </info-popover>
  100. </div>
  101. <div class="gf-form">
  102. <label class="gf-form-label width-9">Tooltip</label>
  103. <input type="text" class="gf-form-input width-29" ng-model="style.linkTooltip" ng-blur="editor.render()" ng-model-onblur data-placement="right">
  104. <info-popover mode="right-absolute">
  105. <p>Specify text for link tooltip.</p>
  106. <span>
  107. This title appears when user hovers pointer over the cell with link.
  108. Use the same variables as for URL.
  109. </span>
  110. </info-popover>
  111. </div>
  112. <gf-form-switch class="gf-form" label-class="width-9" label="Open in new tab" checked="style.linkTargetBlank"></gf-form-switch>
  113. </div>
  114. <div class="clearfix"></div>
  115. <button class="btn btn-danger btn-small" ng-click="editor.removeColumnStyle(style)">
  116. <i class="fa fa-trash"></i> Remove Rule
  117. </button>
  118. <br />
  119. <br />
  120. </div>