Class: Y2Network::Widgets::AddressTab
- Inherits:
-
CWM::Tab
- Object
- CWM::Tab
- Y2Network::Widgets::AddressTab
- Defined in:
- src/lib/y2network/widgets/address_tab.rb
Instance Method Summary collapse
- #contents ⇒ Object
-
#driver_type(type) ⇒ Object
For s390 hwinfo gives us a multitude of types but some are handled the same, mostly acording to the driver which is used.
-
#initialize(settings) ⇒ AddressTab
constructor
Constructor.
- #label ⇒ Object
Constructor Details
#initialize(settings) ⇒ AddressTab
Constructor
39 40 41 42 43 |
# File 'src/lib/y2network/widgets/address_tab.rb', line 39 def initialize(settings) textdomain "network" @settings = settings end |
Instance Method Details
#contents ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'src/lib/y2network/widgets/address_tab.rb', line 49 def contents type = @settings.type drvtype = driver_type(type.short_name) # TODO: check if this kind of device is still valid and used is_ptp = ["ctc", "iucv"].include?(drvtype) # TODO: dynamic for dummy. or add dummy from outside? no_dhcp = is_ptp || type.dummy? address_p2p_contents = Frame( "", # labelless frame VBox(IPAddress.new(@settings), RemoteIP.new(@settings)) ) address_static_contents = Frame( "", # labelless frame VBox( IPAddress.new(@settings), Netmask.new(@settings), # TODO: new widget, add logic # "GATEWAY" Empty() ) ) address_dhcp_contents = VBox(BootProtocol.new(@settings)) just_address_contents = if is_ptp address_p2p_contents elsif no_dhcp address_static_contents else address_dhcp_contents end label = HBox( type.vlan? ? VBox(HBox(VlanInterface.new(@settings), VlanID.new(@settings))) : Empty() ) address_contents = if type.tun? || type.tap? # TODO: move it to own tab or general as it does not fit here VBox(Left(label), Tunnel.new(@settings)) else VBox( Left(label), just_address_contents, AdditionalAddresses.new(@settings) ) end address_contents end |
#driver_type(type) ⇒ Object
For s390 hwinfo gives us a multitude of types but some are handled the same, mostly acording to the driver which is used. So let's group them under the name Driver Type. TODO: move outside
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'src/lib/y2network/widgets/address_tab.rb', line 109 def driver_type(type) drvtype = type # handle HSI like qeth, bsc#55692 #c15 case type when "hsi" drvtype = "qeth" # Should eth occur on s390? when "tr", "eth" drvtype = "lcs" # N#82891 when "escon", "ficon" drvtype = "ctc" end drvtype end |
#label ⇒ Object
45 46 47 |
# File 'src/lib/y2network/widgets/address_tab.rb', line 45 def label _("&Address") end |