Module: Yast::NetworkComplexInclude

Defined in:
src/include/network/complex.rb

Instance Method Summary collapse

Instance Method Details

#HardwareName(hardware, id) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'src/include/network/complex.rb', line 43

def HardwareName(hardware, id)
  return "" if id.nil? || id.empty?
  return "" if hardware.nil? || hardware.empty?

  # filter out a list of hwinfos which correspond to the given id
  res_list = hardware.select do |h|
    have = [
      "id-" + (h["mac"] || ""),
      "bus-" + (h["bus"] || "") + "-" + (h["busid"] || ""),
      h["udi"] || "",
      h["dev_name"] || ""
    ]

    have.include?(id)
  end

  # take first item from the list - there should be just one
  if res_list.empty?
    Builtins.y2warning("HardwareName: no matching hardware for id=#{id}")

    ""
  else
    hwname = res_list.first["name"] || ""
    Builtins.y2milestone("HardwareName: hwname=#{hwname} for id=#{id}")

    hwname
  end
end

TODO: move to HTML.ycp



39
40
41
# File 'src/include/network/complex.rb', line 39

def Hyperlink(href, text)
  Builtins.sformat("<a href=\"%1\">%2</a>", href, text)
end

#initialize_network_complex(include_target) ⇒ Object



30
31
32
33
34
35
36
# File 'src/include/network/complex.rb', line 30

def initialize_network_complex(include_target)
  Yast.import "UI"

  textdomain "network"

  Yast.include include_target, "network/routines.rb"
end