-
Notifications
You must be signed in to change notification settings - Fork 15
/
pool.rb
84 lines (73 loc) · 1.93 KB
/
pool.rb
1
2
3
4
5
6
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
require "yast"
require "cwm/dialog"
require "y2ntp_client/widgets/pool_widgets"
Yast.import "Label"
Yast.import "NtpClient"
Yast.import "Stage"
module Y2NtpClient
module Dialog
# Dialog to add/edit ntp pool server
class Pool < CWM::Dialog
# @param address [String] initial address for pool to show
# @param options [Hash] pool options in format where
# key is option and value is string for key value options
# or nil for keyword options
def initialize(address = "", options = {})
super()
textdomain "ntp-client"
@address = address
@options = options
end
def title
# dialog caption
_("Pool Configuration")
end
def contents
@address_widget = Widgets::PoolAddress.new(@address)
VBox(
HBox(
@address_widget,
HSpacing(),
VBox(
VSpacing(1),
Widgets::SelectFrom.new(@address_widget)
),
HSpacing(),
VBox(
VSpacing(1),
Widgets::TestButton.new(@address_widget)
)
),
VSpacing(),
HBox(
HSpacing(),
Widgets::Iburst.new(@options),
HSpacing(),
Widgets::Offline.new(@options)
)
)
end
def next_button
Yast::Label.OKButton
end
def back_button
Yast::Label.CancelButton
end
def abort_button
# does not show abort, onlyce cancel/ok
""
end
# Returns value set in dialog.
# @return [Array<String, Hash>] returns pair, where first one is address and second
# is modified options ( see #initialize options parameter ).
def resulting_pool
[@address_widget.address, @options]
end
private
# always open new wizard dialog
def should_open_dialog?
true
end
end
end
end