Module: Y2Network::Presenters::InterfaceStatus

Includes:
Yast::I18n
Included in:
InterfaceSummary, InterfacesSummary, S390GroupDeviceSummary
Defined in:
src/lib/y2network/presenters/interface_status.rb

Overview

Mixin that provide status info about interface status_info(config)

Instance Method Summary collapse

Instance Method Details

#status_info(config) ⇒ String

Returns status information.

Parameters:

Returns:

  • (String)

    status information



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'src/lib/y2network/presenters/interface_status.rb', line 31

def status_info(config)
  textdomain "network"

  case config.bootproto
  when BootProtocol::STATIC
    return Yast::HTML.Colorize(_("Configured without an address"), "red") if !config.ip

    ip = config.ip.address.to_s
    host = Yast::NetHwDetection.ResolveIP(config.ip.address.address.to_s)
    addr = ip
    addr << "(#{host})" if host && !host.empty?
    if config.ip.remote_address
      # TRANSLATORS %{local} is local address and %{remote} is remote address
      format(
        _("Configured with address %{local} (remote %{remote})"),
        local:  addr,
        remote: config.ip.remote_address.to_s
      )
    else
      # TRANSLATORS %s is address
      format(_("Configured with address %s"), addr)
    end
  when BootProtocol::NONE
    _("Do not assign (e.g. if included in a bond or bridge)")
  else
    # TODO: maybe human name for boot protocols?
    format(_("Configured with %s"), config.bootproto.name)
  end
end