-
Notifications
You must be signed in to change notification settings - Fork 177
/
add.html
executable file
·68 lines (68 loc) · 2.48 KB
/
add.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<section class="content-header">
<h1>添加后端服务器</h1>
</section>
<section class="content">
<!-- /.row -->
<div class="row">
<div class="col-xs-12">
<div class="box box-primary">
<div class="box-body">
<div class="form-group">
<label>后端服务器IP地址</label>
<input type="text" class="form-control" name="" placeholder="后端服务器IP地址">
</div>
<div class="form-group">
<label>后端服务器端口</label>
<input type="text" class="form-control" name="port" placeholder="后端服务器端口">
</div>
<div class="form-group">
<label>代理协议</label>
<select name="protocol" class="form-control">
<option value="http:https://">http:https://</option>
<option value="https://">https://</option>
</select>
</div>
<div class="form-group">
<label>权重</label>
<input type="text" class="form-control" name="weight" value="1" placeholder="权重">
</div>
<div class="form-group">
<label >服务器备注描述</label>
<input type="text" class="form-control" name="description" placeholder="备注描述">
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<button id="add-server-btn" class="btn btn-primary">添加</button>
<button class="btn btn-default" onclick="load_page('/pages/server/list.html');">取消</button>
</div>
</div>
<!-- /.box -->
</div>
</div>
</section>
<script type="text/javascript">
$(".content-header h1").html(domain_name+" > "+service_name+" > 添加后端服务器")
$("#add-server-btn").click(function(){
if (!is_ip($("input[name='ip']").val())) {
alert("Invalid ip address.");
return;
}
if (!check_port($("input[name='port']").val())) {
alert("Invalid port.");
return;
}
if (!check_weight($("input[name='weight']").val())) {
alert("Invalid weight, must be a number great than 0.");
return;
}
var params = {service_id:service_id,ip:$("input[name='ip']").val(),port:$("input[name='port']").val(),protocol:$("select[name='protocol']").val(),description:$("input[name='description']").val(),weight:$("input[name='weight']").val()};
api_invoke("/api/v1/server/add", params, function(data){
if(data.errno == 0){
load_page("/pages/server/list.html");
}else{
alert(data.msg);
}
});
});
</script>