summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-08-03 14:15:04 +0100
committerFilipa Lacerda <filipa@gitlab.com>2018-08-03 15:16:39 +0100
commit26b8209ecdef4bb8c94b7fa3aa2fca7281de5e2b (patch)
tree51787ad3908a72e52dac47e0240042b82d1eafec
parent0116930bb0ae30bcb7b43b87371f1418e74661f1 (diff)
downloadgitlab-ce-26b8209ecdef4bb8c94b7fa3aa2fca7281de5e2b.tar.gz
Focus terminal on load
Use object.assign for default option
-rw-r--r--app/assets/javascripts/terminal/terminal.js19
-rw-r--r--app/assets/stylesheets/application.scss1
-rw-r--r--changelogs/unreleased/25990-improve-web-terminal.yml5
-rw-r--r--config/application.rb4
4 files changed, 13 insertions, 16 deletions
diff --git a/app/assets/javascripts/terminal/terminal.js b/app/assets/javascripts/terminal/terminal.js
index 8a94c9f4fe1..74c5bbe45a4 100644
--- a/app/assets/javascripts/terminal/terminal.js
+++ b/app/assets/javascripts/terminal/terminal.js
@@ -1,19 +1,13 @@
import $ from 'jquery';
import { Terminal } from 'xterm';
import * as fit from 'xterm/lib/addons/fit/fit';
-import * as attach from 'xterm/lib/addons/attach/attach';
export default class GLTerminal {
- constructor(options) {
- this.options = options || {};
-
- if (!Object.prototype.hasOwnProperty.call(this.options, 'cursorBlink')) {
- this.options.cursorBlink = true;
- }
-
- if (!Object.prototype.hasOwnProperty.call(this.options, 'screenKeys')) {
- this.options.screenKeys = true;
- }
+ constructor(options = {}) {
+ this.options = Object.assign({}, {
+ cursorBlink: true,
+ screenKeys: true,
+ }, options);
this.container = document.querySelector(options.selector);
@@ -37,16 +31,15 @@ export default class GLTerminal {
createTerminal() {
Terminal.applyAddon(fit);
- Terminal.applyAddon(attach);
this.terminal = new Terminal(this.options);
- //TODO - CHECK IF WE SHOULD USE `attach` instead
this.socket = new WebSocket(this.socketUrl, ['terminal.gitlab.com']);
this.socket.binaryType = 'arraybuffer';
this.terminal.open(this.container);
this.terminal.fit();
+ this.terminal.focus();
this.socket.onopen = () => {
this.runTerminal();
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index ebc7e0e8106..f2950308019 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -19,7 +19,6 @@
@import "../../../node_modules/pikaday/scss/pikaday";
-
/*
* GitLab UI framework
*/
diff --git a/changelogs/unreleased/25990-improve-web-terminal.yml b/changelogs/unreleased/25990-improve-web-terminal.yml
new file mode 100644
index 00000000000..3f8a8c6211c
--- /dev/null
+++ b/changelogs/unreleased/25990-improve-web-terminal.yml
@@ -0,0 +1,5 @@
+---
+title: Move xterm to a node dependency and remove it from vendor's folder
+merge_request: 20588
+author:
+type: other
diff --git a/config/application.rb b/config/application.rb
index 222080c16fb..76a2c47a750 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -148,10 +148,10 @@ module Gitlab
config.assets.precompile << "icons.json"
config.assets.precompile << "illustrations/*.svg"
- config.assets.paths<< "#{config.root}/node_modules/xterm/src/"
+ # Import css for xterm
+ config.assets.paths << "#{config.root}/node_modules/xterm/src/"
config.assets.precompile << "xterm.css"
-
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'