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

Returns a new instance of EditInterface.

Parameters:


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

def initialize(table)
  textdomain "network"

  @table = table
end

Instance Method Details

#handleObject


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'src/lib/y2network/widgets/edit_interface.rb', line 48

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

  builder = Y2Network::InterfaceConfigBuilder.for(item.type, config: connection_config)
  builder.name = item.name

  if item.is_a?(Y2Network::S390GroupDevice)
    builder.device_id = builder.name
    activation_dialog = Y2Network::Dialogs::S390DeviceActivation.for(builder)
    return :redraw if activation_dialog.run != :next
  end

  Y2Network::Sequences::Interface.new.public_send(:edit, builder)
  :redraw
end

#helpObject


70
71
72
73
74
75
76
77
# File 'src/lib/y2network/widgets/edit_interface.rb', line 70

def help
  # TRANSLATORS: Help for 'Edit' interface configuration button
  _(
    "<p><b><big>Configuring:</big></b><br>\n" \
    "Choose a network card to change.\n" \
   "Then press <b>Edit</b>.</p>\n"
  )
end

#initObject

See Also:

  • CWM::AbstractWidget#init

40
41
42
# File 'src/lib/y2network/widgets/edit_interface.rb', line 40

def init
  disable unless @table.value
end

#labelObject


44
45
46
# File 'src/lib/y2network/widgets/edit_interface.rb', line 44

def label
  Yast::Label.EditButton
end

#selected_interface(config) ⇒ Object


66
67
68
# File 'src/lib/y2network/widgets/edit_interface.rb', line 66

def selected_interface(config)
  config.interfaces.by_name(@table.value) || config.s390_devices.by_id(@table.value)
end