jumpserver/templates/jperm/perm_role_detail.html

311 lines
15 KiB
HTML
Raw Normal View History

2015-11-14 13:52:09 +00:00
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
2015-11-30 11:06:25 +00:00
<div class="col-sm-4">
2015-11-14 13:52:09 +00:00
<div class="ibox float-e-margins">
<div class="ibox-title">
<span class="label label-primary"><b>授权规则</b></span>
<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>
<ul class="dropdown-menu dropdown-user">
<li><a href="#"></a>
</li>
<li><a href="#"></a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<div>
<div class="text-left">
<table class="table table-striped" id="ugedit" >
<thead>
<tr>
<th class="text-center">时间</th>
<th class="text-center">名称</th>
</tr>
</thead>
<tbody>
{% for rule in rules %}
<tr class="gradeX">
<td class="text-center"> {{ rule.date_added | date:"Y-m-d H:i:s"}} </td>
<td class="text-center"> {{ rule.name }} </td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
2015-11-30 11:06:25 +00:00
<div class="col-sm-4">
2015-11-14 13:52:09 +00:00
<div class="ibox float-e-margins">
<div class="ibox-title">
<span class="label label-primary"><b>授权用户/用户组</b></span>
<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>
<ul class="dropdown-menu dropdown-user">
<li><a href="#"></a>
</li>
<li><a href="#"></a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<div>
<div class="text-left">
<table class="table table-striped" id="ugedit" >
<thead>
<tr>
<th class="text-center">用户</th>
<th class="text-center">用户组</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr class="gradeX">
<td class="text-center"> {{ user.name }} </td>
<td class="text-center"> {{ user | user_which_groups:"group" }} </td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
2015-11-30 11:06:25 +00:00
<div class="col-sm-4">
2015-11-14 13:52:09 +00:00
<div class="ibox float-e-margins">
<div class="ibox-title">
<span class="label label-primary"><b>授权主机/主机组</b></span>
<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>
<ul class="dropdown-menu dropdown-user">
<li><a href="#"></a>
</li>
<li><a href="#"></a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<div>
<div class="text-left">
<table class="table table-striped" id="agedit" >
<thead>
<tr>
<th class="text-center">主机</th>
<th class="text-center">主机组</th>
</tr>
</thead>
<tbody>
{% for asset in assets %}
<tr class="gradeX">
<td class="text-center"> {{ asset.ip }} </td>
<td class="text-center"> {{ asset | asset_which_groups:"group" }} </td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
2015-11-30 15:04:02 +00:00
<div class="col-sm-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<span class="label label-primary"><b>推送主机</b></span>
<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>
<ul class="dropdown-menu dropdown-user">
<li><a href="#"></a>
</li>
<li><a href="#"></a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
2015-11-14 13:52:09 +00:00
</div>
<div class="ibox-content">
<div>
<div class="text-left">
<table class="table table-striped" id="ugedit" >
2015-11-30 15:04:02 +00:00
<a class="btn btn-xs btn-danger del_muti"> 删除 </a>
<thead>
<tr>
2015-11-30 15:04:02 +00:00
<th class="text-center">
2015-12-01 03:58:11 +00:00
<input type="checkbox" id="check_push" onclick="checkAll('check_push', 'asset_id')">
2015-11-30 15:04:02 +00:00
</th>
<th class="text-center">主机</th>
2015-11-30 11:06:25 +00:00
<th class="text-center">密钥</th>
<th class="text-center">密码</th>
<th class="text-center">结果</th>
2015-11-30 15:04:02 +00:00
<th class="text-center">操作</th>
2015-11-30 11:06:25 +00:00
</tr>
</thead>
<tbody>
{% for asset, info in pushed_asset.items %}
<tr class="gradeX">
2015-11-30 15:04:02 +00:00
<th class="text-center">
2015-12-01 03:58:11 +00:00
<input type="checkbox" name="asset_id" value="{{ asset.id }}">
2015-11-30 15:04:02 +00:00
</th>
2015-11-30 11:06:25 +00:00
<td class="text-center"> {{ asset.hostname }} </td>
<td class="text-center"> {{ info.key | yesno:"是,否,未知" }} </td>
<td class="text-center"> {{ info.password | yesno:"是,否,未知" }} </td>
{% if info.success %}
<td class="text-center" style="color: #1ab394;" >{{ info.success | yesno:"成功,失败,未知" }} </td>
{% else %}
<td class="text-center" style="color: #ec4758;cursor: help" title="{{ info.result }}" >{{ info.success | yesno:"成功,失败,未知" }} </td>
{% endif %}
2015-11-30 15:04:02 +00:00
<td class="text-center" ><a class="fa fa-times del" href="/jperm/role/recycle/?role_id={{ role.id }}&asset_id={{ asset.id }}" style="color: #ec4758;"></a></td>
2015-11-30 11:06:25 +00:00
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="ibox float-e-margins">
<div class="ibox-title">
2015-11-30 11:51:34 +00:00
<span class="label label-danger"><b>未推送主机</b></span>
2015-11-30 11:06:25 +00:00
<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>
<div class="text-left">
2015-12-01 03:58:11 +00:00
<table class="table table-striped" >
<a class="btn btn-xs btn-primary push_muti"> 推送 </a>
2015-11-30 11:06:25 +00:00
<thead>
<tr>
2015-12-01 03:58:11 +00:00
<th class="text-center">
<input type="checkbox" id="check_no_push" onclick="checkAll('check_no_push', 'asset_no_push_id')">
</th>
2015-11-30 11:06:25 +00:00
<th class="text-center">主机</th>
<th class="text-center">IP</th>
</tr>
</thead>
<tbody>
2015-11-30 11:06:25 +00:00
{% for asset in need_push_asset %}
<tr class="gradeX">
2015-12-01 03:58:11 +00:00
<th class="text-center">
<input type="checkbox" name="asset_no_push_id" value="{{ asset.id }}">
</th>
2015-11-30 11:06:25 +00:00
<td class="text-center"> {{ asset.hostname }} </td>
<td class="text-center"> {{ asset.ip }} </td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
2015-11-14 13:52:09 +00:00
</div>
</div>
</div>
2015-11-14 13:52:09 +00:00
</div>
</div>
2015-11-30 15:04:02 +00:00
{% endblock %}
{% block self_footer_js %}
2015-11-14 13:52:09 +00:00
<script>
$(document).ready(function(){
2015-11-30 15:04:02 +00:00
$('.del').click(function(){
var url = $(this).attr('href');
$.get(
url,
{},
function(data){
location.reload()
}
);
return false;
});
2015-11-14 13:52:09 +00:00
2015-11-30 15:04:02 +00:00
$('.del_muti').click(function(){
var check_array = [];
if (confirm("确定删除")) {
2015-12-01 03:58:11 +00:00
$(".gradeX input[name='asset_id']:checked").each(function() {
2015-11-30 15:04:02 +00:00
check_array.push($(this).attr("value"))
});
var url = '/jperm/role/recycle/?role_id={{ role.id }}&asset_id=' + check_array.join(',');
2015-12-01 03:58:11 +00:00
console.log(check_array);
2015-11-30 15:04:02 +00:00
$.get(url,
{},
function(data){
location.reload()
}
)
}
return false;
});
2015-11-14 13:52:09 +00:00
2015-12-01 03:58:11 +00:00
$('.push_muti').click(function(){
var check_array = [];
$(".gradeX input[name='asset_no_push_id']:checked").each(function() {
check_array.push($(this).attr("value"))
});
var url = '/jperm/role/push/?id={{ role.id }}&asset_id=' + check_array.join(',');
$(this).attr('href', url)
})
2015-11-30 15:04:02 +00:00
})
</script>
2015-11-14 13:52:09 +00:00
{% endblock %}