Module: Yast::NfsUiInclude

Defined in:
../../src/include/nfs/ui.rb

Overview

NFS client dialogs

Instance Method Summary (collapse)

Instance Method Details

- (Object) ChooseExport(exports)

Give me one name from the list of exports

Parameters:

  • exports (Array<String>)

    a list of exports

Returns:

  • an export



172
173
174
175
176
177
178
179
# File '../../src/include/nfs/ui.rb', line 172

def ChooseExport(exports)
  exports = deep_copy(exports)
  Wizard.SetScreenShotName("nfs-client-1ab-exports")
  # selection box label
  ret = ChooseItem(_("&Exported Directories"), exports)
  Wizard.RestoreScreenShotName
  ret
end

- (Object) ChooseHostName(hosts)

Give me one name from the list of hosts

Parameters:

  • hosts (Array<String>)

    a list of hostnames

Returns:

  • a hostname



158
159
160
161
162
163
164
165
166
167
# File '../../src/include/nfs/ui.rb', line 158

def ChooseHostName(hosts)
  hosts = deep_copy(hosts)
  Wizard.SetScreenShotName("nfs-client-1aa-hosts")
  # selection box label
  # changed from "Remote hosts" because now it shows
  # NFS servers only
  ret = ChooseItem(_("&NFS Servers"), hosts)
  Wizard.RestoreScreenShotName
  ret
end

- (Object) ChooseItem(title, items)

Let the user choose one of a list of items

Parameters:

  • title (String)

    selectionbox title

  • items (Array<String>)

    a list of items

Returns:

  • one item or nil



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
# File '../../src/include/nfs/ui.rb', line 88

def ChooseItem(title, items)
  items = deep_copy(items)
  item = nil
  ret = nil

  UI.OpenDialog(
    VBox(
      HSpacing(40),
      HBox(SelectionBox(Id(:items), title, items), VSpacing(10)),
      ButtonBox(
        PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton),
        PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton)
      )
    )
  )
  UI.SetFocus(Id(:items))
  loop do
    ret = UI.UserInput
    break if ret == :ok || ret == :cancel
  end

  if ret == :ok
    item = Convert.to_string(UI.QueryWidget(Id(:items), :CurrentItem))
  end
  UI.CloseDialog

  item
end

- (Object) EnableDisableButtons



467
468
469
470
471
472
# File '../../src/include/nfs/ui.rb', line 467

def EnableDisableButtons
  UI.ChangeWidget(Id(:editbut), :Enabled, @nfs_entries != [])
  UI.ChangeWidget(Id(:delbut), :Enabled, @nfs_entries != [])

  nil
end

- (Object) FstabDialog

NFS client dialog itselfs

Returns:

  • back,abort or `next



672
673
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
# File '../../src/include/nfs/ui.rb', line 672

def FstabDialog
  ret = nil
  event = nil
  Wizard.SetScreenShotName("nfs-client-1-fstab")

  @nfs_entries = deep_copy(Nfs.nfs_entries)

  # dialog heading
  Wizard.SetContents(
    _("NFS Client Configuration"),
    MainDialogLayout(),
    @help_text1,
    false,
    true
  )

  InitFstabEntries()

  # Kludge, because a `Table still does not have a shortcut.
  # Simple to solve here: there's only the table and buttons,
  # so it is OK to always set focus to the table
  UI.SetFocus(Id(:fstable))

  loop do
    event = UI.WaitForEvent
    ret = Ops.get(event, "ID")
    if ret == :ok
      ret = :next
    elsif ret == :cancel
      ret = :abort
    elsif ret == :abort && Nfs.GetModified && !Popup.ReallyAbort(true)
      ret = :again
    else
      HandleEvent(ret)
    end
    break if [:back, :next, :abort].include? ret
  end

  if ret == :next
    # grab current settings, store them to SuSEFirewall::
    SaveFstabEntries() if UI.WidgetExists(Id(:fstable))
    SaveSettings(event) if UI.WidgetExists(Id(:enable_nfs4))
  end

  Wizard.RestoreScreenShotName
  Convert.to_symbol(ret)
end

- (Object) FstabTab



474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# File '../../src/include/nfs/ui.rb', line 474

