-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
ConvertTo-PodeWebPage - add grouping parameters #351
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -682,7 +682,7 @@ function Add-PodeWebPageLink | |||
|
||||
function ConvertTo-PodeWebPage | ||||
{ | ||||
[CmdletBinding()] | ||||
[CmdletBinding(DefaultParameterSetName = 'NoGrouping')] | ||||
param( | ||||
[Parameter(ValueFromPipeline=$true)] | ||||
[string[]] | ||||
|
@@ -692,9 +692,18 @@ function ConvertTo-PodeWebPage | |||
[string] | ||||
$Module, | ||||
|
||||
[Parameter(ParameterSetName = 'GroupByCustomKey')] | ||||
[string] | ||||
$Group, | ||||
|
||||
[Parameter(ParameterSetName = 'GroupByVerbs')] | ||||
[switch] | ||||
$GroupVerbs, | ||||
|
||||
[Parameter(ParameterSetName = 'GroupByModuleName')] | ||||
[switch] | ||||
$GroupModule, | ||||
|
||||
[Parameter()] | ||||
[Alias('NoAuth')] | ||||
[switch] | ||||
|
@@ -854,11 +863,33 @@ function ConvertTo-PodeWebPage | |||
New-PodeWebTab -Name $name -Layouts $form | ||||
}) | ||||
|
||||
$group = [string]::Empty | ||||
if ($GroupVerbs) { | ||||
$group = $cmdInfo.Verb | ||||
if ([string]::IsNullOrWhiteSpace($group)) { | ||||
$group = '_' | ||||
switch ($PSCmdlet.ParameterSetName) { | ||||
'NoGrouping' { | ||||
$group = [string]::Empty | ||||
break | ||||
} | ||||
|
||||
'GroupByVerbs' { | ||||
$group = [string]::Empty | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Safe to remove this line :) |
||||
$group = $cmdInfo.Verb | ||||
if ([string]::IsNullOrWhiteSpace($group)) { | ||||
$group = '_' | ||||
} | ||||
break | ||||
} | ||||
|
||||
'GroupByCustomKey' { | ||||
$group = $Group -replace "\.","" | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering why you were replacing the dots, but I'm guessing it's because it stops the groups expanding? This looks like the same issue as with spaces. This line here: Pode.Web/src/Private/Helpers.ps1 Line 347 in 7db656c
Changing |
||||
break | ||||
} | ||||
|
||||
'GroupByModuleName' { | ||||
$group = $cmdInfo.ModuleName -replace "\.","" | ||||
break | ||||
} | ||||
|
||||
default { | ||||
throw 'Unknown parameter set.' | ||||
} | ||||
} | ||||
|
||||
|
@@ -974,4 +1005,4 @@ function Test-PodeWebPage | |||
} | ||||
|
||||
return (@($pages) | Measure-Object).Count -gt 0 | ||||
} | ||||
} |
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.
The
break
s aren't really needed in this switch statement, since only a single value is being supplied to theswitch
and not an array.