index.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. {% extends "portal/layout.html" %}
  2. {% block content %}
  3. <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-datetimepicker.css') }}"/>
  4. <script type="text/javascript"
  5. src="{{ url_for('static', filename='js/bootstrap-datetimepicker.js') }}"></script>
  6. <div class="form-inline" role="form">
  7. <div class="form-group">
  8. <input type="text" value="{{ data.query }}" class="form-control" id="query"
  9. placeholder="search hostname" onkeydown="if(event.keyCode==13)query_host()">
  10. </div>
  11. <button type="button" onclick="query_host();" class="btn btn-default">
  12. <span class="glyphicon glyphicon-search"></span>
  13. </button>
  14. <input type="checkbox" name="maintaining" id="maintaining"
  15. {% if data.maintaining == '1' %}checked="checked"{% endif %}>
  16. <span>maintaining</span>
  17. <div class="pull-right">
  18. <span class="green">
  19. <span class="glyphicon glyphicon-tag"></span>
  20. {{ data.group.grp_name }}
  21. </span>
  22. <a {% if g.xbox %}target="_blank"{% endif %} href="{{ url_for('host_add_get', group_id = data.group.id) }}"
  23. class="btn btn-default" style="margin-left: 10px;">
  24. <span class="glyphicon glyphicon-plus"></span>
  25. Add Host
  26. </a>
  27. </div>
  28. </div>
  29. <table class="table table-hover table-bordered table-striped" style="margin-bottom: 0px; margin-top: 10px;">
  30. <thead>
  31. <tr>
  32. <th><input type="checkbox" onclick="select_all();" id="chk"/></th>
  33. <th>hostname</th>
  34. <th>maintain begin</th>
  35. <th>maintain end</th>
  36. <th>relation</th>
  37. </tr>
  38. </thead>
  39. <tbody id="hosts">
  40. {% for v in data.vs %}
  41. <tr>
  42. <td><input type="checkbox" hid="{{ v.id }}"/></td>
  43. <td><a href="http://{{ v.hostname }}:1988/" target="_blank">{{ v.hostname }}</a></td>
  44. <td>{{ v.maintain_begin | fmt_time }}</td>
  45. <td>{{ v.maintain_end | fmt_time }}</td>
  46. <td>
  47. <a href="{{ url_for('host_groups_get', host_id=v.id) }}">groups</a>
  48. <span class="cut-line">¦</span>
  49. <a href="{{ url_for('host_templates_get', host_id=v.id) }}">templates</a>
  50. </td>
  51. </tr>
  52. {% else %}
  53. <tr>
  54. <td colspan="5">no records</td>
  55. </tr>
  56. {% endfor %}
  57. <tr>
  58. <td>
  59. <a href="javascript:remove_hosts();" style="text-decoration: none;">
  60. <span class="glyphicon glyphicon-trash orange"></span>
  61. </a>
  62. </td>
  63. <td colspan="4">
  64. <div class="form-inline" role="form">
  65. <div class='input-group date'>
  66. <input type='text' class="form-control" size="16" placeholder="begin" id='begin'/>
  67. <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
  68. </span>
  69. </div>
  70. <div class='input-group date'>
  71. <input type='text' class="form-control" size="16" placeholder="end" id='end'/>
  72. <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
  73. </span>
  74. </div>
  75. <div class='input-group'>
  76. <button class="btn btn-default" onclick="maintain()">Maintain</button>
  77. </div>
  78. <div class='input-group'>
  79. <button class="btn btn-default" onclick="no_maintain()">Unset</button>
  80. </div>
  81. </div>
  82. </td>
  83. </tr>
  84. </tbody>
  85. </table>
  86. <input type="hidden" id="group_id" value="{{ data.group.id }}">
  87. <input type="hidden" id="xbox" value="{{ g.xbox or '' }}">
  88. {% import "portal/blocks.html" as blocks %}
  89. <div class="pull-left">
  90. {{ blocks.pager('/portal/group/'+data.group.id.__str__()+'/hosts?q='+data.query+'&maintaining='+data.maintaining+'&xbox='+g.xbox, data.total, data.limit, data.page) }}
  91. </div>
  92. <div class="pull-left" style="margin-left: 10px; margin-top: 20px;">
  93. <div class="pull-left" style="line-height: 30px;">total: {{ data.total }}, page size:</div>
  94. <select style="width: 80px;" onchange="query_host();" id="limit" class="form-control pull-left">
  95. <option {% if data.limit == 10 %}selected{% endif %}>10</option>
  96. <option {% if data.limit == 50 %}selected{% endif %}>50</option>
  97. <option {% if data.limit == 100 %}selected{% endif %}>100</option>
  98. <option {% if data.limit == 200 %}selected{% endif %}>200</option>
  99. <option {% if data.limit == 500 %}selected{% endif %}>500</option>
  100. </select>
  101. </div>
  102. <div class="pull-right mt20">
  103. <a target="_blank" class="btn btn-default" href="{{ url_for('group_hosts_export', group_id=data.group.id) }}">
  104. <span class="glyphicon glyphicon-save"></span>
  105. </a>
  106. </div>
  107. <script>
  108. $(function () {
  109. $("#maintaining").click(query_host);
  110. $('.date').datetimepicker({
  111. format: "YYYY-MM-DD HH:mm"
  112. });
  113. });
  114. </script>
  115. <br/>
  116. <br/>
  117. <br/>
  118. <br/>
  119. <br/>
  120. <br/>
  121. <br/>
  122. {% endblock %}