Tables, rendering and dynamic regions

@Support ll start by saying this is probably not the best way of programming this section out but I am generating a table that has a status column. When a user clicks deploy I would like the status for each row one by one to update - first to a progress bar then to the completed or failed status. If completed it will move on, if not the process will stop.

$output = @(
				[pscustomobject]@{
					Details = 'Client Name'
					Data= $LastResults.context.ClientsFullName
					Status = "cn"
				}
				[pscustomobject]@{
					Details = 'Clients FQDN'
					Data= $LastResults.context.ClientsFQDN
					Status = "cf"
				}
				[pscustomobject]@{
					Details = 'Clients Production DNS Server'
					Data= $LastResults.context.ClientsProductionDNSServer
					Status = "cpd"
				}
				[pscustomobject]@{
					Details = 'Clients Disaster Recovery DNS Server'
					Data= $LastResults.context.ClientsDisasterRecoveryDNSServer
					Status = "cdd"
				}
			)
			New-UDGrid -Container -Content {
				New-UDGrid -Item -ExtraSmallSize 12 -Content {
					$columns = @(
						New-UDTableColumn -Property Details -Title Details
						New-UDTableColumn -Property Data -Title Data
						New-UDTableColumn -Property Status -Title Status -Render {
							New-UDDynamic -Id '$EventData.Status' -Content {
								switch ( $session:process )
								{
									cn
									{
										switch ( $session:cn )
										{
											compleated 
											{
											
											}
											Failed
											{
											
											}
											default 
											{
												New-UDProgress -Circular
											}
										}
									}
									default 
									{
										New-UDTypography -Text "Pending Deploy"
									}
								}
							}
						}
					) 
					New-UDTable -data $output -Columns $Columns
				}

New-UDButton -Icon (New-UDIcon -Icon rocket) -Text 'Deploy' -OnClick {
						$session:process = cn
						Sync-UDElement -Id "cn"
}

This is what I have so far but its not updating. Can anyone help me out or point me in the right direction.

thanks

Something like this?

    $session:output = @(
        [pscustomobject]@{
            Details = 'Client Name'
            Data= "FullName"
            Status = "cn"
            DeploymentStatus = 'Pending Deploy'
        }
        [pscustomobject]@{
            Details = 'Clients FQDN'
            Data= "FDQN"
            Status = "cf"
            DeploymentStatus = 'Pending Deploy'
        }
        [pscustomobject]@{
            Details = 'Clients Production DNS Server'
            Data= "DNSServer"
            Status = "cpd"
            DeploymentStatus = 'Pending Deploy'
        }
        [pscustomobject]@{
            Details = 'Clients Disaster Recovery DNS Server'
            Data= "ClientsDisasterRecoveryDNSServer"
            Status = "cdd"
            DeploymentStatus = 'Pending Deploy'
        }
    )
    New-UDGrid -Container -Content {
        New-UDGrid -Item -ExtraSmallSize 12 -Content {
            $columns = @(
                New-UDTableColumn -Property Details -Title Details
                New-UDTableColumn -Property Data -Title Data
                New-UDTableColumn -Property Status -Title Status -Render {
                    $Status = $EventData.Status 
                    New-UDDynamic -Id $Status -Content {
                        $Output = $Session:Output 
                        $Item = $Output | Where-Object Status -eq $Status
                        if ($Item.DeploymentStatus -eq 'Running')
                        {
                            New-UDProgress -Circular
                        }
                        else 
                        {
                            New-UDTypography $Item.DeploymentStatus
                        }
                    }
                }
            ) 
            New-UDTable -data $session:output -Columns $Columns
        }

        New-UDButton -Icon (New-UDIcon -Icon rocket) -Text 'Deploy' -OnClick {
            $Output = $Session:Output
            foreach($item in $Output)
            {
                $item.DeploymentStatus = "Running"
                $Session:Output = $Output
                Sync-UDElement -Id $item.Status
                Start-Sleep 1
                $item.DeploymentStatus = "Completed"
                $Session:Output = $Output
                Sync-UDElement -Id $item.Status
            }
        }
    }

Yes this is what I am looking for. Ill work on that and use it to perform each of the tasks.

Thanks

2 Likes