弹窗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'>
<input name="id" value="{{ asset.id }}" type="checkbox" class="i-checks">
</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.idc.name|default_if_none:"" }} </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 href = $(this).attr('href');
var new_url = '/jlog/web_terminal/?id=' + $(this).attr('value') + '&role=';
var hostname = $(this).closest('tr').find('.hostname')[0].innerHTML;
$.ajax({
type: 'GET',
url: url,
@ -182,21 +183,22 @@
success: function(data){
var dataArray = data.split(',');
if (dataArray.length == 1 && data != 'error'){
var title = 'Jumpserver Web Terminal' + '<span class="text-info"> '+ hostname +'</span>';
layer.open({
type: 2,
title: 'Jumpserver Web Terminal',
maxmin: true,
shade: false,
area: ['628px', '452px'],
content: new_url
});
type: 2,
title: title,
maxmin: true,
shade: false,
area: ['628px', '452px'],
content: new_url
});
//window.open(new_url + data, '', 'location=no, resizeable=no, height=410, width=625, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,status=no');
} else if (dataArray.length == '1' && data == 'error'){
layer.alert('没有授权角色')
} else {
aUrl = '';
$.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, {
skin: 'layui-layer-molv',
@ -211,11 +213,13 @@
});
});
function windowOpen(aTab){
var new_url = aTab.href;
function windowOpen(a){
var new_url = $(a).attr('href');
var hostname = $(a).attr('value');
var title = 'Jumpserver Web Terminal - ' + '<span class="text-info"> '+ hostname +'</span>';
layer.open({
type: 2,
title: 'Jumpserver Web Terminal',
title: title,
maxmin: true,
area: ['628px', '452px'],
shade: false,
@ -261,7 +265,6 @@
});
$('#asset_del').click(function () {
var asset_id_all = getIDall();
if (asset_id_all == ''){

@ -98,6 +98,7 @@
<table class="table table-striped table-bordered table-hover ">
<thead>
<tr>
<th class="text-center"> ID </th>
<th class="text-center"> 用户名 </th>
<th class="text-center"> 登录主机 </th>
<th class="text-center"> 来源IP </th>
@ -114,15 +115,16 @@
{% for post in contacts.object_list %}
<tr class="gradeX">
<td class="text-center" id="username"> {{ post.user }} </td>
<td class="text-center" id="ip"> {{ post.host }} </td>
<td class="text-center" id="remote_ip"> {{ post.remote_ip }} </td>
<td class="text-center username"> {{ post.id }} </td>
<td class="text-center username"> {{ post.user }} </td>
<td class="text-center ip"> {{ post.host }} </td>
<td class="text-center remote_ip"> {{ post.remote_ip }} </td>
{% ifnotequal session_role_id 0 %}
<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 命令统计 </a></td>
{% endifnotequal %}
<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" id="end_time"> {{ post.end_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 end_time"> {{ post.end_time|date:"Y-m-d H:i:s" }} </td>
</tr>
{% endfor %}
</tbody>
@ -142,20 +144,36 @@
<script>
$('.log_record').click(function(){
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;
});
$('.log_command').on('click',function(){
var url = $(this).attr('href');
var username = $('#username')[0].innerText;
var ip = $('#ip')[0].innerText;
var start_time = $('#start_time')[0].innerText;
var end_time = $('#end_time')[0].innerText;
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;
var url = $(this).attr('href');
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;
$.ajax({url:url,
success:function(data){
var tag = $('<div style="height: 500px;overflow: auto;background-color: rgba(0, 0, 0, 0);"></div>').html(data.replace(/\n/g,"<br />"));

Loading…
Cancel
Save