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
7771ff9b
Commit
7771ff9b
authored
May 08, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修复bug
parent
cd60b1cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
10 deletions
+2
-10
ssh-term.component.ts
src/app/elements/ssh-term/ssh-term.component.ts
+2
-10
No files found.
src/app/elements/ssh-term/ssh-term.component.ts
View file @
7771ff9b
import
{
AfterViewInit
,
Component
,
Input
,
OnInit
}
from
'@angular/core'
;
import
*
as
io
from
'socket.io-client'
;
// import {ws} from '../../globals';
import
*
as
Terminal
from
'xterm/dist/xterm'
;
import
{
NavList
}
from
'../../pages/control/control/control.component'
;
import
{
UUIDService
}
from
'../../app.service'
;
import
{
TermWS
}
from
'../../globals'
;
const
ws
=
io
.
connect
(
'/ssh'
)
;
const
ws
=
TermWS
;
@
Component
({
selector
:
'elements-ssh-term'
,
...
...
@@ -27,8 +26,6 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit {
ngOnInit
()
{
this
.
secret
=
this
.
_uuid
.
gen
();
this
.
term
=
new
Terminal
({
// cols: 80,
// rows: 24,
useStyle
:
true
,
screenKeys
:
true
,
});
...
...
@@ -68,22 +65,17 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit {
ws
.
on
(
'logout'
,
(
data
)
=>
{
if
(
data
[
'room'
]
===
NavList
.
List
[
that
.
index
].
room
)
{
NavList
.
List
[
that
.
index
].
connected
=
false
;
// this.term.write('\r\n\x1b[31mBye Bye!\x1b[m\r\n');
}
});
ws
.
on
(
'room'
,
data
=>
{
console
.
log
(
'Compile secret: '
,
data
[
'secret'
],
this
.
secret
);
if
(
data
[
'secret'
]
===
this
.
secret
)
{
console
.
log
(
'Set room: '
,
data
[
'room'
]);
NavList
.
List
[
that
.
index
].
room
=
data
[
'room'
];
console
.
log
(
'get'
,
that
.
index
,
'room: '
,
NavList
.
List
[
that
.
index
].
room
);
}
});
}
disconnect
()
{
NavList
.
List
[
this
.
index
].
connected
=
false
;
// this.term.write('\r\n\x1b[31mBye Bye!\x1b[m\r\n');
ws
.
emit
(
'logout'
,
NavList
.
List
[
this
.
index
].
room
);
}
...
...
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