-
Notifications
You must be signed in to change notification settings - Fork 347
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 Summary screen by adding more details about applied resources #912
Improve Summary screen by adding more details about applied resources #912
Conversation
@microsoft-github-policy-service agree |
@betanzos Thank you for creating this PR! Today the configuration output in the summary page is missing the |
I see these as a great improvement for the output! I know @shakersMSFT has some other ideas for future plans on further enhancements. I'm going to go ahead and cross-link this with the Issue over at WinGet-CLI so we can make sure we're aware of any future potential for breaking changes as we work towards WinGet configuration becoming a stable feature. |
This looks great to me! We definitely want to make sure we are keeping parity with the WinGet CLI! |
@AmelBawa-msft @shakersMSFT is there a reason why the PR is still here and not merged? |
tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/Tasks/ElevatedConfigurationTask.cs
Outdated
Show resolved
Hide resolved
tools/SetupFlow/DevHome.SetupFlow/Models/ConfigurationUnitResult.cs
Outdated
Show resolved
Hide resolved
/azp run |
No pipelines are associated with this pull request. |
Closing and reopening to enable pipelines added since this was opened. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of having each of the components jump around depending on the format. For example, sometimes name leads everything and sometimes it's in brackets, and the ID can be on its own or with the name.
How about this format: Intent : Name [Id] - Description
? And we can build it depending on what we have. Like
summary = "Intent : Name"
if (Id) summary += " [Id]"
if (Description) summary += " - Description"
tools/SetupFlow/DevHome.SetupFlow.ElevatedComponent/Tasks/ElevatedConfigurationTask.cs
Outdated
Show resolved
Hide resolved
<data name="ConfigurationUnitSummaryNoDescription" xml:space="preserve"> | ||
<value>{0} : {1} [{2}]</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need all of these variants to be localized? I'm a bit concerned that we may have more combinations we want to be able to handle and that's going to grow too much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just followed the current style because I have no much context on why we are using a localized string for this, but folks, if you want I'm good with removing this strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember getting guidance specifically about this. When I've added strings like these to localization it is because I'm not sure if other locales would use the same characters.
For example, I know for quotes some languages use 「these」 and some others use „these“. Not sure if that applies in this case, particularly considering the audience here is developers.
If we're keeping your current formatting, I think it's okay to localize these. IIRC my comment was thinking of adding the components to the string one by one always in the same order, instead of the current formatting where things change places depending on which ones are available.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: It bothers me a bit to have all the repetition of GetLocalized
. I wonder if it could make sense to do something like
var resourceKey = StringResourceKey.ConfigurationUnitSummaryFull;
if (condition1) resourceKey = [another string]
else if (condition2) resourceKey = [another string]
return _stringResource.GetLocalized(resourceKey, _unitResult.Intent, _unitResult.UnitName, ...);
Though this may be abusing the GetLocalized function since it may not be intended to get more replacements than placeholders there are
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a corner case that break the simplicity of this solution: if the unit ID is missing the description should be the thrid param. Because of this the resulting code looks worse (even assuming the repetition of return _stringResource.GetLocalized(...)
) to me because hide its intention:
private string BuildTitle()
{
var missingId = string.IsNullOrEmpty(_unitResult.Id);
var missingDescription = string.IsNullOrEmpty(_unitResult.Description);
var summaryResourceKey = StringResourceKey.ConfigurationUnitSummaryFull;
object[] localizedParams = { _unitResult.Intent, _unitResult.UnitName, _unitResult.Id, _unitResult.Description };
if (missingId && missingDescription)
{
summaryResourceKey = StringResourceKey.ConfigurationUnitSummaryMinimal;
}
else if (missingId)
{
summaryResourceKey = StringResourceKey.ConfigurationUnitSummaryNoId;
// for this variant of the string template the description is the thrid param
localizedParams[2] = _unitResult.Description;
}
else if (missingDescription)
{
summaryResourceKey = StringResourceKey.ConfigurationUnitSummaryNoDescription;
}
return _stringResource.GetLocalized(summaryResourceKey, localizedParams);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the unit ID is missing the description should be the thrid param
This may be a Bad Idea® but... This could probably be avoided by having that string skip the replacement {2}
so it would be like {0} : {3} [{1}]
Unless something is checking that the numbers used are contiguous.
Anyways, what I'm suggesting would be adding complexity in the strings to get some simplicity here, so it may not be worth it.
To me the elements of the summary string has the following precedence:
So, I would like to see in first place those elements with the higher precendence and the rest withing the brackets. If an element is missing the next one (if any) takes it place. If there are no elements to be added to the brackets it will be hidden. And that's it. I'm open to hear your comments but the format introduced by this PR looks better to me. |
I see. This should be fine, and we can change the specific strings easily if we get any feedback. |
Summary of the pull request
Add new variants for the applied resource summary.
References and relevant issues
#873
Detailed description of the pull request / Additional comments
The current applied resource summary only includes the Intent and the Unit Name and this PR adds three new variants for the applied resource summary, resulting in four available variants as shown below.
New variants will be choosen according to the presence of the unit Identifier (
id
) and the Description directive.FULL: Used when all the info is available
Format:
{Intent} : {Description} [{UnitName} {Identifier}]
MISSING ID: Used when only the Identifier is missing
Format:
{Intent} : {Description} [{UnitName}]
MISSING DESCRIPTION: Used when only the Description is missing
Format:
{Intent} : {UnitName} [{Identifier}]
MINIMAL: Used when both Identifier and Description are missing. This is the current format
Format:
{Intent} : {UnitName}
Validation steps performed
PR checklist