Class: Y2Network::Widgets::EditInterface

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

Instance Method Summary collapse

Constructor Details

#initialize(table) ⇒ EditInterface


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

def initialize(table)
  textdomain "network"

  @table = table
end

Instance Method Details

#handleObject


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'src/lib/y2network/widgets/edit_interface.rb', line 41

def handle
  config = Yast::Lan.yast_config.copy
  connection_config = config.connections.by_name(@table.value)

  name, type =
    if connection_config
      [connection_config.name, connection_config.type]
    else
      interface = config.interfaces.by_name(@table.value)
      [interface.name, interface.type]
    end

  builder = Y2Network::InterfaceConfigBuilder.for(type, config: connection_config)
  builder.name = name
  Y2Network::Sequences::Interface.new.edit(builder)
  :redraw
end

#labelObject


37
38
39
# File 'src/lib/y2network/widgets/edit_interface.rb', line 37

def label
  Yast::Label.EditButton
end