2015-01-05 10:21:34 +00:00
{% extends 'base.html' %}
2015-01-19 02:09:16 +00:00
{% load mytags %}
2015-01-05 10:21:34 +00:00
{% block content %}
2015-01-07 10:35:09 +00:00
{% include 'nav_cat_bar.html' %}
< div class = "wrapper wrapper-content animated fadeInRight" >
< div class = "row" >
< div class = "col-lg-10" >
< div class = "ibox float-e-margins" >
2015-01-11 11:27:21 +00:00
< div id = "ibox-content" class = "ibox-title" >
2015-01-07 10:35:09 +00:00
< h5 > 填写主机基本信息 < / h5 >
< div class = "ibox-tools" >
< a class = "collapse-link" >
< i class = "fa fa-chevron-up" > < / i >
< / a >
< a class = "dropdown-toggle" data-toggle = "dropdown" href = "#" >
< i class = "fa fa-wrench" > < / i >
< / a >
< ul class = "dropdown-menu dropdown-user" >
< li > < a href = "#" > 未启用 1< / a >
< / li >
< li > < a href = "#" > 未启用 2< / a >
< / li >
< / ul >
< a class = "close-link" >
< i class = "fa fa-times" > < / i >
< / a >
2015-01-05 10:21:34 +00:00
< / div >
2015-01-07 10:35:09 +00:00
< / div >
2015-01-19 02:09:16 +00:00
< div class = "ibox-content" >
2015-01-07 10:35:09 +00:00
{% if emg %}
< div class = "alert alert-warning text-center" > {{ emg }}< / div >
{% endif %}
2015-01-19 02:09:16 +00:00
{% if smg %}
< div class = "alert alert-success text-center" > {{ smg }}< / div >
{% endif %}
< form id = "assetForm" method = "post" class = "form-horizontal" autocomplete = "off" >
2015-02-01 15:00:23 +00:00
< div class = "form-group" > < label class = "col-sm-2 control-label" > IP地址< span class = "red-fonts" > *< / span > < / label >
2015-01-19 02:09:16 +00:00
< div class = "col-sm-8" > < input type = "text" name = "j_ip" value = "{{ post.ip }}" placeholder = "192.168.1.1" class = "form-control" > < / div >
2015-01-07 10:35:09 +00:00
< / div >
2015-01-05 10:21:34 +00:00
2015-01-07 10:35:09 +00:00
< div class = "hr-line-dashed" > < / div >
2015-02-01 15:00:23 +00:00
< div class = "form-group" > < label class = "col-sm-2 control-label" > 端口号< span class = "red-fonts" > *< / span > < / label >
2015-01-19 02:09:16 +00:00
< div class = "col-sm-8" > < input type = "text" placeholder = "22" name = "j_port" value = "{{ post.port }}" class = "form-control" > < / div >
2015-01-05 10:21:34 +00:00
< / div >
2015-01-07 10:35:09 +00:00
< div class = "hr-line-dashed" > < / div >
2015-02-01 15:00:23 +00:00
< div class = "form-group" > < label class = "col-sm-2 control-label" > 登录方式< span class = "red-fonts" > *< / span > < / label >
2015-01-07 10:35:09 +00:00
< div class = "col-sm-8" >
2015-01-19 02:09:16 +00:00
{% for t, type in login_types.items %}
{% ifequal t post.login_type %}
2015-01-22 15:02:44 +00:00
< div class = "radio i-checks" > < label > < input type = "radio" id = "{{ t }}" checked = "" value = "{{ t }}" name = "j_type" onclick = "show(this)" > < i > {{ type }} < / i > < / label > < / div >
2015-01-19 02:09:16 +00:00
{% else %}
< div class = "radio i-checks" > < label > < input type = "radio" id = "{{ t }}" value = "{{ t }}" name = "j_type" onclick = "show(this)" > < i > {{ type }} < / i > < / label > < / div >
{% endifequal %}
{% endfor %}
2015-01-05 10:21:34 +00:00
< / div >
2015-03-14 05:13:46 +00:00
{% ifequal post.login_type M %}
2015-01-07 10:35:09 +00:00
< div class = "form-group" > < label class = "col-sm-2 col-sm-offset-1 control-label" > 普通用户名 < / label >
2015-03-14 05:13:46 +00:00
< div class = "col-sm-6" > < input type = "text" name = "j_user" value = "{{ post.username }}" class = "form-control" > < / div >
2015-01-07 10:35:09 +00:00
< / div >
2015-01-05 10:21:34 +00:00
2015-01-07 10:35:09 +00:00
< div class = "form-group" > < label class = "col-sm-2 col-sm-offset-1 control-label" > 普通用户密码 < / label >
2015-03-14 05:13:46 +00:00
< div class = "col-sm-6" > < input type = "password" name = "j_password" value = "{{ post.password }}" class = "form-control" > < / div >
2015-01-07 10:35:09 +00:00
< / div >
2015-03-14 05:13:46 +00:00
{% else %}
< div name = "a1" id = a1 style = "display:none;" >
< div class = "form-group" > < label class = "col-sm-2 col-sm-offset-1 control-label" > 普通用户名 < / label >
< div class = "col-sm-6" > < input type = "text" name = "j_user" placeholder = "lilei" class = "form-control" > < / div >
< / div >
< div class = "form-group" > < label class = "col-sm-2 col-sm-offset-1 control-label" > 普通用户密码 < / label >
< div class = "col-sm-6" > < input type = "password" name = "j_password" placeholder = "Password" class = "form-control" > < / div >
< / div >
< / div >
{% endifequal %}
2015-01-07 10:35:09 +00:00
< / div >
2015-01-05 10:21:34 +00:00
2015-01-07 10:35:09 +00:00
< div class = "hr-line-dashed" > < / div >
< div class = "form-group" >
2015-02-01 15:00:23 +00:00
< label for = "j_idc" class = "col-lg-2 control-label" > 所属IDC< span class = "red-fonts" > *< / span > < / label >
2015-01-07 10:35:09 +00:00
< div class = "col-sm-8" >
< select id = "j_idc" name = "j_idc" class = "form-control m-b" >
{% for i in eidc %}
2015-01-19 02:09:16 +00:00
{% ifequal i.id post.idc_id %}
< option selected > {{ i }} < / option >
{% else %}
< option > {{ i }} < / option >
{% endifequal %}
2015-01-07 10:35:09 +00:00
{% endfor %}
< / select >
< / div >
2015-01-05 10:21:34 +00:00
< / div >
2015-01-07 10:35:09 +00:00
< div class = "hr-line-dashed" > < / div >
< div class = "form-group" >
2015-02-01 15:00:23 +00:00
< label for = "j_group" class = "col-lg-2 control-label" > 所属主机组< span class = "red-fonts" > *< / span > < / label >
2015-01-07 10:35:09 +00:00
< div class = "col-sm-8" >
2015-02-01 15:00:23 +00:00
< select id = "j_group" name = "j_group" class = "form-control m-b" multiple size = "10" >
{% for g in egroup %}
{% if g in e_group %}
< option type = "checkbox" value = "{{ g.name }}" selected > {{ g.name }} --- {{ g.comment }}< / option >
{% else %}
< option type = "checkbox" value = "{{ g.name }}" > {{ g.name }} --- {{ g.comment }}< / option >
{% endif %}
{% endfor %}
< / select >
2015-01-07 10:35:09 +00:00
< / div >
< / div >
2015-01-05 10:21:34 +00:00
2015-01-07 10:35:09 +00:00
< div class = "hr-line-dashed" > < / div >
2015-02-01 15:00:23 +00:00
< div class = "form-group" > < label class = "col-sm-2 control-label" > 是否激活< span class = "red-fonts" > *< / span > < / label >
2015-01-07 10:35:09 +00:00
< div class = "col-sm-8" >
2015-01-19 02:09:16 +00:00
{% for a,active in actives.items %}
{% ifequal a post.is_active %}
< div class = "radio i-checks" > < label > < input type = "radio" checked value = "{{ a }}" name = "j_active" > < i > {{ active }} < / i > < / label > < / div >
{% else %}
< div class = "radio i-checks" > < label > < input type = "radio" value = "{{ a }}" name = "j_active" > < i > {{ active }} < / i > < / label > < / div >
{% endifequal %}
{% endfor %}
2015-01-07 10:35:09 +00:00
< / div >
< / div >
2015-01-05 10:21:34 +00:00
2015-01-07 10:35:09 +00:00
< div class = "hr-line-dashed" > < / div >
< div class = "form-group" > < label class = "col-sm-2 control-label" > 备注 < / label >
2015-01-19 02:09:16 +00:00
< div class = "col-sm-8" > < input type = "text" placeholder = "hadoop01" value = "{{ post.comment }}" name = "j_comment" class = "form-control" > < / div >
2015-01-07 10:35:09 +00:00
< / div >
2015-01-05 10:21:34 +00:00
2015-01-07 10:35:09 +00:00
< div class = "hr-line-dashed" > < / div >
< div class = "form-group" >
< div class = "col-sm-4 col-sm-offset-5" >
< button class = "btn btn-white" type = "submit" > 重置 < / button >
< button class = "btn btn-primary" type = "submit" > 提交 < / button >
< / div >
2015-01-05 10:21:34 +00:00
< / div >
2015-01-07 10:35:09 +00:00
< / form >
< / div >
2015-01-05 10:21:34 +00:00
< / div >
< / div >
< / div >
< / div >
< script >
2015-01-19 02:09:16 +00:00
var showFlag={};
2015-01-05 10:21:34 +00:00
function show(o){
showFlag[o.name]=o.value;
2015-01-19 02:09:16 +00:00
if(showFlag.j_type=="M"){
2015-01-05 10:21:34 +00:00
document.getElementById("a1").style.display="";
}
else{
document.getElementById("a1").style.display="none";
}};
2015-01-19 02:09:16 +00:00
$('#assetForm').validator({
2015-01-14 11:19:56 +00:00
timely: 2,
theme: "yellow_right_effect",
rules: {
2015-01-19 02:09:16 +00:00
check_ip: [/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){3}$/, 'ip地址不正确'],
check_port: [/^\d{1,5}$/, '端口号不正确'],
type_m: function(element){
return $("#M").is(":checked");
}
2015-01-14 11:19:56 +00:00
},
fields: {
"j_ip": {
rule: "required;check_ip",
2015-01-19 02:09:16 +00:00
tip: "输入IP",
ok: "",
2015-01-14 11:19:56 +00:00
msg: {required: "必须填写!"}
},
"j_port": {
rule: "required;check_port",
2015-01-19 02:09:16 +00:00
tip: "输入端口号",
ok: "",
2015-01-14 11:19:56 +00:00
msg: {required: "必须填写!"}
},
2015-01-19 02:09:16 +00:00
"j_group": {
2015-01-21 10:54:31 +00:00
rule: "checked",
2015-01-19 02:09:16 +00:00
tip: "选择业务组",
2015-01-14 11:19:56 +00:00
ok: "",
2015-01-21 10:54:31 +00:00
msg: {checked: "至少选择一个组"}
2015-01-14 11:19:56 +00:00
},
2015-01-19 02:09:16 +00:00
"j_user": {
rule: "required(type_m)",
tip: "普通用户名",
ok: "",
msg: {required: "请填写用户名"}
},
"j_password": {
2015-03-14 05:13:46 +00:00
rule: "required(type_m);length[6~100]",
2015-01-19 02:09:16 +00:00
tip: "密码6-16位",
ok: "",
msg: {required: "6-16位"}
2015-01-14 11:19:56 +00:00
}
},
valid: function(form) {
2015-01-19 02:09:16 +00:00
form.submit();
2015-01-14 11:19:56 +00:00
}
});
2015-01-05 10:21:34 +00:00
< / script >
2015-01-22 15:02:44 +00:00
2015-01-05 10:21:34 +00:00
{% endblock %}