-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed sync issue and bring bach 'Select from'
- Loading branch information
Showing
12 changed files
with
468 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
require "yast" | ||
|
||
require "cwm/popup" | ||
|
||
Yast.import "Label" | ||
Yast.import "NtpClient" | ||
Yast.import "Stage" | ||
Yast.import "Popup" | ||
|
||
# Work around YARD inability to link across repos/gems: | ||
|
||
# @!macro [new] seeAbstractWidget | ||
# @see http://www.rubydoc.info/github/yast/yast-yast2/CWM/AbstractWidget:${0} | ||
# @!macro [new] seeCustomWidget | ||
# @see http://www.rubydoc.info/github/yast/yast-yast2/CWM/CustomWidget:${0} | ||
# @!macro [new] seeItemsSelection | ||
# @see http://www.rubydoc.info/github/yast/yast-yast2/CWM/ItemsSelection:${0} | ||
# @!macro [new] seeDialog | ||
# @see http://www.rubydoc.info/github/yast/yast-yast2/CWM/Dialog:${0} | ||
# @!macro [new] seePopup | ||
# @see http://www.rubydoc.info/github/yast/yast-yast2/CWM/Popup:${0} | ||
|
||
module Y2NtpClient | ||
module Dialog | ||
# Dialog to add/edit ntp pool server | ||
class AddPool < ::CWM::Popup | ||
# Constructor | ||
# | ||
# @param address_widget [CWM::InputField] | ||
# @param pool_type [Symbol] | ||
def initialize(address_widget, pool_type) | ||
textdomain "ntp-client" | ||
@address_widget = address_widget | ||
@address = @address_widget.value | ||
@pool_chooser = pool_for(pool_type) | ||
end | ||
|
||
# @macro seeDialog | ||
def title | ||
_("Local ntp servers discovered") | ||
end | ||
|
||
# @macro seeDialog | ||
def contents | ||
VBox( | ||
@pool_chooser | ||
) | ||
end | ||
|
||
def next_handler | ||
return :cancel if @pool_chooser.value.to_s.empty? | ||
@address = @pool_chooser.value | ||
|
||
:next | ||
end | ||
|
||
# @macro seeDialog | ||
def next_button | ||
ok_button_label | ||
end | ||
|
||
# @macro seeDialog | ||
def run | ||
result = super | ||
@address_widget.value = @address if result == :next | ||
|
||
result | ||
end | ||
|
||
private | ||
|
||
# @macro seeDialog | ||
def ok_button | ||
PushButton(Id(:next), Opt(:default), ok_button_label) | ||
end | ||
|
||
def pool_for(type) | ||
{ local: Widgets::LocalList, | ||
public: Widgets::PublicList }.fetch(type, Widgets::LocalList).new(@address_widget.value) | ||
end | ||
|
||
# @macro see | ||
def min_height | ||
8 | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require "yast" | ||
|
||
module Y2NtpClient | ||
# Bunch of methods for retrieving ntp servers dinamically, i.e. by dhcp or | ||
# slp. | ||
module DynamicServers | ||
def dhcp_ntp_servers | ||
Yast.import "Lan" | ||
Yast.import "LanItems" | ||
Yast.import "NetworkService" | ||
|
||
# When proposing NTP servers we need to know | ||
# 1) list of (dhcp) interfaces | ||
# 2) network service in use | ||
# We can either use networking submodule for network service handling and get list of | ||
# interfaces e.g. using a bash command or initialize whole networking module. | ||
Yast::Lan.ReadWithCacheNoGUI | ||
|
||
Yast::LanItems.dhcp_ntp_servers.values.reduce(&:concat) || [] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.