Skip to content

Conversation

@lfu
Copy link
Contributor

@lfu lfu commented Dec 8, 2025

  • Add Export button on the new hosts overview page.
  • Add Manage columns Organization and Location to pagelet for CSV export.

Related to Katello/katello#11591.
Related to theforeman/foreman_rh_cloud#1132.

To test
Before apply this patch.
Hosts - All Hosts - Legacy UI - Export - save the exported CSV file A
Hosts - All Hosts - Content Hosts - Export - save the exported CSV file B

Apply this patch.
Hosts - All Hosts - Legacy UI - Export
The exported file should be the same as the saved exported CSV file A

Hosts - All Hosts - Export
The columns in the exported file should contain the columns exported from CSV file A + CSV file B

@jeremylenz
Copy link
Contributor

If I click Manage Columns and change my columns, and then export to CSV, does the CSV contain different columns?

Same question for the legacy page and the new UI.

@lfu
Copy link
Contributor Author

lfu commented Dec 8, 2025

Yes. Export for both Legacy and new hosts page would show different contents as you change the managed columns.

Also noticed the export file would contain all the hosts in the page.
In other words, selected hosts is not honored here. And this's the current behavior with export from Legacy UI and content hosts UI.

@lfu lfu force-pushed the 38427_export_hosts branch from a55dae9 to 9e6a0c2 Compare December 9, 2025 01:21
Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Lucy, left a few comments, have not tested yet.

Copy link
Contributor

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lfu! A few issues I found in initial testing:

  1. The column names do not seem to match the UI. For example, in the UI I see "OS" but in the CSV I see "Operatingsystem"
  2. I added the "Type" column (image mode/package mode) but this is not exported
  3. The order of the columns does not match the UI. (Not as big of a concern, but nice to have)
  4. If I have more than one page of results, the Legacy UI exports only the first page. In New UI I still get all hosts.
  5. If I have hosts filtered with a search, I still get all hosts.
  6. Can you also open a PR in foreman_rh_cloud to add those columns?

@lfu
Copy link
Contributor Author

lfu commented Dec 11, 2025

  1. The column names do not seem to match the UI. For example, in the UI I see "OS" but in the CSV I see "Operatingsystem"

It is by design.

  • UI label: label: N_('OS')
  • CSV export key: export_key: 'operatingsystem'

Copy link
Contributor

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general comment about the approach - My concern here is that

  1. CSV export definitions rely on pagelets
  2. When the legacy ERB All Hosts page goes away eventually, pagelets will also go away
  3. This will break CSV exports.

We already define columns in parallel for the React pages and with the legacy pagelets, but only pagelets have the CSV definitions. Might be worth thinking about, either in a followup technical debt issue or here.

@lfu
Copy link
Contributor Author

lfu commented Dec 19, 2025

We already define columns in parallel for the React pages and with the legacy pagelets, but only pagelets have the CSV definitions. Might be worth thinking about, either in a followup technical debt issue or here.

Could we work on the new JS columns definitions for CSV export later when ERB is going away? @jeremylenz

@jeremylenz
Copy link
Contributor

Could we work on the new JS columns definitions for CSV export later when ERB is going away?

Yes, that's fine with me. Can you please open an issue to track it :)

@lfu
Copy link
Contributor Author

lfu commented Dec 19, 2025

Opened https://projects.theforeman.org/issues/38969

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants