From 388dacb52e7efd11434fc5c288965cd6733111cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Fri, 27 Sep 2024 06:36:54 +0100 Subject: [PATCH 1/5] fix: use "agama" textdomain in change_locale --- service/lib/agama/with_locale.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/lib/agama/with_locale.rb b/service/lib/agama/with_locale.rb index 6ec4cd7773..a26bf471a5 100644 --- a/service/lib/agama/with_locale.rb +++ b/service/lib/agama/with_locale.rb @@ -36,7 +36,7 @@ def change_process_locale(locale) ENV["LANG"] = locale log.info "set yast locale to #{locale}" # explicit call to textdomain to force fast gettext change of language ASAP - textdomain "installation" + textdomain "agama" end end end From f3e5331c4ff309d956995c4c15b5b86b5b315128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Fri, 27 Sep 2024 06:32:41 +0100 Subject: [PATCH 2/5] fix: refresh users issues when language changes --- service/lib/agama/manager.rb | 3 ++- service/lib/agama/users.rb | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/service/lib/agama/manager.rb b/service/lib/agama/manager.rb index 4a48e64a16..51067c0e1f 100644 --- a/service/lib/agama/manager.rb +++ b/service/lib/agama/manager.rb @@ -84,6 +84,7 @@ def startup_phase def locale=(locale) service_status.busy change_process_locale(locale) + users.update_issues start_progress_with_descriptions( _("Load software translations"), _("Load storage translations") @@ -183,7 +184,7 @@ def language # Users client # - # @return [DBus::Clients::Users] + # @return [Agama::Users] def users @users ||= Users.new(logger) end diff --git a/service/lib/agama/users.rb b/service/lib/agama/users.rb index d85cc0459b..c294b3e819 100644 --- a/service/lib/agama/users.rb +++ b/service/lib/agama/users.rb @@ -139,10 +139,6 @@ def write end end - private - - attr_reader :logger - # Recalculates the list of issues def update_issues new_issues = [] @@ -158,6 +154,10 @@ def update_issues self.issues = new_issues end + private + + attr_reader :logger + # Determines whether a first user is defined or not # # @return [Boolean] From 2d984ede9d12ee3ce5c20a71c2369dfcdf441185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Fri, 27 Sep 2024 10:01:38 +0100 Subject: [PATCH 3/5] fix: refresh storage issues when language changes --- service/lib/agama/storage/manager.rb | 1 + service/lib/agama/storage/proposal.rb | 45 ++++++++++++++------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/service/lib/agama/storage/manager.rb b/service/lib/agama/storage/manager.rb index 1d4faf9f9c..2cd5546abf 100644 --- a/service/lib/agama/storage/manager.rb +++ b/service/lib/agama/storage/manager.rb @@ -179,6 +179,7 @@ def actions # @param locale [String] new locale def locale=(locale) change_process_locale(locale) + update_issues end private diff --git a/service/lib/agama/storage/proposal.rb b/service/lib/agama/storage/proposal.rb index f8d014e04f..f35a869c35 100644 --- a/service/lib/agama/storage/proposal.rb +++ b/service/lib/agama/storage/proposal.rb @@ -45,11 +45,6 @@ def initialize(config, logger: nil) @on_calculate_callbacks = [] end - # List of issues. - # - # @return [Array] - attr_reader :issues - # Whether the proposal was already calculated. # # @return [Boolean] @@ -192,6 +187,25 @@ def guided_settings strategy_object.settings end + # List of issues. + # + # @return [Array] + def issues + items = [] + + case @calculate_error + when Y2Storage::NoDiskSpaceError + items << failed_issue + when Y2Storage::Error + items << exception_issue(@calculate_error) + else + items << failed_issue if proposal&.failed? + end + + items.concat(strategy_object.issues) if strategy_object + items + end + private # @return [Agama::Config] @@ -232,16 +246,15 @@ def calculate_agama_from_json(storage_json) def calculate return false unless storage_manager.probed? - @issues = [] - + @calculate_error = nil begin strategy_object.calculate - @issues << failed_issue if proposal.failed? rescue Y2Storage::Error => e - handle_exception(e) + @calculate_error = e + rescue StandardError => e + raise e end - @issues.concat(strategy_object.issues) @on_calculate_callbacks.each(&:call) success? end @@ -263,18 +276,6 @@ def storage_manager Y2Storage::StorageManager.instance end - # Handle Y2Storage exceptions - def handle_exception(error) - case error - when Y2Storage::NoDiskSpaceError - @issues << failed_issue - when Y2Storage::Error - @issues << exception_issue(error) - else - raise error - end - end - # Issue representing the proposal is not valid. # # @return [Issue] From b0f542592265d12c217ea410f8b544d72e38400d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Fri, 27 Sep 2024 10:26:09 +0100 Subject: [PATCH 4/5] doc(service): update changes file --- service/package/rubygem-agama-yast.changes | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/service/package/rubygem-agama-yast.changes b/service/package/rubygem-agama-yast.changes index e843a97ff3..1d490946c9 100644 --- a/service/package/rubygem-agama-yast.changes +++ b/service/package/rubygem-agama-yast.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Sep 27 09:23:40 UTC 2024 - Imobach Gonzalez Sosa + +- Handle language change in users and storage (gh#agama-project/agama#1642). + ------------------------------------------------------------------- Mon Sep 23 14:55:53 UTC 2024 - José Iván López González From 1ba13558aead9732883a4c4db7a0046730956b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Fri, 27 Sep 2024 12:03:35 +0100 Subject: [PATCH 5/5] doc(service): clarify change description --- service/package/rubygem-agama-yast.changes | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/package/rubygem-agama-yast.changes b/service/package/rubygem-agama-yast.changes index 1d490946c9..4a65f5a910 100644 --- a/service/package/rubygem-agama-yast.changes +++ b/service/package/rubygem-agama-yast.changes @@ -1,7 +1,8 @@ ------------------------------------------------------------------- Fri Sep 27 09:23:40 UTC 2024 - Imobach Gonzalez Sosa -- Handle language change in users and storage (gh#agama-project/agama#1642). +- Handle UI language change in users and storage + (gh#agama-project/agama#1642). ------------------------------------------------------------------- Mon Sep 23 14:55:53 UTC 2024 - José Iván López González