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
d272a5dc
Unverified
Commit
d272a5dc
authored
Oct 23, 2019
by
BaiJiangJie
Committed by
GitHub
Oct 23, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #126 from jumpserver/dev
Dev
parents
580c1486
7c357ae5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
17 deletions
+26
-17
angular.json
angular.json
+0
-0
json.component.ts
src/app/elements/replay/json/json.component.ts
+2
-8
ssh-term.component.ts
src/app/elements/ssh-term/ssh-term.component.ts
+2
-9
common.ts
src/app/utils/common.ts
+22
-0
favicon.ico
src/favicon.ico
+0
-0
No files found.
angular.json
View file @
d272a5dc
src/app/elements/replay/json/json.component.ts
View file @
d272a5dc
...
...
@@ -2,6 +2,7 @@ import {Component, Input, OnInit, OnChanges} from '@angular/core';
import
{
Terminal
}
from
'xterm'
;
import
{
HttpService
,
LogService
}
from
'@app/services'
;
import
{
Replay
}
from
'@app/model'
;
import
{
newTerminal
}
from
'@app/utils/common'
;
function
zeroPad
(
num
,
minLength
)
{
let
str
=
num
.
toString
();
...
...
@@ -80,14 +81,7 @@ export class ElementReplayJsonComponent implements OnInit {
constructor
(
private
_http
:
HttpService
)
{}
ngOnInit
()
{
this
.
term
=
new
Terminal
({
fontFamily
:
'"Monaco", "Consolas", "monospace"'
,
fontSize
:
14
,
rightClickSelectsWord
:
true
,
theme
:
{
background
:
'#1f1b1b'
}
});
this
.
term
=
newTerminal
(
14
);
if
(
this
.
replay
.
src
!==
'READY'
)
{
this
.
_http
.
getReplayData
(
this
.
replay
.
src
)
.
subscribe
(
...
...
src/app/elements/ssh-term/ssh-term.component.ts
View file @
d272a5dc
...
...
@@ -4,6 +4,7 @@ import {View} from '@app/model';
import
{
LogService
,
SettingService
,
UUIDService
}
from
'@app/services'
;
import
{
Socket
}
from
'@app/utils/socket'
;
import
{
getWsSocket
,
translate
}
from
'@app/globals'
;
import
{
newTerminal
}
from
'@app/utils/common'
;
@
Component
({
...
...
@@ -38,15 +39,7 @@ export class ElementSshTermComponent implements OnInit, OnDestroy {
newTerm
()
{
const
fontSize
=
this
.
settingSvc
.
setting
.
fontSize
;
this
.
term
=
new
Terminal
({
fontFamily
:
'monaco, Consolas, "Lucida Console", monospace'
,
lineHeight
:
1.2
,
fontSize
:
fontSize
,
rightClickSelectsWord
:
true
,
theme
:
{
background
:
'#1f1b1b'
}
});
this
.
term
=
newTerminal
(
fontSize
);
this
.
view
.
Term
=
this
.
term
;
this
.
term
.
attachCustomKeyEventHandler
(
e
=>
{
if
(
e
.
ctrlKey
&&
e
.
key
===
'c'
&&
this
.
term
.
hasSelection
())
{
...
...
src/app/utils/common.ts
View file @
d272a5dc
import
{
Terminal
}
from
'xterm'
;
export
function
groupBy
(
array
,
f
)
{
const
groups
=
{};
array
.
forEach
(
function
(
o
)
{
...
...
@@ -9,3 +11,23 @@ export function groupBy(array, f) {
return
groups
[
group
];
});
}
export
function
newTerminal
(
fontSize
?:
number
)
{
if
(
!
fontSize
||
fontSize
<
5
||
fontSize
>
50
)
{
fontSize
=
13
;
}
const
ua
=
navigator
.
userAgent
.
toLowerCase
();
let
lineHeight
=
1
;
if
(
ua
.
indexOf
(
'windows'
)
!==
-
1
)
{
lineHeight
=
1.2
;
}
return
new
Terminal
({
fontFamily
:
'monaco, Consolas, "Lucida Console", monospace'
,
lineHeight
:
lineHeight
,
fontSize
:
fontSize
,
rightClickSelectsWord
:
true
,
theme
:
{
background
:
'#1f1b1b'
}
});
}
src/favicon.ico
View replaced file @
580c1486
View file @
d272a5dc
3.92 KB
|
W:
|
H:
2.88 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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