Private/Start-XDUDashboard-notes.txt

<#
 #
 #region Page2
$Audit = New-UDPage -Name "Citrix Audit" -Icon database -Content {
    New-UDButton -Text "Refresh" -Icon cloud -IconAlignment left -onClick {
 
        $job = Start-RSJob -ScriptBlock { Initialize-CitrixAudit -XMLParameterFilePath $PSParameters -Verbose }
        do {
            Show-UDModal -Content { New-UDHeading -Text "Refreshing your data" } -Persistent
            Start-Sleep -Seconds 10
            Hide-UDModal
        } until ($job.State -notlike 'Running')
    } # end button
    $TodayAudit = Get-Item ((Get-ChildItem $ReportsFolder\XDAudit\*.html | Sort-Object -Property LastWriteTime -Descending)[0]) | select *
Sync-UDElement -Id 'CardDisplayNameCARD'
New-UDCollapsible -Items {
    New-UDCollapsibleItem -Content {
        New-UDCard -Id 'CardDisplayNameCARD' -Endpoint {
            param ($TodayAudit)
            New-UDHtml ([string](Get-Content $TodayAudit.FullName))
        } } -Active -Title ' Latest Citrix Audit'
         
}
}
#endregion
 
 $CTXHomePage = New-UDPage -Name "Health Check" -Icon home -DefaultHomePage -Content {
    New-UDButton -Text "Refresh" -Icon cloud -IconAlignment left -onClick {
 
        $job = Start-RSJob -ScriptBlock { Initialize-CitrixHealthCheck -XMLParameterFilePath $PSParameters -Verbose }
        do {
            Show-UDModal -Content { New-UDHeading -Text "Refreshing your data" } -Persistent
            Start-Sleep -Seconds 10
            Hide-UDModal
        } until ($job.State -notlike 'Running')
    } # end button
 
$TodayReport = Get-Item ((Get-ChildItem $ReportsFolder\XDHealth\*.html | Sort-Object -Property LastWriteTime -Descending)[0]) | select *
$YesterdayReport = Get-Item ((Get-ChildItem $ReportsFolder\XDHealth\*.html | Sort-Object -Property LastWriteTime -Descending)[1]) | select *
$2daysReport = Get-Item ((Get-ChildItem $ReportsFolder\XDHealth\*.html | Sort-Object -Property LastWriteTime -Descending)[2]) | select *
 
Sync-UDElement -Id 'Healcheck1'
Sync-UDElement -Id 'Healcheck2'
Sync-UDElement -Id 'Healcheck3'
 
 
New-UDCollapsible -Items {
    New-UDCollapsibleItem -Content {
        New-UDCard -Id 'Healcheck1' -Endpoint {
            param ($TodayReport)
            New-UDHtml ([string](Get-Content $TodayReport.FullName))
        }
    } -Active -Title ' Today''s Report'
 
    New-UDCollapsibleItem -Content {
        New-UDCard -Id 'Healcheck2' -Endpoint {
            param ($YesterdayReport)
            New-UDHtml ([string](Get-Content $YesterdayReport.FullName)) }
 } -Title ' Yesterday''s Report'
     
    New-UDCollapsibleItem -Content {
        New-UDCard -Id 'Healcheck3' -Endpoint {
            param ($2daysReport)
            New-UDHtml ([string](Get-Content $2daysReport.FullName)) } } -Title ' 2 Days Ago''s Report'
  
}
}
 
New-UDTable -Title "Server Information" -Headers @("Severity", "Name",'Affected Hosts') -Endpoint {
    1..10 | foreach {
      [pscustomobject]@{
        Severity = 'CRITICAL'
        Name = New-UDLink -Text 'KB123456' -Url "localhost\kb123456"
        'Affected Hosts' = '123'
      }
    }| Out-UDTableData -Property @("Severity", "Name",'Affected Hosts')
  }
 
 
 
New-UDCard -Id 'CardDisplayNameCARD' -Title 'DisplayName Card' -Endpoint {
         New-UDParagraph -Text $Session:DisplayName
    }
      
    New-UDInput -Title "Input testing" -Id "MyUserForm" -Content {
        New-UDInputField -Type 'textbox' -Name 'InputDisplayName' -Placeholder 'Name Here!'
  
    } -Endpoint {
  
        param($InputDisplayName)
          
        $Session:DisplayName = $InputDisplayName
  
         Sync-UDElement -Id 'CardDisplayNameCARD'
    }
 
 
 
 
 
 
 
 
 
 
