ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
36 stars 4 forks source link

Can't get to log or test tabs for dynamic endpoints #3947

Open MikeShepard opened 3 days ago

MikeShepard commented 3 days ago

Version

5.0.12

Severity

Low

Environment

msi

Steps to Reproduce

When I create a dynamic endpoint, I can't get to the log or test tabs.

I completely get why you can't edit the code.

You can work around by manipulating the url, though.

For instance, if I have endpoints.ps1 that looks like this:

New-PSUEndpoint -Url "/api/Manual/WindowsService/:computername/:servicename" -Method @('GET') -Endpoint {
   Get-Service -ComputerName $computername -Name $servicename
} 

#region PSUFooter
New-PSUEndpoint -Url "/user/:id/:data" -Method @('GET') -Endpoint {
    Write-Host "ID=  $Id Data2=$data"
}
#endregion

I get this on the endpoints page: image

If I click the edit for the first (nondynamic) endpoint I get this URL: http://localhost:5000/admin/apis/endpoints/1

Updating the URL to /2, I get to see the log/test/edit for the dynamic endpoint: image

I'd like to be able to get to this, and have the "Code" tab disabled (since it's dynamic). The test and log work fine, though.

Expected behavior

Expect to see an edit button, with working Test and Log tabs (code disabled).

Actual behavior

No buttons.

Additional Environment data

No response

Screenshots/Animations

No response

MikeShepard commented 3 days ago

Note: if you write the endpoint scriptblock out to a file and use the -Path parameter, you can see the log and test.

Unfortunately, you can also edit the endpoint. :-(