mirror of https://github.com/jumpserver/jumpserver
修改支持选中执行
parent
6080a861db
commit
255e3a043a
|
@ -363,5 +363,6 @@ def download(request):
|
|||
@login_required(login_url='/login')
|
||||
def exec_cmd(request):
|
||||
role = request.GET.get('role')
|
||||
check_assets = request.GET.get('check_assets', '')
|
||||
web_terminal_uri = 'ws://%s/exec?role=%s' % (WEB_SOCKET_HOST, role)
|
||||
return my_render('exec_cmd.html', locals(), request)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<div id="footer">
|
||||
<div class="content">
|
||||
<input type="text" id="pattern" placeholder="Ansible Pattern">
|
||||
<input type="text" id="pattern" value="{{ check_assets }}" placeholder="Ansible Pattern">
|
||||
<input type="text" id="command" placeholder="Command to execute">
|
||||
<input type="button" id="send_btn" value="Send" onclick="sendMessage()">
|
||||
</div>
|
||||
|
@ -119,7 +119,7 @@
|
|||
position: relative;
|
||||
}
|
||||
|
||||
#pattern { width: 20%; }
|
||||
#pattern { width: 25%; }
|
||||
#command { width: 60%; }
|
||||
#send_btn {
|
||||
width: 10%;
|
||||
|
|
|
@ -176,6 +176,11 @@
|
|||
$('#exec_cmd').click(function(){
|
||||
var url = '/jperm/role/get/';
|
||||
var new_url = '/exec_cmd/?role=';
|
||||
var check_array = [];
|
||||
$(".gradeX input:checked").closest('tr').find('.hostname a').each(function() {
|
||||
check_array.push($(this).text())
|
||||
});
|
||||
check_assets = check_array.join(':');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
|
@ -190,7 +195,7 @@
|
|||
maxmin: true,
|
||||
shade: false,
|
||||
area: ['800px', '700px'],
|
||||
content: new_url+data
|
||||
content: new_url+data+'&check_assets='+check_assets
|
||||
});
|
||||
//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'){
|
||||
|
@ -198,7 +203,7 @@
|
|||
} else {
|
||||
aUrl = '';
|
||||
$.each(dataArray, function(index, value){
|
||||
aUrl += '<a onclick="windowOpenExec(this); return false" class="btn btn-xs btn-primary newa" href=' + new_url + value + '>' + value + '</a> '
|
||||
aUrl += '<a onclick="windowOpenExec(this); return false" class="btn btn-xs btn-primary newa" href=' + new_url + value + '&check_assets=' + check_assets + '>' + value + '</a> '
|
||||
});
|
||||
layer.alert(aUrl, {
|
||||
skin: 'layui-layer-molv',
|
||||
|
|
Loading…
Reference in New Issue