Class: Y2Network::Widgets::InterfacesTable

Inherits:
CWM::Table
  • Object
show all
Defined in:
src/lib/y2network/widgets/interfaces_table.rb

Instance Method Summary collapse

Constructor Details

#initialize(description) ⇒ InterfacesTable


32
33
34
35
36
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 32

def initialize(description)
  textdomain "network"

  @description = description
end

Instance Method Details

#handleObject


51
52
53
54
55
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 51

def handle
  @description.value = create_description

  nil
end

#headerObject


38
39
40
41
42
43
44
45
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 38

def header
  [
    _("Name"),
    _("IP Address"),
    _("Device"),
    _("Note")
  ]
end

#initObject

Workaround for usage in old CWM which also cache content of cwm items


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 72

def init
  if Yast::NetworkService.is_network_manager
    Yast::Popup.Warning(
      _(
        "Network is currently handled by NetworkManager\n" \
        "or completely disabled. YaST is unable to configure some options."
      )
    )
    # switch to global tab
    Yast::UI.FakeUserInput("ID" => "global")
    return
  end

  change_items(items)
  handle
end

#itemsObject


57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 57

def items
  config = Yast::Lan.yast_config
  config.interfaces.map do |interface|
    conn = config.connections.by_name(interface.name)
    [
      interface.name, # first is ID in table
      friendly_name(interface),
      interface_protocol(conn),
      interface.name,
      note(interface, conn, config)
    ]
  end
end

#optObject


47
48
49
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 47

def opt
  [:notify, :immediate]
end