-
Notifications
You must be signed in to change notification settings - Fork 724
Resize TTYs #1966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resize TTYs #1966
Conversation
Works great for containers! Using the controls endpoint is a bit awkward right now: to construct the url A pipe based endpoint feels like it would be cleaner: If thats not feasible I guess either:
|
Awesome! but shouldn't it be generic? (i.e. if the pipe response sets
Can't you save them with the pipeID and associate them to the terminal instance?
That makes it awkward for the backend. I gave it a lot of thought and this was the best option I could come up with, respecting what we already have for controls (we cannot use the pipes directly because we don't have a way to send out of band control information cleanly without breaking backwards compatibility in the pipes protocol). We could use your proposed API and still use controls under the hood, but that would make it internally stateful (we would have to keep a map from pipeIDs to probeIDs and control) |
Yep, true, we can do that.
Ah hah! This is probably why host is not working right now. Will clean up and fix this. |
Adds terminal resizing on popped out windows
Working on hosts and popped out windows too now. Can the resize_tty_control be missing sometimes? |
It won't be missing in the response of docker_exec/host_exec controls but it's optional, so I would handle it as such. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go code LGTM. One comment that you can act on at your discretion.
return ResponseErrorf("Bad parameter: width (%q): %v", widthS, err) | ||
} | ||
|
||
return next(pipeID, uint(height), uint(width)) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well, nicely done. Apart from naming issues, LGTM
|
||
log('Caculated (col, row) sizes in px: ', pixelPerCol, pixelPerRow); | ||
return {pixelPerCol, pixelPerRow}; | ||
log('Caculated (charWidth, charHeight) sizes in px: ', characterWidth, characterHeight); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -248,6 +252,22 @@ export function doControlRequest(nodeId, control, dispatch) { | |||
}); | |||
} | |||
|
|||
|
|||
export function doResizePipe(pipeId, control, cols, rows) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
res.pipe, | ||
nodeId, | ||
res.raw_tty, | ||
{id: res.resize_tty_control, probeId: control.probeId, nodeId: control.nodeId})); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -580,16 +580,17 @@ export function receiveControlNodeRemoved(nodeId) { | |||
}; | |||
} | |||
|
|||
export function receiveControlPipeFromParams(pipeId, rawTty) { | |||
export function receiveControlPipeFromParams(pipeId, rawTty, resizeTtyControl) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
So we don't receive a resize control from |
…tach) - Fix text selection in terminal (was our force focus stuff, introduced if you clicked on the black border that was not actually the terminal
I don't think it does. Logs are not in raw mode, so it shouldn't matter (in general at least) |
Docker provides https://godoc.org/github.com/fsouza/go-dockerclient#Client.ResizeContainerTTY so it should be easy to add, but I don't think it's even worth it. That could change if I am presented with a reasonable usecase. |
This PR adds the possibility to resize TTYs. It adds (optional) arguments to controls and modifies the UI<->App contract in the following way:
resize_tty_control
which indicates what control to use in order to resize the TTYwidth
,height
andpipeID
Here's an example:
POST http://172.16.0.3:4040/api/control/3b89ec4023a94f3e/516cc48f99788d7d6b558d4ebf3d0e3bd1d3f2eae65ceb4e405a53498ed99b45%3B%3Ccontainer%3E/docker_exec_container
to create a containter TTY{"pipe":"pipe-4012265930510560261","raw_tty":true,"resize_tty_control":"docker_resize_exec_tty"}
. Note the newresize_tty_control
field.curl -X POST -d '{ "pipeID": "pipe-4012265930510560261", "height": "100", "width": "100"}' http://172.16.0.3:4040/api/control/3b89ec4023a94f3e/516cc48f99788d7d6b558d4ebf3d0e3bd1d3f2eae65ceb4e405a53498ed99b45%3B%3Ccontainer%3E/docker_resize_exec_tty
TODO:
I would appreciate a design review (maybe by @tomwilkie )
Fixes #746.
Fixs #1964