Hello,
I want to get both the title of each UDCollapsibleItem, and its content to be refreshed automatically from time to time but I don’t get it
In the code fragment that I put below I can only refresh the content but not the title, since the variable $ Color_estado_sccm, changes during execution, but its content is not refreshed.
Any ideas?
Thank you.
Start-UdDashboard -Content {
New-UdDashboard -Title "Main Title" -Color '#FF050F7F' -Content {
New-UdColumn -Size 10 -Content {
New-UDCollapsible -Popout -Items {
New-UDCollapsibleItem -Title "$titulo_sccm" -FontColor "$Color_estado_sccm" -Icon arrow_circle_right -Content {
New-UdGrid -Title "Title 1" -Headers $columnas -Properties $columnas -Endpoint {
$maquinas_sccm = @()
actualizar_lista_servidores ([ref]$maquinas_sccm) ($servicio_sccm) ($cache:estados_sccm)
$maquinas_sccm | Out-UDGridData
} -AutoRefresh -RefreshInterval 120
}
New-UDCollapsibleItem -Title "$titulo_fss" -FontColor "$Color_estado_fss" -Icon arrow_circle_right -Content {
New-UdGrid -Title "Title 2" -Headers $columnas -Properties $columnas -Endpoint {
$maquinas_fss = @()
actualizar_lista_servidores ([ref]$maquinas_fss) ($servicio_fss) ($cache:estados_fss)
$maquinas_fss | Out-UDGridData
} -AutoRefresh -RefreshInterval 120
}
}
}
}
} -Endpoint $Cada5min_sccm, $Cada5min_fss -Port 10002 -AutoReload
it’s not possible atm, you would need to make a new endpoint around your stuff, and then make that update.
New-UDElement -Tag ‘div’ -AutoRefresh -RefreshInterval 120 -Endpoint {
New-UDCollapsibleItem -Title “$titulo_sccm” -FontColor “$Color_estado_sccm” -Icon arrow_circle_right -Content {
New-UdGrid -Title "Title 1" -Headers $columnas -Properties $columnas -Endpoint {
$maquinas_sccm = @()
actualizar_lista_servidores ([ref]$maquinas_sccm) ($servicio_sccm) ($cache:estados_sccm)
$maquinas_sccm | Out-UDGridData
}
}
New-UDCollapsibleItem -Title "$titulo_fss" -FontColor "$Color_estado_fss" -Icon arrow_circle_right -Content {
New-UdGrid -Title "Title 2" -Headers $columnas -Properties $columnas -Endpoint {
$maquinas_fss = @()
actualizar_lista_servidores ([ref]$maquinas_fss) ($servicio_fss) ($cache:estados_fss)
$maquinas_fss | Out-UDGridData
}
}
}
1 Like
Hi @McAndersDK,
With your indications I have managed to see that UDCollapsibleItem’s is updated, but the $ color_state_sccm variable does not seem to be updated in the UDCollapsibleItem title with the new color assigned to the variable.
Outside of Start-UDdashboard I have the following code that changes the content of the variable $ color_estado_sccm.
This is the code that affects this behavior:
$schedule5 = New-UDEndpointSchedule -Every 5 -Minute
$Color_estado_sccm = "Black"
$Cada5min_sccm = New-UDEndpoint -Schedule $Schedule5 -Endpoint {
$Color_estado_sccm = "Red"
# ..... some code
}
}
Start-UdDashboard -Content {
New-UdDashboard -Title "Main Title" -Color '#FF050F7F' -Content {
New-UdColumn -Size 10 -Content {
New-UDElement -Tag ‘div’ -AutoRefresh -RefreshInterval 120 -Endpoint {
New-UDCollapsible -Popout -Items {
# ------------------------------------------------- SERVICIOS -----------------------------------------------
# -- SCCM
New-UDCollapsibleItem -Title "$titulo_sccm" -FontColor "$Color_estado_sccm" -Icon arrow_circle_right -Content {
New-UdTable -Title "Maquinas del servicio" -Header $columnas -Endpoint {
$maquinas_sccm = @()
actualizar_lista_servidores ([ref]$maquinas_sccm) ($servicio_sccm) ($cache:estados_sccm)
$maquinas_sccm | Out-UDTableData -Property $columnas
} #-AutoRefresh -RefreshInterval 120
}
# ---------------------------------------------------------------------------------------------------------------
}
}
}
}
} -Endpoint $Cada5min_sccm -Port 10002 -AutoReload
Thanks
you need to save the variable in $cache, unless it will not be exposed to other endpoints.
1 Like
Hi @McAndersDK, your solution works fine
Thank you very much