Skip to content

Commit

Permalink
Merge pull request #42 from jumpserver/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ibuler authored Aug 7, 2018
2 parents b05f7d8 + e2183f2 commit 2f1d29d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 25 deletions.
4 changes: 2 additions & 2 deletions mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def watch_win_size_change_async(self):
def ssh_with_password(self, width=80, height=24):
ssh = paramiko.SSHClient()
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)
return chan

Expand Down Expand Up @@ -175,7 +175,7 @@ def get_session_replay(pk):
# })
return jsonify({
'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',
})

Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "luna",
"version": "1.3.0",
"version": "1.3.2",
"license": "GPLv3",
"scripts": {
"ng": "ng",
Expand Down Expand Up @@ -37,7 +37,7 @@
"elfinder": "git+https://github.com/Studio-42/elFinder.git#2.1.33",
"filetree-css": "^1.0.0",
"font-awesome": "4.7.0",
"guacamole-common-js": "^0.9.14-b",
"guacamole-common-js": "0.9.14-b",
"handlebars": "^4.0.11",
"intl": "1.2.5",
"jquery": "3.2.1",
Expand All @@ -47,7 +47,7 @@
"lodash": "^4.17.10",
"material-design-icons": "^3.0.1",
"materialize-css": "^0.100.2",
"metismenu": "^2.7.7",
"metismenu": "^2.7.9",
"mstsc.js": "^0.2.4",
"ng2-charts": "^1.5.0",
"ngx-bootstrap": "^1.6.6",
Expand Down Expand Up @@ -80,7 +80,6 @@
"@angular/language-service": "5.2.0",
"@types/jasmine": "2.8.4",
"@types/jasminewd2": "~2.0.2",
"@types/xterm": "^3.0.0",
"codelyzer": "4.0.2",
"jasmine-core": "2.8.0",
"jasmine-spec-reporter": "4.2.1",
Expand Down
6 changes: 3 additions & 3 deletions src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ export class HttpService {
return this.http.get('/api/terminal/v1/sessions/' + token + '/replay');
}

get_replay_json(token: string) {
return this.http.get('/api/terminal/v2/sessions/' + token + '/replay');
}
// get_replay_json(token: string) {
// return this.http.get('/api/terminal/v2/sessions/' + token + '/replay');
// }

get_replay_data(src: string) {
return this.http.get(src);
Expand Down
25 changes: 17 additions & 8 deletions src/app/elements/asset-tree/asset-tree.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
data: {
simpleData: {
enable: true
},
key: {
title: 'title'
}
},
callback: {
Expand Down Expand Up @@ -67,7 +70,6 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
}
if (changes['query'] && !changes['query'].firstChange) {
this.searchEvt$.next(this.query);
// this.filter();
}
}

Expand All @@ -81,8 +83,10 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
'id': node['id'],
'key': node['key'],
'name': node['name'],
'title': node['name'],
'value': node['value'],
'pId': node['parent'],
'ip': '',
'assets_amount': node['assets_amount'],
'isParent': true,
'open': node['key'] === '0'
Expand All @@ -91,16 +95,18 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {

node['assets_granted'].forEach(asset => {
if (!assets[asset['id']]) {
const platform = asset['platform'].toLowerCase().indexOf('win') === 0 ? 'windows' : 'linux';
this.nodes.push({
'id': asset['id'],
'name': asset['hostname'],
'value': asset['hostname'],
'system_users_granted': asset['system_users_granted'],
'platform': asset['platform'],
'comment': asset['comment'],
'ip': asset['ip'],
'title': asset['ip'],
'isParent': false,
'pId': node['id'],
'iconSkin': asset['platform'].toLowerCase()
'iconSkin': platform
});
assets[asset['id'] + '@' + node['id']] = true;
}
Expand All @@ -116,10 +122,12 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
}
});
$.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) {
// console.log(host);
let user: any;
if (host.system_users_granted.length > 1) {
user = this.checkPriority(host.system_users_granted);
Expand Down Expand Up @@ -163,7 +171,7 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
NavList.List[id].closed = false;
NavList.List[id].host = host;
NavList.List[id].user = user;
if (user.protocol === 'ssh') {
if (user.protocol === 'ssh' || user.protocol === 'telnet') {
NavList.List[id].type = 'ssh';
} else if (user.protocol === 'rdp') {
NavList.List[id].type = 'rdp';
Expand Down Expand Up @@ -237,12 +245,13 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
return null;
}
let shouldShow = [];
nodes.forEach((node) => {
if (shouldShow.indexOf(node) === -1 && node.name.indexOf(_keywords) !== -1) {
const matchedNodes = zTreeObj.getNodesByFilter(function(node){
return node.name.indexOf(_keywords) !== -1 || node.ip.indexOf(_keywords) !== -1;
});
matchedNodes.forEach((node) => {
const parents = this.recurseParent(node);
const children = this.recurseChildren(node);
shouldShow = [...shouldShow, ...parents, ...children, node];
}
});
this.hiddenNodes = nodes;
this.expandNodes = shouldShow;
Expand Down
8 changes: 4 additions & 4 deletions src/app/elements/term/term.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
const elementPaddingVer = elementPadding.top + elementPadding.bottom;
const elementPaddingHor = elementPadding.right + elementPadding.left;
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 = [
Math.floor(availableWidth / (<any>this.term).renderer.dimensions.actualCellWidth) - 1,
Math.floor(availableHeight / (<any>this.term).renderer.dimensions.actualCellHeight) - 1
Math.floor(availableWidth / (<any>this.term)._core.renderer.dimensions.actualCellWidth) - 1,
Math.floor(availableHeight / (<any>this.term)._core.renderer.dimensions.actualCellHeight) - 1
];
return geometry;
}
Expand All @@ -70,7 +70,7 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
if (isNaN(size[0]) || isNaN(size[1])) {
fit(this.term);
} else {
(<any>this.term).renderer.clear();
(<any>this.term)._core.renderer.clear();
this.term.resize(size[0], size[1]);
}
this.winSizeChangeTrigger.emit([this.term.cols, this.term.rows]);
Expand Down
3 changes: 1 addition & 2 deletions src/app/pages/replay/replay.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ export class PagesReplayComponent implements OnInit {
.subscribe(params => {
token = params['token'];
});
this._http.get_replay_json(token)
this._http.get_replay(token)
.subscribe(
data => {
this.replay.type = data['type'];
this.replay.src = data['src'];
this.replay.id = data['id'];
},
err => {
this._http.get_replay(token);
alert('没找到录像文件');
}
);
Expand Down
4 changes: 2 additions & 2 deletions src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export const environment = {
production: true
};
// export const version = '1.3.0-{{BUILD_NUMBER}} GPLv2.';
// export const version = '1.3.0-101 GPLv2.';
export const version = '1.3.0-{{BUILD_NUMBER}} GPLv2.';
// export const version = '1.3.3-101 GPLv2.';
export const version = '1.3.3-{{BUILD_NUMBER}} GPLv2.';

0 comments on commit 2f1d29d

Please sign in to comment.