From d89235a85d5a3692ee40c460cdca90bd7418051b Mon Sep 17 00:00:00 2001 From: Sean Kavanagh Date: Mon, 21 Aug 2023 08:20:37 -0400 Subject: [PATCH] Fix terminals due to api changes in xterm --- pom.xml | 2 +- src/main/webapp/_res/inc/header.html | 4 +- src/main/webapp/admin/secure_shell.html | 101 ++++++++++++------------ 3 files changed, 55 insertions(+), 52 deletions(-) diff --git a/pom.xml b/pom.xml index 7f032c13..bc4b4f91 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.bastillion bastillion-ec2 - 1.78.0-SNAPSHOT + 1.78.0 war Bastillion for EC2 diff --git a/src/main/webapp/_res/inc/header.html b/src/main/webapp/_res/inc/header.html index f0dcea4b..4fa1e657 100755 --- a/src/main/webapp/_res/inc/header.html +++ b/src/main/webapp/_res/inc/header.html @@ -71,7 +71,7 @@ } }); - $("form input, form select").keydown(function (event) { + $("form input, form select, .btn").keydown(function (event) { if (event.keyCode === 13) { event.preventDefault(); $(this).closest("form").submit(); @@ -110,7 +110,7 @@ //break if loaded in frame [# th:if="${isFrame == null || !isFrame}"] - if (top !== self) top.location.replace(self.location.href); + if (top !== self) top.location.replace(self.location.href); [/] /*]]>*/ diff --git a/src/main/webapp/admin/secure_shell.html b/src/main/webapp/admin/secure_shell.html index e1702f13..4af08e73 100755 --- a/src/main/webapp/admin/secure_shell.html +++ b/src/main/webapp/admin/secure_shell.html @@ -40,18 +40,18 @@ //submit $(".submit_btn").button().click(function () { [# th:if= "${pendingSystemStatus != null && pendingSystemStatus.id != null}"] - $(this).parents('.modal').find('form').submit(); + $(this).parents('.modal').find('form').submit(); [/] - $(this).parents('.modal').modal('hide'); + $(this).parents('.modal').modal('hide'); }); //close all forms $(".cancel_btn").button().click(function () { window.location = 'getNextPendingSystemForTerms.ktrl?pendingSystemStatus.id=' + /*[[${pendingSystemStatus.id}]]*/ '' [# th:if= "${script != null && script.id > 0}"] - +'&script.id=' + /*[[${script.id}]]*/ '' + +'&script.id=' + /*[[${script.id}]]*/ '' [/] - + '&_csrf=' + [[${session._csrf}]]; + + '&_csrf=' + [[${session._csrf}]]; }); //disconnect terminals and remove from view @@ -98,23 +98,23 @@ }); [# th:if= "${currentSystemStatus != null && (#strings.equals(currentSystemStatus.statusCd, 'GENERICFAIL') || #strings.equals(currentSystemStatus.statusCd, 'HOSTFAIL'))}"] - new bootstrap.Modal($("#error_dialog")).show(); - [/] - [# th:if= "${pendingSystemStatus != null && pendingSystemStatus.id != null && (currentSystemStatus == null || (!#strings.equals(currentSystemStatus.statusCd, 'GENERICFAIL') && !#strings.equals(currentSystemStatus.statusCd, 'HOSTFAIL')) )}"] - [# th:if= "${ #strings.equals(pendingSystemStatus.statusCd, 'AUTHFAIL')}"] - new bootstrap.Modal($("#set_password_dialog")).show(); + new bootstrap.Modal($("#error_dialog")).show(); [/] + [# th:if= "${pendingSystemStatus != null && pendingSystemStatus.id != null && (currentSystemStatus == null || (!#strings.equals(currentSystemStatus.statusCd, 'GENERICFAIL') && !#strings.equals(currentSystemStatus.statusCd, 'HOSTFAIL')) )}"] + [# th:if= "${ #strings.equals(pendingSystemStatus.statusCd, 'AUTHFAIL')}"] + new bootstrap.Modal($("#set_password_dialog")).show(); + [/] [# th:if= "${#strings.equals(pendingSystemStatus.statusCd, 'KEYAUTHFAIL')}"] - new bootstrap.Modal($("#set_passphrase_dialog")).show(); - [/] + new bootstrap.Modal($("#set_passphrase_dialog")).show(); + [/] [# th:if= "${currentSystemStatus == null || (!#strings.equals(pendingSystemStatus.statusCd, 'AUTHFAIL') && !#strings.equals(pendingSystemStatus.statusCd, 'KEYAUTHFAIL')&& !#strings.equals(pendingSystemStatus.statusCd, 'GENERICFAIL'))}"] - $("#composite_terms_frm").submit(); - [/] + $("#composite_terms_frm").submit(); [/] + [/] - [# th:if= "${pendingSystemStatus == null || pendingSystemStatus.id == null}"] + [# th:if= "${pendingSystemStatus == null || pendingSystemStatus.id == null}"] $('#dummy').focus(); var keys = {}; @@ -277,45 +277,48 @@ function createTermMap(id, output) { + var CUSTOM_THEME = + { + [# th:if= "${userSettings != null && userSettings.bg != null}"] + background: [[${userSettings.bg}]], + [/] + [# th:if= "${userSettings != null && userSettings.bg != null}"] + foreground: [[${userSettings.fg}]], + cursor: [[${userSettings.fg}]], + cursorAccent: [[${userSettings.fg}]], + [/] + [# th:if= "${userSettings !=null && userSettings.colors != null && userSettings.colors.length == 16}"] + black: [[${userSettings.colors[0]}]], + red: [[${userSettings.colors[1]}]], + green: [[${userSettings.colors[2]}]], + yellow: [[${userSettings.colors[3]}]], + blue: [[${userSettings.colors[4]}]], + magenta: [[${userSettings.colors[5]}]], + cyan: [[${userSettings.colors[6]}]], + white: [[${userSettings.colors[7]}]], + brightBlack: [[${userSettings.colors[8]}]], + brightRed: [[${userSettings.colors[9]}]], + brightGreen: [[${userSettings.colors[10]}]], + brightYellow: [[${userSettings.colors[11]}]], + brightBlue: [[${userSettings.colors[12]}]], + brightMagenta: [[${userSettings.colors[13]}]], + brightCyan: [[${userSettings.colors[14]}]], + brightWhite: [[${userSettings.colors[15]}]] + [/] + }; + termMap[id] = new Terminal({ fontSize: 14, + 'theme': CUSTOM_THEME, + 'cursorStyle' : 'bar', + 'cursorWidth' : '10', + 'cursorInactiveStyle' : 'bar', fontFamily: 'DejaVu Sans Mono, Liberation Mono, monospace' }); fitMap[id] = new FitAddon.FitAddon() termMap[id].loadAddon(fitMap[id]) - var CUSTOM_THEME = - { - [# th:if= "${userSettings != null && userSettings.bg != null}"] - background: [[${userSettings.bg}]], - [/] - [# th:if= "${userSettings != null && userSettings.bg != null}"] - foreground: [[${userSettings.fg}]], - cursor: [[${userSettings.fg}]], - cursorAccent: [[${userSettings.fg}]], - [/] - [# th:if= "${userSettings !=null && userSettings.colors != null && userSettings.colors.length == 16}"] - black: [[${userSettings.colors[0]}]], - red: [[${userSettings.colors[1]}]], - green: [[${userSettings.colors[2]}]], - yellow: [[${userSettings.colors[3]}]], - blue: [[${userSettings.colors[4]}]], - magenta: [[${userSettings.colors[5]}]], - cyan: [[${userSettings.colors[6]}]], - white: [[${userSettings.colors[7]}]], - brightBlack: [[${userSettings.colors[8]}]], - brightRed: [[${userSettings.colors[9]}]], - brightGreen: [[${userSettings.colors[10]}]], - brightYellow: [[${userSettings.colors[11]}]], - brightBlue: [[${userSettings.colors[12]}]], - brightMagenta: [[${userSettings.colors[13]}]], - brightCyan: [[${userSettings.colors[14]}]], - brightWhite: [[${userSettings.colors[15]}]] - [/] - }; - - termMap[id].setOption('theme', CUSTOM_THEME); termMap[id].open($("#run_cmd_" + id).find('.output').get(0)); @@ -437,8 +440,8 @@ //set connected systems [# th:each = "s : ${systemList}" ] - $(createTermElement([[${s.instanceId}]], [[${s.id}]], [[${s.displayLabel}]])).appendTo(".termwrapper"); - setTerminalEvents($("#run_cmd_" + [[${s.instanceId}]])); + $(createTermElement([[${s.instanceId}]], [[${s.id}]], [[${s.displayLabel}]])).appendTo(".termwrapper"); + setTerminalEvents($("#run_cmd_" + [[${s.instanceId}]])); [/] var y_offset = $('.run_cmd:first').innerHeight() - $('.run_cmd').find(".output:first").innerHeight(); @@ -562,9 +565,9 @@