2015-01-11 11:27:21 +00:00
|
|
|
{% extends 'base.html' %}
|
2015-03-18 10:05:46 +00:00
|
|
|
{% load mytags %}
|
2015-01-11 11:27:21 +00:00
|
|
|
{% block content %}
|
|
|
|
{% 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">
|
|
|
|
<div id="ibox-content" class="ibox-title">
|
2015-01-26 15:32:52 +00:00
|
|
|
<h5> 填写主机组基本信息 </h5>
|
2015-01-11 11:27:21 +00:00
|
|
|
</div>
|
|
|
|
<div class="ibox-content">
|
|
|
|
{% 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">
|
2015-03-14 09:54:27 +00:00
|
|
|
<div class="form-group"><label class="col-sm-2 control-label"> 主机组名<span class="red-fonts">*</span></label>
|
2015-02-09 11:02:25 +00:00
|
|
|
<div class="col-sm-8" name="group_id" value="{{ post.id }}"><input type="text" value="{{ group.name }}" placeholder="网站" name="j_group" class="form-control"></div>
|
2015-02-03 14:45:51 +00:00
|
|
|
</div>
|
|
|
|
|
2015-03-18 10:05:46 +00:00
|
|
|
{% ifequal session_role_id 2 %}
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="j_dept" class="col-lg-2 control-label">所属部门<span class="red-fonts">*</span></label>
|
|
|
|
<div class="col-sm-8">
|
|
|
|
<select id="j_dept" name="j_dept" class="form-control m-b">
|
|
|
|
{% for d in edept %}
|
|
|
|
<option type="checkbox" value="{{ d.name }}">{{ d.name }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
2015-03-14 09:54:27 +00:00
|
|
|
</div>
|
2015-03-18 10:05:46 +00:00
|
|
|
{% endifequal %}
|
|
|
|
|
|
|
|
{% ifequal session_role_id 1 %}
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
<div class="form-group">
|
2015-03-19 10:32:10 +00:00
|
|
|
<label for="j_dept" class="col-lg-2 control-label">所属部门<span class="red-fonts" style="">*</span></label>
|
2015-03-18 10:05:46 +00:00
|
|
|
<div class="col-sm-8"><input type="text" name="j_dept" value="{{ edept.name }}" class="form-control" readonly="readonly"></div>
|
|
|
|
</div>
|
|
|
|
{% endifequal %}
|
2015-03-14 09:54:27 +00:00
|
|
|
|
|
|
|
<div class="hr-line-dashed"></div>
|
|
|
|
<div class="form-group">
|
2015-04-07 11:15:45 +00:00
|
|
|
<div>
|
|
|
|
<label for="groups" class="col-lg-2 control-label">主机<span class="red-fonts">*</span></label>
|
|
|
|
<div class="col-sm-3">
|
|
|
|
<select multiple="multiple" id="id_domains_filter" name="domains_filter" style="display: none;">
|
|
|
|
</select>
|
|
|
|
<div class="input-group" style="padding-bottom: 5px">
|
|
|
|
<input type="text" size="19" class="form-control input-sm" id="search" name="keyword" placeholder="过滤">
|
|
|
|
</div>
|
|
|
|
<select id="groups" size="12" class="form-control m-b" multiple>
|
|
|
|
{% for post in posts %}
|
2015-02-03 14:45:51 +00:00
|
|
|
<option value="{{ post.id }}">{{ post.ip }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
2015-04-07 11:15:45 +00:00
|
|
|
<div class="col-sm-1">
|
|
|
|
<div class="btn-group" style="margin-top: 50px;">
|
|
|
|
<button type="button" class="btn btn-xm btn-white" onclick="move('groups', 'groups_selected')"><i class="fa fa-chevron-right"></i></button>
|
|
|
|
<button type="button" class="btn btn-xm btn-white" onclick="move_left('groups_selected', 'groups')"><i class="fa fa-chevron-left"></i></button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-3">
|
|
|
|
<h4 style="padding-bottom: 5px">已选中主机</h4>
|
|
|
|
<div>
|
|
|
|
<select id="groups_selected" name="j_hosts" class="form-control m-b" size="12" multiple>
|
|
|
|
{% for post in eposts %}
|
|
|
|
<option value="{{ post.id }}">{{ post.ip }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-02-03 14:45:51 +00:00
|
|
|
</div>
|
2015-01-11 11:27:21 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<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" value="{{ j_comment }}" placeholder=包括web组所有主机 name="j_comment" class="form-control"></div>
|
2015-01-11 11:27:21 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<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>
|
2015-02-03 14:45:51 +00:00
|
|
|
<button class="btn btn-primary" type="submit" onclick="on_submit('groups_selected') "> 提交 </button>
|
2015-01-11 11:27:21 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
2015-01-19 02:09:16 +00:00
|
|
|
$('#assetForm').validator({
|
|
|
|
timely: 2,
|
|
|
|
theme: "yellow_right_effect",
|
|
|
|
fields: {
|
|
|
|
"j_group": {
|
|
|
|
rule: "required",
|
|
|
|
tip: "输入业务组名",
|
|
|
|
ok: "",
|
|
|
|
msg: {required: "业务组名必须填写!"},
|
|
|
|
data: {'data-ok':"业务组名可以使用"}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
valid: function(form) {
|
|
|
|
form.submit();
|
2015-01-11 11:27:21 +00:00
|
|
|
}
|
2015-01-19 02:09:16 +00:00
|
|
|
});
|
2015-02-03 14:45:51 +00:00
|
|
|
|
|
|
|
function on_submit(id){
|
|
|
|
$('#'+id+' option').each(
|
|
|
|
function(){
|
|
|
|
$(this).prop('selected', true)
|
|
|
|
})
|
|
|
|
}
|
2015-04-07 11:15:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
$('#search').keyup(function() {
|
|
|
|
var $rows = $('#groups option');
|
2015-04-11 09:45:33 +00:00
|
|
|
console.log($rows);
|
2015-04-07 11:15:45 +00:00
|
|
|
var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
|
|
|
|
|
|
|
|
$rows.show().filter(function() {
|
|
|
|
var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
|
|
|
|
return !~text.indexOf(val);
|
|
|
|
}).hide();
|
|
|
|
});
|
2015-01-11 11:27:21 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
{% endblock %}
|