2015-09-08 16:19:17 +00:00
|
|
|
{% extends 'base.html' %}
|
|
|
|
{% load mytags %}
|
2015-11-03 09:07:46 +00:00
|
|
|
{% load bootstrap %}
|
2015-09-08 16:19:17 +00:00
|
|
|
{% block content %}
|
|
|
|
{% include 'nav_cat_bar.html' %}
|
|
|
|
<div class="wrapper wrapper-content animated fadeInRight">
|
|
|
|
<div class="row">
|
2015-12-03 10:37:18 +00:00
|
|
|
<div class="col-sm-10">
|
2015-09-08 16:19:17 +00:00
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
<div id="ibox-content" class="ibox-title">
|
|
|
|
<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>
|
|
|
|
<a class="close-link">
|
|
|
|
<i class="fa fa-times"></i>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="ibox-content">
|
|
|
|
<div class="panel-body">
|
|
|
|
<div class="tab-content">
|
|
|
|
<div id="tab-1" class="ibox float-e-margins tab-pane active">
|
|
|
|
{% if error %}
|
|
|
|
<div class="alert alert-warning text-center">{{ error }}</div>
|
|
|
|
{% endif %}
|
|
|
|
{% if msg %}
|
|
|
|
<div class="alert alert-success text-center">{{ msg }}</div>
|
|
|
|
{% endif %}
|
|
|
|
<form id="assetForm" method="post" class="form-horizontal">
|
2015-11-03 09:07:46 +00:00
|
|
|
|
2015-11-21 10:28:25 +00:00
|
|
|
{{ af.hostname|bootstrap_horizontal }}
|
2015-09-08 16:19:17 +00:00
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-11-21 10:28:25 +00:00
|
|
|
{{ af.ip|bootstrap_horizontal }}
|
2015-11-03 09:07:46 +00:00
|
|
|
|
2015-11-08 14:39:30 +00:00
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.other_ip|bootstrap_horizontal }}
|
2015-11-21 10:28:25 +00:00
|
|
|
<p class="col-sm-offset-2">Tips: 多个IP使用,号隔开</p>
|
2015-11-08 14:39:30 +00:00
|
|
|
|
2015-11-03 09:07:46 +00:00
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.remote_ip|bootstrap_horizontal }}
|
|
|
|
|
2015-11-21 10:28:25 +00:00
|
|
|
{# <div class="hr-line-dashed"></div>#}
|
|
|
|
{# {{ af.port|bootstrap_horizontal }}#}
|
2015-09-08 16:19:17 +00:00
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
<div class="form-group">
|
2015-11-08 14:39:30 +00:00
|
|
|
<label for="j_group" class="col-sm-2 control-label">管理账号 <span class="red-fonts">*</span></label>
|
2015-11-03 09:07:46 +00:00
|
|
|
<div class="col-sm-2">
|
2015-09-08 16:19:17 +00:00
|
|
|
<div class="radio i-checks">
|
|
|
|
<label>
|
2015-11-23 15:55:19 +00:00
|
|
|
<input type="checkbox" {% if asset.use_default_auth %} checked="checked" {% endif %} id="id_use_default_auth" name="use_default_auth"><span> 使用默认 </span>
|
2015-09-08 16:19:17 +00:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-11-08 14:39:30 +00:00
|
|
|
<div class="form-group" id="admin_account" {% if asset.use_default_auth %} style="display: none" {% endif %}>
|
2015-11-21 10:28:25 +00:00
|
|
|
<div class="hr-line-dashed"></div>
|
2015-11-08 14:39:30 +00:00
|
|
|
<label class="col-sm-2 control-label"> 管理用户名 <span class="red-fonts">*</span> </label>
|
2015-09-08 16:19:17 +00:00
|
|
|
<div class="col-sm-3">
|
2015-11-08 14:39:30 +00:00
|
|
|
<input type="text" value="{{ asset.username }}" name="username" class="form-control">
|
2015-09-08 16:19:17 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<label class="col-sm-1 control-label"> 密码<span class="red-fonts">*</span> </label>
|
|
|
|
<div class="col-sm-4">
|
2015-11-26 15:42:58 +00:00
|
|
|
<input type="password" value="" name="password" placeholder="不填写即不更改密码." class="form-control">
|
2015-09-08 16:19:17 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2015-11-26 15:42:58 +00:00
|
|
|
<div class="form-group" id="id_port">
|
2015-11-21 10:28:25 +00:00
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
<label class="col-sm-2 control-label"> 端口<span class="red-fonts">*</span> </label>
|
|
|
|
<div class="col-sm-8">
|
2015-11-22 10:57:47 +00:00
|
|
|
<input type="text" placeholder="Port" value="{{ asset.port|default_if_none:"" }}" name="port" class="form-control">
|
2015-11-21 10:28:25 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-11-03 09:07:46 +00:00
|
|
|
|
2015-09-08 16:19:17 +00:00
|
|
|
<div class="hr-line-dashed"></div>
|
2015-11-03 09:07:46 +00:00
|
|
|
{{ af.group|bootstrap_horizontal }}
|
2015-09-08 16:19:17 +00:00
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-11-03 09:07:46 +00:00
|
|
|
{{ af.idc|bootstrap_horizontal }}
|
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.brand|bootstrap_horizontal }}
|
2015-09-08 16:19:17 +00:00
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-11-03 09:07:46 +00:00
|
|
|
{{ af.cpu|bootstrap_horizontal }}
|
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.memory|bootstrap_horizontal }}
|
|
|
|
|
2015-11-22 15:53:25 +00:00
|
|
|
<div class="hr-line-dashed"></div>
|
2015-11-24 11:04:16 +00:00
|
|
|
{{ af.disk|bootstrap_horizontal }}
|
2015-11-22 15:53:25 +00:00
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
2015-11-24 11:04:16 +00:00
|
|
|
{{ af.system_type|bootstrap_horizontal }}
|
2015-11-22 15:53:25 +00:00
|
|
|
|
2015-11-03 09:07:46 +00:00
|
|
|
<div class="hr-line-dashed"></div>
|
2015-11-24 11:04:16 +00:00
|
|
|
{{ af.system_version|bootstrap_horizontal }}
|
2015-11-03 09:07:46 +00:00
|
|
|
|
2015-12-01 15:39:49 +00:00
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.system_arch|bootstrap_horizontal }}
|
|
|
|
|
2015-11-03 09:07:46 +00:00
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.number|bootstrap_horizontal }}
|
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.sn|bootstrap_horizontal }}
|
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.cabinet|bootstrap_horizontal }}
|
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.position|bootstrap_horizontal }}
|
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.asset_type|bootstrap_horizontal }}
|
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.env|bootstrap_horizontal }}
|
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.status|bootstrap_horizontal }}
|
|
|
|
|
|
|
|
{# <div class="hr-line-dashed"></div>#}
|
2015-11-08 14:39:30 +00:00
|
|
|
{# {{ af.is_active|bootstrap_horizontal }}#}
|
2015-09-08 16:19:17 +00:00
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
<div class="form-group"><label class="col-sm-2 control-label"> 是否激活<span class="red-fonts">*</span> </label>
|
|
|
|
<div class="col-sm-8">
|
|
|
|
<div class="radio i-checks">
|
|
|
|
{% ifequal asset.is_active 1 %}
|
|
|
|
<label> <input type="radio" checked="" value="1" name="is_active">激活 </label>
|
|
|
|
<label> <input type="radio" value="0" name="is_active"> 禁用</label>
|
|
|
|
{% else %}
|
|
|
|
<label> <input type="radio" value="1" name="is_active">激活 </label>
|
|
|
|
<label> <input type="radio" checked="" value="0" name="is_active"> 禁用</label>
|
|
|
|
{% endifequal %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2015-11-03 09:07:46 +00:00
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
{{ af.comment|bootstrap_horizontal }}
|
2015-09-08 16:19:17 +00:00
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-sm-4 col-sm-offset-2">
|
|
|
|
<button class="btn btn-white" type="reset"> 重置 </button>
|
|
|
|
<button class="btn btn-primary" type="submit"> 提交 </button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block self_footer_js %}
|
|
|
|
<script>
|
2015-11-08 14:39:30 +00:00
|
|
|
$('document').ready(function(){
|
|
|
|
$('#id_use_default_auth').click(function(){
|
|
|
|
if ($(this).is(':checked')){
|
2015-11-21 10:28:25 +00:00
|
|
|
$('#admin_account').css('display', 'none');
|
2015-11-08 14:39:30 +00:00
|
|
|
}
|
|
|
|
else {
|
2015-11-21 10:28:25 +00:00
|
|
|
$('#admin_account').css('display', 'block');
|
2015-11-08 14:39:30 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
2015-09-08 16:19:17 +00:00
|
|
|
|
2015-11-21 10:28:25 +00:00
|
|
|
var required_fields = ["id_hostname", "id_port"];
|
2015-11-08 14:39:30 +00:00
|
|
|
required_fields.forEach(function(field) {
|
|
|
|
$('label[for="' + field + '"]').parent().addClass("required");
|
|
|
|
});
|
|
|
|
|
2015-11-24 03:20:01 +00:00
|
|
|
$('#assetForm').validator({
|
2015-11-08 14:39:30 +00:00
|
|
|
timely: 2,
|
|
|
|
theme: "yellow_right_effect",
|
|
|
|
rules: {
|
|
|
|
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}$/, '端口号不正确'],
|
2015-11-24 03:20:01 +00:00
|
|
|
use_default_auth: function() {
|
|
|
|
var str1 = $("#id_use_default_auth").is(":checked");
|
|
|
|
if (str1 == true){
|
|
|
|
var decide = false;
|
|
|
|
} else {
|
|
|
|
var decide = true;
|
|
|
|
}
|
|
|
|
return decide}
|
2015-11-08 14:39:30 +00:00
|
|
|
},
|
|
|
|
fields: {
|
2015-11-21 10:28:25 +00:00
|
|
|
"hostname": {
|
|
|
|
rule: "required",
|
|
|
|
tip: "填写主机名",
|
2015-11-08 14:39:30 +00:00
|
|
|
ok: "",
|
|
|
|
msg: {required: "必须填写!"}
|
|
|
|
},
|
2015-11-24 03:20:01 +00:00
|
|
|
"port": {
|
|
|
|
rule: "required(use_default_auth)",
|
|
|
|
tip: "输入端口号",
|
|
|
|
ok: "",
|
|
|
|
msg: {required: "必须填写!"}
|
|
|
|
},
|
|
|
|
"username": {
|
|
|
|
rule: "required(use_default_auth)",
|
|
|
|
tip: "输入用户名",
|
|
|
|
ok: "",
|
|
|
|
msg: {required: "必须填写!"}
|
|
|
|
},
|
2015-11-26 15:42:58 +00:00
|
|
|
{# "password": {#}
|
|
|
|
{# rule: "required(use_default_auth)",#}
|
|
|
|
{# tip: "输入密码",#}
|
|
|
|
{# ok: "",#}
|
|
|
|
{# msg: {required: "必须填写!"}#}
|
|
|
|
{# }#}
|
2015-09-08 16:19:17 +00:00
|
|
|
},
|
2015-11-08 14:39:30 +00:00
|
|
|
valid: function(form) {
|
|
|
|
form.submit();
|
2015-09-08 16:19:17 +00:00
|
|
|
}
|
2015-11-08 14:39:30 +00:00
|
|
|
});
|
2015-09-08 16:19:17 +00:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
{% endblock %}
|