Skip to content

Commit

Permalink
feat: Added option to associate individual vm to host (#300)
Browse files Browse the repository at this point in the history
fixes #301
  • Loading branch information
Manisha15 committed Nov 15, 2023
1 parent d0ebba1 commit ccbdb06
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/helpers/proxmox_compute_resources_vms_helper.rb
Expand Up @@ -41,6 +41,11 @@ def vm_power_action(vm, authorizer = nil)
end

def vm_associate_action(vm)
vm_associate_link(vm, link_class: "btn btn-default")
end

def vm_associate_link(vm, link_class: "")
return unless @compute_resource.supports_host_association?
display_link_if_authorized(
_('Associate VM'),
hash_for_associate_compute_resource_vm_path(
Expand All @@ -52,7 +57,7 @@ def vm_associate_action(vm)
),
:title => _('Associate VM to a Foreman host'),
:method => :put,
:class => 'btn btn-default'
:class => link_class
)
end

Expand Down
1 change: 1 addition & 0 deletions app/views/compute_resources_vms/index/_proxmox.html.erb
Expand Up @@ -41,6 +41,7 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
<td>
<%= action_buttons(
vm_power_action(vm, authorizer),
vm_associate_link(vm),
display_delete_if_authorized(hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.unique_cluster_identity(@compute_resource)).merge(:auth_object => @compute_resource, :authorizer => authorizer))) %>
</td>
</tr>
Expand Down

0 comments on commit ccbdb06

Please sign in to comment.