Unverified Commit 2f1d29d6 authored by 老广's avatar 老广 Committed by GitHub

Merge pull request #42 from jumpserver/dev

Dev
parents b05f7d8e e2183f2d
...@@ -69,7 +69,7 @@ class Forwarder: ...@@ -69,7 +69,7 @@ class Forwarder:
def ssh_with_password(self, width=80, height=24): def ssh_with_password(self, width=80, height=24):
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("192.168.244.176", 22, "root", "redhat123") ssh.connect("192.168.244.128", 22, "web", "redhat")
chan = ssh.invoke_shell(term='xterm', width=width, height=height) chan = ssh.invoke_shell(term='xterm', width=width, height=height)
return chan return chan
...@@ -175,7 +175,7 @@ def get_session_replay(pk): ...@@ -175,7 +175,7 @@ def get_session_replay(pk):
# }) # })
return jsonify({ return jsonify({
'type': 'json', 'type': 'json',
'src': 'http://localhost/media/2018-05-02/dbd5302d-7861-4810-b555-5fe71e26ccc3.gz', 'src': 'http://localhost/media/replay/2018-06-08/581a12ca-fa8f-4399-8800-f97935219ddf.replay.gz',
'status': 'DONE', 'status': 'DONE',
}) })
......
{ {
"name": "luna", "name": "luna",
"version": "1.3.0", "version": "1.3.2",
"license": "GPLv3", "license": "GPLv3",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
"elfinder": "git+https://github.com/Studio-42/elFinder.git#2.1.33", "elfinder": "git+https://github.com/Studio-42/elFinder.git#2.1.33",
"filetree-css": "^1.0.0", "filetree-css": "^1.0.0",
"font-awesome": "4.7.0", "font-awesome": "4.7.0",
"guacamole-common-js": "^0.9.14-b", "guacamole-common-js": "0.9.14-b",
"handlebars": "^4.0.11", "handlebars": "^4.0.11",
"intl": "1.2.5", "intl": "1.2.5",
"jquery": "3.2.1", "jquery": "3.2.1",
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
"lodash": "^4.17.10", "lodash": "^4.17.10",
"material-design-icons": "^3.0.1", "material-design-icons": "^3.0.1",
"materialize-css": "^0.100.2", "materialize-css": "^0.100.2",
"metismenu": "^2.7.7", "metismenu": "^2.7.9",
"mstsc.js": "^0.2.4", "mstsc.js": "^0.2.4",
"ng2-charts": "^1.5.0", "ng2-charts": "^1.5.0",
"ngx-bootstrap": "^1.6.6", "ngx-bootstrap": "^1.6.6",
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
"@angular/language-service": "5.2.0", "@angular/language-service": "5.2.0",
"@types/jasmine": "2.8.4", "@types/jasmine": "2.8.4",
"@types/jasminewd2": "~2.0.2", "@types/jasminewd2": "~2.0.2",
"@types/xterm": "^3.0.0",
"codelyzer": "4.0.2", "codelyzer": "4.0.2",
"jasmine-core": "2.8.0", "jasmine-core": "2.8.0",
"jasmine-spec-reporter": "4.2.1", "jasmine-spec-reporter": "4.2.1",
......
...@@ -126,9 +126,9 @@ export class HttpService { ...@@ -126,9 +126,9 @@ export class HttpService {
return this.http.get('/api/terminal/v1/sessions/' + token + '/replay'); return this.http.get('/api/terminal/v1/sessions/' + token + '/replay');
} }
get_replay_json(token: string) { // get_replay_json(token: string) {
return this.http.get('/api/terminal/v2/sessions/' + token + '/replay'); // return this.http.get('/api/terminal/v2/sessions/' + token + '/replay');
} // }
get_replay_data(src: string) { get_replay_data(src: string) {
return this.http.get(src); return this.http.get(src);
......
...@@ -25,6 +25,9 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges { ...@@ -25,6 +25,9 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
data: { data: {
simpleData: { simpleData: {
enable: true enable: true
},
key: {
title: 'title'
} }
}, },
callback: { callback: {
...@@ -67,7 +70,6 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges { ...@@ -67,7 +70,6 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
} }
if (changes['query'] && !changes['query'].firstChange) { if (changes['query'] && !changes['query'].firstChange) {
this.searchEvt$.next(this.query); this.searchEvt$.next(this.query);
// this.filter();
} }
} }
...@@ -81,8 +83,10 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges { ...@@ -81,8 +83,10 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
'id': node['id'], 'id': node['id'],
'key': node['key'], 'key': node['key'],
'name': node['name'], 'name': node['name'],
'title': node['name'],
'value': node['value'], 'value': node['value'],
'pId': node['parent'], 'pId': node['parent'],
'ip': '',
'assets_amount': node['assets_amount'], 'assets_amount': node['assets_amount'],
'isParent': true, 'isParent': true,
'open': node['key'] === '0' 'open': node['key'] === '0'
...@@ -91,16 +95,18 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges { ...@@ -91,16 +95,18 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
node['assets_granted'].forEach(asset => { node['assets_granted'].forEach(asset => {
if (!assets[asset['id']]) { if (!assets[asset['id']]) {
const platform = asset['platform'].toLowerCase().indexOf('win') === 0 ? 'windows' : 'linux';
this.nodes.push({ this.nodes.push({
'id': asset['id'], 'id': asset['id'],
'name': asset['hostname'], 'name': asset['hostname'],
'value': asset['hostname'], 'value': asset['hostname'],
'system_users_granted': asset['system_users_granted'], 'system_users_granted': asset['system_users_granted'],
'platform': asset['platform'], 'platform': asset['platform'],
'comment': asset['comment'], 'ip': asset['ip'],
'title': asset['ip'],
'isParent': false, 'isParent': false,
'pId': node['id'], 'pId': node['id'],
'iconSkin': asset['platform'].toLowerCase() 'iconSkin': platform
}); });
assets[asset['id'] + '@' + node['id']] = true; assets[asset['id'] + '@' + node['id']] = true;
} }
...@@ -116,10 +122,12 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges { ...@@ -116,10 +122,12 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
} }
}); });
$.fn.zTree.init($('#ztree'), this.setting, this.nodes); $.fn.zTree.init($('#ztree'), this.setting, this.nodes);
const zTree = $.fn.zTree.getZTreeObj('ztree');
const root = zTree.getNodes()[0];
zTree.expandNode(root, true);
} }
Connect(host) { Connect(host) {
// console.log(host);
let user: any; let user: any;
if (host.system_users_granted.length > 1) { if (host.system_users_granted.length > 1) {
user = this.checkPriority(host.system_users_granted); user = this.checkPriority(host.system_users_granted);
...@@ -163,7 +171,7 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges { ...@@ -163,7 +171,7 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
NavList.List[id].closed = false; NavList.List[id].closed = false;
NavList.List[id].host = host; NavList.List[id].host = host;
NavList.List[id].user = user; NavList.List[id].user = user;
if (user.protocol === 'ssh') { if (user.protocol === 'ssh' || user.protocol === 'telnet') {
NavList.List[id].type = 'ssh'; NavList.List[id].type = 'ssh';
} else if (user.protocol === 'rdp') { } else if (user.protocol === 'rdp') {
NavList.List[id].type = 'rdp'; NavList.List[id].type = 'rdp';
...@@ -237,12 +245,13 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges { ...@@ -237,12 +245,13 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
return null; return null;
} }
let shouldShow = []; let shouldShow = [];
nodes.forEach((node) => { const matchedNodes = zTreeObj.getNodesByFilter(function(node){
if (shouldShow.indexOf(node) === -1 && node.name.indexOf(_keywords) !== -1) { return node.name.indexOf(_keywords) !== -1 || node.ip.indexOf(_keywords) !== -1;
});
matchedNodes.forEach((node) => {
const parents = this.recurseParent(node); const parents = this.recurseParent(node);
const children = this.recurseChildren(node); const children = this.recurseChildren(node);
shouldShow = [...shouldShow, ...parents, ...children, node]; shouldShow = [...shouldShow, ...parents, ...children, node];
}
}); });
this.hiddenNodes = nodes; this.hiddenNodes = nodes;
this.expandNodes = shouldShow; this.expandNodes = shouldShow;
......
...@@ -57,10 +57,10 @@ export class ElementTermComponent implements OnInit, AfterViewInit { ...@@ -57,10 +57,10 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
const elementPaddingVer = elementPadding.top + elementPadding.bottom; const elementPaddingVer = elementPadding.top + elementPadding.bottom;
const elementPaddingHor = elementPadding.right + elementPadding.left; const elementPaddingHor = elementPadding.right + elementPadding.left;
const availableHeight = activeEle.height() - elementPaddingVer; const availableHeight = activeEle.height() - elementPaddingVer;
const availableWidth = activeEle.width() - elementPaddingHor - (<any>this.term).viewport.scrollBarWidth; const availableWidth = activeEle.width() - elementPaddingHor - (<any>this.term)._core.viewport.scrollBarWidth;
const geometry = [ const geometry = [
Math.floor(availableWidth / (<any>this.term).renderer.dimensions.actualCellWidth) - 1, Math.floor(availableWidth / (<any>this.term)._core.renderer.dimensions.actualCellWidth) - 1,
Math.floor(availableHeight / (<any>this.term).renderer.dimensions.actualCellHeight) - 1 Math.floor(availableHeight / (<any>this.term)._core.renderer.dimensions.actualCellHeight) - 1
]; ];
return geometry; return geometry;
} }
...@@ -70,7 +70,7 @@ export class ElementTermComponent implements OnInit, AfterViewInit { ...@@ -70,7 +70,7 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
if (isNaN(size[0]) || isNaN(size[1])) { if (isNaN(size[0]) || isNaN(size[1])) {
fit(this.term); fit(this.term);
} else { } else {
(<any>this.term).renderer.clear(); (<any>this.term)._core.renderer.clear();
this.term.resize(size[0], size[1]); this.term.resize(size[0], size[1]);
} }
this.winSizeChangeTrigger.emit([this.term.cols, this.term.rows]); this.winSizeChangeTrigger.emit([this.term.cols, this.term.rows]);
......
...@@ -24,7 +24,7 @@ export class PagesReplayComponent implements OnInit { ...@@ -24,7 +24,7 @@ export class PagesReplayComponent implements OnInit {
.subscribe(params => { .subscribe(params => {
token = params['token']; token = params['token'];
}); });
this._http.get_replay_json(token) this._http.get_replay(token)
.subscribe( .subscribe(
data => { data => {
this.replay.type = data['type']; this.replay.type = data['type'];
...@@ -32,7 +32,6 @@ export class PagesReplayComponent implements OnInit { ...@@ -32,7 +32,6 @@ export class PagesReplayComponent implements OnInit {
this.replay.id = data['id']; this.replay.id = data['id'];
}, },
err => { err => {
this._http.get_replay(token);
alert('没找到录像文件'); alert('没找到录像文件');
} }
); );
......
...@@ -2,5 +2,5 @@ export const environment = { ...@@ -2,5 +2,5 @@ export const environment = {
production: true production: true
}; };
// export const version = '1.3.0-{{BUILD_NUMBER}} GPLv2.'; // export const version = '1.3.0-{{BUILD_NUMBER}} GPLv2.';
// export const version = '1.3.0-101 GPLv2.'; // export const version = '1.3.3-101 GPLv2.';
export const version = '1.3.0-{{BUILD_NUMBER}} GPLv2.'; export const version = '1.3.3-{{BUILD_NUMBER}} GPLv2.';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment