New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a reporting dashboard #1003

Open
michaellwest opened this Issue May 15, 2018 · 4 comments

Comments

@michaellwest
Member

michaellwest commented May 15, 2018

Need some way for developers to author reports that appear on a dashboard.

@michaellwest

This comment has been minimized.

Show comment
Hide comment
@michaellwest

michaellwest May 15, 2018

Member
  • Build UI for reporting
  • Add to packaging for authorable reports.
Member

michaellwest commented May 15, 2018

  • Build UI for reporting
  • Add to packaging for authorable reports.
@michaellwest

This comment has been minimized.

Show comment
Hide comment
@michaellwest

michaellwest Sep 20, 2018

Member

Need to check for when the report node does not exist.

Need to check that chartData.Results is not null.

Verify that this line called by the Rendering-Usage report does not fail when there is a broken link. May just need to wrap the call to Get-ItemReferrer in a try/catch.

.Select(link => link.GetSourceItem())

Member

michaellwest commented Sep 20, 2018

Need to check for when the report node does not exist.

Need to check that chartData.Results is not null.

Verify that this line called by the Rendering-Usage report does not fail when there is a broken link. May just need to wrap the call to Get-ItemReferrer in a try/catch.

.Select(link => link.GetSourceItem())

@michaellwest

This comment has been minimized.

Show comment
Hide comment
@michaellwest

michaellwest Sep 20, 2018

Member

Decided to make the Template Usage and Rendering Usage as standard reports. Way too much data to show on the dashboard.

Member

michaellwest commented Sep 20, 2018

Decided to make the Template Usage and Rendering Usage as standard reports. Way too much data to show on the dashboard.

@michaellwest

This comment has been minimized.

Show comment
Hide comment
@michaellwest

michaellwest Sep 21, 2018

Member

Removing these reports.

Import-Function -Name Invoke-ApiScript

$script = {
    $ignorePattern = "^(" + ("Branches/System","Common","List Manager", "Sample", "System" -join "|") + ")"
    $templates = [Sitecore.Data.Managers.TemplateManager]::GetTemplates((Get-Database "master"))
    $columns = [System.Collections.ArrayList]@()
    foreach($template in $templates) {
        if($template -and ($template.Value.FullName -notmatch $ignorePattern) -and -not ($template.GetType().Name -match "ErrorRecord")) {
            $templateItem = Get-Item master:\ -ID $template.Value.ID
            $items =@(Get-ItemReferrer -Database "master" -ID $template.Value.ID | Where-Object { $template.Name -ne "__Standard Values"})
            $columns.Add(@($template.Value.Name, $items.Count)) > $null
        }
    }
    
    [ordered]@{
        "title" = "Template Usage"
        "data" = [ordered]@{
            "columns" = @($columns)
            "type" = "bar"
        }
        "size" = @{
            "height" = 450
            "width" = 800
        }
    }
}

Invoke-ApiScript -ScriptBlock $script -Arguments $scriptArguments 
Import-Function -Name Invoke-ApiScript

$script = {

    filter IsRendering {
        # Look for Controller and View renderings
        $renderingIds = @("{2A3E91A0-7987-44B5-AB34-35C2D9DE83B9}","{99F8905D-4A87-4EB8-9F8B-A9BEBFB3ADD6}")
        if(($renderingIds -contains $_.TemplateID)) { $_; return }
    }
    
    $database = "master"
    
    # Renderings Root
    $renderingsRootItem = Get-Item -Path "$($database):{32566F0E-7686-45F1-A12F-D7260BD78BC3}"
    $items = $renderingsRootItem.Axes.GetDescendants() | Initialize-Item | IsRendering

    $columns = [System.Collections.ArrayList]@()
    foreach($item in $items) {
        $count = 0
        $referrers = Get-ItemReferrer -Item $item
        if ($referrers -ne $null) {
            $count = $referrers.Count
        }
        
        $columns.Add(@($item.Name, $count)) > $null
    }

    [ordered]@{
        "title" = "Rendering Usage"
        "data" = [ordered]@{
            "columns" = @($columns)
            "type" = "bar"
        }
        "size" = @{
            "height" = 450
            "width" = 800
        }
        "donut" = @{
            "title" = "Rendering Usage"
        }
    }
}

Invoke-ApiScript -ScriptBlock $script -Arguments $scriptArguments
Member

michaellwest commented Sep 21, 2018

Removing these reports.

Import-Function -Name Invoke-ApiScript

$script = {
    $ignorePattern = "^(" + ("Branches/System","Common","List Manager", "Sample", "System" -join "|") + ")"
    $templates = [Sitecore.Data.Managers.TemplateManager]::GetTemplates((Get-Database "master"))
    $columns = [System.Collections.ArrayList]@()
    foreach($template in $templates) {
        if($template -and ($template.Value.FullName -notmatch $ignorePattern) -and -not ($template.GetType().Name -match "ErrorRecord")) {
            $templateItem = Get-Item master:\ -ID $template.Value.ID
            $items =@(Get-ItemReferrer -Database "master" -ID $template.Value.ID | Where-Object { $template.Name -ne "__Standard Values"})
            $columns.Add(@($template.Value.Name, $items.Count)) > $null
        }
    }
    
    [ordered]@{
        "title" = "Template Usage"
        "data" = [ordered]@{
            "columns" = @($columns)
            "type" = "bar"
        }
        "size" = @{
            "height" = 450
            "width" = 800
        }
    }
}

Invoke-ApiScript -ScriptBlock $script -Arguments $scriptArguments 
Import-Function -Name Invoke-ApiScript

$script = {

    filter IsRendering {
        # Look for Controller and View renderings
        $renderingIds = @("{2A3E91A0-7987-44B5-AB34-35C2D9DE83B9}","{99F8905D-4A87-4EB8-9F8B-A9BEBFB3ADD6}")
        if(($renderingIds -contains $_.TemplateID)) { $_; return }
    }
    
    $database = "master"
    
    # Renderings Root
    $renderingsRootItem = Get-Item -Path "$($database):{32566F0E-7686-45F1-A12F-D7260BD78BC3}"
    $items = $renderingsRootItem.Axes.GetDescendants() | Initialize-Item | IsRendering

    $columns = [System.Collections.ArrayList]@()
    foreach($item in $items) {
        $count = 0
        $referrers = Get-ItemReferrer -Item $item
        if ($referrers -ne $null) {
            $count = $referrers.Count
        }
        
        $columns.Add(@($item.Name, $count)) > $null
    }

    [ordered]@{
        "title" = "Rendering Usage"
        "data" = [ordered]@{
            "columns" = @($columns)
            "type" = "bar"
        }
        "size" = @{
            "height" = 450
            "width" = 800
        }
        "donut" = @{
            "title" = "Rendering Usage"
        }
    }
}

Invoke-ApiScript -ScriptBlock $script -Arguments $scriptArguments

michaellwest added a commit that referenced this issue Sep 21, 2018

#1003 : Updated dashboard reports.
Converted some to a regular report.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment