Skip to content

Commit

Permalink
Merge 00664d4 into eae7534
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Aug 23, 2021
2 parents eae7534 + 00664d4 commit ef6f05d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 41 deletions.
7 changes: 7 additions & 0 deletions package/yast2-add-on.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Aug 19 16:00:54 UTC 2021 - David Diaz <dgonzalez@suse.com>

- Improve UX by using a less misleading message when
repo URL is unknown (bsc#1188635).
- 4.4.1

-------------------------------------------------------------------
Tue Apr 20 12:55:53 UTC 2021 - Ladislav Slezák <lslezak@suse.cz>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-add-on.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-add-on
Version: 4.4.0
Version: 4.4.1
Release: 0
Summary: YaST2 - Add-On media installation code
License: GPL-2.0-only
Expand Down
62 changes: 22 additions & 40 deletions src/include/add-on/add-on-workflow.rb
Expand Up @@ -1171,49 +1171,29 @@ def ReturnCurrentlySelectedProductInfo
end

def AdjustInfoWidget
pi = ReturnCurrentlySelectedProductInfo()
if pi.nil? || pi == {}
product_info = ReturnCurrentlySelectedProductInfo()

if product_info.to_h.empty?
UI.ChangeWidget(Id("product_details"), :Value, "")

return
end

vendor = pi["product"].vendor.empty? ? _("Unknown vendor") : pi["product"].vendor
version = pi["product"].version.empty? ? _("Unknown version") : pi["product"].version
rt_description = Builtins.sformat(
"<p>%1\n%2\n%3\n%4</p>",
Builtins.sformat(
_("<b>Vendor:</b> %1<br>"),
vendor
),
Builtins.sformat(
_("<b>Version:</b> %1<br>"),
version
),
Builtins.sformat(
_("<b>Repository URL:</b> %1<br>"),
if Ops.greater_than(
Builtins.size(Ops.get_list(pi, ["info", "URLs"], [])),
0
)
Builtins.mergestring(Ops.get_list(pi, ["info", "URLs"], []), ",")
else
_("Unknown repository URL")
end
),
if Ops.greater_than(
Builtins.size(Ops.get_list(pi, ["info", "aliases"], [])),
0
)
Builtins.sformat(
_("<b>Repository Alias:</b> %1<br>"),
Builtins.mergestring(Ops.get_list(pi, ["info", "aliases"], []), ",")
)
else
""
end
)
product = product_info["product"]
info = product_info["info"] || {}

vendor = product.vendor.empty? ? _("Unknown vendor") : product.vendor
version = product.version.empty? ? _("unknown version") : product.version
urls = info.fetch("URLs", []).join(",")
aliases = info.fetch("aliases", []).join(",")

details = []
details << format(_("<b>Vendor:</b> %s<br>"), vendor)
details << format(_("<b>Version:</b> %s<br>"), version)
details << format(_("<b>Repository URL:</b> %s<br>"), urls) unless urls.empty?
details << format(_("<b>Repository Alias:</b> %s<br>"), aliases) unless aliases.empty?

UI.ChangeWidget(Id("product_details"), :Value, rt_description)
UI.ChangeWidget(Id("product_details"), :Value, "<p>#{details.join("\n")}</p>")

nil
end
Expand Down Expand Up @@ -1431,9 +1411,11 @@ def RedrawAddOnsOverviewTable
log.info("Currently used add-ons: #{product_infos}")

products = product_infos.map do |index, product_desc|
Item(Id("product_#{index}"),
Item(
Id("product_#{index}"),
ui_product_name(product_desc["product"]),
product_desc["info"]["URLs"].first || _("Unknown URL"))
product_desc["info"]["URLs"].first || _("Not found in enabled repositories")
)
end

UI.ChangeWidget(Id("list_of_addons"), :Items, products)
Expand Down

0 comments on commit ef6f05d

Please sign in to comment.