Skip to content

Commit 9ba9a99

Browse files
Merge pull request #2849 from rhamilto/container-terminal-next
Automatic merge from submit-queue. Bump kubernetes-container-terminal to v3.0.0 Requires kubernetes-ui/container-terminal#35 ![screen shot 2018-02-23 at 10 37 13 am](https://user-images.githubusercontent.com/895728/36602271-99eb8a40-1885-11e8-91d1-a5e63c4fd55b.PNG) ![screen shot 2018-02-23 at 10 37 38 am](https://user-images.githubusercontent.com/895728/36602273-99f55296-1885-11e8-8e27-927979047c9b.PNG) Known issues: * [Default fonts are vertically offset on some Linux distributions](xtermjs/xterm.js#1170) ![screen shot 2018-02-23 at 9 32 32 am](https://user-images.githubusercontent.com/895728/36599221-bf750902-187c-11e8-8f3f-becafbcbb46b.PNG) * Firefox on Windows incorrectly calculates the terminal width due to padding on div.terminal.xterm ![screen shot 2018-02-23 at 9 33 56 am](https://user-images.githubusercontent.com/895728/36599319-0d1b7aba-187d-11e8-9705-4956454e92ac.PNG)
2 parents dd7f1a0 + aff114e commit 9ba9a99

File tree

9 files changed

+3772
-3427
lines changed

9 files changed

+3772
-3427
lines changed

app/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<link rel="stylesheet" href="bower_components/angularjs-datatables/dist/plugins/bootstrap/datatables.bootstrap.min.css" />
2121
<link rel="stylesheet" href="bower_components/angular-patternfly/dist/styles/angular-patternfly.css" />
2222
<link rel="stylesheet" href="bower_components/kubernetes-label-selector/labelFilter.css" />
23-
<link rel="stylesheet" href="bower_components/xterm.js/dist/xterm.css" />
23+
<link rel="stylesheet" href="bower_components/xterm.js-next/xterm.css" />
2424
<link rel="stylesheet" href="bower_components/kubernetes-container-terminal/dist/container-terminal.css" />
2525
<link rel="stylesheet" href="bower_components/registry-image-widgets/dist/image-widgets.css" />
2626
<link rel="stylesheet" href="bower_components/ng-sortable/dist/ng-sortable.css" />
@@ -139,7 +139,7 @@ <h1>JavaScript Required</h1>
139139
<script src="bower_components/selectize/dist/js/selectize.js"></script>
140140
<script src="bower_components/kubernetes-label-selector/labelSelector.js"></script>
141141
<script src="bower_components/kubernetes-label-selector/labelFilter.js"></script>
142-
<script src="bower_components/xterm.js/dist/xterm.js"></script>
142+
<script src="bower_components/xterm.js-next/xterm.js"></script>
143143
<script src="bower_components/kubernetes-container-terminal/dist/container-terminal.js"></script>
144144
<script src="bower_components/registry-image-widgets/dist/image-widgets.js"></script>
145145
<script src="bower_components/kubernetes-object-describer/dist/object-describer.js"></script>

app/scripts/controllers/pod.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,9 @@ angular.module('openshiftConsole')
147147
}, 50);
148148
return;
149149
}
150-
var windowWidth = win.width();
151150
var windowHeight = win.height();
152-
var termWidth = windowWidth - r.left - 54; // we want 54px right padding, includes 6px border within the container terminal
153-
var termHeight = windowHeight - r.top - 36; // we want 36px bottom padding, includes 6px border within the container terminal
151+
var termWidth = r.width - 17; // 17px is roughly the width of an average scrollbar
152+
var termHeight = windowHeight - r.top - 36;
154153
$scope.terminalCols = Math.max(_.floor(termWidth / characterBoundingBox.width), 80);
155154
$scope.terminalRows = Math.max(_.floor(termHeight / characterBoundingBox.height), 24);
156155
});

