Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve UX using generic error message for unknown repo URL #111

Merged
merged 5 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions package/yast2-add-on.changes
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
65 changes: 25 additions & 40 deletions src/include/add-on/add-on-workflow.rb
Original file line number Diff line number Diff line change
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)
Copy link
Member Author

@dgdavid dgdavid Aug 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this changes a bit the translation since former %1 is now %s but... I hope it does not hurt. If so, I can revert the last commit completely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately in my experience the translators quite often overlook such small differences and they just reuse the old translations. 😟

But we have the check_po_files.rb for that reason. I run it from time to time and do fixes like this.

So go ahead, I'll run the script after few days to fix the problems. 😃

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,14 @@ def RedrawAddOnsOverviewTable
log.info("Currently used add-ons: #{product_infos}")

products = product_infos.map do |index, product_desc|
Item(Id("product_#{index}"),
# TRANSLATORS: Product status, the installed product was not found in any enabled repository
url = product_desc["info"]["URLs"].first || _("Not found in enabled repositories")

Item(
Id("product_#{index}"),
ui_product_name(product_desc["product"]),
product_desc["info"]["URLs"].first || _("Unknown URL"))
url
)
end

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