资产详情弹窗

pull/6/head
halcyon 2015-01-14 16:39:57 +08:00
parent acf508f074
commit 6b95c7ed6f
13 changed files with 1270 additions and 18 deletions

View File

@ -4,10 +4,11 @@ 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'idc_add', jadd_idc), url(r"(\d+.\d+.\d+.\d+)/$",jlist_ip),
url(r'idc_list', jlist_idc), url(r'idc_add/$', jadd_idc),
url(r'group_add', jadd_group), url(r'idc_list/$', jlist_idc),
url(r'group_list', jlist_group), url(r'group_add/$', jadd_group),
url(r'group_list/$', jlist_group),
) )

View File

@ -1,10 +1,6 @@
# coding:utf-8 # coding:utf-8
import datetime
from django.shortcuts import render
from django.http import HttpResponse
from django.template import RequestContext from django.template import RequestContext
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.core.paginator import Paginator, EmptyPage from django.core.paginator import Paginator, EmptyPage
from models import IDC, Asset, BisGroup from models import IDC, Asset, BisGroup
@ -73,7 +69,7 @@ def jlist_host(request):
header_title, path1, path2 = '查看主机 | List Host', '资产管理', '查看主机' header_title, path1, path2 = '查看主机 | List Host', '资产管理', '查看主机'
posts = contact_list = Asset.objects.all().order_by('ip') posts = contact_list = Asset.objects.all().order_by('ip')
print posts print posts
paginator = Paginator(contact_list, 5) p = paginator = Paginator(contact_list, 5)
try: try:
page = int(request.GET.get('page', '1')) page = int(request.GET.get('page', '1'))
except ValueError: except ValueError:
@ -86,6 +82,11 @@ def jlist_host(request):
return render_to_response('jasset/jlist.html', locals(), context_instance=RequestContext(request)) return render_to_response('jasset/jlist.html', locals(), context_instance=RequestContext(request))
def jlist_ip(request, offset):
header_title, path1, path2 = '主机详细信息 | Host Detail.', '资产管理', '主机详情'
print offset
post = contact_list = Asset.objects.get(ip = str(offset))
return render_to_response('jasset/jlist_ip.html', locals(), context_instance=RequestContext(request))
def jadd_idc(request): def jadd_idc(request):
header_title, path1, path2 = '添加IDC | Add IDC', '资产管理', '添加IDC' header_title, path1, path2 = '添加IDC | Add IDC', '资产管理', '添加IDC'

50
static/css/colorbox.css Executable file
View File

@ -0,0 +1,50 @@
/*
Colorbox Core Style:
The following CSS is consistent between example themes and should not be altered.
*/
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
#cboxWrapper {max-width:none;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative;}
#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
#cboxTitle{margin:0;}
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;}
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
/*
User Style:
Change the following styles to modify the appearance of Colorbox. They are
ordered & tabbed in a way that represents the nesting of the generated HTML.
*/
#cboxOverlay{background:#fff; opacity: 0.9; filter: alpha(opacity = 90);}
#colorbox{outline:0;}
#cboxContent{margin-top:32px; overflow:visible; background:#000;}
.cboxIframe{background:#fff;}
#cboxError{padding:50px; border:1px solid #ccc;}
#cboxLoadedContent{background:#000; padding:1px;}
#cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;}
#cboxLoadingOverlay{background:#000;}
#cboxTitle{position:absolute; top:-22px; left:0; color:#000;}
#cboxCurrent{position:absolute; top:-22px; right:205px; text-indent:-9999px;}
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; text-indent:-9999px; width:20px; height:20px; position:absolute; top:-20px; background:url(images/controls.png) no-repeat 0 0;}
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
#cboxPrevious{background-position:0px 0px; right:44px;}
#cboxPrevious:hover{background-position:0px -25px;}
#cboxNext{background-position:-25px 0px; right:22px;}
#cboxNext:hover{background-position:-25px -25px;}
#cboxClose{background-position:-50px 0px; right:0;}
#cboxClose:hover{background-position:-50px -25px;}
.cboxSlideshow_on #cboxPrevious, .cboxSlideshow_off #cboxPrevious{right:66px;}
.cboxSlideshow_on #cboxSlideshow{background-position:-75px -25px; right:44px;}
.cboxSlideshow_on #cboxSlideshow:hover{background-position:-100px -25px;}
.cboxSlideshow_off #cboxSlideshow{background-position:-100px 0px; right:44px;}
.cboxSlideshow_off #cboxSlideshow:hover{background-position:-75px -25px;}

BIN
static/css/images/controls.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

BIN
static/css/images/loading.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

1090
static/js/jquery.colorbox.js Executable file

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@
<link rel="shortcut icon" href="/static/img/facio.ico" type="image/x-icon"> <link rel="shortcut icon" href="/static/img/facio.ico" type="image/x-icon">
{% include 'link_css.html' %} {% include 'link_css.html' %}
{% include 'script.html' %}
</head> </head>
@ -26,7 +27,7 @@
</div> </div>
</div> </div>
{% include 'script.html' %} <!--{% include 'script.html' %}-->
</body> </body>
</html> </html>

33
templates/css_js.html Normal file
View File