def FstabTab
  fstab_content = VBox(
    Table(
      Id(:fstable),
      Opt(:notify, :immediate),
      Header(
        # table header
        _("Server") + "  ",
        _("Remote Directory") + "  ",
        # table header
        _("Mount Point") + "  ",
        # table header
        _("NFS Type"),
        # table header
        _("Options") + "  "
      ),
      FstabTableItems(@nfs_entries)
    ),
    HBox(
      PushButton(Id(:newbut), Opt(:key_F3), Label.AddButton),
      PushButton(Id(:editbut), Opt(:key_F4), Label.EditButton),
      PushButton(Id(:delbut), Opt(:key_F5), Label.DeleteButton),
      # #211570
      HStretch()
    )
  )

  deep_copy(fstab_content)
end

- (Object) GetFstabEntry(fstab_ent, existing)

Ask user for an entry.

Parameters:

  • fstab_ent (Hash{String => Object})

    $[“spec”: “file”: “mntops”:] or nil

  • existing (Array<Hash>)

    list of fstab entries for duplicate mount-point checking

Returns:

  • a nfs_entry or nil



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
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
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
# File '../../src/include/nfs/ui.rb', line 195

def GetFstabEntry(fstab_ent, existing)
  fstab_ent = deep_copy(fstab_ent)
  existing = deep_copy(existing)
  Wizard.SetScreenShotName("nfs-client-1a-edit")

  server = ""
  pth = ""
  mount = ""
  nfs4 = false
  nfs41 = false
  options = "defaults"
  servers = []
  old = ""
  ret = nil

  if fstab_ent
    couple = SpecToServPath(Ops.get_string(fstab_ent, "spec", ""))
    server = Ops.get_string(couple, 0, "")
    pth = Ops.get_string(couple, 1, "")
    mount = Ops.get_string(fstab_ent, "file", "")
    nfs4 = Ops.get_string(fstab_ent, "vfstype", "") == "nfs4"
    options = Ops.get_string(fstab_ent, "mntops", "")
    nfs41 = nfs4 && NfsOptions.get_nfs41(options)
    servers = [server]
    old = Ops.get_string(fstab_ent, "spec", "")
  else
    proposed_server = ProposeHostname()
    servers = [proposed_server] if HostnameExists(proposed_server)
  end

  # append already defined servers - bug #547983
  Builtins.foreach(@nfs_entries) do |nfs_entry|
    couple = SpecToServPath(Ops.get_string(nfs_entry, "spec", ""))
    known_server = Ops.get_string(couple, 0, "")
    if !Builtins.contains(servers, known_server)
      servers = Builtins.add(servers, known_server)
    end
  end

  servers = Builtins.sort(servers)
  #

  UI.OpenDialog(
    Opt(:decorated),
    HBox(
      HSpacing(1),
      VBox(
        VSpacing(0.2),
        HBox(
          TextAndButton(
            ComboBox(
              Id(:serverent),
              Opt(:editable),
              # text entry label
              _("&NFS Server Hostname"),
              servers
            ),
            # pushbutton label
            # choose a host from a list
            # appears in help text too
            PushButton(Id(:choose), _("Choo&se"))
          ),
          HSpacing(0.5),
          TextAndButton(
            InputField(
              Id(:pathent),
              Opt(:hstretch),
              # textentry label
              _("&Remote Directory"),
              pth
            ),
            # pushbutton label,
            # select from a list of remote filesystems
            # make it short
            # appears in help text too
            PushButton(Id(:pathent_list), _("&Select"))
          )
        ),
        Left(
          HBox(
            CheckBox(Id(:nfs4), _("NFS&v4 Share"), nfs4),
            HSpacing(2),
            # parallel NFS, protocol version 4.1
            CheckBox(Id(:nfs41), _("pNFS (v4.1)"), nfs41)
          )
        ),
        Left(
          TextAndButton(
            InputField(
              Id(:mountent),
              Opt(:hstretch),
              # textentry label
              _("&Mount Point (local)"),
              mount
            ),
            # button label
            # browse directories to select a mount point
            # appears in help text too
            PushButton(Id(:browse), _("&Browse"))
          )
        ),
        # textentry label
        VSpacing(0.2),
        InputField(Id(:optionsent), Opt(:hstretch), _("O&ptions"), options),
        VSpacing(0.2),
        ButtonBox(
          PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton),
          PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton),
          PushButton(Id(:help), Opt(:key_F1), Label.HelpButton)
        ),
        VSpacing(0.2)
      ),
      HSpacing(1)
    )
  )
  UI.ChangeWidget(Id(:serverent), :Value, server)
  UI.SetFocus(Id(:serverent))

  loop do
    ret = UI.UserInput

    if ret == :choose
      if @hosts.nil?
        # label message
        UI.OpenDialog(Label(_("Scanning for hosts on this LAN...")))
        @hosts = Nfs.ProbeServers
        UI.CloseDialog
      end
      if @hosts == [] || @hosts.nil?
        # Translators: 1st part of error message
        error_msg = _("No NFS server has been found on your network.")

        if SuSEFirewall.GetStartService
          # Translators: 2nd part of error message (1st one is 'No nfs servers have been found ...)
          error_msg = Ops.add(
            error_msg,
            _(
              "\n" \
                "This could be caused by a running SuSEfirewall2,\n" \
                "which probably blocks the network scanning."
            )
          )
        end
        Report.Error(error_msg)
      else
        host = ChooseHostName(@hosts)
        UI.ChangeWidget(Id(:serverent), :Value, host) if host
      end
    elsif ret == :pathent_list
      server2 = Convert.to_string(UI.QueryWidget(Id(:serverent), :Value))
      v4 = Convert.to_boolean(UI.QueryWidget(Id(:nfs4), :Value))

      if !CheckHostName(server2)
        UI.SetFocus(Id(:serverent))
        next
      end

      UI.OpenDialog(
        Label(
          # Popup dialog, %1 is a host name
          Builtins.sformat(
            _("Getting directory list for \"%1\"..."),
            server2
          )
        )
      )
      dirs = Nfs.ProbeExports(server2, v4)
      UI.CloseDialog

      dir = ChooseExport(dirs)
      UI.ChangeWidget(Id(:pathent), :Value, dir) if dir
    elsif ret == :browse
      dir = Convert.to_string(UI.QueryWidget(Id(:mountent), :Value))
      dir = "/" if dir.nil? || Builtins.size(dir) == 0

      # heading for a directory selection dialog
      dir = UI.AskForExistingDirectory(dir, _("Select the Mount Point"))

      if dir && Ops.greater_than(Builtins.size(dir), 0)
        UI.ChangeWidget(Id(:mountent), :Value, dir)
      end
    elsif ret == :ok
      server = FormatHostnameForFstab(
        Convert.to_string(UI.QueryWidget(Id(:serverent), :Value))
      )
      pth = StripExtraSlash(
        Convert.to_string(UI.QueryWidget(Id(:pathent), :Value))
      )
      mount = StripExtraSlash(
        Convert.to_string(UI.QueryWidget(Id(:mountent), :Value))
      )
      nfs4 = Convert.to_boolean(UI.QueryWidget(Id(:nfs4), :Value))
      nfs41 = Convert.to_boolean(UI.QueryWidget(Id(:nfs41), :Value))
      options = Builtins.deletechars(
        Convert.to_string(UI.QueryWidget(Id(:optionsent), :Value)),
        " "
      )
      options = NfsOptions.set_nfs41(options, nfs41)

      ret = nil
      options_error = NfsOptions.validate(options)
      if !CheckHostName(server)
        UI.SetFocus(Id(:serverent))
      elsif !CheckPath(pth)
        UI.SetFocus(Id(:pathent))
      elsif !CheckPath(mount) || IsMpInFstab(existing, mount)
        UI.SetFocus(Id(:mountent))
      elsif Ops.greater_than(Builtins.size(options_error), 0)
        Popup.Error(options_error)
        UI.SetFocus(Id(:optionsent))
      else
        fstab_ent = {
          "spec"    => Ops.add(Ops.add(server, ":"), pth),
          "file"    => mount,
          "vfstype" => nfs4 ? "nfs4" : "nfs",
          "mntops"  => options
        }
        if old != Ops.add(Ops.add(server, ":"), pth)
          fstab_ent = Builtins.add(fstab_ent, "old", old)
        end
        ret = :ok
      end
    elsif ret == :help
      # help text 1/4
      # change: locally defined -> servers on LAN
      helptext = _(
        "<p>Enter the <b>NFS Server Hostname</b>.  With\n" \
          "<b>Choose</b>, browse through a list of\n" \
          "NFS servers on the local network.</p>\n"
      )
      # help text 2/4
      # added "Select" button
      helptext = Ops.add(
        helptext,
        _(
          "<p>In <b>Remote File System</b>,\n" \
            "enter the path to the directory on the NFS server.  Use\n" \
            "<b>Select</b> to select one from those exported by the server.\n" \
            "</p>"
        )
      )
      # help text 3/4
      helptext = Ops.add(
        helptext,
        _(
          "<p>\t\t\n" \
            "For <b>Mount Point</b>, enter the path in the local " \
            "file system where the directory should be mounted. With\n" \
            "<b>Browse</b>, select your mount point\n" \
            "interactively.</p>"
        )
      )
      # help text 4/4
      helptext = Ops.add(
        helptext,
        _(
          "<p>For a list of <b>Options</b>,\nread the man page mount(8).</p>"
        )
      )
      # popup heading
      Popup.LongText(_("Help"), RichText(helptext), 50, 18)
    end
    break if ret == :ok || ret == :cancel
  end

  UI.CloseDialog
  Wizard.RestoreScreenShotName

  return deep_copy(fstab_ent) if ret == :ok
  nil
