All checks were successful
Build & Sign Wraith / Build Windows + Sign (push) Successful in 4m5s
VUE-1: store workspace save interval ID, clear in onUnmounted VUE-2: extract beforeunload handler to named function, remove in onUnmounted VUE-3: move useTerminal() to <script setup> top level in DetachedSession VUE-4: call useTerminal() before nextTick await in CopilotPanel launch() VUE-5: remove duplicate ResizeObserver from LocalTerminalView (useTerminal already creates one) VUE-6: store terminal.onResize() IDisposable, dispose in onBeforeUnmount VUE-7: extract connectSsh(), connectRdp(), resolveCredentials() from 220-line connect() VUE-8: check session protocol before ssh_resize vs pty_resize in TerminalView Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
63 lines
1.3 KiB
Vue
63 lines
1.3 KiB
Vue
<template>
|
|
<div class="flex flex-col h-full">
|
|
<div
|
|
ref="containerRef"
|
|
class="terminal-container flex-1"
|
|
@click="terminal.focus()"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, onMounted, onBeforeUnmount, watch } from "vue";
|
|
import { invoke } from "@tauri-apps/api/core";
|
|
import { useTerminal } from "@/composables/useTerminal";
|
|
import "@/assets/css/terminal.css";
|
|
|
|
const props = defineProps<{
|
|
sessionId: string;
|
|
isActive: boolean;
|
|
}>();
|
|
|
|
const containerRef = ref<HTMLElement | null>(null);
|
|
const { terminal, mount, fit, destroy } = useTerminal(props.sessionId, "pty");
|
|
|
|
onMounted(() => {
|
|
if (containerRef.value) {
|
|
mount(containerRef.value);
|
|
}
|
|
setTimeout(() => {
|
|
fit();
|
|
terminal.focus();
|
|
invoke("pty_resize", {
|
|
sessionId: props.sessionId,
|
|
cols: terminal.cols,
|
|
rows: terminal.rows,
|
|
}).catch(() => {});
|
|
}, 50);
|
|
});
|
|
|
|
watch(
|
|
() => props.isActive,
|
|
(active) => {
|
|
if (active) {
|
|
requestAnimationFrame(() => {
|
|
requestAnimationFrame(() => {
|
|
fit();
|
|
terminal.focus();
|
|
invoke("pty_resize", {
|
|
sessionId: props.sessionId,
|
|
cols: terminal.cols,
|
|
rows: terminal.rows,
|
|
}).catch(() => {});
|
|
});
|
|
});
|
|
}
|
|
},
|
|
);
|
|
|
|
onBeforeUnmount(() => {
|
|
destroy();
|
|
});
|
|
</script>
|