-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Only display properties with values for MeasureInfo #7104
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
Only display properties with values for MeasureInfo #7104
Conversation
|
From #6412 #6214 (comment)
|
|
The build errors seems completely separate from my changes. |
|
Reopen the PR to restart CIs. |
|
I don't intend to fix the remaining CodeFactor issues. |
|
@JamesWTruher can you please take a look? Thx. |
|
Jim is on a leave; + @SteveL-MSFT for review who is familiar with formatting APIs. |
| } | ||
|
|
||
| private ListEntryBuilder AddItem(string value, string label, DisplayEntryValueType kind, string format) | ||
| private ListEntryBuilder AddItem(string value, string label, DisplayEntryValueType kind, string format, DisplayEntry itemSelectionContition) |
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.
typo: itemSelectionCondition
|
|
||
| /// <summary></summary> | ||
| public ListEntryBuilder AddItemScriptBlock(string scriptBlock, string label = null, string format = null) | ||
| public ListEntryBuilder AddItemScriptBlock(string scriptBlock, string label = null, string format = null, DisplayEntry itemSelectionContition = null) |
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.
typo: itemSelectionCondition
|
|
||
| /// <summary></summary> | ||
| public ListEntryBuilder AddItemProperty(string property, string label = null, string format = null) | ||
| public ListEntryBuilder AddItemProperty(string property, string label = null, string format = null, DisplayEntry itemSelectionContition = null) |
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.
typo: itemSelectionCondition
| /// <summary></summary> | ||
| public ListEntryBuilder AddItemPropertyIfSet(string property, string label = null, string format = null) | ||
| { | ||
| var itemSelectionContition = DisplayEntry.CreatePropertyEntry(property); |
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.
typo: itemSelectionCondition
SteveL-MSFT
left a comment
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.
LGTM
| $text = 1, 2, 3 | Measure-Object -Minimum -Maximum | Format-List | Out-String | ||
| $text -match "min" | Should -BeTrue | ||
| $text -match "max" | Should -BeTrue | ||
| $text -match 'Average' | Should -BeFalse |
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.
Seems we skipped
$text -match 'Sum' | Should -BeFalseThere 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.
@powercode Please address the comment.
1b4a460 to
b424329
Compare
|
@powercode Thank you for the contribution! I added "Documentation-Needed" label (if you can please open new issue in PowerShell-Docs repo). |
| /// <returns>A <see cref="DisplayEntry"/> for the <paramref name="scriptblock"/>.</returns> | ||
| public static DisplayEntry CreateScriptBlockEntry(string scriptblock) | ||
| { | ||
| return new DisplayEntry(scriptblock, DisplayEntryValueType.ScriptBlock); |
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.
@PaulHigin should review this new public api for any security implications in creating script blocks that might circumvent the language mode.
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.
@PaulHigin reviewed this and told me he doesn't see a security issue. @PaulHigin can you confirm?
|
@iSazonov we should revert this commit until security review of the public api has been completed cc @TravisEz13 |
|
@SteveL-MSFT Opened #7754. |
…ll#7104)" (PowerShell#7754) This reverts commit 87ccd0a until security review of the public api has been completed.
PR Summary
Adding Item selection conditions to the list formatting info for MeasureInfo so that only the properties with values gets displayed
Reopening #6214
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature testsThis change is