end

- (Object) HandleEvent(widget)



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
659
660
661
662
663
664
665
666
667
668
# File '../../src/include/nfs/ui.rb', line 576

def HandleEvent(widget)
  widget = deep_copy(widget)
  entryno = -1
  # handle the events, enable/disable the button, show the popup if button clicked
  if UI.WidgetExists(Id("_cwm_firewall_details")) &&
      UI.WidgetExists(Id("_cwm_open_firewall"))
    CWMFirewallInterfaces.OpenFirewallHandle(
      @fw_cwm_widget,
      "",
      "ID" => widget
    )
  end
  if UI.WidgetExists(Id(:fstable))
    entryno = Convert.to_integer(UI.QueryWidget(Id(:fstable), :CurrentItem))
  end

  if widget == :newbut
    entry = GetFstabEntry(
      nil,
      Convert.convert(
        Builtins.union(Nfs.non_nfs_entries, @nfs_entries),
        :from => "list",
        :to   => "list <map>"
      )
    )

    if entry
      @nfs_entries = Builtins.add(@nfs_entries, entry)
      @modify_line = deep_copy(entry)
      EnableDisableButtons()

      Nfs.SetModified
    end

    UI.ChangeWidget(Id(:fstable), :Items, FstabTableItems(@nfs_entries))
  elsif widget == :editbut
    entry = GetFstabEntry(
      Ops.get(@nfs_entries, entryno, {}),
      Convert.convert(
        Builtins.union(
          Nfs.non_nfs_entries,
          Builtins.remove(@nfs_entries, entryno)
        ),
        :from => "list",
        :to   => "list <map>"
      ) # Default values
    )
    if entry
      count2 = 0
      @nfs_entries = Builtins.maplist(@nfs_entries) do |ent|
        count2 = Ops.add(count2, 1)
        next deep_copy(ent) if Ops.subtract(count2, 1) != entryno
        deep_copy(entry)
      end

      @modify_line = deep_copy(entry)
      UI.ChangeWidget(Id(:fstable), :Items, FstabTableItems(@nfs_entries))
      Nfs.SetModified
    end
  elsif widget == :delbut &&
      Ops.greater_than(Builtins.size(@nfs_entries), 0)
    share = Ops.get(@nfs_entries, entryno, {})
    if Popup.YesNo(
      Builtins.sformat(
        _("Really delete %1?"),
        Ops.get_string(share, "spec", "")
      )
      )
      @modify_line = deep_copy(share)
      @nfs_entries = Builtins.remove(@nfs_entries, entryno)
      UI.ChangeWidget(Id(:fstable), :Items, FstabTableItems(@nfs_entries))
      EnableDisableButtons()

      Nfs.SetModified
    end
  elsif widget == :enable_nfs4
    enabled = Convert.to_boolean(UI.QueryWidget(Id(:enable_nfs4), :Value))
    UI.ChangeWidget(Id(:nfs4_domain), :Enabled, enabled)
    Nfs.SetModified
  elsif widget == :settings
    SaveFstabEntries()
    UI.ReplaceWidget(Id(:rp), SettingsTab())
    InitSettings()
    Wizard.SetHelpText(@help_text2)
  elsif widget == :overview
    SaveSettings("ID" => widget)
    UI.ReplaceWidget(Id(:rp), FstabTab())
    InitFstabEntries()
    Wizard.SetHelpText(@help_text1)
  end

  nil
