* chore: 🤖 create terminal preload * chore: 🤖 created terminal-manager service and updated handlers * chore: 🤖 adds terminal view and bundling script * chore: 🤖 addede terminal service, updated tabs component * chore: 🤖 hides terminal on signout modal * test: 💍 added terminal service tests * chore: 🤖 removed debug file * chore: 🤖 adds windows event handler * docs: ✏️ adds jsdoc for terminal view * chore: 🤖 removed xterm dependency from desktop package.json * chore: 🤖 updated sessionId check * chore: 🤖 fixed zoom sync with main window * chore: 🤖 adds CSP for terminal view * chore: 🤖 hides terminal on error * chore: 🤖 cleamup listener, fixed failing tests * chore: 🤖 fixed terminal view cleanup * chore: 🤖 addressed feedback * fix: 🐛 adds null check for destroy, hdie terminal view * fix: 🐛 fixed terminal view on logout/app quit modal * fix: 🐛 fixed hidding modal on app quit * chore: 🤖 addressed feedback * chore: 🤖 hides terminal view when sidenav is expanded * chore: 🤖 removed canDisplayExistingTerminal
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
/**
|
|
* Copyright IBM Corp. 2021, 2026
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { service } from '@ember/service';
|
|
|
|
export default class SessionTerminalTabsComponent extends Component {
|
|
// =services
|
|
|
|
@service terminal;
|
|
|
|
// =actions
|
|
|
|
@action
|
|
async openTerminal() {
|
|
this.terminal.setTerminalTabActive(true);
|
|
|
|
// If the terminal view is already created, just display the existing one.
|
|
if (this.terminal.isTerminalViewCreated) {
|
|
this.terminal.displayTerminalView();
|
|
return;
|
|
}
|
|
|
|
// If the terminal view has not been created yet, we create it.
|
|
const isSSHCommandAvailable =
|
|
await window.desktop.system.checkCommand('ssh');
|
|
const { started_desktop_client, target, id } = this.args.model;
|
|
|
|
const autoSSH = Boolean(
|
|
target?.isSSH && started_desktop_client && isSSHCommandAvailable,
|
|
);
|
|
|
|
const payload = {
|
|
id,
|
|
autoSSH,
|
|
};
|
|
|
|
this.terminal.createTerminalView(payload);
|
|
}
|
|
|
|
/**
|
|
* When the details tab is clicked, we want to hide the terminal view
|
|
*/
|
|
@action
|
|
openDetails() {
|
|
this.terminal.setTerminalTabActive(false);
|
|
}
|
|
|
|
willDestroy() {
|
|
super.willDestroy(...arguments);
|
|
this.terminal.cleanup();
|
|
}
|
|
}
|