use the table's filtered data when saving to file (#400)

mine
IgorRamalho 2019-11-07 01:37:27 -03:00 committed by Gustavo Silva Paiva
parent 8f64ee3b41
commit fb55fc5013
2 changed files with 6 additions and 1 deletions

View File

@ -195,6 +195,11 @@ func (v *Table) GetData() resource.TableData {
return v.data
}
// GetFilteredData fetch filtered tabular data.
func (v *Table) GetFilteredData() resource.TableData {
return v.filtered()
}
// SetBaseTitle set the table title.
func (v *Table) SetBaseTitle(s string) {
v.baseTitle = s

View File

@ -33,7 +33,7 @@ func (v *tableView) BufferActive(state bool, k ui.BufferKind) {
}
func (v *tableView) saveCmd(evt *tcell.EventKey) *tcell.EventKey {
if path, err := saveTable(v.app.Config.K9s.CurrentCluster, v.GetBaseTitle(), v.GetData()); err != nil {
if path, err := saveTable(v.app.Config.K9s.CurrentCluster, v.GetBaseTitle(), v.GetFilteredData()); err != nil {
v.app.Flash().Err(err)
} else {
v.app.Flash().Infof("File %s saved successfully!", path)