end

- (Object) HostnameExists(hname)

Find out whether this nfs host really exists

Parameters:

  • hname (String)

    hostname

Returns:

  • true if it exists, false otherwise



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File '../../src/include/nfs/ui.rb', line 120

def HostnameExists(hname)
  prog_name = "/usr/bin/host"
  ret = false

  if FileUtils.Exists(prog_name)
    out = Convert.to_map(
      SCR.Execute(
        path(".target.bash_output"),
        Builtins.sformat("%1 %2", prog_name, hname)
      )
    )

    ret = Ops.get_integer(out, "exit", -1) == 0
    Builtins.y2debug("DNS lookup of %1 returned %2", hname, ret)
  else
    Builtins.y2warning(
      "Cannot DNS lookup %1, will not propose default hostname",
      hname
    )
  end

  ret
end

- (Object) InitFstabEntries



537
538
539
540
541
542
# File '../../src/include/nfs/ui.rb', line 537

def InitFstabEntries
  UI.ChangeWidget(Id(:fstable), :Items, FstabTableItems(@nfs_entries))
  EnableDisableButtons()

  nil
end

- (Object) initialize_nfs_ui(include_target)



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
# File '../../src/include/nfs/ui.rb', line 7

def initialize_nfs_ui(include_target)
  Yast.import "UI"
  textdomain "nfs"

  Yast.import "CWMFirewallInterfaces"
  Yast.import "Hostname"
  Yast.import "FileUtils"
  Yast.import "Label"
  Yast.import "Nfs"
  Yast.import "NfsOptions"
  Yast.import "Popup"
  Yast.import "SuSEFirewall"
  Yast.import "Wizard"
  Yast.include include_target, "nfs/routines.rb"

  # Caches names of nfs servers for GetFstabEntry

  @hosts = nil

  # List of already defined nfs mount points
  @nfs_entries = deep_copy(Nfs.nfs_entries)

  # firewall widget using CWM
  @fw_settings = {
    "services"        => ["service:nfs-client"],
    "display_details" => true
  }
  @fw_cwm_widget = CWMFirewallInterfaces.CreateOpenFirewallWidget(
    @fw_settings
  )

  @modify_line = {}

  # Help, part 1 of 3
  @help_text1 = _(
    "<p>The table contains all directories \n" \
      "exported from remote servers and mounted locally via NFS (NFS shares).</p>"
  ) +
    # Help, part 2 of 3
    _(
      "<p>Each NFS share is identified by remote NFS server address and\n" \
        "exported directory, local directory where the remote directory is mounted, \n" \
        "NFS type (either plain nfs or nfsv4) and mount options. For further information \n" \
        "about mounting NFS and mount options, refer to <tt>man nfs.</tt></p>"
    ) +
    # Help, part 3 of 3
    _(
      "<p>To mount a new NFS share, click <B>Add</B>. To change the configuration of\n" \
        "a currently mounted share, click <B>Edit</B>. Remove and unmount a selected\n" \
        "share with <B>Delete</B>.</p>\n"
    )

  @help_text2 = Ops.add(
    _(
      "<p>If you need to access NFSv4 shares (NFSv4 is a newer version of the NFS\n" \
        "protocol), check the <b>Enable NFSv4</b> option. In that case, you might need\n" \
        "to supply specific a <b>NFSv4 Domain Name</b> required for the correct setting\n" \
        "of file/directory access rights.</p>\n"
    ),
    Ops.get_string(@fw_cwm_widget, "help", "")
  )
