Skip to content

Conversation

GilbertCherrie
Copy link
Member

@GilbertCherrie GilbertCherrie commented Sep 30, 2025

Fixes: #9518. This pr converts the vm snapshot tree page from HAML to React.

Before:
Screenshot 2025-09-30 at 11 23 19 AM

After:
Screenshot 2025-09-30 at 11 20 25 AM

@GilbertCherrie GilbertCherrie requested a review from a team as a code owner September 30, 2025 14:34
@GilbertCherrie GilbertCherrie changed the title [WIP] Convert vm snapshot form Convert vm snapshot form Sep 30, 2025
page << "miqScrollTop();" if @flash_array.present?
page.replace("desc_content", :partial => "/vm_common/snapshots_desc",
:locals => {:selected => params[:id]})
formatted_time = format_timezone(@snap_selected[:create_time].to_time, Time.zone, "view")
Copy link
Member

Choose a reason for hiding this comment

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

Should this be in the users time zone?

Copy link
Member

Choose a reason for hiding this comment

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

Or should this be in UTC and we convert on the client side?

Copy link
Member Author

Choose a reason for hiding this comment

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

This line converts it to the user's timezone in the MIQ settings, converting timezones is messy on JS and would be difficult to match the original formatting which is why I kept it on the ruby side

page.replace("desc_content", :partial => "/vm_common/snapshots_desc",
:locals => {:selected => params[:id]})
formatted_time = format_timezone(@snap_selected[:create_time].to_time, Time.zone, "view")
number_to_human_size(@snap_selected[:total_size], :precision => 2)
Copy link
Member

Choose a reason for hiding this comment

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

This line isn't doing anything on its own. Should this be used below in the formatted bytes section?

Copy link
Member Author

@GilbertCherrie GilbertCherrie Sep 30, 2025

Choose a reason for hiding this comment

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

I just copied the original code for this part. Is the original code wrong here?

= number_to_human_size(selected_id[:total_size], :precision => 2)
= _("(%{number} bytes)") % {:number => number_with_delimiter(selected_id[:total_size], :delimiter => ",", :separator => ".")}

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

Successfully merging this pull request may close these issues.

Snapshot selection bug
4 participants