We are moving some dashboards that where working with the Universal Dashboard community version and ran into an error when restructuring the powershell.
We are developing a set/ list of data pulled from ADO rest api, that provides version info. We are loading this using powershell outside the New-UDDashboard and then consuming the data in the dashboard.
we are getting this error on each of the cache:datalist lines where we define the 4 New-UDGrid elements.
couple of questions.
-
In powershell universal, can you process data outside of the New-UDDashboard element or do you have to do that inside?
-
What would cause this to not work when in Powershell universal?
---- ERROR: -----
C:\ProgramData\PowerShellUniversal\Server\Modules\UniversalDashboard\4.1.0\UniversalDashboard.psd1
Startup: Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.
Startup: at <ScriptBlock>, C:\ProgramData\UniversalAutomation\Repository\dashboards\version\version.ps1: line 176
at <ScriptBlock>, <No file>: line 1
----- Dashboard Script ------
$PAToken = "dfsdfsdfsfsdfsdfsdfsfsdfsfsdfsdfsdfsdfsfsfsfsf"
$Headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($PAToken)")) }
$DashboardName = 'AzureDevOpsBuildDashboard'
$Init = New-UDEndpointInitialization -Variable @('OrgName', 'PAToken', 'uri', 'Headers')
$BuildRefresh = New-UDEndpointSchedule -Every 10 -Minute
$buildDataRefresh = New-UDEndpoint -Schedule $BuildRefresh -Endpoint {
$Cache:dataList = [System.Collections.Generic.List[pscustomobject]]::new()
<.....code to format data .....>
$Cache:dataList.Add(
[pscustomobject]@{
'ProjectId' = $def.id
'ApplicationName' = $def.Name
'Type' = $type
'CI' = (New-UDLink -Text $ciVersion -Url $ciUrl)
'QA' = (New-UDLink -Text $qaVersion -Url $qaUrl)
}
)
}
}
Sync-UDElement -Id 'gridapp'
Sync-UDElement -Id 'griddb'
Sync-UDElement -Id 'griddocker'
Sync-UDElement -Id 'gridmobile'
}
$gridapp = New-UDGrid -Id 'gridapp' -Title "Release Information" -PageSize 30 -Headers @('ApplicationName', 'CI', 'QA') -Properties @('ApplicationName', 'CI', 'QA') -Endpoint {
<line 176> $Cache:dataList | Where-Object -Property 'Type' -EQ "Application" | Out-UDGridData
}
$griddb = New-UDGrid -Id 'griddb' -Title "Release Information" -PageSize 30 -Headers @('DatabaseName', 'CI', 'QA') -Properties @('ApplicationName', 'CI', 'QA') -Endpoint {
$Cache:dataList | Where-Object -Property 'Type' -EQ "Database" | Out-UDGridData
}
$griddocker = New-UDGrid -Id 'griddocker' -Title "Release Information" -PageSize 30 -Headers @('ApplicationName', 'CI', 'QA') -Properties @('ApplicationName', 'CI', 'QA') -Endpoint {
$Cache:dataList | Where-Object -Property 'Type' -EQ "Docker" | Out-UDGridData
}
$tabs = New-UDTabs -Tabs {
New-UDTab -Text "Applications" -Content {
New-UDElement -Tag 'div' -Content {
$gridapp
}
}
New-UDTab -Text "Database" -Content {
New-UDElement -Tag 'div' -Content {
$griddb
}
}
New-UDTab -Text "Docker" -Content {
New-UDElement -Tag 'div' -Content {
$griddocker
}
}
}
New-UDDashboard -Title 'PowerShell Universal' -Content{ $tabs }