Commit 7863a685 authored by halcyon's avatar halcyon

资产管理页面基本完成,尚有部分小bug

parent 1925cf40
...@@ -4,11 +4,16 @@ from jasset.views import * ...@@ -4,11 +4,16 @@ from jasset.views import *
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^$', index), url(r'^$', index),
url(r'host_add/$', jadd_host), url(r'^host_add/$', jadd_host),
url(r'host_list/$', jlist_host), url(r'^host_list/$', jlist_host),
url(r"(\d+.\d+.\d+.\d+)/$",jlist_ip), url(r"^(\d+.\d+.\d+.\d+)/$",jlist_ip),
url(r'idc_add/$', jadd_idc), url(r'^idc_add/$', jadd_idc),
url(r'idc_list/$', jlist_idc), url(r'^idc_list/$', jlist_idc),
url(r'group_add/$', jadd_group), url(r'^idc_del/(\d+)/$', idc_del),
url(r'group_list/$', jlist_group), url(r'^group_add/$', jadd_group),
url(r'^group_list/$', jlist_group),
url(r'^group_del/(\d+)/$', group_del),
url(r'^host_del/(\d+.\d+.\d+.\d+)/$', host_del),
url(r'^host_edit/(\d+.\d+.\d+.\d+)/$', host_edit),
url(r'^test/$', test),
) )
\ No newline at end of file
This diff is collapsed.
...@@ -15,3 +15,7 @@ def stamp2str(value): ...@@ -15,3 +15,7 @@ def stamp2str(value):
@register.filter(name='int2str') @register.filter(name='int2str')
def int2str(value): def int2str(value):
return str(value) return str(value)
@register.filter(name='get_item')
def get_item(dictionary, key):
return dictionary.get(key)
...@@ -158,7 +158,6 @@ def user_list(request): ...@@ -158,7 +158,6 @@ def user_list(request):
def db_add_user(**kwargs): def db_add_user(**kwargs):
groups_post = kwargs.pop('groups') groups_post = kwargs.pop('groups')
user = User(**kwargs) user = User(**kwargs)
group_select = []
for group_id in groups_post: for group_id in groups_post:
group = UserGroup.objects.filter(id=group_id) group = UserGroup.objects.filter(id=group_id)
group_select.extend(group) group_select.extend(group)
......
...@@ -30,14 +30,17 @@ ...@@ -30,14 +30,17 @@
{% if emg %} {% if emg %}
<div class="alert alert-warning text-center">{{ emg }}</div> <div class="alert alert-warning text-center">{{ emg }}</div>
{% endif %} {% endif %}
<form method="post" class="form-horizontal"> {% if smg %}
<div class="alert alert-success text-center">{{ smg }}</div>
{% endif %}
<form id="assetForm" method="post" class="form-horizontal">
<div class="form-group"><label class="col-sm-2 control-label"> 业务组名 </label> <div class="form-group"><label class="col-sm-2 control-label"> 业务组名 </label>
<div class="col-sm-8"><input type="text" value="{{ j_ip }}" placeholder="网站" name="j_group" class="form-control"></div> <div class="col-sm-8"><input type="text" value="{{ j_group }}" placeholder="网站" name="j_group" class="form-control"></div>
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
<div class="form-group"><label class="col-sm-2 control-label"> 备注 </label> <div class="form-group"><label class="col-sm-2 control-label"> 备注 </label>
<div class="col-sm-8"><input type="text" value="{{ s_port }}" placeholder=包括web组所有主机 name="j_comment" class="form-control"></div> <div class="col-sm-8"><input type="text" value="{{ j_comment }}" placeholder=包括web组所有主机 name="j_comment" class="form-control"></div>
</div> </div>
<div class="hr-line-dashed"></div> <div class="hr-line-dashed"></div>
...@@ -54,52 +57,23 @@ ...@@ -54,52 +57,23 @@
</div> </div>
</div> </div>
<!-- Peity -->
<script src="static/js/plugins/peity/jquery.peity.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="static/js/inspinia.js"></script>
<script src="static/js/plugins/pace/pace.min.js"></script>
<!-- Peity -->
<script src="static/js/demo/peity-demo.js"></script>
<script> <script>
var showFlag={}; $('#assetForm').validator({
function show(o){ timely: 2,
showFlag[o.name]=o.value; theme: "yellow_right_effect",
if(showFlag.j_type=="MAP"){ fields: {
document.getElementById("a1").style.display=""; "j_group": {
rule: "required",
tip: "输入业务组名",
ok: "",
msg: {required: "业务组名必须填写!"},
data: {'data-ok':"业务组名可以使用"}
} }
else{ },
document.getElementById("a1").style.display="none"; valid: function(form) {
}}; form.submit();
}
$(document).ready(function(){ });
// Local script for demo purpose only
$('#lightVersion').click(function(event) {
event.preventDefault()
$('#ibox-content').removeClass('ibox-content');
$('#vertical-timeline').removeClass('dark-timeline');
$('#vertical-timeline').addClass('light-timeline');
});
$('#darkVersion').click(function(event) {
event.preventDefault()
$('#ibox-content').addClass('ibox-content');
$('#vertical-timeline').removeClass('light-timeline');
$('#vertical-timeline').addClass('dark-timeline');
});
$('#leftVersion').click(function(event) {
event.preventDefault()
$('#vertical-timeline').toggleClass('center-orientation');
});
});
</script> </script>
......
...@@ -29,23 +29,29 @@ ...@@ -29,23 +29,29 @@
<div class="ibox-content"> <div class="ibox-content">
<div class=""> <div class="">
<a onclick="fnClickAddRow();" href="javascript:void(0);" class="btn btn-primary "> 添加 </a> <a target="_blank" href="/jasset/group_add" class="btn btn-sm btn-primary "> 添加 </a>
</div> </div>
<table class="table table-striped table-bordered table-hover " id="editable" > <table class="table table-striped table-bordered table-hover " id="editable" >
<thead> <thead>
<tr> <tr>
<th> ID </th> <th class="text-center"> ID </th>
<th> 机房名 </th> <th class="text-center"> 机房名 </th>
<th> 备注 </th> <th class="text-center"> 备注 </th>
<th class="text-center"> 操作 </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for post in posts %} {% for post in posts %}
<tr class="gradeX"> <tr class="gradeX">
<td> {{ post.id }} </td> <td class="text-center"> {{ post.id }} </td>
<td> {{ post.name }} </td> <td class="text-center"> {{ post.name }} </td>
<td> {{ post.comment }} </td> <td class="text-center"> {{ post.comment }} </td>
<td class="text-center">
<a href="/jasset/{{ post.ip }}/" class="iframe btn btn-xs btn-primary">详情</a>
<a href="/jasset/host_edit/{{ post.ip }}" class="btn btn-xs btn-info">编辑</a>
<a href="/jasset/group_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
......
This diff is collapsed.
{% extends 'base.html' %} {% extends 'base.html' %}
{% load mytags %}
{% block content %} {% block content %}
{% include 'nav_cat_bar.html' %} {% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight"> <div class="wrapper wrapper-content animated fadeInRight">
<div class="row"> <div class="row">
<div class="col-lg-10"> <div class="col-lg-12">
<div class="ibox float-e-margins"> <div class="ibox float-e-margins">
<div class="ibox-title"> <div class="ibox-title">
<h5> 主机详细信息列表 </h5> <h5> 主机详细信息列表 </h5>
...@@ -29,35 +30,43 @@ ...@@ -29,35 +30,43 @@
<div class="ibox-content"> <div class="ibox-content">
<div class=""> <div class="">
<a onclick="fnClickAddRow();" href="javascript:void(0);" class="btn btn-primary "> 添加 </a> <a target="_blank" href="/jasset/host_add" class="btn btn-sm btn-primary "> 添加 </a>
</div> </div>
<table class="table table-striped table-bordered table-hover " id="editable" > <table class="table table-striped table-bordered table-hover " id="editable" >
<thead> <thead>
<tr> <tr>
<th> IP地址 </th> <th class="text-center"><input type="checkbox" class="i-checks" name=""></th>
<th> 端口号 </th> <th class="text-center"> IP地址 </th>
<th> 登录方式 </th> <th class="text-center"> 端口号 </th>
<th> 所属IDC </th> <th class="text-center"> 登录方式 </th>
<th> 所属业务组 </th> <th class="text-center"> 所属IDC </th>
<th> 添加时间 </th> <th class="text-center"> 所属业务组 </th>
<th> 备注 </th> <th class="text-center"> 添加时间 </th>
<th class="text-center"> 备注 </th>
<th class="text-center"> 操作 </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for post in contacts.object_list %} {% for post in contacts.object_list %}
<tr class="gradeX"> <tr class="gradeX">
<td> <a class="iframe" href="/jasset/{{ post.ip }}/">{{ post.ip }}</a></td> <td class="text-center"><input type="checkbox" class="i-checks" name=""></td>
<td> {{ post.port }} </td> <td class="text-center"> {{ post.ip }} </td>
<td> {{ post.get_login_type}} </td> <td class="text-center"> {{ post.port }} </td>
<td class="center"> {{ post.idc.name }} </td> <td class="text-center"> {{ login_types|get_item:post.login_type }} </td>
<td class="center"> <td class="text-center"> {{ post.idc.name }} </td>
<td class="text-center">
{% for group in post.bis_group.all %} {% for group in post.bis_group.all %}
{{ group }} {{ group }}
{% endfor %} {% endfor %}
</td> </td>
<td class="center"> {{ post.date_added }} </td> <td class="text-center"> {{ post.date_added }} </td>
<td class="center"> {{ post.comment }} </td> <td class="text-center"> {{ post.comment }} </td>
<td class="text-center">
<a href="/jasset/{{ post.ip }}/" class="iframe btn btn-xs btn-primary">详情</a>
<a href="/jasset/host_edit/{{ post.ip }}" class="btn btn-xs btn-info">编辑</a>
<a href="/jasset/host_del/{{ post.ip }}" class="btn btn-xs btn-danger">删除</a>
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
......
...@@ -30,7 +30,10 @@ ...@@ -30,7 +30,10 @@
{% if emg %} {% if emg %}
<div class="alert alert-warning text-center">{{ emg }}</div> <div class="alert alert-warning text-center">{{ emg }}</div>
{% endif %} {% endif %}
<form method="post" class="form-horizontal"> {% if smg %}
<div class="alert alert-success text-center">{{ smg }}</div>
{% endif %}
<form id="assetForm" method="post" class="form-horizontal">
<div class="form-group"><label class="col-sm-2 control-label"> IDC名 </label> <div class="form-group"><label class="col-sm-2 control-label"> IDC名 </label>
<div class="col-sm-8"><input type="text" value="{{ j_ip }}" placeholder="北京联通" name="j_idc" class="form-control"></div> <div class="col-sm-8"><input type="text" value="{{ j_ip }}" placeholder="北京联通" name="j_idc" class="form-control"></div>
</div> </div>
...@@ -44,7 +47,7 @@ ...@@ -44,7 +47,7 @@
<div class="form-group"> <div class="form-group">
<div class="col-sm-4 col-sm-offset-5"> <div class="col-sm-4 col-sm-offset-5">
<button class="btn btn-white" type="submit"> 重置 </button> <button class="btn btn-white" type="submit"> 重置 </button>
<button class="btn btn-primary" type="submit"> 提交 </button> <button class="btn btn-primary" type="sumbit"> 提交 </button>
</div> </div>
</div> </div>
</form> </form>
...@@ -54,53 +57,23 @@ ...@@ -54,53 +57,23 @@
</div> </div>
</div> </div>
<!-- Peity -->
<script src="static/js/plugins/peity/jquery.peity.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="static/js/inspinia.js"></script>
<script src="static/js/plugins/pace/pace.min.js"></script>
<!-- Peity -->
<script src="static/js/demo/peity-demo.js"></script>
<script> <script>
var showFlag={}; $('#assetForm').validator({
function show(o){ timely: 2,
showFlag[o.name]=o.value; theme: "yellow_right_effect",
if(showFlag.j_type=="MAP"){ fields: {
document.getElementById("a1").style.display=""; "j_idc": {
rule: "required",
tip: "输入IDC名",
ok: "",
msg: {required: "IDC名必须填写!"},
data: {'data-ok':"主机名可以使用", 'data-msg-required': '主机名已正确'}
} }
else{ },
document.getElementById("a1").style.display="none"; valid: function(form) {
}}; form.submit();
}
$(document).ready(function(){ });
// Local script for demo purpose only
$('#lightVersion').click(function(event) {
event.preventDefault()
$('#ibox-content').removeClass('ibox-content');
$('#vertical-timeline').removeClass('dark-timeline');
$('#vertical-timeline').addClass('light-timeline');
});
$('#darkVersion').click(function(event) {
event.preventDefault()
$('#ibox-content').addClass('ibox-content');
$('#vertical-timeline').removeClass('light-timeline');
$('#vertical-timeline').addClass('dark-timeline');
});
$('#leftVersion').click(function(event) {
event.preventDefault()
$('#vertical-timeline').toggleClass('center-orientation');
});
});
</script> </script>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -29,23 +29,29 @@ ...@@ -29,23 +29,29 @@
<div class="ibox-content"> <div class="ibox-content">
<div class=""> <div class="">
<a onclick="fnClickAddRow();" href="javascript:void(0);" class="btn btn-primary "> 添加 </a> <a target="_blank" href="/jasset/idc_add" class="btn btn-sm btn-primary "> 添加 </a>
</div> </div>
<table class="table table-striped table-bordered table-hover " id="editable" > <table class="table table-striped table-bordered table-hover " id="editable" >
<thead> <thead>
<tr> <tr>
<th> ID </th> <th class="text-center"> ID </th>
<th> 机房名 </th> <th class="text-center"> 机房名 </th>
<th> 备注 </th> <th class="text-center"> 备注 </th>
<th class="text-center"> 操作 </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for post in posts %} {% for post in posts %}
<tr class="gradeX"> <tr class="gradeX">
<td> {{ post.id }} </td> <td class="text-center"> {{ post.id }} </td>
<td> {{ post.name }} </td> <td class="text-center"> {{ post.name }} </td>
<td> {{ post.comment }} </td> <td class="text-center"> {{ post.comment }} </td>
<td class="text-center">
<a href="/jasset/{{ post.ip }}/" class="iframe btn btn-xs btn-primary">详情</a>
<a href="/jasset/host_edit/{{ post.ip }}" class="btn btn-xs btn-info">编辑</a>
<a href="/jasset/idc_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
......
<div id="result" class="tip-ok" style="display:none">提交成功</div>
<form id="signup_form" class="signup" autocomplete="off">
<fieldset>
<div class="form-item">
<div class="field-name">全名</div>
<div class="field-input">
<input type="text" name="user[name]" maxlength="20" autocomplete="off">
</div>
</div>
<div class="form-item">
<div class="field-name">电子邮件地址</div>
<div class="field-input">
<input type="text" name="user[email]" autocomplete="off">
</div>
</div>
<div class="form-item">
<div class="field-name">创建密码</div>
<div class="field-input">
<input type="password" name="user[user_password]">
</div>
</div>
<div class="form-item">
<div class="field-name">选择你的用户名</div>
<div class="field-input">
<input type="text" name="user[screen_name]" maxlength="15" autocomplete="off">
</div>
</div>
</fieldset>
<button id="btn-submit" class="btn-submit" type="submit">创建我的账号</button>
</form>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment