• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yast / yast-users / 5453098972

pending completion
5453098972

Pull #383

github

web-flow
Merge 54d62cefa into f91b954c3
Pull Request #383: User creation page got messed when going back after importing user(s) from existing installation

16 of 16 new or added lines in 1 file covered. (100.0%)

3319 of 5513 relevant lines covered (60.2%)

35.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

46.15
/src/lib/users/dialogs/users_to_import.rb
1
# Copyright (c) 2016 SUSE LLC.
2
#  All Rights Reserved.
3

4
#  This program is free software; you can redistribute it and/or
5
#  modify it under the terms of version 2 or 3 of the GNU General
6
#  Public License as published by the Free Software Foundation.
7

8
#  This program is distributed in the hope that it will be useful,
9
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
10
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
11
#  GNU General Public License for more details.
12

13
#  You should have received a copy of the GNU General Public License
14
#  along with this program; if not, contact SUSE LLC.
15

16
#  To contact SUSE about this file by physical or electronic mail,
17
#  you may find current contact information at www.suse.com
18

19
require "yast"
1✔
20
require "ui/dialog"
1✔
21

22
module Yast
1✔
23
  # This dialog offers a way to select which users should be imported from a previously installed
24
  # system
25
  class UsersToImportDialog < ::UI::Dialog
1✔
26
    def initialize(all, initial)
1✔
27
      super()
×
28

29
      Yast.import "UI"
×
30
      Yast.import "Label"
×
31

32
      textdomain "users"
×
33

34
      @all = all
×
35
      @initial = initial
×
36
    end
37

38
    # Event callback for 'select or deselect all'
39
    def all_handler
1✔
40
      sel = UI.QueryWidget(Id(:all), :Value) ? @all : []
×
41
      UI.ChangeWidget(Id(:userlist), :SelectedItems, sel)
×
42
    end
43

44
    # Event callback for the 'ok' button
45
    def ok_handler
1✔
46
      selected = UI.QueryWidget(Id(:userlist), :SelectedItems)
×
47
      finish_dialog(selected)
×
48
    end
49

50
  private
1✔
51

52
    def dialog_content
1✔
53
      HBox(
×
54
        VSpacing([@all.size, 15].max),
55
        VBox(
56
          HSpacing(50),
57
          MultiSelectionBox(
58
            Id(:userlist),
59
            # selection box label
60
            _("&Select Users to Read"),
61
            initial_items
62
          ),
63
          Left(
64
            CheckBox(
65
              Id(:all),
66
              Opt(:notify),
67
              # check box label
68
              _("Select or Deselect &All"),
69
              initially_all_checked?
70
            )
71
          ),
72
          HBox(
73
            PushButton(Id(:ok), Opt(:default), Label.OKButton),
74
            PushButton(Id(:cancel), Label.CancelButton)
75
          )
76
        )
77
      )
78
    end
79

80
    def dialog_options
1✔
81
      Opt(:decorated)
×
82
    end
83

84
    def initial_items
1✔
85
      @all.map { |u| Item(Id(u), u, @initial.include?(u)) }
×
86
    end
87

88
    def initially_all_checked?
1✔
89
      @all.size == @initial.size
×
90
    end
91
  end
92
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc