Skip to content
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

HTML Forms? #471

Open
m4admin opened this issue Jan 22, 2025 · 5 comments
Open

HTML Forms? #471

m4admin opened this issue Jan 22, 2025 · 5 comments

Comments

@m4admin
Copy link

m4admin commented Jan 22, 2025

Would be nice that pswritehtml get some form methods to create easy html pages with form validation.

Up to now I don’t find any powershell modules for this.

@PrzemyslawKlys
Copy link
Member

And what would you do with forms? There's no back-end to apply this? Your best bet is UniversalDashboard

@m4admin
Copy link
Author

m4admin commented Jan 22, 2025

There are some nice backends with powershell like pode. Unfortunately pode.web is in alpha status and had many bugs.

UniversalDashboard is not open source and if you want Kerberos auth you have to pay.

Pode with pswritehtml is a really good combo to create nice dashboards. I have some good examples with it and dynamic dashboards with sql datastore.

@PrzemyslawKlys
Copy link
Member

Right, I have once tried to use Pode, so I am not sure what you can really do with it.

I would need to see some code to understand how one could utilize it, as at the moment I have no clue how to connect 1 and the other. Adding forms, or telling datatables to get data from SQL is one thing, but the other is how to really use it.

I started building a C# version of PSWriteHTML:

Which I guess would be more useful, but it's not as complete.

@m4admin
Copy link
Author

m4admin commented Jan 23, 2025

I would use it to create forms to perform administrative tasks.

  • start/end processes
  • read event viewer
  • combine with the excellent diagrams from pswritehtml

some basic code to integrate:

`

Start-PodeServer {

Add-PodeRoute -Method Get -Path '/pswritehtml' -Authentication 'IISAuth' -ScriptBlock {

$name = $WebEvent.Query['name']


$html = New-HTML -TitleText 'My title' -Online {
	New-HTMLSection -HeaderText "Hello $name" -CanCollapse {
		New-HTMLPanel {
			New-HTMLChart {
				New-ChartLegend -LegendPosition bottom -HorizontalAlign right -Color Red, Blue, Yellow -DisableOnItemHoverHighlightDataSeries -DisableOnItemClickToggleDataSeries
				New-ChartAxisY -LabelMaxWidth 200 -LabelAlign left -Show -LabelFontColor Red, Blue, Green -TitleText 'This is title for y Axis' -TitleColor Red
				New-ChartBarOptions -Distributed
				New-ChartBar -Name 'Test very long' -Value 1
				New-ChartBar -Name 'Test1' -Value 20
				New-ChartBar -Name 'Test2 and even longer title' -Value 30
			} -Title 'Testing Title' -TitleAlignment center -SubTitle 'Because SubTitles are better' -SubTitleAlignment center -SubTitleFontSize 30 -TitleColor Gold
		}
	}
} -Online


Write-PodehtmlResponse -Value $html

}

}

`

but I can understand if you don't want to use forms. With pode and pswritehtml together, the possibilities would be endless in my opinion.

@PrzemyslawKlys
Copy link
Member

There3 are plenty of available options:

To try and, based on that, create something of my own. I guess I'm just not sure how to bind it to pode properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants