bugfix(upload web) When download file, static file will unreachable. (#206)

* Update install.py

修改centos7支持

* Update install.py

* Support resize web terminal size

Support resize web terminal size.

Change new windows to a new tab.
May be more hommization

* Static bug (#204)

* 紧急修复下载文件后静态文件404问题

* 紧急修复监控白屏问题

* bugfix(upload web) When download file, static file will unreachable.

Didn't change dir

fixed
pull/207/head
ibuler 2016-04-20 15:20:11 +08:00
parent 9be13cf08f
commit cb58012a82
5 changed files with 24 additions and 16 deletions

View File

@ -85,12 +85,12 @@ class PreSetup(object):
@property @property
def _is_redhat(self): def _is_redhat(self):
if self.dist == "centos" or self.dist == "redhat" or self.dist == "fedora" or self.dist == "amazon linux ami": if self.dist.startswith("centos") or self.dist.startswith("red") or self.dist == "fedora" or self.dist == "amazon linux ami":
return True return True
@property @property
def _is_centos7(self): def _is_centos7(self):
if self.dist == "centos" and self.version.startswith("7"): if self.dist.startswith("centos") and self.version.startswith("7"):
return True return True
@property @property

View File

@ -326,11 +326,10 @@ def download(request):
FileLog(user=request.user.username, host=' '.join([asset.hostname for asset in asset_select]), FileLog(user=request.user.username, host=' '.join([asset.hostname for asset in asset_select]),
filename=file_path, type='download', remote_ip=remote_ip, result=runner.results).save() filename=file_path, type='download', remote_ip=remote_ip, result=runner.results).save()
logger.debug(runner.results) logger.debug(runner.results)
os.chdir('/tmp')
tmp_dir_name = os.path.basename(upload_dir) tmp_dir_name = os.path.basename(upload_dir)
tar_file = '%s.tar.gz' % upload_dir tar_file = '%s.tar.gz' % tmp_dir_name
bash('tar czf %s %s' % (tar_file, tmp_dir_name)) bash('cd /tmp && tar czf %s %s' % (tar_file, tmp_dir_name))
f = open(tar_file) f = open('/tmp/%s' % tar_file)
data = f.read() data = f.read()
f.close() f.close()
response = HttpResponse(data, content_type='application/octet-stream') response = HttpResponse(data, content_type='application/octet-stream')

View File

@ -1,4 +1,3 @@
/** /**
* Created by liuzheng on 3/3/16. * Created by liuzheng on 3/3/16.
*/ */
@ -63,8 +62,14 @@ function openTerminal(options) {
rowHeight = 35; rowHeight = 35;
colWidth = 100 colWidth = 100
} }
if(rowHeight){}else{rowHeight=35}; if (rowHeight) {
if(colWidth){}else{colWidth=100}; } else {
rowHeight = 35
}
if (colWidth) {
} else {
colWidth = 100
}
var term = new Terminal({ var term = new Terminal({
rows: rowHeight, rows: rowHeight,
@ -139,6 +144,11 @@ $(document).ready(function () {
term_client.term.resize(col, row); term_client.term.resize(col, row);
term_client.client.send({'resize': {'rows': row, 'cols': col}}); term_client.client.send({'resize': {'rows': row, 'cols': col}});
$('#ssh').show(); $('#ssh').show();
});
$(".terminal").mouseleave(function () {
$(".termChangBar").slideDown();
});
$(".terminal").mouseenter(function () {
$(".termChangBar").slideUp();
}) })
}); });

View File

@ -245,7 +245,7 @@
}); });
window.open(new_url+data, '_blank', 'toolbar=yes, location=yes, scrollbars=yes, resizable=yes, copyhistory=yes, width=628, height=400') window.open(new_url+data, '_blank', 'toolbar=yes, location=yes, scrollbars=yes, resizable=yes, copyhistory=yes, width=628, height=400')
*/ */
window.open(new_url+data, '', 'width=628px, height=380px'); window.open(new_url+data, "_blank");
} else if (dataArray.length == 1 && data != 'error'){ } else if (dataArray.length == 1 && data != 'error'){
/*layer.open({ /*layer.open({
type: 2, type: 2,
@ -256,8 +256,7 @@
content: new_url+data content: new_url+data
}); });
*/ */
window.open(new_url+data, '_blank', 'toolbar=yes, location=yes, copyhistory=yes, scrollbars=yes, width=628, height=410'); window.open(new_url+data, '_blank');
} }
else { else {
aUrl = ''; aUrl = '';
@ -293,7 +292,7 @@
content: new_url content: new_url
}); });
*/ */
window.open(new_url, '_blank', 'toolbar=yes, location=yes, copyhistory=yes, scrollbars=yes, width=628, height=380') window.open(new_url, '_blank')
} else { } else {
/* /*
@ -306,7 +305,7 @@
content: new_url content: new_url
}); });
*/ */
window.open(new_url, '_blank', 'toolbar=yes, location=yes, copyhistory=yes, scrollbars=yes, width=628, height=410'); window.open(new_url, '_blank');
} }
return false return false

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Jumpserver Web Terminal: {{ hostname }}</title> <title>{{ hostname }}</title>
<style> <style>
body { body {