Skip to content

Column order set by dragging is lost on restart in Report, Screener, Assets and Core status (only Orders and Alerts keep it) #707

Description

@Alena-Selezneva

Reported by @viktor_s_r (macOS): "если упорядочить колонки, то после запуска терминала упорядоченный список сбивается и включается по умолчанию. Хотелось бы, чтобы сохранялся список в том порядке, который сделал юзер." He reported the same for Report in early September; no issue was filed then.

What happens

Every MoonDataTable column is draggable by default (MoonUI MoonDataTableColumn::new sets movable: true), so the user can reorder columns in every table. The new order lives only in MoonDataTableState::column_order and is persisted by just two panels:

  • Orders: panels/orders/persist.rs stores column_order in docks.json and restores it.
  • Alerts: panels/alerts/mod.rs, same approach.

Nothing else stores it, so after a restart these tables go back to their default order:

  • Report (report-table). Default order = the core's report schema order (visible_cols() filters self.cols). The Columns menu (Колонки) only toggles visibility, so the user has no other way to set the order.
  • Screener (screener-table)
  • Assets
  • Core status: main table, by-IP view, problems, warnings, updates list

This is not macOS-specific. Nothing about it depends on the platform.

It looks like a bug from the user's side: in the same tables, column widths, visible columns and sort already survive a restart through persistence/table_persist.rs (layout.toml, keyed by ctx_id with :dock/:win). Only the order is dropped.

Suggested direction

Add a column-order entry to table_persist next to widths / visible / sort (same ctx_id key, same compare-then-mark-dirty contract), and restore and persist it in the tables above. That gives every table one storage path instead of per-panel docks.json fields.

Things to keep:

  • The Report schema comes from the core and can gain or lose columns. MoonUI's ordered_columns already skips unknown saved keys and appends new columns at the end. Keep that behaviour and do not drop the saved order when the schema changes.
  • Dock and detached window keep separate layouts, as widths do now.
  • Orders/Alerts: either migrate their docks.json order into the shared storage or leave them as they are. Existing users must not lose their saved order either way.
  • A column switched back on through the Columns menu gets appended at the tail of a saved order. Alerts avoids this by clearing its drag order whenever the visible set changes (panels/alerts/mod.rs, cols_changed), which throws away the user's arrangement. A shared solution should insert the column at its canonical position instead of wiping the order.
  • Reset: the width-reset button (⤢) resets only widths. Decide whether order needs its own reset.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions