Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
luna
Commits
f3eb3e92
Commit
f3eb3e92
authored
Jun 07, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改第一次登陆窗口大小
parent
313728a0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
15 deletions
+22
-15
mock.py
mock.py
+10
-4
ssh-term.component.ts
src/app/elements/ssh-term/ssh-term.component.ts
+12
-5
term.component.ts
src/app/elements/term/term.component.ts
+0
-6
No files found.
mock.py
View file @
f3eb3e92
...
...
@@ -24,6 +24,10 @@ logger.setLevel(logging.DEBUG)
sh
=
logging
.
StreamHandler
(
stream
=
None
)
logger
.
addHandler
(
sh
)
logger2
=
logging
.
getLogger
(
'coco'
)
logger2
.
setLevel
(
logging
.
DEBUG
)
logger2
.
addHandler
(
sh
)
eventlet
.
monkey_patch
()
# async_mode = 'threading'
async_mode
=
'eventlet'
...
...
@@ -38,7 +42,9 @@ nodes = '[{"id":"03059e2e-06b8-4ef1-b949-72e230b706fa","key":"0:9:5","name":"部
class
Forwarder
:
def
__init__
(
self
,
client
):
self
.
client
=
client
self
.
server
=
self
.
ssh_with_password
()
width
=
client
.
request
.
meta
[
'width'
]
height
=
client
.
request
.
meta
[
'height'
]
self
.
server
=
self
.
ssh_with_password
(
width
,
height
)
self
.
watch_win_size_change_async
()
def
proxy
(
self
,
asset
,
system_user
):
...
...
@@ -60,11 +66,10 @@ class Forwarder:
thread
.
daemon
=
True
thread
.
start
()
def
ssh_with_password
(
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"
)
width
,
height
=
(
80
,
24
)
chan
=
ssh
.
invoke_shell
(
term
=
'xterm'
,
width
=
width
,
height
=
height
)
return
chan
...
...
@@ -75,7 +80,8 @@ class Forwarder:
height
=
self
.
client
.
request
.
meta
.
get
(
'height'
,
24
)
logger
.
debug
(
"Change win size:
%
s -
%
s"
%
(
width
,
height
))
try
:
self
.
server
.
chan
.
resize_pty
(
width
=
width
,
height
=
height
)
self
.
server
.
resize_pty
(
width
=
width
,
height
=
height
)
# self.server.chan.resize_pty(width=width, height=height)
except
Exception
:
break
...
...
src/app/elements/ssh-term/ssh-term.component.ts
View file @
f3eb3e92
...
...
@@ -34,9 +34,6 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit {
background
:
'#1f1b1b'
}
});
const
rowInit
=
parseInt
(
this
.
_cookie
.
get
(
'rows'
)
||
'24'
,
10
);
const
colsInit
=
parseInt
(
this
.
_cookie
.
get
(
'cols'
)
||
'80'
,
10
);
this
.
term
.
resize
(
colsInit
,
rowInit
);
}
ngAfterViewInit
()
{
...
...
@@ -49,11 +46,21 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit {
joinRoom
()
{
NavList
.
List
[
this
.
index
].
Term
=
this
.
term
;
console
.
log
(
this
.
term
);
console
.
log
(
'Col: '
,
this
.
term
.
cols
,
'rows'
,
this
.
term
.
rows
);
if
(
this
.
host
)
{
ws
.
emit
(
'host'
,
{
'uuid'
:
this
.
host
.
id
,
'userid'
:
this
.
userid
,
'secret'
:
this
.
secret
});
ws
.
emit
(
'host'
,
{
'uuid'
:
this
.
host
.
id
,
'userid'
:
this
.
userid
,
'secret'
:
this
.
secret
,
'size'
:
[
this
.
term
.
cols
,
this
.
term
.
rows
]
});
}
if
(
this
.
token
)
{
ws
.
emit
(
'token'
,
{
'token'
:
this
.
token
,
'secret'
:
this
.
secret
});
ws
.
emit
(
'token'
,
{
'token'
:
this
.
token
,
'secret'
:
this
.
secret
,
'size'
:
[
this
.
term
.
cols
,
this
.
term
.
rows
]
});
}
const
that
=
this
;
...
...
src/app/elements/term/term.component.ts
View file @
f3eb3e92
...
...
@@ -63,10 +63,6 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
Math
.
floor
(
availableHeight
/
(
<
any
>
this
.
term
).
renderer
.
dimensions
.
actualCellHeight
)
-
1
];
return
geometry
;
// const cols = Math.floor((activeEle.width() - 15) / markerEle.width() * 6) - 1;
// const rows = Math.floor(activeEle.height() / markerEle.height()) - 1;
// return [cols, rows];
}
resizeTerm
()
{
...
...
@@ -78,8 +74,6 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
this
.
term
.
resize
(
size
[
0
],
size
[
1
]);
}
this
.
winSizeChangeTrigger
.
emit
([
this
.
term
.
cols
,
this
.
term
.
rows
]);
this
.
_cookie
.
set
(
'cols'
,
this
.
term
.
cols
.
toString
(),
0
,
'/'
,
document
.
domain
);
this
.
_cookie
.
set
(
'rows'
,
this
.
term
.
rows
.
toString
(),
0
,
'/'
,
document
.
domain
);
}
active
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment