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
37
38
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 32

def initialize(description)
  super()
  textdomain "network"

  @description = description
  @handlers = []
end

Instance Method Details

#add_handler(handler) ⇒ Object



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

def add_handler(handler)
  @handlers << handler
end

#handleObject



57
58
59
60
61
62
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 57

def handle
  @description.value = create_description
  refresh_handlers

  nil
end

#headerObject



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

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

#helpObject



92
93
94
95
96
97
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 92

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



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

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



64
65
66
67
68
69
70
71
72
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 64

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



49
50
51
# File 'src/lib/y2network/widgets/interfaces_table.rb', line 49

def opt
  [:notify, :immediate]
end