kubebox icon indicating copy to clipboard operation
kubebox copied to clipboard

auto-focus logs when pod is selected

Open frudolph77 opened this issue 4 years ago • 5 comments

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

frudolph77 avatar Nov 13 '20 17:11 frudolph77

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?

astefanutti avatar Nov 15 '20 15:11 astefanutti

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.

frudolph77 avatar Nov 17 '20 10:11 frudolph77

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.

astefanutti avatar Nov 17 '20 10:11 astefanutti

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.

frudolph77 avatar Nov 17 '20 13:11 frudolph77

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

astefanutti avatar Nov 17 '20 13:11 astefanutti