mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
fix(console): use writeUtf8 instead of environment variables EE-6593 (#11019)
This commit is contained in:
parent
249b6bc628
commit
b640b58371
3 changed files with 19 additions and 30 deletions
|
@ -46,27 +46,19 @@ export function KubeCtlShell({ environmentId, onClose }: Props) {
|
|||
onClose();
|
||||
}, [onClose, terminal, socket]);
|
||||
|
||||
const openTerminal = useCallback(
|
||||
(socket: WebSocket | null) => {
|
||||
if (!terminalElem.current) {
|
||||
return;
|
||||
}
|
||||
const openTerminal = useCallback(() => {
|
||||
if (!terminalElem.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
terminal.open(terminalElem.current);
|
||||
terminal.setOption('cursorBlink', true);
|
||||
terminal.focus();
|
||||
fit(terminal);
|
||||
if (socket) {
|
||||
socket.send('export LANG=C.UTF-8\n');
|
||||
socket.send('export LC_ALL=C.UTF-8\n');
|
||||
socket.send('clear\n');
|
||||
}
|
||||
terminal.writeln('#Run kubectl commands inside here');
|
||||
terminal.writeln('#e.g. kubectl get all');
|
||||
terminal.writeln('');
|
||||
},
|
||||
[terminal]
|
||||
);
|
||||
terminal.open(terminalElem.current);
|
||||
terminal.setOption('cursorBlink', true);
|
||||
terminal.focus();
|
||||
fit(terminal);
|
||||
terminal.writeln('#Run kubectl commands inside here');
|
||||
terminal.writeln('#e.g. kubectl get all');
|
||||
terminal.writeln('');
|
||||
}, [terminal]);
|
||||
|
||||
// refresh socket listeners on socket updates
|
||||
useEffect(() => {
|
||||
|
@ -74,10 +66,11 @@ export function KubeCtlShell({ environmentId, onClose }: Props) {
|
|||
return () => {};
|
||||
}
|
||||
function onOpen() {
|
||||
openTerminal(socket);
|
||||
openTerminal();
|
||||
}
|
||||
function onMessage(e: MessageEvent) {
|
||||
terminal.write(e.data);
|
||||
const encoded = new TextEncoder().encode(e.data);
|
||||
terminal.writeUtf8(encoded);
|
||||
}
|
||||
function onClose() {
|
||||
handleClose();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue