list.html 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {% extends "portal/layout.html" %}
  2. {% block content %}
  3. <script>
  4. function query_nodata() {
  5. var query = $.trim($("#query").val());
  6. var mine = document.getElementById('mine').checked ? 1 : 0;
  7. window.location.href = '/portal/nodata?q=' + query + '&mine=' + mine;
  8. }
  9. function delete_nodata(id) {
  10. my_confirm('确定要删除???', ['确定', '取消'], function () {
  11. $.getJSON('/portal/nodata/delete/' + id, {}, function (json) {
  12. handle_quietly(json, function () {
  13. location.reload();
  14. });
  15. })
  16. }, function () {
  17. return false;
  18. });
  19. }
  20. </script>
  21. <div class="form-inline" role="form">
  22. <div class="form-group">
  23. <input type="text" value="{{ data.query }}" class="form-control" id="query"
  24. placeholder="search..." onkeydown="if(event.keyCode==13)query_nodata()">
  25. </div>
  26. <button type="button" onclick="query_nodata();" class="btn btn-default">
  27. <span class="glyphicon glyphicon-search"></span>
  28. </button>
  29. <input type="checkbox" name="mine" id="mine" {% if data.mine == '1' %}checked="checked"{% endif %}>
  30. <span>mine</span>
  31. <div class="pull-right">
  32. <a href="{{ url_for('nodata_add_get') }}" class="btn btn-default">
  33. <span class="glyphicon glyphicon-plus"></span>
  34. </a>
  35. </div>
  36. </div>
  37. <div>
  38. {% for v in data.vs %}
  39. <hr/>
  40. <div>{{ v.name }}; {{ v.obj_type }} [{{ v.obj }}]/{{ v.metric }}/{{ v.tags }};&nbsptype={{ v.dstype }},step={{ v.step }}</div>
  41. <div class="mt10 gray">
  42. <span class="gray">默认值: {{ v.mock }}</span>
  43. {% if v.writable(g.user) %}
  44. <div class="pull-right">
  45. <a href="{{ url_for('nodata_add_get', id=v.id) }}" class="btn btn-default"
  46. style="text-decoration: none;">
  47. <span class="glyphicon glyphicon-edit orange"></span>
  48. </a>
  49. <button onclick="delete_nodata('{{ v.id }}');" class="btn btn-default">
  50. <span class="glyphicon glyphicon-trash orange"></span>
  51. </button>
  52. </div>
  53. {% endif %}
  54. </div>
  55. <div class="mt10 gray">
  56. <p> 创建人: {{ v.creator }}, 最后更改时间: {{ v.t_modify }}</p>
  57. </div>
  58. {% else %}
  59. <hr/>
  60. no records
  61. {% endfor %}
  62. </div>
  63. {% import "portal/blocks.html" as blocks %}
  64. {{ blocks.pager('/portal/nodata?q='+data.query+'&mine='+data.mine, data.total, data.limit, data.page) }}
  65. <br/>
  66. <br/>
  67. <br/>
  68. <br/>
  69. <script>
  70. $(function () {
  71. $("#mine").click(query_nodata);
  72. });
  73. </script>
  74. {% endblock %}