end

- (Object) InitSettings



544
545
546
547
548
549
550
551
552
# File '../../src/include/nfs/ui.rb', line 544

def InitSettings
  CWMFirewallInterfaces.OpenFirewallInit(@fw_cwm_widget, "")
  UI.ChangeWidget(Id(:enable_nfs4), :Value, Nfs.nfs4_enabled != false)
  UI.ChangeWidget(Id(:nfs4_domain), :Enabled, Nfs.nfs4_enabled != false)
  UI.ChangeWidget(Id(:nfs4_domain), :Value, Nfs.idmapd_domain)
  UI.ChangeWidget(Id(:enable_nfs_gss), :Value, Nfs.nfs_gss_enabled != false)

  nil
end

- (Object) MainDialogLayout



523
524
525
526
527
528
529
530
531
532
533
534
535
# File '../../src/include/nfs/ui.rb', line 523

def MainDialogLayout
  contents = VBox(
    DumbTab(
      [
        Item(Id(:overview), _("&NFS Shares")),
        Item(Id(:settings), _("NFS &Settings"))
      ],
      ReplacePoint(Id(:rp), FstabTab())
    )
  )

  deep_copy(contents)
end

- (Object) ProposeHostname

Return convenient hostname (FaTE #302863) to be proposed i.e. nfs + current domain (nfs. + suse.cz)

Returns:

  • string proposed hostname



147
148
149
150
151
152
153
# File '../../src/include/nfs/ui.rb', line 147

def ProposeHostname
  ret = ""
  cur_domain = Hostname.CurrentDomain

  ret = "nfs.#{cur_domain}" if cur_domain && cur_domain != ""
  ret
end

- (Object) ReadDialog

Read settings dialog

Returns:

  • abort if aborted andnext otherwise



72
73
74
75
# File '../../src/include/nfs/ui.rb', line 72

def ReadDialog
  ret = Nfs.Read
  ret ? :next : :abort
end

- (Object) SaveFstabEntries



554
555
556
557
558
# File '../../src/include/nfs/ui.rb', line 554

def SaveFstabEntries
  Nfs.nfs_entries = deep_copy(@nfs_entries)

  nil
end

- (Object) SaveSettings(event)



560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# File '../../src/include/nfs/ui.rb', line 560

def SaveSettings(event)
  event = deep_copy(event)
  CWMFirewallInterfaces.OpenFirewallStore(@fw_cwm_widget, "", event)
  Nfs.nfs4_enabled = Convert.to_boolean(
    UI.QueryWidget(Id(:enable_nfs4), :Value)
  )
  Nfs.nfs_gss_enabled = Convert.to_boolean(
    UI.QueryWidget(Id(:enable_nfs_gss), :Value)
  )
  Nfs.idmapd_domain = Convert.to_string(
    UI.QueryWidget(Id(:nfs4_domain), :Value)
  )

  nil
end

- (Object) SettingsTab



504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File '../../src/include/nfs/ui.rb', line 504

def SettingsTab
  settings_content = VBox(
    HBox(
      Left(CheckBox(Id(:enable_nfs4), Opt(:notify), _("Enable NFSv4"))),
      Left(InputField(Id(:nfs4_domain), _("NFSv4 Domain Name"))),
      HStretch()
    ),
    VSpacing(1),
    Left(
      CheckBox(Id(:enable_nfs_gss), Opt(:notify), _("Enable &GSS Security"))
    ),
    VSpacing(1),
    Ops.get_term(@fw_cwm_widget, "custom_widget", Empty()),
    VStretch()
  )

  deep_copy(settings_content)
end

- (Object) TextAndButton(text, button)

Nicely put a TextEntry and its helperPushButton together

Parameters:

  • text (Yast::Term)

    textentry widget

  • button (Yast::Term)

    pushbutton widget

Returns:

  • a HBox



185
186
187
188
189
# File '../../src/include/nfs/ui.rb', line 185

def TextAndButton(text, button)
  text = deep_copy(text)
  button = deep_copy(button)
  HBox(Bottom(text), HSpacing(0.5), Bottom(button))
end

- (Object) WriteDialog

Write settings dialog

Returns:

  • abort if aborted andnext otherwise



79
80
81
82
# File '../../src/include/nfs/ui.rb', line 79

def WriteDialog
  ret = Nfs.Write
  ret ? :next : :abort
end