#region Page 5
$DynamicUserPage2 = New-UDPage -Url "/compare/:Username1/:$username2" -Icon user_o -Endpoint {
param($Username1,$Username2)
 
        $job = Start-RSJob -ScriptBlock { Initialize-CitrixUserReports -XMLParameterFilePath "$ParametersFolder\Parameters.xml" -Username1 $Username1 -Username2 $Username2 }
        do {
            Show-UDModal -Content { New-UDHeading -Text "Calculating" } -Persistent
            Start-Sleep -Seconds 10
            Hide-UDModal
        } until ($job.State -notlike 'Running')
 
        $UserCompare = Get-Item ((Get-ChildItem $ReportsFolder\XDUsers\*.html | Sort-Object -Property LastWriteTime -Descending)[0]) | select *
        New-UDCollapsible -Items {
        New-UDCollapsibleItem -Icon arrow_circle_right -Content { New-UDHtml ([string](Get-Content $UserCompare.FullName)) } -Active -BackgroundColor lightgrey -FontColor black
        }
}
#endregion
 
 
             $job = Start-RSJob -ScriptBlock { Initialize-CitrixUserReports -XMLParameterFilePath "$ParametersFolder\Parameters.xml" -Username1 $Username1 -Username2 $Username2 }
            $UserCompare = Get-Item ((Get-ChildItem $ReportsFolder\XDUsers\*.html | Sort-Object -Property LastWriteTime -Descending)[0]) | select *
            do {
                Show-UDModal -Content { New-UDHeading -Text "Comparing $Username1 with $Username2" } -Persistent
                Start-Sleep -Seconds 10
                Hide-UDModal
            } until ($job.State -notlike 'Running')
 
 
New-UDInput -Title "Module Info Locator" -Endpoint {
    param($ModuleName)
 
    # Get a module from the gallery
    $Module = Find-Module $ModuleName
 
    # Output a new card based on that info
    New-UDInputAction -Content @(
        New-UDCard -Title "$ModuleName - $($Module.Version)" -Text $Module.Description
    )
}
 
 
 
 New-UDInput -Title "Simple Form" -Id "Form" -Content {
    New-UDInputField -Type 'textbox' -Name 'Email' -Placeholder 'Email Address'
    New-UDInputField -Type 'checkbox' -Name 'Newsletter' -Placeholder 'Sign up for newsletter'
    New-UDInputField -Type 'select' -Name 'FavoriteLanguage' -Placeholder 'Favorite Programming Language' -Values @("PowerShell", "Python", "C#")
    New-UDInputField -Type 'radioButtons' -Name 'FavoriteEditor' -Placeholder @("Visual Studio", "Visual Studio Code", "Notepad") -Values @("VS", "VSC", "NP")
    New-UDInputField -Type 'password' -Name 'password' -Placeholder 'Password'
    New-UDInputField -Type 'textarea' -Name 'notes' -Placeholder 'Additional Notes'
} -Endpoint {
    param($Email, $Newsletter, $FavoriteLanguage, $FavoriteEditor, $password, $notes)
}
 
 
  
 
 
#New-UDGridLayout -Content {
# New-UDCard -Title "Card 1" -Id 'Card1'
# New-UDCard -Title "Card 2" -Id 'Card2'
# New-UDCard -Title "Card 3" -Id 'Card3'
 
 
 
 
 
$CompareUsers = New-UDPage -Name 'ADUser' -Icon user -Title 'Compare users' -Content {
    New-UDInput -Title "User Details" -Endpoint {
        param @($user1, $user2)
        New-UDInputField -Type 'textbox' -Name 'user1' -Placeholder 'Username1'
        New-UDInputField -Type 'textbox' -Name 'user2' -Placeholder 'Username2'
        New-UDInputAction -RedirectUrl "/dynamic/$User1" }
}
 
$DynamicUserPage = New-UDPage -Url "/dynamic/:User1" -Icon address_book -Endpoint {
        param @($user1, $user2)
}
#>