hedit.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <div class="row tile">
  2. <div class="col-md-12 col-md-auto">
  3. <div class="ibox float-e-margins">
  4. <h3 class="ibox-title">add host</h3>
  5. <div class="ibox-content">
  6. <form class="form-horizontal">
  7. <input type="hidden" name="id" value="{{.h.Id}}">
  8. <div class="form-group">
  9. <label class="col-sm-2 control-label">remark</label>
  10. <div class="col-sm-10">
  11. <input value="{{.h.Remark}}" class="form-control" type="text" name="remark"
  12. placeholder="remark">
  13. </div>
  14. </div>
  15. <div class="form-group">
  16. <label class="col-sm-2 control-label">host</label>
  17. <div class="col-sm-10">
  18. <input value="{{.h.Host}}" class="form-control" type="text" name="host"
  19. placeholder="such as a.proxy.com">
  20. </div>
  21. </div>
  22. <div class="form-group" id="scheme">
  23. <label class="control-label col-sm-2">scheme</label>
  24. <div class="col-sm-10">
  25. <select class="form-control" name="scheme">
  26. <option {{if eq "all" .h.Scheme}}selected{{end}} value="all">all</option>
  27. <option {{if eq "http" .h.Scheme}}selected{{end}} value="http">http</option>
  28. <option {{if eq "https" .h.Scheme}}selected{{end}} value="https">https</option>
  29. </select>
  30. </div>
  31. </div>
  32. <div class="form-group">
  33. <label class="col-sm-2 control-label">url router</label>
  34. <div class="col-sm-10">
  35. <input value="{{.h.Location}}" class="form-control" type="text" name="location"
  36. placeholder="empty means to be unrestricted">
  37. </div>
  38. </div>
  39. <div class="form-group">
  40. <label class="col-sm-2 control-label">client id</label>
  41. <div class="col-sm-10">
  42. <input value="{{.h.Client.Id}}" class="form-control" type="text" name="client_id"
  43. placeholder="client id">
  44. </div>
  45. </div>
  46. <div class="form-group">
  47. <label class="col-sm-2 control-label">target of Intranet(ip:port)</label>
  48. <div class="col-sm-10">
  49. <textarea class="form-control" rows="4" type="text" name="target"
  50. placeholder="such as
  51. 10.1.50.203:80
  52. 10.1.50.202:80">{{.h.Target}}</textarea>
  53. <span class="help-block m-b-none">Line break if load balancing</span>
  54. </div>
  55. </div>
  56. <div class="form-group" id="header">
  57. <label class="col-sm-2 control-label">header modify</label>
  58. <div class="col-sm-10">
  59. <textarea class="form-control" rows="4" type="text" name="header"
  60. placeholder="Cache-Control: no-cache">{{.h.HeaderChange}}</textarea>
  61. <span class="help-block m-b-none"> Colon separated, multiple lines please fill in</span>
  62. </div>
  63. </div>
  64. <div class="form-group" id="hostchange">
  65. <label class="col-sm-2 control-label">host modify</label>
  66. <div class="col-sm-10">
  67. <input value="{{.h.HostChange}}" class="form-control" value="" type="text" name="hostchange"
  68. placeholder="host modify">
  69. </div>
  70. </div>
  71. <div class="hr-line-dashed"></div>
  72. <div class="form-group">
  73. <div class="col-sm-4 col-sm-offset-2">
  74. &nbsp;<button class="btn btn-success" href="#" id="add"><i
  75. class="fa fa-fw fa-lg fa-eye"></i>save
  76. </button>
  77. </div>
  78. </div>
  79. </form>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <script>
  85. $(function () {
  86. $("#add").on("click", function () {
  87. $.ajax({
  88. type: "POST",
  89. url: "/index/edithost",
  90. data: $("form").serializeArray(),
  91. success: function (res) {
  92. alert(res.msg)
  93. if (res.status) {
  94. history.back(-1)
  95. }
  96. }
  97. })
  98. })
  99. })
  100. </script>