Module: Yast::NetworkLanComplexInclude
- Defined in:
- src/include/network/lan/complex.rb
Instance Method Summary collapse
-
#abort_button_label ⇒ String
The label for the abort/quit button.
- #add_interface ⇒ Object
-
#Commit(builder:) ⇒ Object
Commit changes to internal structures.
- #delete_interface ⇒ Object
- #edit_interface ⇒ Object
-
#hide_abort_button? ⇒ Boolean
Whether abort button should be hide.
- #initialize_network_lan_complex(include_target) ⇒ Object
-
#input_done?(ret) ⇒ Boolean
Evaluates if user should be asked again according dialogs result value.
- #interface_description ⇒ Object
- #interfaces_table ⇒ Object
- #MainDialog(init_tab) ⇒ Object
-
#next_button_label ⇒ String
The label for the next/ok button.
-
#ReadDialog ⇒ Object
Read settings dialog.
-
#running_installer? ⇒ Boolean
Whether running during installation.
- #tabs_descr ⇒ Object
- #wd ⇒ Object
-
#WriteDialog ⇒ Object
Write settings dialog.
Instance Method Details
#abort_button_label ⇒ String
The label for the abort/quit button
285 286 287 |
# File 'src/include/network/lan/complex.rb', line 285 def running_installer? ? Label.AbortButton : Label.CancelButton end |
#add_interface ⇒ Object
144 145 146 |
# File 'src/include/network/lan/complex.rb', line 144 def add_interface @add_interface ||= Y2Network::Widgets::AddInterface.new end |
#Commit(builder:) ⇒ Object
Commit changes to internal structures
166 167 168 169 170 |
# File 'src/include/network/lan/complex.rb', line 166 def Commit(builder:) builder.save :next end |
#delete_interface ⇒ Object
156 157 158 159 160 161 162 |
# File 'src/include/network/lan/complex.rb', line 156 def delete_interface return @delete_interface if @delete_interface @delete_interface = Y2Network::Widgets::DeleteInterface.new(interfaces_table) interfaces_table.add_handler(@delete_interface) @delete_interface end |
#edit_interface ⇒ Object
148 149 150 151 152 153 154 |
# File 'src/include/network/lan/complex.rb', line 148 def edit_interface return @edit_interface if @edit_interface @edit_interface = Y2Network::Widgets::EditInterface.new(interfaces_table) interfaces_table.add_handler(@edit_interface) @edit_interface end |
#hide_abort_button? ⇒ Boolean
Whether abort button should be hide
is present and true; false otherwise
293 294 295 296 297 |
# File 'src/include/network/lan/complex.rb', line 293 def return false unless running_installer? GetInstArgs.argmap["hide_abort_button"] == true end |
#initialize_network_lan_complex(include_target) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'src/include/network/lan/complex.rb', line 38 def initialize_network_lan_complex(include_target) Yast.import "UI" textdomain "network" Yast.import "CWM" Yast.import "Lan" Yast.import "DNS" Yast.import "Mode" Yast.import "NetworkConfig" Yast.import "NetworkService" Yast.import "Wizard" Yast.import "Popup" Yast.import "Label" Yast.import "Package" Yast.import "TablePopup" Yast.import "CWMTab" Yast.import "Stage" Yast.import "Systemd" Yast.import "GetInstArgs" Yast.include include_target, "network/routines.rb" Yast.include include_target, "network/lan/help.rb" Yast.include include_target, "network/services/routing.rb" Yast.include include_target, "network/services/dns.rb" Yast.include include_target, "network/lan/dhcp.rb" Yast.include include_target, "network/lan/s390.rb" Yast.include include_target, "network/widgets.rb" @shown = false end |
#input_done?(ret) ⇒ Boolean
Evaluates if user should be asked again according dialogs result value
it is basically useful if user aborts dialog and he has done some changes already. Calling this function may results in confirmation popup.
214 215 216 217 218 219 220 221 222 |
# File 'src/include/network/lan/complex.rb', line 214 def input_done?(ret) return true if ret != :abort return Popup.ConfirmAbort(:painless) if Stage.initial return ReallyAbort() if Lan.yast_config != Lan.system_config true end |
#interface_description ⇒ Object
140 141 142 |
# File 'src/include/network/lan/complex.rb', line 140 def interface_description @interface_description ||= Y2Network::Widgets::InterfaceDescription.new end |
#interfaces_table ⇒ Object
136 137 138 |
# File 'src/include/network/lan/complex.rb', line 136 def interfaces_table @interfaces_table ||= Y2Network::Widgets::InterfacesTable.new(interface_description) end |
#MainDialog(init_tab) ⇒ Object
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'src/include/network/lan/complex.rb', line 224 def MainDialog(init_tab) = _("Network Settings") = { "tab" => CWMTab.CreateWidget( "tab_order" => if Systemd.Running ["global", "overview", "resolv", "route"] else ["overview", "resolv", "route"] end, "tabs" => tabs_descr, "widget_descr" => wd, "initial_tab" => Stage.normal ? init_tab : "overview", "tab_help" => "" ) } contents = VBox("tab") w = CWM.CreateWidgets( ["tab"], Convert.convert( , from: "map", to: "map <string, map <string, any>>" ) ) help = CWM.MergeHelps(w) contents = CWM.PrepareDialog(contents, w) Wizard.SetContentsButtons( , contents, help, Label.BackButton, ) Wizard.SetAbortButton(:abort, ) Wizard.HideAbortButton if Wizard.HideBackButton unless running_installer? ret = nil loop do ret = CWM.Run(w, {}) break if input_done?(ret) end ret end |
#next_button_label ⇒ String
The label for the next/ok button
278 279 280 |
# File 'src/include/network/lan/complex.rb', line 278 def running_installer? ? Label.NextButton : Label.OKButton end |
#ReadDialog ⇒ Object
Read settings dialog
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'src/include/network/lan/complex.rb', line 174 def ReadDialog Wizard.RestoreHelp(Ops.get_string(@help, "read", "")) Lan.AbortFunction = -> { PollAbort() } ret = Lan.Read(:cache) if Lan.HaveXenBridge && !Popup.ContinueCancel( Builtins.sformat( # continue-cancel popup, #178848 # %1 is a (long) path to a README file _( "A Xen network bridge was detected.\n" \ "Due to the renaming of network interfaces by the bridge script,\n" \ "network interfaces should not be configured or restarted.\n" \ "See %1 for details." ), "/usr/share/doc/packages/xen/README.SuSE" ) ) ret = false end ret ? :next : :abort end |
#running_installer? ⇒ Boolean
Whether running during installation
302 303 304 |
# File 'src/include/network/lan/complex.rb', line 302 def running_installer? Mode.installation || Mode.update end |
#tabs_descr ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'src/include/network/lan/complex.rb', line 101 def tabs_descr return @tabs_descr if @tabs_descr @tabs_descr = { "global" => { "header" => _("Global Options"), "contents" => VBox( MarginBox(1, 0.49, "MANAGED"), MarginBox(1, 0.49, "IPV6"), MarginBox(1, 0.49, "DHCLIENT_OPTIONS"), VStretch() ), "widget_names" => ["MANAGED", "IPV6", "DHCLIENT_OPTIONS"] }, "overview" => { "header" => _("Overview"), "contents" => VBox( interfaces_table., interface_description., Left( HBox( add_interface., edit_interface., delete_interface. ) ) ), "widget_names" => [ interfaces_table., interface_description., add_interface., edit_interface., delete_interface. ] } } @tabs_descr = Builtins.union(@tabs_descr, route_td) @tabs_descr = Builtins.union(@tabs_descr, @dns_td) end |
#wd ⇒ Object
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 |
# File 'src/include/network/lan/complex.rb', line 71 def wd return @wd if @wd @wd = { "MANAGED" => , "IPV6" => , interfaces_table. => interfaces_table.cwm_definition, interface_description. => interface_description.cwm_definition, add_interface. => add_interface.cwm_definition, edit_interface. => edit_interface.cwm_definition, delete_interface. => delete_interface.cwm_definition } @wd = Convert.convert( Builtins.union(@wd, @widget_descr_dns), from: "map", to: "map <string, map <string, any>>" ) @wd = Convert.convert( Builtins.union(@wd, ), # routing widgets from: "map", to: "map <string, map <string, any>>" ) @wd = Convert.convert( Builtins.union(@wd, @widget_descr_dhclient), from: "map", to: "map <string, map <string, any>>" ) end |
#WriteDialog ⇒ Object
Write settings dialog
200 201 202 203 204 205 206 207 |
# File 'src/include/network/lan/complex.rb', line 200 def WriteDialog return :next if !Lan.Modified Wizard.RestoreHelp(Ops.get_string(@help, "write", "")) Lan.AbortFunction = -> { PollAbort() && ReallyAbort() } ret = Lan.Write ret ? :next : :abort end |