poshud/pages/scheduled-endpoints.ps1

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
35
36
37
38
39
40
New-UDPage -Name "Scheduled-Endpoints" -Endpoint {

    $OnlineVersion = 'https://github.com/ironmansoftware/universal-dashboard/blob/master/src/poshud/pages/scheduled-endpoints.ps1'

    New-UDElement -Tag div -Attributes @{ style = @{ paddingLeft = "20px" }} -Content {
        New-UDRow -Columns {
            New-UDColumn -Size 12 -Content {
                New-UDHeading -Size 3 -Text "Scheduled Endpoints"
            }
        }

        New-UDRow -Columns {
            New-UDButton -Icon github -Text "Edit on GitHub" -OnClick (
                New-UDEndpoint -Endpoint {
                    Invoke-UDRedirect -Url $ArgumentList[0] -OpenInNewWindow 
                } -ArgumentList $OnlineVersion
            ) -BackgroundColor 'white' -FontColor 'black'
        }

        New-UDRow -Columns {
            New-UDColumn -Size 12 -Content {
                New-UDHeading -Size 5 -Text "Scheduled endpoints allow you to schedule actions to be taken on an interval. This is similar to a task scheduler but can interact with features of Universal Dashboard."
            }
        }

        New-UDElement -tag 'hr'

        New-UDRow -Columns {
            New-UDColumn -Size 12 -Content {
                New-UDHeading -Size 4 -Text "Examples"
            }
        }

        New-UDRow -Columns {
            New-UDColumn -Size 12 -Content {
                New-UDRawExample -Title 'Scheduled every 10 minutes' -Description "Runs the scheduled endpoint every ten minutes." -Code "New-UDEndpoint -Schedule (New-UDEndpointSchedule -Every 10 -Minute) -Endpoint { `$Cache:Processes = Get-Process }" 
            }
        }
    }
}