mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add reaction to update terminals. Cleanup
Signed-off-by: DMYTRO ZHARKOV <dmytrozharkov@DMYTROs-MBP.fritz.box>
This commit is contained in:
parent
5beb4f18bc
commit
2ca1973add
@ -25,13 +25,9 @@ import { SubTitle } from "../layout/sub-title";
|
||||
import { Input, InputValidators } from "../input";
|
||||
import { isWindows } from "../../../common/vars";
|
||||
import { Switch } from "../switch";
|
||||
import { TerminalStore } from "../dock/terminal.store";
|
||||
import { dockStore, TabKind } from "../dock/dock.store";
|
||||
|
||||
export const Terminal = observer(() => {
|
||||
const userStore = UserStore.getInstance();
|
||||
const terminalStore = TerminalStore.getInstance();
|
||||
const { tabs, selectedTab, isOpen } = dockStore;
|
||||
const [terminalSettings, setTerminalSettings] = React.useState({
|
||||
shell: userStore.shell || "",
|
||||
terminalFontSize: userStore.terminalConfig.fontSize,
|
||||
@ -81,17 +77,7 @@ export const Terminal = observer(() => {
|
||||
...terminalSettings,
|
||||
terminalFontSize: Number(value),
|
||||
})}
|
||||
onBlur={() => {
|
||||
userStore.terminalConfig.fontSize = terminalSettings.terminalFontSize;
|
||||
console.log("tabs", tabs);
|
||||
console.log("selectedTab", selectedTab);
|
||||
|
||||
if (selectedTab?.kind === TabKind.TERMINAL && isOpen) {
|
||||
terminalStore.reconnect(selectedTab.id);
|
||||
}
|
||||
|
||||
terminalStore.reconnectTerminals();
|
||||
}}
|
||||
onBlur={() => userStore.terminalConfig.fontSize = terminalSettings.terminalFontSize}
|
||||
/>
|
||||
</section>
|
||||
<section>
|
||||
@ -104,10 +90,7 @@ export const Terminal = observer(() => {
|
||||
...terminalSettings,
|
||||
terminalFontFamily: value.toString(),
|
||||
})}
|
||||
onBlur={() => {
|
||||
userStore.terminalConfig.fontFamily = terminalSettings.terminalFontFamily;
|
||||
terminalStore.reconnectTerminals();
|
||||
}}
|
||||
onBlur={() => userStore.terminalConfig.fontFamily = terminalSettings.terminalFontFamily}
|
||||
/>
|
||||
</section>
|
||||
</div>);
|
||||
|
||||
@ -107,14 +107,6 @@ export class TerminalStore extends Singleton {
|
||||
return this.connections.get(tabId)?.readyState === WebSocketApiState.CLOSED;
|
||||
}
|
||||
|
||||
reconnectTerminals() {
|
||||
console.log("Reconencting connections", this.connections);
|
||||
console.log("Reconencting terminals", this.terminals);
|
||||
this.connections.forEach(cn => {
|
||||
console.log("cn", cn);
|
||||
});
|
||||
}
|
||||
|
||||
async sendCommand(command: string, options: { enter?: boolean; newTab?: boolean; tabId?: TabId } = {}) {
|
||||
const { enter, newTab, tabId } = options;
|
||||
|
||||
|
||||
@ -101,6 +101,12 @@ export class Terminal {
|
||||
}, {
|
||||
fireImmediately: true,
|
||||
}),
|
||||
reaction(() => UserStore.getInstance().terminalConfig.fontSize, this.setFontSize, {
|
||||
fireImmediately: true,
|
||||
}),
|
||||
reaction(() => UserStore.getInstance().terminalConfig.fontFamily, this.setFontFamily, {
|
||||
fireImmediately: true,
|
||||
}),
|
||||
dependencies.dockStore.onResize(this.onResize),
|
||||
() => onDataHandler.dispose(),
|
||||
() => this.fitAddon.dispose(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user