Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions anweb/static/ajax/table_group.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<div class="row">
<div id="breadcrumb" class="col-xs-12">
<a href="#" class="show-sidebar">
<i class="fa fa-bars"></i>
</a>
<ol class="breadcrumb pull-left">
<li><a href="#">Dashbord</a></li>
<li><a href="#">Cherry</a></li>
<li><a href="#">Group</a></li>
</ol>
<div id="social" class="pull-right">
<a href="#"><i class="fa fa-google-plus"></i></a>
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-linkedin"></i></a>
<a href="#"><i class="fa fa-youtube"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<div class="box-name">
<i class="fa fa-linux"></i>
<span>服务器列表</span>
</div>
<div class="box-icons">
<a class="fa fa-plus-square-o" href="http://www.w3school.com.cn"></a>
<a class="fa fa-minus-square-o" href="http://www.w3school.com.cn"></a>
<a class="fa fa-sun-o" href="http://www.w3school.com.cn"></a>
</div>
<div class="no-move"></div>
</div>
<div class="box-content no-padding table-responsive">
<table class="table table-bordered table-striped table-hover table-heading table-datatable" id="datatable-2">
<thead>
<tr>
<th>组序号</th>
<th>组名称</th>
<th>组操作</th>
<th>组备注</th>
</tr>
</thead>
<tbody>

</tbody>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function getGroup() {
$.ajax({
url: 'groupsearch/',
type: "GET",
success: function (group_list) {
group_list = JSON.parse(group_list);
var string='';
for(var i in group_list){
for(var j=0;j<group_list[i].length;j++){
var temp=JSON.parse(group_list[i][j])
string+='<tr><td>'+temp['id']+'</td><td>'+temp['group_name']+
'</td><td><a class="fa fa-desktop" href="#static/ajax/table_host.html"></a></td><td>'
+ temp['remark']+'</td>';
}
}
$('tbody').html(string);
}
});
}
// Run Datables plugin and create 3 variants of settings
function AllTables(){
TestTable1();
TestTable2();
TestTable3();
LoadSelect2Script(MakeSelect2);
}
function MakeSelect2(){
$('select').select2();
$('.dataTables_filter').each(function(){
$(this).find('label input[type=text]').attr('placeholder', 'Search');
});
}

$(document).ready(function() {
// Load Datatables and run plugin on tables
LoadDataTablesScripts(AllTables);
// Add Drag-n-Drop feature
//WinMove();
getGroup();
});
</script>
84 changes: 84 additions & 0 deletions anweb/static/ajax/table_host.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<div class="row">
<div id="breadcrumb" class="col-xs-12">
<a href="#" class="show-sidebar">
<i class="fa fa-bars"></i>
</a>
<ol class="breadcrumb pull-left">
<li><a href="#">Dashbord</a></li>
<li><a href="#">Cherry</a></li>
<li><a href="#">Host</a></li>
</ol>
<div id="social" class="pull-right">
<a href="#"><i class="fa fa-google-plus"></i></a>
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-linkedin"></i></a>
<a href="#"><i class="fa fa-youtube"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<div class="box-name">
<i class="fa fa-linux"></i>
<span>服务器列表</span>
</div>
<div class="box-icons">
<a class="fa fa-plus-square-o" href="http://www.w3school.com.cn"></a>
<a class="fa fa-minus-square-o" href="http://www.w3school.com.cn"></a>
<a class="fa fa-sun-o" href="http://www.w3school.com.cn"></a>
</div>
<div class="no-move"></div>
</div>
<div class="box-content no-padding table-responsive">
<table class="table table-bordered table-striped table-hover table-heading table-datatable" id="datatable-2">
<thead>
<tr>
<th>主机序号</th>
<th>主机名称</th>
<th>主机属组</th>
<th>主机类别</th>
<th>主机操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>redis.yo.miracle.com</td>
<td>新闻24小时APP</td>
<td>Redis服务器</td>
<td>
<a class="fa fa-calendar" href="http://www.w3school.com.cn"></a>
<a class="fa fa-calendar" href="http://www.w3school.com.cn"></a>
<a class="fa fa-calendar" href="http://www.w3school.com.cn"></a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
// Run Datables plugin and create 3 variants of settings
function AllTables(){
TestTable1();
TestTable2();
TestTable3();
LoadSelect2Script(MakeSelect2);
}
function MakeSelect2(){
$('select').select2();
$('.dataTables_filter').each(function(){
$(this).find('label input[type=text]').attr('placeholder', 'Search');
});
}
$(document).ready(function() {
// Load Datatables and run plugin on tables
LoadDataTablesScripts(AllTables);
// Add Drag-n-Drop feature
WinMove();
});
</script>
10 changes: 5 additions & 5 deletions anweb/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def Index(request):

@require_http_methods(["GET",])
def get_group_list(request):
group_list=Group.objects.all()
list={}
for group in group_list:
list=list+toJSON(group)
a=Group.objects.all()
list=[]
for i in a:
list.append(toJSON(i))
print(list)
return HttpResponse(json.dumps({
'group_list':json.dumps(serializers.serialize("json",Group.objects.all())),
'group_list':list
}))
3 changes: 2 additions & 1 deletion util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ def toJSON(self):
d[attr]=getattr(self, attr).__str__()
else:
d[attr]=getattr(self, attr)
return json.dumps(d)
return json.dumps(d)