app/styles/_container-terminal.less

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
display: none;
4747
line-height: 1;
4848
position: absolute;
49-
right: 25px;
49+
right: 19px;
5050
top: 0;
51-
z-index: 1;
51+
z-index: 10;
5252
a {
5353
.style-terminal-action();
5454
}
@@ -59,11 +59,6 @@
5959
display: block;
6060
}
6161
}
62-
.terminal-actions .btn {
63-
background: none;
64-
.btn-link();
65-
.style-terminal-action();
66-
}
6762
// so that &-:ms-fullscreen works correctly, these need to come after .fullscreen-toggle
6863
&:-moz-full-screen {
6964
.fullscreen();
@@ -80,21 +75,30 @@
8075
}
8176

8277
kubernetes-container-terminal {
83-
// Control what fonts are used in the container terminal since we need the terminal-font class for row/col character calculations
84-
.terminal {
85-
.terminal-font();
86-
}
8778
.terminal-actions {
8879
top: 0;
89-
right: 47px;
80+
right: 25px;
81+
.btn {
82+
background: none;
83+
.btn-link();
84+
.style-terminal-action();
85+
}
9086
.spinner {
9187
top: 5px;
9288
}
9389
}
9490
}
9591

92+
// .terminal-font is used for row/col character calculations.
93+
// It must match what's in the xterm.js config in kubernetes-container-terminal.
94+
// However, the line-height is dependent on the font, so instead of a value
95+
// of 1, it gets the pixel value of the declared font as rendered inside of
96+
// xterm.js, which varies across browser and platform. Our default monospace
97+
// font stack won't work in this instance because the fonts there render with
98+
// different line heights based on the browser (e.g., Menlo renders with a
99+
// line-height of 12px in Chrome for MacOS, but 14px in Firefox for MacOS).
96100
.terminal-font {
97-
font-family: "Monospace Regular", "DejaVu Sans Mono", Menlo, Monaco, Consolas, monospace;
101+
font-family: "Courier New", Courier, monospace;
98102
font-size: 12px;
99-
line-height: 1em;
103+
line-height: 14px;
100104
}

app/styles/_core.less

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -896,11 +896,6 @@ select:invalid {
896896
width: 12px;
897897
}
898898

899-
.spinner.spinner-inverse {
900-
border-color: rgba(0,153,211, .25);
901-
border-top-color: rgba(0,153,211, .75);
902-
}
903-
904899
.attention-message {
905900
background-color: lighten(@brand-primary, 50%);
906901
border: 1px solid darken(@brand-primary, 10%);
@@ -1032,10 +1027,6 @@ a.disabled-link {
10321027
.empty-state-message {
10331028
margin-top: 60px;
10341029
}
1035-
kubernetes-container-terminal {
1036-
.text-center();
1037-
overflow: hidden;
1038-
}
10391030
.original-cmd-msg {
10401031
margin-bottom: 10px;
10411032
}

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"selectize": "0.12.1",
2929
"c3": "0.4.11",
3030
"kubernetes-label-selector": "2.1.1",
31-
"kubernetes-container-terminal": "2.1.1",
31+
"kubernetes-container-terminal": "3.0.0",
3232
"registry-image-widgets": "https://github.com/cockpit-project/registry-image-widgets.git#0.0.15",
3333
"kubernetes-object-describer": "1.0.4",
3434
"bootstrap-hover-dropdown": "2.1.3",

dist/scripts/scripts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4815,8 +4815,8 @@ var t = $(".container-terminal-wrapper").get(0);
48154815
if (t) {
48164816
var n = t.getBoundingClientRect();
48174817
if (0 !== n.left || 0 !== n.top || 0 !== n.width || 0 !== n.height) {
4818-
var o = w.width(), i = w.height(), s = o - n.left - 54, c = i - n.top - 36;
4819-
r.terminalCols = Math.max(_.floor(s / C.width), 80), r.terminalRows = Math.max(_.floor(c / C.height), 24);
4818+
var o = w.height(), i = n.width - 17, s = o - n.top - 36;
4819+
r.terminalCols = Math.max(_.floor(i / C.width), 80), r.terminalRows = Math.max(_.floor(s / C.height), 24);
48204820
} else a(function() {
48214821
P(e + 1);
48224822
}, 50);

0 commit comments

Comments
 (0)