pages/analytics.ps1

#Total Jobs Run
#Average Daily Jobs
#Job by Day Chart

# JOb Rate
# Average Runtime
# Longest Running SCripts


New-UDPage -Name "Analytics" -Icon chart_line -Content {

    New-UDHelmet -Content {
        New-UDHtmlTag -Tag 'title' -Content { "Universal Automation / Analytics" }
    }

    New-UDRow -Endpoint {
    
        New-UDElement -Tag 'div' -Endpoint {
            
            $Cache:Stats = Get-UAStats #PERF WARNING :)
            $Jobs = Get-UAJob
            $CompletedJobs | Where-Object -Property Status -eq -Value Completed
            $FailedJobs | Where-Object -Property Status -eq -Value Completed
            $Scripts = Get-UAScript
            $UAGitStats = Get-UAGitStatus

            New-UDTabContainer -Tabs {
                
                New-UDTab -Text 'Job Analytics' -Content {
                    
                    New-UDColumn -SmallSize 3 -Content {
                        New-UDCounter -Title "Total Jobs Run" -Endpoint {
                            $Cache:Stats.JobsRunAllTime
                        } -BackgroundColor "#4452B8" -FontColor '#ffffff' -Icon check_circle -TextSize Medium
                    }
                    New-UDColumn -SmallSize 3 -Content {
                        New-UDCounter -Title "Total Jobs Successful" -Endpoint {
                            $Cache:Stats.JobsSuccessAllTime
                        } -BackgroundColor '#4caf50' -FontColor "#ffffff" -Icon calendar_check -TextSize Medium
                    }
                    New-UDColumn -SmallSize 3 -Content {
                        New-UDCounter -Title "Total Jobs Failed" -Endpoint {
                            $Cache:Stats.JobsFailedAllTime
                        } -BackgroundColor '#ff1744' -FontColor "#ffffff" -Icon times_circle -TextSize Medium
                    }

                    
                    New-JobHistoricalChart



                    
                }
                    
                New-UDTab -Text 'Script Analytics' -Content {
                    New-UDColumn -SmallSize 3 -Content {
                        New-UDCounter -Title "Total Scripts" -Endpoint {
                            $Scripts.Count
                        } -BackgroundColor "#4caf50" -FontColor '#ffffff' -Icon check_circle -TextSize Medium
                    }
                }
                
                New-UDTab -Text 'Development Analytics' -Content {
                    #Something about GITS / AUTHORING
                    New-UDColumn -SmallSize 3 -Content {
                        New-UDCounter -Title "Git Changes" -Endpoint {
                            $UAGitStats.Changes
                        } -BackgroundColor "#3f51b5" -FontColor '#ffffff' -Icon edit -TextSize Medium
                    }

                    New-UDColumn -SmallSize 3 -Content {
                        New-UDCounter -Title "Sync Time" -Endpoint {
                            ($UAGitStats.SyncTime).Seconds
                        } -BackgroundColor '#1769aa' -FontColor "#ffffff" -Icon times_circle -TextSize Medium
                    }

                }
                
                New-UDTab -Text 'Usage Analytics' -Content {
                    # Most active Users
                    # Users who own most scripts
                    # MINUTES SAVED
                   
                }

            }

        }
                
    }
}