#1 - I dont see why you couldnt do this using the PSU API. Im not too familiar with it as I havent used that side of PSU much but i’m aware of the command Invoke-UAScript which also offers a -wait param if you wish for it to wait or just trigger and move on, so you have the option for either.
There’s also Get-UAJob and Wait-UAJob
#2 - I’m not 100% sure about this one, I’ll be honest I was making a few assumptions on how I used to do this back in the old version of universal dashboard (before it became PSU). I basically used to have a sync-udelement sat inside one of my API endpoints, and I’d call that (passing in an ID of the element i wanted to update). I’m assuming something similar can be done, if not directly in the PSU script, maybe via an API, but havent fully tested this in PSU.
#3 - I think I follow. If you follow the ‘simple’ example here: Table - PowerShell Universal
which takes column information from your data array automatically, and then instead just give it an empty array, you’ll notice you get a minified react error. This is due to the fact is has no information on what the column headers are supposed to be.
Instead, take a look at the table with custom columns example, in which you specify the columns as a separate parameter, now if you do the same and provide it with an empty array, it will still show the column headers but it wont have any rows.
You could have the table load on page, if you dont have data, keep it empty in this way, then when you use you button click event, you can just perform a ‘set’ on the table element to update it with the new data/get it to refresh. Hope that’s what you mean?
#4 - it doesnt nessesarily have to be the autorefresh flat, which ever way you do it, you can wrap it in a dynamic element, but depending on an if statement and the state of your button/switch, you can modify how your table, region, or whatever element you choose inside that dynamic element, functions, e.g by stopping the autorefresh. Yes you could do it on a per user basis, you’d likley have to take a copy of the data in your cache or from your script output, and store it into a $session variable, and then use that for the table display - so when the user pauses their version of the page or components, its relevant to them at the time of the pause, and it doesnt interfere with everyone else. Basically you’d be creating a cached copy of your script output for that users session. Otherwise, if you do want a pause function that effects everyone browsing, then you’d use a cache variable. Also when you use sync-udelement there’s a -broadcast param, which basically means it will update that component for everyone, otherwise you’ll just update the component for that users session only.