astefanutti / kubebox

⎈❏ Terminal and Web console for Kubernetes
http://astefanutti.github.io/kubebox
MIT License
2.14k stars 142 forks source link

auto-focus logs when pod is selected #106

Open frudolph77 opened 3 years ago

frudolph77 commented 3 years ago

auto-focus logs when pod is selected. From my point of view, a very useful feature.

astefanutti commented 3 years ago

I can see it's useful in some use cases. On the other hand, I can also see use cases where it's not ideal. For example, with pods having more than one containers. One idea could be to focus the log element only when the Shift key or Alt key has also been pressed?

frudolph77 commented 3 years ago

As far as I understand the code blessed does not support key Alt key. And I also did not get a binding like Shift+Enter or Ctrl+Enter working.

astefanutti commented 3 years ago

It should be possible to test for key.shift or key.meta in the listener. If the listener is not called, it's possible the terminal emulator you use already have a key binding for the combination.

frudolph77 commented 3 years ago

It should be possible to test for key.shift or key.meta in the listener.

Yes, i know.

I've added this code to dashboard.js:

    pods_table.key(['S-enter', 'C-enter', 'enter'], (_, key) => {
      debug.log("pods_table.key('enter') : '" + JSON.stringify(key) +"'");
    });

    screen.on('keypress', function(key) {
      debug.log("screen.on('keypress') : '" + JSON.stringify(key) +"'");
    });

The keypress-Event always gets fired twice when pressing enter and shows \r as output, only the Alt Key is also displayed. The pods_table.key only shows the enter key, neither with shitft nor with ctrl.

I'm pretty sure that there is no keybinding for Shift-Enter or Control-Enter in my terminal.

astefanutti commented 3 years ago

OK, thanks. I'll have a deeper look at it ASAP.