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

Returns a new instance of 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

#helpObject


85
86
87
88
89
90
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 85

def help
  _(
    "<p><b><big>Overview</big></b><br>\n" \
     "Obtain an overview of the network interfaces configuration.</p>\n"
  )
end

#initObject

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


68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 68

def init
  if config.backend?(: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
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 57

def items
  items_list = []
  config.interfaces.each { |i| items_list << interface_item(i) }
  config.s390_devices.select(&:offline?).each do |device|
    items_list << device_item(device)
  end

  items_list
end

#optObject


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

def opt
  [:notify, :immediate]
end