Module: Yast::NetworkComplexInclude
- Defined in:
- ../../src/include/network/complex.rb
Instance Method Summary (collapse)
-
- (Object) BuildDescription(devtype, devnum, devmap, _Hardware)
Used for initializing the description variable (ifcfg) The code is mostly moved from BuildSummaryDevs Take the NAME field from ifcfg If empty, identify the hardware and use its data.
-
- (Object) BuildOverview(devregex, _Hardware)
Create overview table contents.
-
- (Object) BuildOverviewDevs(_Devs, _Hardware)
Create overview table contents List of terms
item (
id (id), …). -
- (configured, unconfigured) BuildSummary(devregex, _Hardware, split, link)
Build textual summary.
-
- (configured, unconfigured) BuildSummaryDevs(_Devs, _Hardware, split, link)
Build textual summary.
-
- ($[id, table_descr, rich descr]) BuildUnconfigured(_class, _Hardware)
NetworkInterfaces (#103073).
-
- ($[id, table_descr, rich descr]) BuildUnconfiguredCommon(sum, _class)
Convert the output of BuildSummary for inclusion in the unified device list.
- - ($[id, table_descr, rich descr]) BuildUnconfiguredDevs(_Devs, _class, _Hardware)
- - (Object) CheckEmptyName(devtype, hwname)
-
- (Object) DeviceProtocol(devmap)
Return the device protocol or IP address in case of static config Or indicate that NetworkManager takes over.
- - (Object) DeviceStatus(devtype, devname, devmap)
-
- (Object) getConnMacBusDescription(v, _Hardware)
Return description used for device summary dialog In case device is not connected “(not connected)” string will be added.
- - (Object) HardwareName(_Hardware, id)
-
- (Object) Hyperlink(href, text)
TODO move to HTML.ycp.
- - (Object) initialize_network_complex(include_target)
-
- (Object) ProviderName(provider)
Get aprovider name from the provider map.
Instance Method Details
- (Object) BuildDescription(devtype, devnum, devmap, _Hardware)
Used for initializing the description variable (ifcfg) The code is mostly moved from BuildSummaryDevs Take the NAME field from ifcfg If empty, identify the hardware and use its data
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File '../../src/include/network/complex.rb', line 53 def BuildDescription(devtype, devnum, devmap, _Hardware) devmap = deep_copy(devmap) _Hardware = deep_copy(_Hardware) descr = Ops.get_string(devmap, "NAME", "") return descr if descr != "" descr = HardwareName(_Hardware, devnum) return descr if descr != "" descr = HardwareName(_Hardware, Ops.get_string(devmap, "UNIQUE", "")) return descr if descr != "" descr = HardwareName(_Hardware, Ops.get_string(devmap, "dev_name", "")) return descr if descr != "" descr = CheckEmptyName(devtype, descr) descr end |
- (Object) BuildOverview(devregex, _Hardware)
Create overview table contents
662 663 664 665 666 |
# File '../../src/include/network/complex.rb', line 662 def BuildOverview(devregex, _Hardware) _Hardware = deep_copy(_Hardware) _Devs = NetworkInterfaces.FilterDevices(devregex) BuildOverviewDevs(_Devs, _Hardware) end |
- (Object) BuildOverviewDevs(_Devs, _Hardware)
Create overview table contents
List of terms
item (
id (id),
...)
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 |
# File '../../src/include/network/complex.rb', line 488 def BuildOverviewDevs(_Devs, _Hardware) _Devs = deep_copy(_Devs) _Hardware = deep_copy(_Hardware) overview = [] startmode_descrs = { # summary description of STARTMODE=auto "auto" => _( "Started automatically at boot" ), # summary description of STARTMODE=hotplug "hotplug" => _( "Started automatically at boot" ), # summary description of STARTMODE=ifplugd "ifplugd" => _( "Started automatically on cable connection" ), # summary description of STARTMODE=managed "managed" => _( "Managed by NetworkManager" ), # summary description of STARTMODE=off "off" => _( "Will not be started at all" ) } Builtins.maplist(_Devs) do |type, devmap| Builtins.maplist( Convert.convert(devmap, :from => "map", :to => "map <string, map>") ) do |devname, v| item = nil ip = DeviceProtocol(v) descr = BuildDescription(type, devname, v, _Hardware) startmode_descr = Ops.get_locale( startmode_descrs, Ops.get_string(v, "STARTMODE", ""), _("Started manually") ) # Modem and DSL if type == "ppp" || type == "modem" || type == "dsl" # create the rich text description rich = Ops.add( Ops.add(HTML.Bold(descr), "<br>"), HTML.List( [ Builtins.sformat(_("Device Name: %1"), devname), Builtins.sformat( _("Mode: %1"), Ops.get_locale(v, "PPPMODE", _("Unknown")) ), startmode_descr ] ) ) item = Item( Id(devname), devname, NetworkInterfaces.GetDevTypeDescription(type, false), ProviderName(Ops.get_string(v, "PROVIDER", "")), rich ) # ISDN stuff elsif type == "contr" # FIXME: richtext cname = Ops.get_string(v, "NAME", "unknown") item = Item( Id(devname), #, "active?", ip, "?", "?" devname, NetworkInterfaces.GetDevTypeDescription(type, false), cname ) # ISDN stuff elsif type == "net" # FIXME: richtext cname = Ops.get_string(v, "PROVIDER", "unknown") rip = Ops.get_string(v, "PTPADDR", "none") proto = Ops.get_string(v, "PROTOCOL", "unknown") item = Item(Id(devname), devname, proto, cname, ip, rip) else # if(!regexpmatch(type, NetworkAllRegex)) # y2error("Unknown type: %1", type); bullets = [ Builtins.sformat(_("Device Name: %1"), devname), startmode_descr ] if Ops.get_string(v, "STARTMODE", "") != "managed" if ip != "NONE" bullets = Ops.add( bullets, [ ip == "DHCP" ? _("IP address assigned using DHCP") : Builtins.sformat( _("IP address: %1, subnet mask %2"), ip, Ops.get_string(v, "NETMASK", "") ) ] ) end # build aliases overview if Ops.greater_than( Builtins.size(Ops.get_map(v, "_aliases", {})), 0 ) && !NetworkService.IsManaged Builtins.foreach(Ops.get_map(v, "_aliases", {})) do |key, desc| parameters = Builtins.sformat( _("IP address: %1, subnet mask %2"), Ops.get_string(desc, "IPADDR", ""), Ops.get_string(desc, "NETMASK", "") ) bullets = Builtins.add( bullets, Builtins.sformat("%1 (%2)", key, parameters) ) end end end # build the "Bond Slaves" entry of rich box if type == "bond" slaves = "" Builtins.foreach( Convert.convert(v, :from => "map", :to => "map <string, any>") ) do |key, value| if value != nil && Builtins.regexpmatch(key, "BONDING_SLAVE[0-9]") slaves = Ops.add( Ops.add(slaves, slaves != "" ? ", " : ""), Convert.to_string(value) ) end end if slaves != "" bullets = Ops.add( bullets, [Ops.add(_("Bond slaves") + " : ", slaves)] ) end end rich = descr rich = Ops.add( Ops.add(HTML.Bold(rich), getConnMacBusDescription(v, _Hardware)), HTML.List(bullets) ) hw_id = -1 found = false Builtins.foreach(_Hardware) do |device| hw_id = Ops.add(hw_id, 1) if Ops.get_string(v, "UNIQUE", "") == Ops.get_string(device, "unique_key", "") found = true raise Break end end item = Item(Id(devname), descr, ip, rich, found ? hw_id : -1) end overview = Builtins.add(overview, item) end end Builtins.y2debug("overview=%1", overview) deep_copy(overview) end |
- (configured, unconfigured) BuildSummary(devregex, _Hardware, split, link)
Build textual summary
204 205 206 207 208 209 |
# File '../../src/include/network/complex.rb', line 204 def BuildSummary(devregex, _Hardware, split, link) _Hardware = deep_copy(_Hardware) _Devs = NetworkInterfaces.FilterDevices(devregex) ret = BuildSummaryDevs(_Devs, _Hardware, split, link) deep_copy(ret) end |
- (configured, unconfigured) BuildSummaryDevs(_Devs, _Hardware, split, link)
Build textual summary
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 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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File '../../src/include/network/complex.rb', line 77 def BuildSummaryDevs(_Devs, _Hardware, split, link) _Devs = deep_copy(_Devs) _Hardware = deep_copy(_Hardware) Builtins.y2milestone("Devs=%1", NetworkInterfaces.ConcealSecrets(_Devs)) Builtins.y2milestone("Hardware=%1", _Hardware) Builtins.y2debug("split=%1", split) uniques = [] uniques_old = [] configured = [] unconfigured = [] links = [] # build a list of configured devices Builtins.maplist(_Devs) do |devtype, devsmap| Builtins.maplist( Convert.convert(devsmap, :from => "map", :to => "map <string, map>") ) do |devname, devmap| # main device summary descr = BuildDescription(devtype, devname, devmap, _Hardware) unq = Ops.get_string(devmap, "UNIQUE", "") status = DeviceStatus(devtype, devname, devmap) if link if devtype == "wlan" && Ops.get_string(devmap, "WIRELESS_AUTH_MODE", "") == "open" && Ops.get_string(devmap, "WIRELESS_KEY_0", "") == "" href = Ops.add("lan--wifi-encryption-", devname) # interface summary: WiFi without encryption warning = HTML.Colorize( _("Warning: no encryption is used."), "red" ) status = Ops.add( Ops.add(Ops.add(Ops.add(status, " "), warning), " "), # Hyperlink: Change the configuration of an interface Hyperlink(href, _("Change.")) ) links = Builtins.add(links, href) end end configured = Builtins.add(configured, Summary.Device(descr, status)) uniques = Builtins.add(uniques, devname) uniques_old = Builtins.add(uniques_old, unq) # aliases summary aliasee = Ops.get_map(devmap, "_aliases", {}) Builtins.maplist(aliasee) do |aid, amap| # Table item # this is what used to be Virtual Interface # (eth0:1) descr = _("Additional Address") status = DeviceStatus(devtype, devname, amap) configured = Builtins.add(configured, Summary.Device(descr, status)) end if aliasee != {} end end Builtins.y2debug("uniques(%1)", uniques) Builtins.y2debug("uniques_old(%1)", uniques_old) # build a list of unconfigured devices id = 0 Builtins.maplist(_Hardware) do |h| unq = Ops.get_string(h, "unique", "") busid = Ops.add( Ops.add(Ops.add("bus-", Ops.get_string(h, "bus", "")), "-"), Ops.get_string(h, "busid", "") ) mac = Ops.add("id-", Ops.get_string(h, "mac", "")) hwtype = Ops.get_string(h, "type", "") hwname = CheckEmptyName(hwtype, Ops.get_string(h, "name", "")) Builtins.y2debug("busid=%1, mac=%2", busid, mac) if !Builtins.contains(uniques, busid) && !Builtins.contains(uniques, mac) && !Builtins.contains(uniques_old, unq) if split && !Builtins.contains(uniques_old, unq) Ops.set(h, "id", id) unconfigured = Builtins.add(unconfigured, h) else configured = Builtins.add( configured, Summary.Device(hwname, Summary.NotConfigured) ) end end id = Ops.add(id, 1) end Builtins.y2debug("configured=%1", configured) Builtins.y2debug("unconfigured=%1", unconfigured) # create a summary text summary = Summary.DevicesList(configured) # if not split -> summary is finished return [summary, links] if !split # add headers if Ops.greater_than(Builtins.size(configured), 0) # Summary text summary = Ops.add( Summary.AddHeader("", _("Already Configured Devices:")), summary ) else # Summary text summary = Summary.AddHeader("", _("Nothing is configured")) end # create a table of unconfigured devices selected = Ops.get_integer(unconfigured, [0, "num"], -1) # list devs = hwlist2items(unconfigured, selected); # FIXME OtherDevices(devs, type); # Label for not detected devices # devs = add(devs, `item(`id(`other), _("Other (not detected)"), size(devs) == 0)); Builtins.y2debug("summary=%1", summary) # y2debug("devs=%1", devs); [summary, unconfigured] # return [ summary, devs ]; end |
- ($[id, table_descr, rich descr]) BuildUnconfigured(_class, _Hardware)
NetworkInterfaces (#103073)
744 745 746 747 748 749 750 751 752 753 |
# File '../../src/include/network/complex.rb', line 744 def BuildUnconfigured(_class, _Hardware) _Hardware = deep_copy(_Hardware) split = true proposal = false sum = BuildSummary(_class, _Hardware, split, proposal) BuildUnconfiguredCommon( Ops.get_list(sum, Ops.subtract(Builtins.size(sum), 1), []), _class ) end |
- ($[id, table_descr, rich descr]) BuildUnconfiguredCommon(sum, _class)
Convert the output of BuildSummary for inclusion in the unified device list. Called by BuildUnconfigured and BuildUnconfiguredDevs. determines how to arrange output, yuck
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 |
# File '../../src/include/network/complex.rb', line 674 def BuildUnconfiguredCommon(sum, _class) sum = deep_copy(sum) # unconfigured devices # list<term> res = sum[1]:[`item(`id(`other))]; # filter out the item for adding an unknown one # list res = filter (term card, sum, ``( card[0,0]:nil != `other )); # translators: this device has not been configured yet nc = _("Not configured") Builtins.maplist( Convert.convert(sum, :from => "list", :to => "list <map <string, any>>") ) do |card| # configured cards are identified by the string after ifcfg-, # unconfigured ones by "-%1" where %1 is the index in hardware list id = Builtins.sformat("-%1", Ops.get_integer(card, "id", 0)) name = Ops.get_string(card, "name", "") desc = [] case _class when "netcard" desc = [name, nc] when "dsl", "modem" desc = [ name, NetworkInterfaces.GetDevTypeDescription(_class, false), nc ] when "isdn" desc = [ nc, NetworkInterfaces.GetDevTypeDescription(_class, false), name ] else Builtins.y2warning(1, "invalid class %1", _class) end rich = Ops.add( Ops.add( HTML.Bold(name), getConnMacBusDescription( card, Convert.convert(sum, :from => "list", :to => "list <map>") ) ), _( "<p>The device is not configured. Press <b>Edit</b> for configuration.</p>" ) ) { "id" => id, "table_descr" => desc, "rich_descr" => rich } end end |
- ($[id, table_descr, rich descr]) BuildUnconfiguredDevs(_Devs, _class, _Hardware)
728 729 730 731 732 733 734 735 736 737 738 |
# File '../../src/include/network/complex.rb', line 728 def BuildUnconfiguredDevs(_Devs, _class, _Hardware) _Devs = deep_copy(_Devs) _Hardware = deep_copy(_Hardware) split = true proposal = false sum = BuildSummaryDevs(_Devs, _Hardware, split, proposal) BuildUnconfiguredCommon( Ops.get_list(sum, Ops.subtract(Builtins.size(sum), 1), []), _class ) end |
- (Object) CheckEmptyName(devtype, hwname)
210 211 212 213 214 215 216 217 218 219 220 221 222 223 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 |
# File '../../src/include/network/complex.rb', line 210 def CheckEmptyName(devtype, hwname) return hwname if hwname != nil && hwname != "" device_names = { # Device type label "contr-pcmcia" => _("PCMCIA ISDN Card"), # Device type label "contr-usb" => _("USB ISDN Card"), # Device type label "eth-pcmcia" => _("PCMCIA Ethernet Network Card"), # Device type label "eth-usb" => _("USB Ethernet Network Card"), # Device type label "fddi-pcmcia" => _("PCMCIA FDDI Network Card"), # Device type label "fddi-usb" => _("USB FDDI Network Card"), # Device type label "ippp-pcmcia" => _("PCMCIA ISDN Connection"), # Device type label "ippp-usb" => _("USB ISDN Connection"), # Device type label "isdn-pcmcia" => _("PCMCIA ISDN Connection"), # Device type label "isdn-usb" => _("USB ISDN Connection"), # Device type label "modem-pcmcia" => _("PCMCIA Modem"), # Device type label "modem-usb" => _("USB Modem"), # Device type label "ppp-pcmcia" => _("PCMCIA Modem"), # Device type label "ppp-usb" => _("USB Modem"), # Device type label "tr-pcmcia" => _( "PCMCIA Token Ring Network Card" ), # Device type label "tr-usb" => _("USB Token Ring Network Card"), # Device type label "usb-usb" => _("USB Network Device"), # Device type label "wlan-pcmcia" => _("PCMCIA Wireless Network Card"), # Device type label "wlan-usb" => _("USB Wireless Network Card") } if Builtins.haskey(device_names, devtype) return Ops.get_string(device_names, devtype, "") else descr = NetworkInterfaces.GetDevTypeDescription(devtype, true) return descr if IsNotEmpty(descr) end if Builtins.haskey(device_names, Ops.add(devtype, "-")) Builtins.y2warning("- device found: %1, %2", devtype, hwname) return Ops.get_string(device_names, Ops.add(devtype, "-"), "") end Builtins.y2error("Unknown type: %1", devtype) # Device type label _("Unknown Network Device") end |
- (Object) DeviceProtocol(devmap)
Return the device protocol or IP address in case of static config Or indicate that NetworkManager takes over.
424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File '../../src/include/network/complex.rb', line 424 def DeviceProtocol(devmap) devmap = deep_copy(devmap) if Ops.get_string(devmap, "STARTMODE", "") == "managed" # Abbreviation for "The interface is Managed by NetworkManager" return _("Managed") end ip = Ops.get_string(devmap, "BOOTPROTO", "static") if ip == nil || ip == "" || ip == "static" ip = Ops.get_string(devmap, "IPADDR", "") else ip = Builtins.toupper(ip) end ip end |
- (Object) DeviceStatus(devtype, devname, devmap)
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
# File '../../src/include/network/complex.rb', line 309 def DeviceStatus(devtype, devname, devmap) devmap = deep_copy(devmap) # Modem and DSL if devtype == "ppp" || devtype == "modem" || devtype == "dsl" nam = ProviderName(Ops.get_string(devmap, "PROVIDER", "")) if nam == "" || nam == nil # Modem status (%1 is device) return Builtins.sformat(_("Configured as %1"), devname) else # Modem status (%1 is device, %2 is provider) return Builtins.sformat( _("Configured as %1 with provider %2"), devname, nam ) end # ISDN card elsif devtype == "isdn" || devtype == "contr" # ISDN device status (%1 is device) return Builtins.sformat(_("Configured as %1"), devname) # ISDN stuff elsif devtype == "net" nam = ProviderName(Ops.get_string(devmap, "PROVIDER", "")) # Connection protocol (syncppp|rawip) proto = Ops.get_string(devmap, "PROTOCOL", "") # ISDN status (%1 is device, %2 is provider, %3 protocol) return Builtins.sformat( _("Configured as %1 with provider %2 (protocol %3)"), devname, nam, proto ) # example: ISDN Connection to Arcor with syncppp on net0 # return sformat(_("to %1 with %2 on %3"), provider, proto, dev); else # if(!regexpmatch(devtype, NetworkAllRegex)) # y2error("Unknown type: %1", devtype); proto = Ops.get_string(devmap, "BOOTPROTO", "static") if proto == "" || proto == "static" || proto == "none" || proto == nil addr = Ops.get_string(devmap, "IPADDR", "") host = NetHwDetection.ResolveIP(addr) remip = Ops.get_string(devmap, "REMOTE_IPADDR", "") if proto == "none" return _("Configured without address (NONE)") elsif IsEmpty(addr) # Network card status return HTML.Colorize(_("Configured without an address"), "red") elsif remip == "" || remip == nil # Network card status (%1 is address) return Builtins.sformat( _("Configured with address %1"), Ops.add(addr, String.OptParens(host)) ) else # Network card status (%1 is address, %2 is address) return Builtins.sformat( _("Configured with address %1 (remote %2)"), addr, remip ) end else # Network card status (%1 is protocol) return Builtins.sformat( _("Configured with %1"), Builtins.toupper(proto) ) end # This is the old version of the above code, including the # configuration name. But the name is long and cryptic so wen # don't use it. # FIXME: dropped interface name if proto == "" || proto == "static" || proto == "none" || proto == nil addr = Ops.get_string(devmap, "IPADDR", "") remip = Ops.get_string(devmap, "REMOTE_IPADDR", "") if addr == "" || addr == nil # Network card status (%1 is device) return Builtins.sformat(_("Configured as %1"), devname) elsif remip == "" || remip == nil # Network card status (%1 is device, %2 is address) return Builtins.sformat( _("Configured as %1 with address %2"), devname, addr ) else # Network card status (%1 is device, %2 is address, %3 is address) return Builtins.sformat( _("Configured as %1 with address %2 (remote %3)"), devname, addr, remip ) end else # Network card status (%1 is device, %2 is protocol) return Builtins.sformat( _("Configured as %1 with %2"), devname, Builtins.toupper(proto) ) end end end |
- (Object) getConnMacBusDescription(v, _Hardware)
Return description used for device summary dialog In case device is not connected "(not connected)" string will be added. Description also contains MAC address or BusID information.
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File '../../src/include/network/complex.rb', line 444 def getConnMacBusDescription(v, _Hardware) v = deep_copy(v) _Hardware = deep_copy(_Hardware) descr = "" conn = "" mac_dev = "" Builtins.foreach(_Hardware) do |device| if Ops.get_string(v, "UNIQUE", "") == Ops.get_string(device, "unique_key", "") conn = HTML.Bold( Ops.get_boolean(device, "link", false) == true ? "" : _("(not connected)") ) if Ops.greater_than( Builtins.size(Ops.get_string(device, "mac", "")), 0 ) mac_dev = Ops.add( Ops.add(HTML.Bold("MAC : "), Ops.get_string(device, "mac", "")), "<br>" ) elsif Ops.greater_than( Builtins.size(Ops.get_string(device, "busid", "")), 0 ) mac_dev = Ops.add( Ops.add( HTML.Bold("BusID : "), Ops.get_string(device, "busid", "") ), "<br>" ) end end end descr = Ops.add(Ops.add(Ops.add(" ", conn), "<br>"), mac_dev) descr end |
- (Object) HardwareName(_Hardware, id)
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File '../../src/include/network/complex.rb', line 272 def HardwareName(_Hardware, id) _Hardware = deep_copy(_Hardware) hwname = "" Builtins.foreach(_Hardware) do |h| have = [ Ops.add("id-", Ops.get_string(h, "mac", "")), Ops.add( Ops.add("bus-", Ops.get_string(h, "bus", "")), String.OptFormat("-%1", Ops.get_string(h, "busid", "")) ), Ops.get_string(h, "udi", ""), Ops.get_string(h, "dev_name", "") ] Builtins.y2debug("what: %1, have: %2", id, have) if Builtins.contains(have, id) hwname = Ops.get_string(h, "name", "") raise Break end end if id != "" Builtins.y2milestone("hwname=%1", hwname) hwname end |
- (Object) Hyperlink(href, text)
TODO move to HTML.ycp
69 70 71 |
# File '../../src/include/network/complex.rb', line 69 def Hyperlink(href, text) Builtins.sformat("<a href=\"%1\">%2</a>", href, text) end |
- (Object) initialize_network_complex(include_target)
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File '../../src/include/network/complex.rb', line 32 def initialize_network_complex(include_target) Yast.import "UI" textdomain "network" Yast.import "NetHwDetection" Yast.import "HTML" Yast.import "NetworkInterfaces" Yast.import "Popup" Yast.import "String" Yast.import "Summary" Yast.import "NetworkService" Yast.include include_target, "network/routines.rb" Yast.include include_target, "network/summary.rb" end |
- (Object) ProviderName(provider)
Get aprovider name from the provider map
299 300 301 302 303 304 305 306 307 308 |
# File '../../src/include/network/complex.rb', line 299 def ProviderName(provider) Yast.import "Provider" return "" if provider == nil || provider == "" Provider.Select(provider) nam = Ops.get_string(Provider.Current, "PROVIDER", provider) return provider if nam == nil || nam == "" nam end |