diff --git a/tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/Helpers/ElevatedConfigureUnitTaskResult.cs b/tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/Helpers/ElevatedConfigureUnitTaskResult.cs index 112425fc38..86e0916459 100644 --- a/tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/Helpers/ElevatedConfigureUnitTaskResult.cs +++ b/tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/Helpers/ElevatedConfigureUnitTaskResult.cs @@ -10,6 +10,10 @@ public sealed class ElevatedConfigureUnitTaskResult { public string? UnitName { get; set; } + public string? Id { get; set; } + + public string? Description { get; set; } + public string? Intent { get; set; } public bool IsSkipped { get; set; } diff --git a/tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/Tasks/ElevatedConfigurationTask.cs b/tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/Tasks/ElevatedConfigurationTask.cs index 56a0d21002..b1eded8de3 100644 --- a/tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/Tasks/ElevatedConfigurationTask.cs +++ b/tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/Tasks/ElevatedConfigurationTask.cs @@ -32,12 +32,18 @@ public IAsyncOperation ApplyConfiguration(string fi taskResult.TaskAttempted = true; taskResult.TaskSucceeded = result.Succeeded; taskResult.RebootRequired = result.RequiresReboot; - taskResult.UnitResults = result.Result.UnitResults.Select(unitResult => new ElevatedConfigureUnitTaskResult + taskResult.UnitResults = result.Result.UnitResults.Select(unitResult => { - UnitName = unitResult.Unit.UnitName, - Intent = unitResult.Unit.Intent.ToString(), - IsSkipped = unitResult.State == ConfigurationUnitState.Skipped, - HResult = unitResult.ResultInformation?.ResultCode?.HResult ?? HRESULT.S_OK, + unitResult.Unit.Directives.TryGetValue("description", out var descriptionObj); + return new ElevatedConfigureUnitTaskResult + { + UnitName = unitResult.Unit.UnitName, + Id = unitResult.Unit.Identifier, + Description = descriptionObj?.ToString() ?? string.Empty, + Intent = unitResult.Unit.Intent.ToString(), + IsSkipped = unitResult.State == ConfigurationUnitState.Skipped, + HResult = unitResult.ResultInformation?.ResultCode?.HResult ?? HRESULT.S_OK, + }; }).ToList(); if (result.ResultException != null) diff --git a/tools/SetupFlow/DevHome.SetupFlow/Models/ConfigurationUnitResult.cs b/tools/SetupFlow/DevHome.SetupFlow/Models/ConfigurationUnitResult.cs index 154925853e..a6d95c6654 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Models/ConfigurationUnitResult.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/Models/ConfigurationUnitResult.cs @@ -13,6 +13,9 @@ public class ConfigurationUnitResult public ConfigurationUnitResult(ApplyConfigurationUnitResult result) { UnitName = result.Unit.UnitName; + Id = result.Unit.Identifier; + result.Unit.Directives.TryGetValue("description", out var descriptionObj); + Description = descriptionObj?.ToString() ?? string.Empty; Intent = result.Unit.Intent.ToString(); IsSkipped = result.State == ConfigurationUnitState.Skipped; HResult = result.ResultInformation?.ResultCode?.HResult ?? HRESULT.S_OK; @@ -21,6 +24,8 @@ public ConfigurationUnitResult(ApplyConfigurationUnitResult result) public ConfigurationUnitResult(ElevatedConfigureUnitTaskResult result) { UnitName = result.UnitName; + Id = result.Id; + Description = result.Description; Intent = result.Intent; IsSkipped = result.IsSkipped; HResult = result.HResult; @@ -28,6 +33,10 @@ public ConfigurationUnitResult(ElevatedConfigureUnitTaskResult result) public string UnitName { get; } + public string Id { get; } + + public string Description { get; } + public string Intent { get; } public bool IsSkipped { get; } diff --git a/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs b/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs index 695eb6aee7..733b36d93b 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/Services/StringResourceKey.cs @@ -32,7 +32,10 @@ public static class StringResourceKey public static readonly string ConfigurationUnitFailed = nameof(ConfigurationUnitFailed); public static readonly string ConfigurationUnitSkipped = nameof(ConfigurationUnitSkipped); public static readonly string ConfigurationUnitSuccess = nameof(ConfigurationUnitSuccess); - public static readonly string ConfigurationUnitSummary = nameof(ConfigurationUnitSummary); + public static readonly string ConfigurationUnitSummaryFull = nameof(ConfigurationUnitSummaryFull); + public static readonly string ConfigurationUnitSummaryMinimal = nameof(ConfigurationUnitSummaryMinimal); + public static readonly string ConfigurationUnitSummaryNoDescription = nameof(ConfigurationUnitSummaryNoDescription); + public static readonly string ConfigurationUnitSummaryNoId = nameof(ConfigurationUnitSummaryNoId); public static readonly string ConfigurationUnitStats = nameof(ConfigurationUnitStats); public static readonly string ConfigurationViewTitle = nameof(ConfigurationViewTitle); public static readonly string DevDriveReviewTitle = nameof(DevDriveReviewTitle); diff --git a/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw b/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw index 94bd484232..9ae93f14ee 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw +++ b/tools/SetupFlow/DevHome.SetupFlow/Strings/en-us/Resources.resw @@ -233,9 +233,21 @@ Configuration successfully applied Message displayed when applying a configuration unit succeeds. - + + {0} : {3} [{1} {2}] + {Locked="{0}","{1}","{2}","{3}"}Summary text for a configuration unit. {0} is replaced by the configuration unit intent (e.g. Assert, Inform, Apply). {1} is replaced by the configuration unit name. {2} is replaced by the configuration unit id. {3} is replaced by the configuration unit description. A string with all values replaced could look like "Apply : Install VS [WinGetPackage vspackage]" + + {0} : {1} - {Locked="{0}","{1}"}Summary text for a configuration unit. {0} is replaced by the configuration unit intent (e.g. Assert, Inform, Apply). {1} is replaced by the configuration unit name. + {Locked="{0}","{1}"}Summary text for a configuration unit. {0} is replaced by the configuration unit intent (e.g. Assert, Inform, Apply). {1} is replaced by the configuration unit name. A string with all values replaced could look like "Apply : WinGetPackage" + + + {0} : {1} [{2}] + {Locked="{0}","{1}","{2}"}Summary text for a configuration unit. {0} is replaced by the configuration unit intent (e.g. Assert, Inform, Apply). {1} is replaced by the configuration unit name. {2} is replaced by the configuration unit id. A string with all values replaced could look like "Apply : WinGetPackage [vspackage]" + + + {0} : {2} [{1}] + {Locked="{0}","{1}","{2}"}Summary text for a configuration unit. {0} is replaced by the configuration unit intent (e.g. Assert, Inform, Apply). {1} is replaced by the configuration unit name. {2} is replaced by the configuration unit description. A string with all values replaced could look like "Apply : Install VS [WinGetPackage]" Succeeded: {0} | Failed: {1} | Skipped: {2} diff --git a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/ConfigurationUnitResultViewModel.cs b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/ConfigurationUnitResultViewModel.cs index 6d76dd8d14..db8bfaeeca 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/ConfigurationUnitResultViewModel.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/ConfigurationUnitResultViewModel.cs @@ -29,7 +29,7 @@ public ConfigurationUnitResultViewModel(ISetupFlowStringResource stringResource, _unitResult = unitResult; } - public string Title => _stringResource.GetLocalized(StringResourceKey.ConfigurationUnitSummary, _unitResult.Intent, _unitResult.UnitName); + public string Title => BuildTitle(); public string ApplyResult => GetApplyResult(); @@ -54,4 +54,24 @@ private string GetApplyResult() return _stringResource.GetLocalized(StringResourceKey.ConfigurationUnitSuccess); } + + private string BuildTitle() + { + if (string.IsNullOrEmpty(_unitResult.Id) && string.IsNullOrEmpty(_unitResult.Description)) + { + return _stringResource.GetLocalized(StringResourceKey.ConfigurationUnitSummaryMinimal, _unitResult.Intent, _unitResult.UnitName); + } + + if (string.IsNullOrEmpty(_unitResult.Id)) + { + return _stringResource.GetLocalized(StringResourceKey.ConfigurationUnitSummaryNoId, _unitResult.Intent, _unitResult.UnitName, _unitResult.Description); + } + + if (string.IsNullOrEmpty(_unitResult.Description)) + { + return _stringResource.GetLocalized(StringResourceKey.ConfigurationUnitSummaryNoDescription, _unitResult.Intent, _unitResult.UnitName, _unitResult.Id); + } + + return _stringResource.GetLocalized(StringResourceKey.ConfigurationUnitSummaryFull, _unitResult.Intent, _unitResult.UnitName, _unitResult.Id, _unitResult.Description); + } }