foreman_column_view icon indicating copy to clipboard operation
foreman_column_view copied to clipboard

Failure: undefined method `link_to

Open ThoTischner opened this issue 7 years ago • 3 comments

Hi,

installed the plugin via rpm on: foreman-1.16.0-1.el7.noarch

Tried to build an ssh link via:

  :sshlink:
    :title: SSH link
    :after: uuid
    :content: link_to(_("SSH"), "ssh://#{host.ip}", { :class => "btn btn-info" } )
    :view: :hosts_properties

The following error appears:

Failure: undefined method `link_to(_("SSH"), "https://#{host.ip}", { :class => "btn btn-info" } )' for #<Host::Managed:0x007f1252419f40>

Thanks, Thomas

ThoTischner avatar Apr 16 '18 09:04 ThoTischner

Thanks for the patience @disappear89 - I've been away for a bit. I'll see if I can reproduce this locally, it's been a while since I tested the link_to part of the readme.

GregSutcliffe avatar May 08 '18 11:05 GregSutcliffe

Hi,

same problem here.

I tried to link to our DCIM system:

:column_view:
  :netbox:
    :title: DCIM
    :after: owner
    :content: link_to(_("Console"), "https://[netbox_url]/search/?q=#{host.interfaces.fqdn}" )
    :view: :hosts_properties

And get the error attached: foreman_column_view_link_to_error.txt.gz

I tried the SSH example above an get the same error as well.

CentOS 7.5.1804 Foreman 1.17.1 Foreman-proxy 1.17.1 Katello 3.6.0 tfm-rubygem-foreman_column_view-0.4.0-1.fm1_17.el7.noarch

ghost avatar Jun 27 '18 13:06 ghost

I'm a bit late to the game, but I think you've been missing:

:eval_content: true

to force evaluation of the :content:. With this, the Console example works for me. Sadly, I'm not clever enough to make more complex examples work, e.g. referencing params inside the URL or the button name, so some more examples in the documentation would for sure help.

olifre avatar Dec 25 '20 18:12 olifre