forked from Badgerati/Pode.Web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.ps1
More file actions
33 lines (26 loc) · 1.41 KB
/
basic.ps1
File metadata and controls
33 lines (26 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Import-Module Pode -MaximumVersion 2.99.99 -Force
Import-Module ..\src\Pode.Web.psm1 -Force
Start-PodeServer {
# add a simple endpoint
Add-PodeEndpoint -Address localhost -Port 8090 -Protocol Http
New-PodeLoggingMethod -Terminal | Enable-PodeErrorLogging
# set the use of templates, and set a login page
Use-PodeWebTemplates -Title 'Basic Example' -Theme Dark
# social
Set-PodeWebSocial -Type GitHub -Url 'https://github.com/badgerati'
Set-PodeWebSocial -Type Twitter -Url 'https://twitter.com/Badgerati' -Tooltip '@Badgerati'
# set the home page controls (just a simple paragraph)
$section = New-PodeWebCard -Name 'Welcome' -NoTitle -Content @(
New-PodeWebParagraph -Value 'This is an example homepage, with some example text'
New-PodeWebParagraph -Value 'Using some example paragraphs'
)
Set-PodeWebHomePage -Layouts $section -Title 'Awesome Homepage'
# add a page to search process (output as json in an appended textbox)
$form = New-PodeWebForm -Name 'Search' -ShowReset -SubmitText 'Search' -ResetText 'Clear' -AsCard -ScriptBlock {
Get-Process -Name $WebEvent.Data.Name -ErrorAction Ignore | Select-Object Name, ID, WorkingSet, CPU | Out-PodeWebTextbox -Multiline -Preformat -AsJson
} -Content @(
New-PodeWebTextbox -Name 'Name'
)
Add-PodeWebPage -Name Processes -Icon 'chart-box-outline' -Layouts $form
Use-PodeWebPages
}