Skip to content

Commit

Permalink
Small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Mar 1, 2019
1 parent 0ce1858 commit 83ec2f6
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/lib/registration/ui/base_system_registration_dialog.rb
Expand Up @@ -288,16 +288,6 @@ def register_scc_option
#
# @return [Yast::Term] UI terms
def register_local_option
# If not special URL is used, probe with SLP
if using_default_url?
# skip SLP discovery if the system is already registered
# during installation (the user is just going back)
urls = (Registration.is_registered? && !Yast::Mode.normal) ? [] : slp_urls
urls = [EXAMPLE_SMT_URL] if urls.empty?
else
urls = [reg_options[:custom_url]]
end

VBox(
Left(
RadioButton(
Expand All @@ -315,7 +305,7 @@ def register_local_option
VBox(
MinWidth(REG_CODE_WIDTH,
ComboBox(Id(:custom_url), Opt(:editable),
_("&Local Registration Server URL"), urls))
_("&Local Registration Server URL"), local_registration_urls))
)
)
),
Expand Down Expand Up @@ -624,6 +614,21 @@ def valid_custom_url?(custom_url)
rescue URI::InvalidURIError
false
end

#
# List of offered local registration servers
#
# @return [Array<String>] List of URLs
#
def local_registration_urls
# If not special URL is used, probe with SLP
return [reg_options[:custom_url]] unless using_default_url?

# skip SLP discovery if the system is already registered
# during installation (the user is just going back)
urls = (Registration.is_registered? && !Yast::Mode.normal) ? [] : slp_urls
urls.empty? ? [EXAMPLE_SMT_URL] : urls
end
end
end
end

0 comments on commit 83ec2f6

Please sign in to comment.