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
af5e0b44
Commit
af5e0b44
authored
May 23, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 更新初始terminal大小
parent
e5703176
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
ssh-term.component.ts
src/app/elements/ssh-term/ssh-term.component.ts
+8
-1
term.component.ts
src/app/elements/term/term.component.ts
+4
-11
No files found.
src/app/elements/ssh-term/ssh-term.component.ts
View file @
af5e0b44
...
...
@@ -2,7 +2,9 @@ import {AfterViewInit, Component, Input, OnInit } from '@angular/core';
import
{
Terminal
}
from
'xterm'
;
import
{
NavList
}
from
'../../pages/control/control/control.component'
;
import
{
UUIDService
}
from
'../../app.service'
;
import
{
CookieService
}
from
'ngx-cookie-service'
;
import
{
TermWS
}
from
'../../globals'
;
import
{
isNumber
}
from
'ngx-bootstrap/timepicker/timepicker.utils'
;
const
ws
=
TermWS
;
...
...
@@ -20,7 +22,7 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit {
term
:
Terminal
;
secret
:
string
;
constructor
(
private
_uuid
:
UUIDService
)
{
constructor
(
private
_uuid
:
UUIDService
,
private
_cookie
:
CookieService
)
{
}
ngOnInit
()
{
...
...
@@ -33,6 +35,11 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit {
background
:
'#1f1b1b'
}
});
const
rowInit
=
this
.
_cookie
.
get
(
'rows'
)
||
'24'
;
const
colsInit
=
this
.
_cookie
.
get
(
'cols'
)
||
'80'
;
if
(
isNumber
(
rowInit
)
&&
isNumber
(
colsInit
))
{
this
.
term
.
resize
(
parseInt
(
colsInit
,
10
),
parseInt
(
rowInit
,
10
));
}
}
ngAfterViewInit
()
{
...
...
src/app/elements/term/term.component.ts
View file @
af5e0b44
...
...
@@ -3,6 +3,7 @@ import {ElementRef} from '@angular/core';
import
{
Terminal
}
from
'xterm'
;
import
{
fit
}
from
'xterm/lib/addons/fit/fit'
;
import
{
Observable
}
from
'rxjs/Rx'
;
import
{
CookieService
}
from
'ngx-cookie-service'
;
import
'rxjs/Observable'
;
import
'rxjs/add/operator/debounceTime'
;
import
'rxjs/add/operator/distinctUntilChanged'
;
...
...
@@ -21,7 +22,7 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
@
Output
()
winSizeChangeTrigger
=
new
EventEmitter
<
Array
<
number
>>
();
winSizeChange$
:
Observable
<
any
>
;
constructor
()
{
constructor
(
private
_cookie
:
CookieService
)
{
}
ngOnInit
()
{
...
...
@@ -44,17 +45,9 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
resizeTerm
()
{
fit
(
this
.
term
);
// let contentElement = $('.window.active');
// if (contentElement.length === 0) {
// contentElement = $('body');
// }
// const markerElement = $('#marker');
// const col = Math.floor((contentElement.width() - 30) / markerElement.width() * 6) - 1;
// const row = Math.floor((contentElement.height() - 30) / markerElement.height());
// this.col = col > 80 ? col : 80;
// this.row = row > 24 ? row : 24;
// this.term.resize(this.col, this.row);
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