Update open-dashboards.ps1

This commit is contained in:
Markus Fleschutz 2023-05-20 09:53:24 +02:00
parent 3fbba09e62
commit 8f1369e0ff

View File

@ -13,19 +13,20 @@
try { try {
$stopWatch = [system.diagnostics.stopwatch]::startNew() $stopWatch = [system.diagnostics.stopwatch]::startNew()
Write-Progress " Loading Data/popular-dashboards.csv..." Write-Host "⏳ (1/2) Loading Data/popular-dashboards.csv..."
$Table = Import-CSV "$PSScriptRoot/../Data/popular-dashboards.csv" $Table = Import-CSV "$PSScriptRoot/../Data/popular-dashboards.csv"
$NumRows = $Table.Length $NumRows = $Table.Length
Write-Host "⏳ (2/2) Opening dashboards in Web browser: " -noNewLine
foreach($Row in $Table) { foreach($Row in $Table) {
$Name = $Row.NAME $Name = $Row.NAME
$URL = $Row.URL $URL = $Row.URL
Write-Progress "⏳ Opening $Name in your browser..." Write-Host "$Name, " -noNewline
& "$PSScriptRoot/open-default-browser.ps1" "$URL" & "$PSScriptRoot/open-default-browser.ps1" "$URL"
Start-Sleep -milliseconds 100 Start-Sleep -milliseconds 100
} }
Write-Progress -completed "." Write-Host ""
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Opened $NumRows Web dashboards in $elapsed sec (use switch-tabs.ps1 to switch the tabs automatically)" "✅ Opened $NumRows dashboards in $elapsed sec (use switch-tabs.ps1 to switch the tabs automatically)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"