Badgerati / Pode.Web

Web template framework for use with the Pode PowerShell web server
MIT License
183 stars 23 forks source link

Improve ConvertTo-PodeWebPage output textbox #555

Open Szeraax opened 4 months ago

Szeraax commented 4 months ago

Describe the Change

When objects get passed to Pode.Web, they can look pretty bad coming to the textbox.

Even changing the line to something like this with a json conversion is a lot better:

(. $cmd @_args) | ConvertTo-Json | Out-PodeWebTextbox -Multiline -Preformat

Current output: image

An improved output: image

Have not tested against simple outputs, but most cmdlets emit objects and primitives generally play decently nice with ConvertTo-Json, so I wouldn't call it a big concern.

May want to do the same for the exception handling that is down 2 lines as well.

Szeraax commented 4 months ago

Don't forget that ConvertTo-Json depth wreaks havoc sometimes, so we will want to test carefully if we do use ConvertTo-Json as the solution. Maybe set depth to a specific value.