Skip to content

Commit

Permalink
fix #1402
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed committed Dec 28, 2021
1 parent 2a9f546 commit 741ede4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PACKAGE := github.com/derailed/$(NAME)
GIT_REV ?= $(shell git rev-parse --short HEAD)
SOURCE_DATE_EPOCH ?= $(shell date +%s)
DATE ?= $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ")
VERSION ?= v0.25.17
VERSION ?= v0.25.18
IMG_NAME := derailed/k9s
IMAGE := ${IMG_NAME}:${VERSION}

Expand Down
25 changes: 25 additions & 0 deletions change_logs/release_v0.25.18.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>

# Release v0.25.18

## Notes

Thank you to all that contributed with flushing out issues and enhancements for K9s! I'll try to mark some of these issues as fixed. But if you don't mind grab the latest rev and see if we're happier with some of the fixes! If you've filed an issue please help me verify and close. Your support, kindness and awesome suggestions to make K9s better are as ever very much noted and appreciated!

If you feel K9s is helping your Kubernetes journey, please consider joining our [sponsorship program](https://github.com/sponsors/derailed) and/or make some noise on social! [@kitesurfer](https://twitter.com/kitesurfer)

On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)

---

## Maintenance Release

---

## Resolved Issues

* [Issue #1402](https://github.com/derailed/k9s/issues/1402) Sort functionality does not work properly on v0.25.16. With Feelings!

---

<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2021 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)
2 changes: 1 addition & 1 deletion internal/ui/select_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (s *SelectTable) SelectRow(r int, broadcast bool) {
if !broadcast {
s.SetSelectionChangedFunc(nil)
}
if r >= s.model.Count() {
if s.model.Count() > 0 && r >= s.model.Count() {
r = s.model.Count()
}
defer s.SetSelectionChangedFunc(s.selectionChanged)
Expand Down
11 changes: 5 additions & 6 deletions internal/ui/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,14 @@ func (t *Table) Update(data render.TableData, hasMetrics bool) {
func (t *Table) doUpdate(data render.TableData) {
if client.IsAllNamespaces(data.Namespace) {
t.actions[KeyShiftP] = NewKeyAction("Sort Namespace", t.SortColCmd("NAMESPACE", true), false)
t.sortCol.name = "NAMESPACE"
} else {
t.actions.Delete(KeyShiftP)
}

var cols []string
if t.viewSetting != nil {
cols := t.header.Columns(t.wide)
if t.viewSetting != nil && len(t.viewSetting.Columns) > 0 {
cols = t.viewSetting.Columns
}
if len(cols) == 0 {
cols = t.header.Columns(t.wide)
}
custData := data.Customize(cols, t.wide)
if t.viewSetting != nil && t.viewSetting.SortColumn != "" {
tokens := strings.Split(t.viewSetting.SortColumn, ":")
Expand All @@ -214,6 +210,9 @@ func (t *Table) doUpdate(data render.TableData) {
}
}

if t.sortCol.name == "" && client.IsAllNamespaces(data.Namespace) {
t.sortCol.name = "NAMESPACE"
}
if t.sortCol.name == "" || (t.sortCol.name == "NAMESPACE" && !client.IsAllNamespaces(data.Namespace)) && len(custData.Header) > 0 {
if idx := custData.Header.IndexOf("NAME", false); idx >= 0 {
t.sortCol.name = custData.Header[idx].Name
Expand Down

0 comments on commit 741ede4

Please sign in to comment.