@ -0,0 +1,33 @@
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="/static/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="/static/css/animate.css" rel="stylesheet">
<link href="/static/css/style.css" rel="stylesheet">
<link href="/static/css/colorbox.css" rel="stylesheet">
<!-- Mainly scripts -->
<script src="/static/js/jquery-2.1.1.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- 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>
<!-- iCheck -->
<script src="/static/js/plugins/iCheck/icheck.min.js"></script>
<!-- Peity -->
<script src="/static/js/demo/peity-demo.js"></script>
<!-- pop windows -->
<script src="/static/js/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
$(".iframe").colorbox({iframe:true, width:"90%", height:"90%"});
});
</script>

View File

@ -7,9 +7,9 @@
<div class="ibox float-e-margins"> <div class="ibox float-e-margins">
<div class="text-center"> <div class="text-center">
<span>请选择添加内容: </span> <span>请选择添加内容: </span>
<a href="#" class="btn btn-xs btn-primary" id="lightVersion">添加主机</a> <a href="#" class="btn btn-xs btn-primary" id="addhost">添加主机</a>
<a href="#" class="btn btn-xs btn-primary" id="darkVersion">添加IDC</a> <a href="#" class="btn btn-xs btn-primary" id="addidc">添加IDC</a>
<a href="#" class="btn btn-xs btn-primary" id="leftVersion">添加业务组</a> <a href="#" class="btn btn-xs btn-primary" id="addbis">添加业务组</a>
</div> </div>
<div id="ibox-content" class="ibox-title"> <div id="ibox-content" class="ibox-title">
<h5> 填写主机基本信息 </h5> <h5> 填写主机基本信息 </h5>
@ -31,8 +31,11 @@
</a> </a>
</div> </div>
</div> </div>
<div class="ibox-content" name="addidc" id="addidc" onclick="show(this)">
addidc
</div>
<div class="ibox-content"> <div class="ibox-content" id="addhost">
{% if emg %} {% if emg %}
<div class="alert alert-warning text-center">{{ emg }}</div> <div class="alert alert-warning text-center">{{ emg }}</div>
{% endif %} {% endif %}
@ -146,6 +149,9 @@ var showFlag={};
if(showFlag.j_type=="MAP"){ if(showFlag.j_type=="MAP"){
document.getElementById("a1").style.display=""; document.getElementById("a1").style.display="";
} }
else if(showFlag.addidc=="addidc"){
document.getElementById("addidc").style.display="";
}
else{ else{
document.getElementById("a1").style.display="none"; document.getElementById("a1").style.display="none";
}}; }};

View File

@ -47,9 +47,9 @@
<tbody> <tbody>
{% for post in contacts.object_list %} {% for post in contacts.object_list %}
<tr class="gradeX"> <tr class="gradeX">
<td> {{ post.ip }} </td> <td> <a class="iframe" href="/jasset/{{ post.ip }}/">{{ post.ip }}</a></td>
<td> {{ post.port }} </td> <td> {{ post.port }} </td>
<td> {{ post.login_type}} </td> <td> {{ post.get_login_type}} </td>
<td class="center"> {{ post.idc.name }} </td> <td class="center"> {{ post.idc.name }} </td>
<td class="center"> <td class="center">
{% for group in post.bis_group.all %} {% for group in post.bis_group.all %}
@ -85,4 +85,10 @@
</div> </div>
</div> </div>
<script>
$(document).ready(function(){
$(".iframe").colorbox({iframe:true, width:"70%", height:"70%"});
});
</script>
{% endblock %} {% endblock %}

View File

@ -0,0 +1,60 @@
<html>
<head>
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="/static/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="/static/css/animate.css" rel="stylesheet">
<link href="/static/css/style.css" rel="stylesheet">
<link href="/static/css/colorbox.css" rel="stylesheet">
<!-- Mainly scripts -->
<script src="/static/js/jquery-2.1.1.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<style type="text/css">
body
{
background: #FFFFFF;
}
</style>
</head>
<body>
<div class="row">
<div class="contact-box">
<h2 class="text-center">{{ offset }}主机详情</h2>
<table class="table table-striped table-bordered table-hover " id="editable" >
<thead>
<tr>
<th> IP地址 </th>
<th> 端口号 </th>
<th> 登录方式 </th>
<th> 所属IDC </th>
<th> 所属业务组 </th>
<th> 添加时间 </th>
<th> 备注 </th>
</tr>
</thead>
<tbody>
<tr class="gradeX">
<td> <a class="iframe" href="/jasset/{{ post.ip }}/">{{ post.ip }}</a></td>
<td> {{ post.port }} </td>
<td> {{ post.get_login_type}} </td>
<td class="center"> {{ post.idc.name }} </td>
<td class="center">
{% for group in post.bis_group.all %}
{{ group }}
{% endfor %}
</td>
<td class="center"> {{ post.date_added }} </td>
<td class="center"> {{ post.comment }} </td>
</tr>
</tbody>
</table>
<a> 是否激活: {{ post.is_active }}</a>
</div>
</div>
</body>
</html>

View File

@ -3,3 +3,4 @@
<link href="/static/css/plugins/iCheck/custom.css" rel="stylesheet"> <link href="/static/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="/static/css/animate.css" rel="stylesheet"> <link href="/static/css/animate.css" rel="stylesheet">
<link href="/static/css/style.css" rel="stylesheet"> <link href="/static/css/style.css" rel="stylesheet">
<link href="/static/css/colorbox.css" rel="stylesheet">

View File

@ -26,3 +26,6 @@
<!--});--> <!--});-->
<!--</script>--> <!--</script>-->
<!-- pop windows -->
<script src="/static/js/jquery.colorbox.js"></script>