astefanutti / kubebox

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

How to set the pods_table label to "Pods [selected namespace]" ? #40

Closed 593769290 closed 5 years ago

593769290 commented 5 years ago

1, When I select one pod from the poslist table, the logs windows show the real log content and change the title from "Logs" to "Logs [docker-name]".

2, But in the whole web page, I don't kown which namespace I have selected. 3, So I want to say, when I select some namespace from the namespace selecting windows. the podlist table display all pods under the namespace, in the mean time, I want the podlist table title change from "Pods" to "Pods [selected namespace]".

4, I have studied some code from the project , and found some code like this:

resources.setLabel(Resources {grey-fg}[${container_selected}]{/grey-fg} {red-fg}TERMINATING{/red-fg}); pod_log.setLabel(Logs {grey-fg}[${container_selected}]{/grey-fg} {red-fg}TERMINATING{/red-fg});

5, So where should I place some code like pods_table.setLabel(Pods {grey-fg}[${current_namespace}]{/grey-fg});

5, So where should I place some code like pods_table.setLabel(Pods {grey-fg}[${current_namespace}]{/grey-fg});

593769290 commented 5 years ago

OK I found it now.

in the file: kubebox/lib/ui/dashboard.js

// FIXME: should be cancellable
const promise = until(client.pods(current_namespace).get())
  .spin(s => pods_table.setLabel(`${s} Pods {grey-fg}[${current_namespace}]{/grey-fg}`))
  .succeed(_ => pods_table.setLabel(`Pods {grey-fg}[${current_namespace}]{/grey-fg}`)) 
593769290 commented 5 years ago

I suggest this feature should be a small enhancement.

astefanutti commented 5 years ago

Thanks for the report. I agree it lacks context of which namespace is selected. I thought that it could be set as the tab tittle, but I like your idea. Would you be able to submit a PR for it?

astefanutti commented 5 years ago

Fixed with 062d22828038acd9edc0fca9b77d01a01940b62b.