Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory checkbox will not show when VM is not up #12678

Merged
merged 1 commit into from
Dec 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/controllers/vm_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ def snap
@name = @description = ""
@in_a_form = true
@button_group = "snap"
@show_snapshot_memory_checkbox = show_snapshot_memory_checkbox?(@vm)
drop_breadcrumb(:name => _("Snapshot VM '%{name}''") % {:name => @record.name},
:url => "/vm_common/snap",
:display => "snapshot_info")
Expand All @@ -566,6 +567,11 @@ def render_missing_field(session, missing_field_name)
end
end

def show_snapshot_memory_checkbox?(vm)
return true unless vm.respond_to?(:snapshotting_memory_allowed?)
vm.snapshotting_memory_allowed?
end

def snap_vm
@vm = @record = identify_record(params[:id], VmOrTemplate)
if params["cancel"] || params[:button] == "cancel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def allowed_to_revert?
current_state == 'off'
end

def snapshotting_memory_allowed?
current_state == 'on'
end

private

def with_snapshots_service(vm_uid_ems)
Expand Down
2 changes: 1 addition & 1 deletion app/views/vm_common/_snap.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
= _('Description')
.col-md-8
= text_area_tag("description", @description, :size => "50x4")
.form-group
%div{:class => "form-group #{@show_snapshot_memory_checkbox ? "" : "hidden"}"}
%label.control-label.col-md-2
= _('Snapshot VM memory')
.col-md-8
Expand Down