Skip to content

Commit

Permalink
feat: specify optional container for shell component
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen Nijhuis committed Jan 11, 2024
1 parent 2b3d513 commit 7cdf280
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/views/Shell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "xterm/css/xterm.css";
import { FitAddon } from "xterm-addon-fit";
import { invoke } from "@tauri-apps/api/tauri";
import { Event, listen } from "@tauri-apps/api/event";
import { V1Pod } from "@kubernetes/client-node";
import { V1Container, V1Pod } from "@kubernetes/client-node";
let terminal: Terminal;
let fitAddon: FitAddon;
Expand All @@ -15,7 +15,7 @@ const props = defineProps<{
context: string;
namespace: string;
pod: V1Pod;
initCommand: string;
container?: V1Container;
}>();
const writeToTerminal = (ev: Event<string>) => {
Expand All @@ -39,7 +39,9 @@ const openTerminal = () => {
"--namespace",
props.namespace,
"-c",
props.pod.spec?.containers?.[0].name as string,
props.container
? props.container.name
: (props.pod.spec?.containers?.[0].name as string),
"--",
"/bin/bash",
],
Expand Down Expand Up @@ -78,12 +80,14 @@ onMounted(() => {
openTerminal();
window.addEventListener("TabOrchestrator_Resized", resize);
window.addEventListener("resize", resize);
});
onUnmounted(() => {
kill();
window.removeEventListener("TabOrchestrator_Resized", resize);
window.removeEventListener("resize", resize);
});
</script>

Expand Down

0 comments on commit 7cdf280

Please sign in to comment.