forked from Badgerati/Pode.Web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogress-async.ps1
More file actions
34 lines (28 loc) · 1.27 KB
/
progress-async.ps1
File metadata and controls
34 lines (28 loc) · 1.27 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
34
Import-Module Pode -MaximumVersion 2.99.99 -Force
Import-Module ..\src\Pode.Web.psd1 -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 'Progress Async' -Theme Dark
# set the controls
Add-PodeWebPage -Name 'Example' -ScriptBlock {
New-PodeWebContainer -Content @(
New-PodeWebForm -Name 'Long Running Form' -ScriptBlock {
Update-PodeWebProgress -Name 'FormProgress' -Value 0 -Colour Blue
# Reset-PodeWebProgress -Name 'FormProgress'
Show-PodeWebElement -Name 'FormProgress' -ObjectType 'Progress'
1..10 | ForEach-Object {
Start-Sleep -Seconds 1
Update-PodeWebProgress -Name 'FormProgress' -Value ($_ * 10)
}
Update-PodeWebProgress -Name 'FormProgress' -Value 100 -Colour Green
} -Content @(
New-PodeWebTextbox -Name 'Text' -Type Text
)
New-PodeWebProgress -Name 'FormProgress' -HideName -Striped -Animated |
Hide-PodeWebElement
)
}
}