弹窗title修改

pull/26/head
ibuler 9 years ago
parent 02c3bc75f3
commit 19dcf171e6

@ -119,7 +119,7 @@
<td class="text-center" name="id" value="{{ asset.id }}" data-editable='false'> <td class="text-center" name="id" value="{{ asset.id }}" data-editable='false'>
<input name="id" value="{{ asset.id }}" type="checkbox" class="i-checks"> <input name="id" value="{{ asset.id }}" type="checkbox" class="i-checks">
</td> </td>
<td class="text-center"> {{ asset.hostname|default_if_none:"" }} </td> <td class="text-center hostname"> {{ asset.hostname|default_if_none:"" }} </td>
<td class="text-center"> {{ asset.ip|default_if_none:"" }} </td> <td class="text-center"> {{ asset.ip|default_if_none:"" }} </td>
<td class="text-center"> {{ asset.idc.name|default_if_none:"" }} </td> <td class="text-center"> {{ asset.idc.name|default_if_none:"" }} </td>
<td class="text-center">{{ asset.group.all|group_str2 }}</td> <td class="text-center">{{ asset.group.all|group_str2 }}</td>
@ -175,6 +175,7 @@
var url='/jlog/get_role_name/?id=' + $(this).attr('value'); var url='/jlog/get_role_name/?id=' + $(this).attr('value');
var href = $(this).attr('href'); var href = $(this).attr('href');
var new_url = '/jlog/web_terminal/?id=' + $(this).attr('value') + '&role='; var new_url = '/jlog/web_terminal/?id=' + $(this).attr('value') + '&role=';
var hostname = $(this).closest('tr').find('.hostname')[0].innerHTML;
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: url, url: url,
@ -182,9 +183,10 @@
success: function(data){ success: function(data){
var dataArray = data.split(','); var dataArray = data.split(',');
if (dataArray.length == 1 && data != 'error'){ if (dataArray.length == 1 && data != 'error'){
var title = 'Jumpserver Web Terminal' + '<span class="text-info"> '+ hostname +'</span>';
layer.open({ layer.open({
type: 2, type: 2,
title: 'Jumpserver Web Terminal', title: title,
maxmin: true, maxmin: true,
shade: false, shade: false,
area: ['628px', '452px'], area: ['628px', '452px'],
@ -196,7 +198,7 @@
} else { } else {
aUrl = ''; aUrl = '';
$.each(dataArray, function(index, value){ $.each(dataArray, function(index, value){
aUrl += '<a onclick="windowOpen(this); return false" class="btn btn-xs btn-primary newa" href=' + new_url + value + '>' + value + '</a> ' aUrl += '<a onclick="windowOpen(this); return false" class="btn btn-xs btn-primary newa" href=' + new_url + value + ' value=' + hostname + '>' + value + '</a> '
}); });
layer.alert(aUrl, { layer.alert(aUrl, {
skin: 'layui-layer-molv', skin: 'layui-layer-molv',
@ -211,11 +213,13 @@
}); });
}); });
function windowOpen(aTab){ function windowOpen(a){
var new_url = aTab.href; var new_url = $(a).attr('href');
var hostname = $(a).attr('value');
var title = 'Jumpserver Web Terminal - ' + '<span class="text-info"> '+ hostname +'</span>';
layer.open({ layer.open({
type: 2, type: 2,
title: 'Jumpserver Web Terminal', title: title,
maxmin: true, maxmin: true,
area: ['628px', '452px'], area: ['628px', '452px'],
shade: false, shade: false,
@ -261,7 +265,6 @@
}); });
$('#asset_del').click(function () { $('#asset_del').click(function () {
var asset_id_all = getIDall(); var asset_id_all = getIDall();
if (asset_id_all == ''){ if (asset_id_all == ''){

@ -98,6 +98,7 @@
<table class="table table-striped table-bordered table-hover "> <table class="table table-striped table-bordered table-hover ">
<thead> <thead>
<tr> <tr>
<th class="text-center"> ID </th>
<th class="text-center"> 用户名 </th> <th class="text-center"> 用户名 </th>
<th class="text-center"> 登录主机 </th> <th class="text-center"> 登录主机 </th>
<th class="text-center"> 来源IP </th> <th class="text-center"> 来源IP </th>
@ -114,15 +115,16 @@
{% for post in contacts.object_list %} {% for post in contacts.object_list %}
<tr class="gradeX"> <tr class="gradeX">
<td class="text-center" id="username"> {{ post.user }} </td> <td class="text-center username"> {{ post.id }} </td>
<td class="text-center" id="ip"> {{ post.host }} </td> <td class="text-center username"> {{ post.user }} </td>
<td class="text-center" id="remote_ip"> {{ post.remote_ip }} </td> <td class="text-center ip"> {{ post.host }} </td>
<td class="text-center remote_ip"> {{ post.remote_ip }} </td>
{% ifnotequal session_role_id 0 %} {% ifnotequal session_role_id 0 %}
<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 命令统计 </a></td> <td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 命令统计 </a></td>
{% endifnotequal %} {% endifnotequal %}
<td class="text-center"><a value="/jlog/record/?id={{ post.id }}" class="log_record"> 回放 </a></td> <td class="text-center"><a value="/jlog/record/?id={{ post.id }}" class="log_record"> 回放 </a></td>
<td class="text-center" id="start_time"> {{ post.start_time|date:"Y-m-d H:i:s"}} </td> <td class="text-center start_time"> {{ post.start_time|date:"Y-m-d H:i:s"}} </td>
<td class="text-center" id="end_time"> {{ post.end_time|date:"Y-m-d H:i:s" }} </td> <td class="text-center end_time"> {{ post.end_time|date:"Y-m-d H:i:s" }} </td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@ -142,16 +144,32 @@
<script> <script>
$('.log_record').click(function(){ $('.log_record').click(function(){
var url = $(this).attr('value'); var url = $(this).attr('value');
window.open(url, '播放', 'height=500, width=910, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no'); //window.open(url, '播放', 'height=500, width=910, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
var username = $(this).closest('tr').find('.username')[0].innerHTML;
var ip = $(this).closest('tr').find('.ip')[0].innerHTML;
var start_time = $(this).closest('tr').find('.start_time')[0].innerHTML;
var end_time = $(this).closest('tr').find('.end_time')[0].innerHTML;
var div_username = ' 用户名: '+'<span class="text-info">'+username+'' + '</span>';
var div_ip = ' 主机: '+'<span class="text-info">' + ip + '</span>';
var div_time = ' 时间: ' + '<span class="text-info">'+start_time +'</span>' +' - <span class="text-info">' + end_time + '</span>';
var title = 'JumpServer录像回放 '+ div_username + div_ip + div_time;
layer.open({
type: 2,
title: title,
maxmin: true,
shade: false,
area: ['800px', '520px'],
content: url
});
return false; return false;
}); });
$('.log_command').on('click',function(){ $('.log_command').on('click',function(){
var url = $(this).attr('href'); var url = $(this).attr('href');
var username = $('#username')[0].innerText; var username = $(this).closest('tr').find('.username')[0].innerHTML;
var ip = $('#ip')[0].innerText; var ip = $(this).closest('tr').find('.ip')[0].innerHTML;
var start_time = $('#start_time')[0].innerText; var start_time = $(this).closest('tr').find('.start_time')[0].innerHTML;
var end_time = $('#end_time')[0].innerText; var end_time = $(this).closest('tr').find('.end_time')[0].innerHTML;
var div_username = ' 用户名: '+'<span class="text-info">'+username+'' + '</span>'; var div_username = ' 用户名: '+'<span class="text-info">'+username+'' + '</span>';
var div_ip = ' 主机: '+'<span class="text-info">' + ip + '</span>'; var div_ip = ' 主机: '+'<span class="text-info">' + ip + '</span>';
var div_time = ' 开始时间: ' + '<span class="text-info">'+start_time +'</span>' + ' 结束时间: ' +'<span class="text-info">' + end_time + '</span>'; var div_time = ' 开始时间: ' + '<span class="text-info">'+start_time +'</span>' + ' 结束时间: ' +'<span class="text-info">' + end_time + '</span>';

Loading…
Cancel
Save