html-table.configurable.columns.mako 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ## Licensed to Cloudera, Inc. under one
  2. ## or more contributor license agreements. See the NOTICE file
  3. ## distributed with this work for additional information
  4. ## regarding copyright ownership. Cloudera, Inc. licenses this file
  5. ## to you under the Apache License, Version 2.0 (the
  6. ## "License"); you may not use this file except in compliance
  7. ## with the License. You may obtain a copy of the License at
  8. ##
  9. ## http://www.apache.org/licenses/LICENSE-2.0
  10. ##
  11. ## Unless required by applicable law or agreed to in writing, software
  12. ## distributed under the License is distributed on an "AS IS" BASIS,
  13. ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ## See the License for the specific language governing permissions and
  15. ## limitations under the License.
  16. <%
  17. data = [
  18. {"id":56,"timezone":"Europe/Amsterdam","name":"Amsterdam","geo/lat":52.3789,"geo/long":4.90067},
  19. {"id":46,"timezone":"America/New_York","name":"Atlanta","geo/lat":33.7525,"geo/long":-84.3888},
  20. {"id":42,"timezone":"America/Chicago","name":"Austin","geo/lat":30.2669,"geo/long":-97.7428},
  21. {"id":63,"timezone":"America/New_York","name":"Baltimore","geo/lat":39.294255,"geo/long":-76.614275},
  22. {"id":24,"timezone":"America/New_York","name":"Boston","geo/lat":42.3583,"geo/long":-71.0603},
  23. {"id":32,"timezone":"America/Chicago","name":"Chicago","geo/lat":41.8858,"geo/long":-87.6181},
  24. {"id":64,"timezone":"America/New_York","name":"Cleveland","geo/lat":41.499819,"geo/long":-81.693716},
  25. {"id":43,"timezone":"America/Chicago","name":"Dallas / Fort Worth","geo/lat":32.7887,"geo/long":-96.7676},
  26. {"id":25,"timezone":"America/Denver","name":"Denver","geo/lat":39.734,"geo/long":-105.026},
  27. {"id":47,"timezone":"America/New_York","name":"Detroit","geo/lat":42.3333,"geo/long":-83.0484},
  28. {"id":48,"timezone":"America/Chicago","name":"Houston","geo/lat":29.7594,"geo/long":-95.3594},
  29. {"id":66,"timezone":"America/New_York","name":"Indianapolis","geo/lat":39.767016,"geo/long":-86.156255},
  30. {"id":65,"timezone":"America/Chicago","name":"Kansas City","geo/lat":39.090431,"geo/long":-94.583644},
  31. {"id":49,"timezone":"America/Los_Angeles","name":"Las Vegas","geo/lat":36.1721,"geo/long":-115.122},
  32. {"id":61,"timezone":"Europe/London","name":"London","geo/lat":51.50714,"geo/long":-0.126171},
  33. {"id":34,"timezone":"America/Los_Angeles","name":"Los Angeles","geo/lat":34.0443,"geo/long":-118.251},
  34. {"id":39,"timezone":"America/New_York","name":"Miami","geo/lat":25.7323,"geo/long":-80.2436},
  35. {"id":67,"timezone":"America/Chicago","name":"Milwaukee","geo/lat":43.038902,"geo/long":-87.906474},
  36. {"id":51,"timezone":"America/Chicago","name":"Minneapolis / St. Paul","geo/lat":44.9609,"geo/long":-93.2642},
  37. {"id":70,"timezone":"America/New_York","name":"Montreal","geo/lat":45.545447,"geo/long":-73.639076},
  38. {"id":52,"timezone":"America/Chicago","name":"New Orleans","geo/lat":29.9544,"geo/long":-90.075},
  39. {"id":22,"timezone":"America/New_York","name":"New York City","geo/lat":40.7255,"geo/long":-73.9983},
  40. {"id":72,"timezone":"America/Chicago","name":"Omaha","geo/lat":41.254006,"geo/long":-95.999258},
  41. {"id":33,"timezone":"America/New_York","name":"Philadelphia","geo/lat":39.8694,"geo/long":-75.2731},
  42. {"id":53,"timezone":"America/Phoenix","name":"Phoenix","geo/lat":33.4483,"geo/long":-112.073},
  43. {"id":60,"timezone":"America/New_York","name":"Pittsburgh","geo/lat":40.4405,"geo/long":-79.9961},
  44. {"id":37,"timezone":"America/Los_Angeles","name":"Portland","geo/lat":45.527,"geo/long":-122.685},
  45. {"id":57,"timezone":"America/New_York","name":"Raleigh / Durham","geo/lat":35.7797,"geo/long":-78.6434},
  46. {"id":73,"timezone":"America/New_York","name":"Richmond","geo/lat":37.542979,"geo/long":-77.469092},
  47. {"id":71,"timezone":"America/Denver","name":"Salt Lake City","geo/lat":40.760779,"geo/long":-111.891047},
  48. {"id":68,"timezone":"America/Chicago","name":"San Antonio","geo/lat":29.424122,"geo/long":-98.493628},
  49. {"id":38,"timezone":"America/Los_Angeles","name":"San Diego","geo/lat":32.7153,"geo/long":-117.156},
  50. {"id":23,"timezone":"America/Los_Angeles","name":"San Francisco","geo/lat":37.7587,"geo/long":-122.433},
  51. {"id":41,"timezone":"America/Los_Angeles","name":"Seattle","geo/lat":47.6036,"geo/long":-122.326},
  52. {"id":62,"timezone":"America/Chicago","name":"St. Louis","geo/lat":38.627491,"geo/long":-90.198417},
  53. {"id":69,"timezone":"America/New_York","name":"Toronto","geo/lat":43.670233,"geo/long":-79.386755},
  54. {"id":59,"timezone":"America/Vancouver","name":"Vancouver","geo/lat":49.259515,"geo/long":-123.103867},
  55. {"id":31,"timezone":"America/New_York","name":"Washington, DC","geo/lat":38.8964,"geo/long":-77.0447}
  56. ]
  57. columns = ['id', 'timezone', 'name', 'geo/lat', 'geo/long']
  58. active_columns = columns[:]
  59. if get_var('show_columns') is not None:
  60. active_columns = []
  61. for col in get_list('show_columns'):
  62. active_columns.append(columns[int(col)])
  63. %>
  64. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
  65. <html>
  66. <head>
  67. <title>Configurable Columns</title>
  68. </head>
  69. <body data-filters="CollapsingElements">
  70. <form action="${request_path}" method="GET" class="ccs-hidden collapsible ccs-table_config">
  71. <ul>
  72. % for i, option in enumerate(columns):
  73. <%
  74. checked = ""
  75. if option in active_columns:
  76. checked = 'checked="checked"'
  77. %>
  78. <li><label><input type="checkbox" name="show_columns" value="${i}" ${checked}/> ${option}</label></li>
  79. % endfor
  80. </ul>
  81. <a class="ccs-checkAll" data-filters="ArtButton" data-check-group=".ccs-table_config input">checkAll</a>
  82. <a class="ccs-checkNone" data-filters="ArtButton" data-check-group=".ccs-table_config input">checkNone</a>
  83. <input type="submit" value="Apply" data-filters="ArtButton"/>
  84. </form>
  85. <table data-filters="HtmlTable">
  86. <thead>
  87. <tr>
  88. % for i, col in enumerate(active_columns):
  89. % if i == 0:
  90. <th>
  91. <a class="collapser ccs-table_config_link ccs-left"></a>
  92. ${col}
  93. </th>
  94. % else:
  95. <th>${col}</th>
  96. % endif
  97. % endfor
  98. </tr>
  99. </thead>
  100. <tbody>
  101. % for d in data:
  102. <tr>
  103. % for name in active_columns:
  104. <td>
  105. ${d.get(name)}
  106. </td>
  107. % endfor
  108. </tr>
  109. % endfor
  110. </tbody>
  111. </table>
  112. </body>
  113. </head>