diff --git a/app/javascript/controllers/terminal_controller.js b/app/javascript/controllers/terminal_controller.js index c1983f569..83494de8a 100644 --- a/app/javascript/controllers/terminal_controller.js +++ b/app/javascript/controllers/terminal_controller.js @@ -67,10 +67,25 @@ export default class extends Controller { this.element.classList.add(this.busyClass) } + #reset(inputValue = "") { + this.inputTarget.value = inputValue + this.confirmationTarget.value = "" + this.waitingForConfirmationValue = false + this.originalInputValue = null + + this.element.classList.remove(this.errorClass) + this.element.classList.remove(this.confirmationClass) + this.element.classList.remove(this.busyClass) + } + get #showHelpCommandEntered() { return [ "/help", "/?" ].includes(this.inputTarget.value) } + get #isHelpMenuOpened() { + return this.element.classList.contains(this.helpClass) + } + #showHelpMenu() { this.element.classList.add(this.helpClass) } @@ -80,10 +95,6 @@ export default class extends Controller { this.element.classList.remove(this.helpClass) } - get #isHelpMenuOpened() { - return this.element.classList.contains(this.helpClass) - } - #handleSuccessResponse(response) { if (response.headers.get("Content-Type")?.includes("application/json")) { response.json().then((responseJson) => { @@ -104,17 +115,6 @@ export default class extends Controller { } } - #reset(inputValue = "") { - this.inputTarget.value = inputValue - this.confirmationTarget.value = "" - this.waitingForConfirmationValue = false - this.originalInputValue = null - - this.element.classList.remove(this.errorClass) - this.element.classList.remove(this.confirmationClass) - this.element.classList.remove(this.busyClass) - } - #showError() { this.element.classList.add(this.errorClass) }