Hello community,
here is the log from the commit of package yast2-registration for
openSUSE:Leap:15.2 checked in at 2020-03-31 07:22:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/yast2-registration (Old)
and /work/SRC/openSUSE:Leap:15.2/.yast2-registration.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-registration"
Tue Mar 31 07:22:29 2020 rev:151 rq:788635 version:4.2.39
Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/yast2-registration/yast2-registration.changes
2020-02-27 06:41:41.161632437 +0100
+++
/work/SRC/openSUSE:Leap:15.2/.yast2-registration.new.3160/yast2-registration.changes
2020-03-31 07:22:35.306403719 +0200
@@ -1,0 +2,40 @@
+Thu Mar 26 12:07:36 UTC 2020 - David Diaz <[email protected]>
+
+- Reverts changes made in 4.2.36 to improve the addons selection,
+ keeping it as it was (bsc#1167523).
+- 4.2.39
+
+-------------------------------------------------------------------
+Mon Mar 23 14:34:05 UTC 2020 - Josef Reidinger <[email protected]>
+
+- Hide registration feedback window when configuring network
+ (bsc#1165705)
+- 4.2.38
+
+-------------------------------------------------------------------
+Wed Mar 18 15:25:57 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Improves online search UX (bsc#1165913 and bsc#1166038):
+ - Make clear how to select/unselect packages in the Qt version.
+ - Improve overall performance.
+ - Properly clear the package details when there are not results.
+ - Add the missing help in the "changes summary".
+ - Extend the help for the search dialog, including more details
+ about how to use it.
+ - Display the "changes summary" when a module/extension is going
+ to be activated, even if no packages will be installed.
+ - Include information about the amount of packages found.
+ - Ignore spaces around the search term.
+- 4.2.37
+
+-------------------------------------------------------------------
+Thu Mar 12 14:11:54 UTC 2020 - David Diaz <[email protected]>
+
+- Improves the addons selection dialog:
+ - Avoid the scroll reset after (un)selecting and addon
+ (bsc#1049965).
+ - Avoid the need to(un)select an addon to see its description
+ (bsc#1161200).
+- 4.2.36
+
+-------------------------------------------------------------------
Old:
----
yast2-registration-4.2.35.tar.bz2
New:
----
yast2-registration-4.2.39.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-registration.spec ++++++
--- /var/tmp/diff_new_pack.lufzRl/_old 2020-03-31 07:22:35.858403959 +0200
+++ /var/tmp/diff_new_pack.lufzRl/_new 2020-03-31 07:22:35.858403959 +0200
@@ -17,7 +17,7 @@
Name: yast2-registration
-Version: 4.2.35
+Version: 4.2.39
Release: 0
Summary: YaST2 - Registration Module
License: GPL-2.0-only
@@ -27,8 +27,8 @@
Source0: %{name}-%{version}.tar.bz2
BuildRequires: update-desktop-files
-# Y2Packager::Product#version_version
-BuildRequires: yast2 >= 4.2.59
+# Popup::SuppressFeedback
+BuildRequires: yast2 >= 4.2.76
BuildRequires: yast2-devtools >= 4.2.2
BuildRequires: yast2-slp >= 3.1.9
BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec)
@@ -38,8 +38,8 @@
BuildRequires: yast2-packager >= 4.2.37
BuildRequires: yast2-update >= 3.1.36
-# Y2Packager::Product#version_version
-Requires: yast2 >= 4.2.59
+# Popup::SuppressFeedback
+Requires: yast2 >= 4.2.76
# "dupAllowVendorChange" option in Pkg.SetSolverFlags()
Requires: yast2-pkg-bindings >= 3.1.34
# N_() method
++++++ yast2-registration-4.2.35.tar.bz2 -> yast2-registration-4.2.39.tar.bz2
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/package/yast2-registration.changes
new/yast2-registration-4.2.39/package/yast2-registration.changes
--- old/yast2-registration-4.2.35/package/yast2-registration.changes
2020-02-19 11:51:11.000000000 +0100
+++ new/yast2-registration-4.2.39/package/yast2-registration.changes
2020-03-26 14:03:28.000000000 +0100
@@ -1,4 +1,44 @@
-------------------------------------------------------------------
+Thu Mar 26 12:07:36 UTC 2020 - David Diaz <[email protected]>
+
+- Reverts changes made in 4.2.36 to improve the addons selection,
+ keeping it as it was (bsc#1167523).
+- 4.2.39
+
+-------------------------------------------------------------------
+Mon Mar 23 14:34:05 UTC 2020 - Josef Reidinger <[email protected]>
+
+- Hide registration feedback window when configuring network
+ (bsc#1165705)
+- 4.2.38
+
+-------------------------------------------------------------------
+Wed Mar 18 15:25:57 UTC 2020 - Imobach Gonzalez Sosa <[email protected]>
+
+- Improves online search UX (bsc#1165913 and bsc#1166038):
+ - Make clear how to select/unselect packages in the Qt version.
+ - Improve overall performance.
+ - Properly clear the package details when there are not results.
+ - Add the missing help in the "changes summary".
+ - Extend the help for the search dialog, including more details
+ about how to use it.
+ - Display the "changes summary" when a module/extension is going
+ to be activated, even if no packages will be installed.
+ - Include information about the amount of packages found.
+ - Ignore spaces around the search term.
+- 4.2.37
+
+-------------------------------------------------------------------
+Thu Mar 12 14:11:54 UTC 2020 - David Diaz <[email protected]>
+
+- Improves the addons selection dialog:
+ - Avoid the scroll reset after (un)selecting and addon
+ (bsc#1049965).
+ - Avoid the need to(un)select an addon to see its description
+ (bsc#1161200).
+- 4.2.36
+
+-------------------------------------------------------------------
Tue Feb 18 16:34:38 UTC 2020 - Knut Anderssen <[email protected]>
- Do not catch exceptions when getting the updates list from the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/package/yast2-registration.spec
new/yast2-registration-4.2.39/package/yast2-registration.spec
--- old/yast2-registration-4.2.35/package/yast2-registration.spec
2020-02-19 11:51:11.000000000 +0100
+++ new/yast2-registration-4.2.39/package/yast2-registration.spec
2020-03-26 14:03:28.000000000 +0100
@@ -17,7 +17,7 @@
Name: yast2-registration
-Version: 4.2.35
+Version: 4.2.39
Release: 0
Summary: YaST2 - Registration Module
License: GPL-2.0-only
@@ -27,8 +27,8 @@
Source0: %{name}-%{version}.tar.bz2
BuildRequires: update-desktop-files
-# Y2Packager::Product#version_version
-BuildRequires: yast2 >= 4.2.59
+# Popup::SuppressFeedback
+BuildRequires: yast2 >= 4.2.76
BuildRequires: yast2-devtools >= 4.2.2
BuildRequires: yast2-slp >= 3.1.9
BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec)
@@ -38,9 +38,8 @@
BuildRequires: yast2-packager >= 4.2.37
BuildRequires: yast2-update >= 3.1.36
-
-# Y2Packager::Product#version_version
-Requires: yast2 >= 4.2.59
+# Popup::SuppressFeedback
+Requires: yast2 >= 4.2.76
# "dupAllowVendorChange" option in Pkg.SetSolverFlags()
Requires: yast2-pkg-bindings >= 3.1.34
# N_() method
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/src/lib/registration/clients/online_search.rb
new/yast2-registration-4.2.39/src/lib/registration/clients/online_search.rb
--- old/yast2-registration-4.2.35/src/lib/registration/clients/online_search.rb
2020-02-19 11:51:11.000000000 +0100
+++ new/yast2-registration-4.2.39/src/lib/registration/clients/online_search.rb
2020-03-26 14:03:28.000000000 +0100
@@ -77,13 +77,15 @@
# Runs the sequence
#
- # This method performs these steps:
+ # This sequence performs the following steps:
#
- # 1. Find the addons
- # 2. Search for packages (UI)
- # 3. Register the addons
- # 4. Display the EULA if needed
- # 5. Select the packages for installation
+ # 1. Check whether the online search is supported in the underlying
system
+ # 2. Get the available addons from the registration server
+ # 3. Allow the user to search for packages (UI)
+ # 4. Display a summary of the changes (addons to register and packages
to install)
+ # 5. Display the EULAs if needed
+ # 6. Register the selected addons
+ # 7. Select the packages for installation
#
# @return [Symbol] Sequence's result (:next or :abort)
def run
@@ -166,7 +168,7 @@
#
# @return [:next]
def display_summary
- return :next if selected_packages.empty?
+ return :next if selected_addons.empty? && selected_packages.empty?
::Registration::Dialogs::OnlineSearchSummary.run(
selected_packages, selected_addons
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/src/lib/registration/controllers/package_search.rb
new/yast2-registration-4.2.39/src/lib/registration/controllers/package_search.rb
---
old/yast2-registration-4.2.35/src/lib/registration/controllers/package_search.rb
2020-02-19 11:51:11.000000000 +0100
+++
new/yast2-registration-4.2.39/src/lib/registration/controllers/package_search.rb
2020-03-26 14:03:28.000000000 +0100
@@ -44,7 +44,7 @@
# @param ignore_case [Boolean] Whether the search is case sensitive or
not
# @return [Array<Registration::RemotePackage>] List of packages
def search(text, ignore_case)
- @search = ::Registration::PackageSearch.new(text: text, ignore_case:
ignore_case)
+ @search = ::Registration::PackageSearch.new(text: text.strip,
ignore_case: ignore_case)
@search.packages
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/src/lib/registration/dialogs/online_search.rb
new/yast2-registration-4.2.39/src/lib/registration/dialogs/online_search.rb
--- old/yast2-registration-4.2.35/src/lib/registration/dialogs/online_search.rb
2020-02-19 11:51:11.000000000 +0100
+++ new/yast2-registration-4.2.39/src/lib/registration/dialogs/online_search.rb
2020-03-26 14:03:28.000000000 +0100
@@ -74,12 +74,19 @@
# @macro seeDialog
def help
- _("The online search feature allows the user to search for packages
across all " \
- "modules and extensions, including those that have not been
activated for this " \
- "system.\n\nOnce the wanted package is found, the user can select it
for " \
- "installation. If it belongs to a not activated module, YaST will
allow activating " \
- "the module/extension. Bear in mind that the activation will take
place at the end, " \
- "after the user clicks the Next button.")
+ # TRANSLATORS: help text for the main dialog of the online search
feature
+ _("<p><b>Online Search</b></p>\n" \
+ "<p>The online search feature allows searching for packages across
all modules and " \
+ "extensions, including those not activated for this system.</p>\n" \
+ "<p>To perform a search, just write a term in the <b>Package
name</b> input field and " \
+ "press the <b>Search</b> button. YaST then contacts the SUSE
Customer Center and, " \
+ "after a few seconds, shows the results in the table, including the
module/extension " \
+ "each package belongs to.</p>\n" \
+ "<p>You can select any package for installation by clicking in the
corresponding table " \
+ "row and pressing the <b>Toggle selection</b> button (or just
double-clicking on the " \
+ "row). If the package belongs to a not activated module/extension,
YaST asks you about " \
+ "activating it. Bear in mind that the real activation takes place
after you click the " \
+ "<b>Next</b> button.</p>\n")
end
private
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/src/lib/registration/dialogs/online_search_summary.rb
new/yast2-registration-4.2.39/src/lib/registration/dialogs/online_search_summary.rb
---
old/yast2-registration-4.2.35/src/lib/registration/dialogs/online_search_summary.rb
2020-02-19 11:51:11.000000000 +0100
+++
new/yast2-registration-4.2.39/src/lib/registration/dialogs/online_search_summary.rb
2020-03-26 14:03:28.000000000 +0100
@@ -47,12 +47,24 @@
Yast::Label.CancelButton
end
+ # @macro seeAbstractWidget
def title
# TRANSLATORS: title for the dialog which displays modules/extensions
to
# install and packages to register
_("Changes Summary")
end
+ # @macro seeAbstractWidget
+ def help
+ # TRANSLATORS: help text for the summary of the online search feature
+ _("<p><b>Online Search Changes Summary</b></p>\n" \
+ "<p>This screen summarizes which modules/extensions are going to be
activated and " \
+ "which packages are going to be installed. If you are okay with
those changes, click " \
+ "the <b>Next</b> button. However, if you prefer to add or remove any
item, click the " \
+ "<b>Back</b> button to get to the search dialog. Finally, if you
decide not to perform " \
+ "any change to your system, click the <b>Cancel</b> button.</p>")
+ end
+
private
# @return [Array<RemotePackage>] Packages to install
@@ -63,20 +75,33 @@
# Returns a string that contains a list of addons to register
#
- # @return [String] text containing the list of addons; an empty string
- # is returned if there are no addons
+ # @see #collection_summary
+ #
+ # @return [String] text containing the list of addons
def addons_text
- return "" if addons.empty?
- heading = format(_("Modules/extensions to register (%{count})"),
count: addons.size)
- Yast::HTML.Heading(heading) + Yast::HTML.List(addons.map(&:name).sort)
+ collection_summary(_("Modules/extensions to register (%{count})"),
addons)
end
# Returns a string that contains the list of packages to select
#
+ # @see #collection_summary
+ #
# @return [String] text containing the list of packages
def packages_text
- heading = format(_("Selected packages (%{count})"), count:
packages.size)
- Yast::HTML.Heading(heading) +
Yast::HTML.List(packages.map(&:name).sort)
+ collection_summary(_("Selected packages (%{count})"), packages)
+ end
+
+ # Returns a string that contains a list with given collection names
+ #
+ # @param text [String] a translatable text including the %{count} named
param
+ # @param collection [Arary<#name>] a collection with objects that
responds to `#name`
+ #
+ # @return [String] text list with given collection; an empty string when
collection is empty
+ def collection_summary(text, collection)
+ return "" if collection.empty?
+
+ heading = format(text, count: collection.size)
+ Yast::HTML.Heading(heading) +
Yast::HTML.List(collection.map(&:name).sort)
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/src/lib/registration/helpers.rb
new/yast2-registration-4.2.39/src/lib/registration/helpers.rb
--- old/yast2-registration-4.2.35/src/lib/registration/helpers.rb
2020-02-19 11:51:11.000000000 +0100
+++ new/yast2-registration-4.2.39/src/lib/registration/helpers.rb
2020-03-26 14:03:28.000000000 +0100
@@ -41,6 +41,7 @@
Yast.import "Installation"
Yast.import "Linuxrc"
Yast.import "Mode"
+ Yast.import "Popup"
Yast.import "Stage"
Yast.import "Report"
Yast.import "SlpService"
@@ -91,7 +92,11 @@
# run the network configuration module
def self.run_network_configuration
log.info "Running network configuration..."
- Yast::WFM.call("inst_lan", [{ "skip_detection" => true }])
+ # ensure that no registration feedback is shown
+ # when running network configuration (bsc#1165705)
+ Yast::Popup.SuppressFeedback do
+ Yast::WFM.call("inst_lan", [{ "skip_detection" => true }])
+ end
end
# check if the network configuration module is present
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/src/lib/registration/package_search.rb
new/yast2-registration-4.2.39/src/lib/registration/package_search.rb
--- old/yast2-registration-4.2.35/src/lib/registration/package_search.rb
2020-02-19 11:51:11.000000000 +0100
+++ new/yast2-registration-4.2.39/src/lib/registration/package_search.rb
2020-03-26 14:03:28.000000000 +0100
@@ -19,6 +19,7 @@
require "suse/connect"
require "y2packager/product"
+require "y2packager/resolvable"
require "registration/addon"
require "registration/remote_package"
@@ -64,7 +65,8 @@
version: pkg["version"],
release: pkg["release"],
arch: pkg["arch"],
- addon: ::Registration::Addon.find_by_id(product["id"])
+ addon: ::Registration::Addon.find_by_id(product["id"]),
+ status: status_for(pkg["name"])
)
end
all.concat(remote_packages)
@@ -97,5 +99,28 @@
summary: yast_product.display_name
)
end
+
+ # Returns the status for a given package
+ #
+ # Finding out the status of a package requires to ask libzypp through
Yast::Pkg.
+ # If there are many results, it might time quite some time. So in order to
speed
+ # up the operation, a status cache is built (see #status_map).
+ #
+ # @param pkg_name [String] Package name
+ def status_for(pkg_name)
+ status_map[pkg_name] || :unknown
+ end
+
+ # Returns a memoized status cache
+ #
+ # @return [Hash<String,Symbol>]
+ def status_map
+ return @status_map if @status_map
+ pkgs = Y2Packager::Resolvable.find({ kind: :package }, [:name, :status])
+ @status_map = pkgs.each_with_object({}) do |pkg, all|
+ next if all.key?(pkg.name)
+ all[pkg.name] = pkg.status
+ end
+ end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/src/lib/registration/remote_package.rb
new/yast2-registration-4.2.39/src/lib/registration/remote_package.rb
--- old/yast2-registration-4.2.35/src/lib/registration/remote_package.rb
2020-02-19 11:51:11.000000000 +0100
+++ new/yast2-registration-4.2.39/src/lib/registration/remote_package.rb
2020-03-26 14:03:28.000000000 +0100
@@ -24,7 +24,7 @@
#
# @example Find the status
class RemotePackage
- attr_reader :id, :name, :arch, :version, :release, :addon
+ attr_reader :id, :name, :arch, :version, :release, :addon, :status
# @param id [Integer] Package ID
# @param name [String] Package name
@@ -32,14 +32,16 @@
# @param version [String] Version number
# @param release [String] Release number
# @param addon [Addon] Addon which the package belongs to
+ # @param status [Symbol] Package status
# rubocop:disable Metrics/ParameterLists
- def initialize(id:, name:, arch:, version:, release:, addon:)
+ def initialize(id:, name:, arch:, version:, release:, addon:, status: nil)
@id = id
@name = name
@arch = arch
@version = version
@release = release
@addon = addon
+ @status = status
end
# rubocop:enable Metrics/ParameterLists
@@ -48,12 +50,13 @@
end
def select!
+ return if selected?
@old_status = @status
@status = :selected
end
def unselect!
- @status = @old_status if selected?
+ @status = @old_status || :unknown if selected?
end
def installed?
@@ -63,27 +66,5 @@
def selected?
@status == :selected
end
-
- # Returns the package's status
- #
- # @return [Symbol] Package status (:available, :installed, etc.). :unknown
- # when there is no libzypp counterpart.
- def status
- return @status if @status
- # TODO: Determine the correct status when the libzypp_package is not
- # available. It might depend on whether the addon is registered/selected
- # or not.
- return :unknown unless libzypp_package
- @status ||= libzypp_package.status
- end
-
- # @return [Y2Packager::Package,nil] Local package (libzypp) counterpart
- def libzypp_package
- return @libzypp_package if @libzypp_package
- candidates = Y2Packager::Package.find(name)
- return nil if candidates.nil?
- # FIXME: Check the version too
- @libzypp_package = candidates.first
- end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/src/lib/registration/widgets/package_search.rb
new/yast2-registration-4.2.39/src/lib/registration/widgets/package_search.rb
---
old/yast2-registration-4.2.35/src/lib/registration/widgets/package_search.rb
2020-02-19 11:51:11.000000000 +0100
+++
new/yast2-registration-4.2.39/src/lib/registration/widgets/package_search.rb
2020-03-26 14:03:28.000000000 +0100
@@ -22,6 +22,8 @@
require "registration/widgets/package_search_form"
require "registration/widgets/remote_packages_table"
require "registration/widgets/remote_package_details"
+require "registration/widgets/search_results_info"
+require "registration/widgets/toggle_package_selection"
require "yast2/popup"
Yast.import "Popup"
@@ -66,6 +68,10 @@
60,
VBox(
MinHeight(14, packages_table),
+ HBox(
+ HWeight(50, search_results),
+ Right(toggle_package_selection)
+ ),
package_details
)
)
@@ -79,6 +85,8 @@
search_package(search_form.text, search_form.ignore_case)
elsif event["WidgetID"] == "remote_packages_table"
handle_packages_table_event(event)
+ elsif event["WidgetID"] == "toggle_package_selection"
+ toggle_package
end
log.debug "Event handled #{event.inspect}"
@@ -106,6 +114,13 @@
@packages_table ||= RemotePackagesTable.new
end
+ # Widget to display search information
+ #
+ # @return [SearchResultsInfo] the search results info widget instance
+ def search_results
+ @search_results ||= SearchResultsInfo.new
+ end
+
# Package details widget
#
# This widget displays the details of the package which is selected in
the
@@ -116,6 +131,13 @@
@package_details ||= RemotePackageDetails.new
end
+ # The button to toggle the selection status for current selected package
+ #
+ # @return [TogglePackageSelection] a toggle package selection button
+ def toggle_package_selection
+ @toggle_package_selection ||= TogglePackageSelection.new
+ end
+
# Handles remote packages table events
#
# @param event [Hash] Widget event to process
@@ -124,7 +146,7 @@
when "Activated"
toggle_package
when "SelectionChanged"
- update_details
+ update
end
end
@@ -144,7 +166,7 @@
def search_package(text, ignore_case)
return unless valid_search_text?(text)
# TRANSLATORS: searching for packages
- Yast::Popup.Feedback(_("Searching..."), _("Searching for packages")) do
+ Yast::Popup.Feedback(searching_message, searching_header) do
@packages = controller.search(text, ignore_case)
selected_package_ids = controller.selected_packages.map(&:id)
@packages.each do |pkg|
@@ -152,29 +174,42 @@
end
end
packages_table.change_items(packages)
- update_details
+ update
end
# Finds out the current package which is selected in the packages table
#
# @return [RemotePackage,nil]
def find_current_package
- packages.find { |p| p.id == packages_table.value }
+ # PackagesTable#value might be slow, so let's avoid to call it too
many times
+ packages_table_value = packages_table.value
+ packages.find { |p| p.id == packages_table_value }
end
# Selects/unselects the current package for installation
def toggle_package
package = find_current_package
+
+ return unless package
+
controller.toggle_package(package)
packages_table.update_item(package)
- update_details
+ update
end
- # Updates the package details widget
- def update_details
- # FIXME: remove the content if the current package is nil
+ # Updates the UI according to selected package
+ def update
current_package = find_current_package
- package_details.update(current_package) if current_package
+
+ search_results.update(packages.size)
+
+ if current_package
+ package_details.update(current_package)
+ toggle_package_selection.enabled = !current_package.installed?
+ else
+ package_details.clear
+ toggle_package_selection.enabled = false
+ end
end
MINIMAL_SEARCH_TEXT_SIZE = 2
@@ -193,6 +228,20 @@
)
false
end
+
+ # Returns the header to display in the feedback window while searching
for packages
+ #
+ # @return [String]
+ def searching_header
+ _("Contacting the SUSE Customer Center. This may take some time.\n")
+ end
+
+ # Returns the message to display in the feedback window while searching
for packages
+ #
+ # @return [String]
+ def searching_message
+ _("Searching for packages")
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/src/lib/registration/widgets/remote_package_details.rb
new/yast2-registration-4.2.39/src/lib/registration/widgets/remote_package_details.rb
---
old/yast2-registration-4.2.35/src/lib/registration/widgets/remote_package_details.rb
2020-02-19 11:51:11.000000000 +0100
+++
new/yast2-registration-4.2.39/src/lib/registration/widgets/remote_package_details.rb
2020-03-26 14:03:28.000000000 +0100
@@ -54,6 +54,11 @@
self.value = lines.join("<br>")
end
+ # Clears the widget's content
+ def clear
+ self.value = ""
+ end
+
private
# Displays the status of the given addon
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/src/lib/registration/widgets/search_results_info.rb
new/yast2-registration-4.2.39/src/lib/registration/widgets/search_results_info.rb
---
old/yast2-registration-4.2.35/src/lib/registration/widgets/search_results_info.rb
1970-01-01 01:00:00.000000000 +0100
+++
new/yast2-registration-4.2.39/src/lib/registration/widgets/search_results_info.rb
2020-03-26 14:03:28.000000000 +0100
@@ -0,0 +1,71 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require "yast"
+require "cwm/custom_widget"
+
+module Registration
+ module Widgets
+ # Widget to display information about the search results
+ class SearchResultsInfo < CWM::CustomWidget
+ # Constructor
+ def initialize
+ textdomain "registration"
+ end
+
+ # (see CWM::CustomWidget#contents)
+ def contents
+ Label(label_id, initial_text)
+ end
+
+ # Updates the information shown based in found results
+ #
+ # @param results [Integer] the amount of packages found
+ def update(results)
+ text =
+ if results.zero?
+ # TRANSLATORS: the text to indicate that search had no results
+ _("No package found")
+ else
+ # TRANSLATORS: texts to show the amount of packages found
(singular and plural forms)
+ n_("%s package found", "%s packages found", results) % results
+ end
+
+ Yast::UI.ChangeWidget(label_id, :Value, text)
+ end
+
+ private
+
+ # Returns the id for the label
+ #
+ # @return [Yast::Term] the id for the label
+ def label_id
+ @label_id ||= Id(:search_results_info)
+ end
+
+ # Returns the text used the first time
+ #
+ # @return [String] the text to display initially
+ def initial_text
+ # TRANSLATORS: the text to display when the user has not done a search
yet
+ _("Not results yet")
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/src/lib/registration/widgets/toggle_package_selection.rb
new/yast2-registration-4.2.39/src/lib/registration/widgets/toggle_package_selection.rb
---
old/yast2-registration-4.2.35/src/lib/registration/widgets/toggle_package_selection.rb
1970-01-01 01:00:00.000000000 +0100
+++
new/yast2-registration-4.2.39/src/lib/registration/widgets/toggle_package_selection.rb
2020-03-26 14:03:28.000000000 +0100
@@ -0,0 +1,54 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require "yast"
+require "cwm/common_widgets"
+
+module Registration
+ module Widgets
+ # Widget representing the button to toggle package selection status
+ class TogglePackageSelection < CWM::PushButton
+ # Constructor
+ def initialize
+ textdomain "registration"
+ self.widget_id = "toggle_package_selection"
+ end
+
+ # Updates the button state according to the given value
+ #
+ # @param value [Boolean] if the button should be enabled or not
+ def enabled=(value)
+ Yast::UI.ChangeWidget(Id(widget_id), :Enabled, value)
+ end
+
+ # Returns the button text
+ #
+ # @return [String] the button text
+ def label
+ # TRANSLATORS: the text for the button to toggle the package selection
+ _("Toggle selection")
+ end
+
+ # (see CWM::AbstractWidget#opt)
+ def opt
+ [:disabled]
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/test/registration/controllers/package_search_test.rb
new/yast2-registration-4.2.39/test/registration/controllers/package_search_test.rb
---
old/yast2-registration-4.2.35/test/registration/controllers/package_search_test.rb
2020-02-19 11:51:11.000000000 +0100
+++
new/yast2-registration-4.2.39/test/registration/controllers/package_search_test.rb
2020-03-26 14:03:28.000000000 +0100
@@ -56,6 +56,17 @@
it "returns the list of packages from SCC" do
expect(controller.search(text, ignore_case)).to eq([package])
end
+
+ context "when text contains leading and/or trailing spaces" do
+ let(:text) { " gnome " }
+
+ it "performs the package search ignoring them" do
+ expect(Registration::PackageSearch).to receive(:new)
+ .with(text: "gnome", ignore_case: ignore_case).and_return(search)
+
+ controller.search(text, ignore_case)
+ end
+ end
end
describe "#toggle_package" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/test/registration/dialogs/online_search_summary_test.rb
new/yast2-registration-4.2.39/test/registration/dialogs/online_search_summary_test.rb
---
old/yast2-registration-4.2.35/test/registration/dialogs/online_search_summary_test.rb
2020-02-19 11:51:11.000000000 +0100
+++
new/yast2-registration-4.2.39/test/registration/dialogs/online_search_summary_test.rb
2020-03-26 14:03:28.000000000 +0100
@@ -47,5 +47,13 @@
expect(subject.contents.to_s).to_not include("Modules")
end
end
+
+ context "when the list of packages is empty" do
+ subject { described_class.new([], [addon]) }
+
+ it "does not include a list of packages" do
+ expect(subject.contents.to_s).to_not include("Selected packages")
+ end
+ end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/test/registration/package_search_test.rb
new/yast2-registration-4.2.39/test/registration/package_search_test.rb
--- old/yast2-registration-4.2.35/test/registration/package_search_test.rb
2020-02-19 11:51:11.000000000 +0100
+++ new/yast2-registration-4.2.39/test/registration/package_search_test.rb
2020-03-26 14:03:28.000000000 +0100
@@ -75,6 +75,10 @@
)
end
+ let(:resolvables) do
+ [Y2Packager::Resolvable.new(name: "SUSEConnect", status: :installed)]
+ end
+
describe "#results" do
let(:packages) { [pkg1, pkg2] }
@@ -87,6 +91,8 @@
.with(1946).and_return(basesystem)
allow(Registration::Addon).to receive(:find_by_id)
.with(1963).and_return(nil)
+ allow(Y2Packager::Resolvable).to receive(:find)
+ .with({ kind: :package }, [:name, :status]).and_return(resolvables)
end
it "returns packages from SCC containing the given text in their names" do
@@ -96,14 +102,16 @@
version: "2.1.0",
release: "4.6.1",
arch: "x86_64",
- addon: nil
+ addon: nil,
+ status: :unknown
),
an_object_having_attributes(
name: "SUSEConnect",
version: "0.3.23",
release: "1.6",
arch: "x86_64",
- addon: basesystem
+ addon: basesystem,
+ status: :installed
)
)
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/test/registration/remote_package_test.rb
new/yast2-registration-4.2.39/test/registration/remote_package_test.rb
--- old/yast2-registration-4.2.35/test/registration/remote_package_test.rb
2020-02-19 11:51:11.000000000 +0100
+++ new/yast2-registration-4.2.39/test/registration/remote_package_test.rb
2020-03-26 14:03:28.000000000 +0100
@@ -24,26 +24,37 @@
describe Registration::RemotePackage do
subject(:package) do
described_class.new(
- id: 1, name: "foobar", arch: :x86_64, version: "1.0", release: "1",
addon: nil
+ id: 1, name: "foobar", arch: :x86_64, version: "1.0",
+ release: "1", addon: nil, status: :available
)
end
- describe "#status" do
- let(:libzypp_package) { instance_double(Y2Packager::Package, status:
:available) }
-
- before do
- allow(package).to receive(:libzypp_package).and_return(libzypp_package)
+ describe "#full_version" do
+ it "returns a version including the version number and the release" do
+ expect(package.full_version).to eq("1.0-1")
end
+ end
- it "returns the libzypp counterpart status" do
- expect(package.status).to eq(:available)
+ describe "#select!" do
+ it "sets the package as selected" do
+ expect { package.select! }.to change { package.selected?
}.from(false).to(true)
end
+ end
- context "when there is no libzypp counterpart" do
- let(:libzypp_package) { nil }
+ describe "#unselect!" do
+ context "when the package was selected" do
+ before do
+ package.select!
+ end
+
+ it "reverts the package to the previous status" do
+ expect { package.unselect! }.to change { package.status
}.from(:selected).to(:available)
+ end
+ end
- it "returns :unknown" do
- expect(package.status).to eq(:unknown)
+ context "when the package is not selected" do
+ it "does not modify the status" do
+ expect { package.unselect! }.to_not change { package.status }
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/test/registration/widgets/package_search_test.rb
new/yast2-registration-4.2.39/test/registration/widgets/package_search_test.rb
---
old/yast2-registration-4.2.35/test/registration/widgets/package_search_test.rb
2020-02-19 11:51:11.000000000 +0100
+++
new/yast2-registration-4.2.39/test/registration/widgets/package_search_test.rb
2020-03-26 14:03:28.000000000 +0100
@@ -39,7 +39,15 @@
end
let(:package_details) do
- instance_double(Registration::Widgets::RemotePackageDetails, update: nil)
+ instance_double(Registration::Widgets::RemotePackageDetails, update: nil,
clear: nil)
+ end
+
+ let(:toggle_package_selection) do
+ instance_double(Registration::Widgets::TogglePackageSelection, :enabled=
=> nil)
+ end
+
+ let(:search_results_info) do
+ instance_double(Registration::Widgets::SearchResultsInfo, update: nil)
end
let(:package) do
@@ -58,19 +66,25 @@
)
end
+ let(:search_result) { [package] }
+
before do
allow(Registration::Widgets::RemotePackagesTable).to receive(:new)
.and_return(packages_table)
allow(Registration::Widgets::RemotePackageDetails).to receive(:new)
.and_return(package_details)
- allow(controller).to receive(:search).and_return([package])
+ allow(Registration::Widgets::TogglePackageSelection).to receive(:new)
+ .and_return(toggle_package_selection)
+ allow(Registration::Widgets::SearchResultsInfo).to receive(:new)
+ .and_return(search_results_info)
+ allow(controller).to receive(:search).and_return(search_result)
end
describe "#handle" do
let(:text) { "gnome" }
let(:ignore_case) { true }
- context "when the user asks for a package" do
+ context "when handling a package search" do
let(:event) { { "WidgetID" => "search_form_button" } }
let(:search_form) do
@@ -89,13 +103,7 @@
subject.handle(event)
end
- it "updates the table and the package details" do
- expect(packages_table).to receive(:change_items).with([package])
- expect(package_details).to receive(:update).with(package)
- subject.handle(event)
- end
-
- context "when the search text is not enough" do
+ context "but the search text is not enough" do
let(:text) { "g" }
it "asks the user to introduce some text" do
@@ -104,6 +112,73 @@
subject.handle(event)
end
end
+
+ context "and there are results" do
+ it "updates the table and the package details" do
+ expect(packages_table).to receive(:change_items).with([package])
+
+ subject.handle(event)
+ end
+
+ it "updates the package details" do
+ expect(package_details).to receive(:update).with(package)
+
+ subject.handle(event)
+ end
+
+ it "updates the search results info message" do
+ expect(search_results_info).to
receive(:update).with(search_result.size)
+
+ subject.handle(event)
+ end
+
+ it "updates the toggle selection button" do
+ expect(toggle_package_selection).to receive(:enabled=)
+
+ subject.handle(event)
+ end
+ end
+
+ context "but there are no results" do
+ let(:search_result) { [] }
+
+ it "updates the table" do
+ expect(packages_table).to receive(:change_items).with([])
+
+ subject.handle(event)
+ end
+
+ it "clears the package details" do
+ expect(package_details).to receive(:clear)
+
+ subject.handle(event)
+ end
+
+ it "updates the search results info message" do
+ expect(search_results_info).to receive(:update).with(0)
+
+ subject.handle(event)
+ end
+
+ it "sets the toggle selection button as disabled" do
+ expect(toggle_package_selection).to receive(:enabled=).with(false)
+
+ subject.handle(event)
+ end
+ end
+ end
+
+ context "when handling a toggle package status request" do
+ let(:event) { { "WidgetID" => "toggle_package_selection" } }
+
+ before do
+ allow(subject).to receive(:packages).and_return([package])
+ end
+
+ it "toggles the selected package" do
+ expect(controller).to receive(:toggle_package).with(package)
+ subject.handle(event)
+ end
end
context "when a package is selected for installation" do
@@ -137,6 +212,26 @@
expect(package_details).to receive(:update).with(package)
subject.handle(event)
end
+
+ context "and the selected package is already installed" do
+ let(:installed?) { true }
+
+ it "sets the toggle selection button as disabled" do
+ expect(toggle_package_selection).to receive(:enabled=).with(false)
+
+ subject.handle(event)
+ end
+ end
+
+ context "and the selected package is not installed" do
+ let(:installed?) { false }
+
+ it "sets the toggle selection button as enabled" do
+ expect(toggle_package_selection).to receive(:enabled=).with(true)
+
+ subject.handle(event)
+ end
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/test/registration/widgets/remote_package_details_test.rb
new/yast2-registration-4.2.39/test/registration/widgets/remote_package_details_test.rb
---
old/yast2-registration-4.2.35/test/registration/widgets/remote_package_details_test.rb
2020-02-19 11:51:11.000000000 +0100
+++
new/yast2-registration-4.2.39/test/registration/widgets/remote_package_details_test.rb
2020-03-26 14:03:28.000000000 +0100
@@ -49,4 +49,12 @@
subject.update(package)
end
end
+
+ describe "#clear" do
+ it "clears the widget's content" do
+ expect(subject).to receive(:value=).with("")
+
+ subject.clear
+ end
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/test/registration/widgets/search_results_info_test.rb
new/yast2-registration-4.2.39/test/registration/widgets/search_results_info_test.rb
---
old/yast2-registration-4.2.35/test/registration/widgets/search_results_info_test.rb
1970-01-01 01:00:00.000000000 +0100
+++
new/yast2-registration-4.2.39/test/registration/widgets/search_results_info_test.rb
2020-03-26 14:03:28.000000000 +0100
@@ -0,0 +1,55 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require_relative "../../spec_helper"
+require "registration/widgets/search_results_info"
+
+require "cwm/rspec"
+
+describe Registration::Widgets::SearchResultsInfo do
+ subject { described_class.new }
+
+ include_examples "CWM::CustomWidget"
+
+ describe "#update" do
+ context "when search does not return pacakges" do
+ it "uses a no package info message" do
+ expect(Yast::UI).to receive(:ChangeWidget).with(anything, :Value, /No
package found/)
+
+ subject.update(0)
+ end
+ end
+
+ context "when search returns just one package" do
+ it "uses the singular form of the info message" do
+ expect(Yast::UI).to receive(:ChangeWidget).with(anything, :Value,
/package found/)
+
+ subject.update(1)
+ end
+ end
+
+ context "when search returns more than one package" do
+ it "uses the plural form of the info message" do
+ expect(Yast::UI).to receive(:ChangeWidget).with(anything, :Value,
/packages found/)
+
+ subject.update(2)
+ end
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-registration-4.2.35/test/registration/widgets/toggle_package_selection_test.rb
new/yast2-registration-4.2.39/test/registration/widgets/toggle_package_selection_test.rb
---
old/yast2-registration-4.2.35/test/registration/widgets/toggle_package_selection_test.rb
1970-01-01 01:00:00.000000000 +0100
+++
new/yast2-registration-4.2.39/test/registration/widgets/toggle_package_selection_test.rb
2020-03-26 14:03:28.000000000 +0100
@@ -0,0 +1,51 @@
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require_relative "../../spec_helper"
+
+require "cwm/rspec"
+require "registration/widgets/toggle_package_selection"
+
+describe Registration::Widgets::TogglePackageSelection do
+ include Yast::UIShortcuts
+
+ subject { described_class.new }
+
+ include_examples "CWM::PushButton"
+
+ let(:id) { Id(subject.widget_id) }
+
+ describe "#enabled=" do
+ context "when `true` is given" do
+ it "sets the button as enabled " do
+ expect(Yast::UI).to receive(:ChangeWidget).with(id, :Enabled, true)
+
+ subject.enabled = true
+ end
+ end
+
+ context "when `false` is given" do
+ it "sets the button as disabled " do
+ expect(Yast::UI).to receive(:ChangeWidget).with(id, :Enabled, false)
+
+ subject.enabled = false
+ end
+ end
+ end
+end