ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
34 stars 2 forks source link

Cannot link to a tab #3426

Closed timoline closed 1 month ago

timoline commented 2 months ago

Version

4.3.0

Severity

Low

Environment

IIS

Steps to Reproduce

Hello, I want to link to a page to a specific tab (within psu) Normally you can use # in the url, but it doestn't work.

Maybe I do something wrong, or maybe it's a bug?

Expected behavior

link to a specific tab

Actual behavior

doesn't link to a specific tab

Additional Environment data

No response

Screenshots/Animations

No response

Omzig commented 1 month ago

We almost need a new property called -ActiveTab. Then we could gather the $query and get the tab name and then pass it into the New-UDTabs cmdlet.

timoline commented 1 month ago

I understand you labelled it as low prio, but for our customers is this the nr1 feature request. How can I motive you to give it more love/prio? (create a support ticket?)

eizedev commented 1 month ago

We also have a priority for this, as otherwise tabs are not completely usable for us in many places and we have so far built a workaround using buttons, among other things. I thought I had also opened an issue about this last year, but I was probably wrong. In any case, we are also very interested in this and look forward to its implementation. Thank you very much.

adamdriscoll commented 1 month ago

Here's an example that work with the current release. We can look at implementing this directly.

New-UDApp -Content { 
    $Tabs = @(
        New-UDTab -Text 'Tab1' -Id 'tab1' -Content {
            "Tab 1" 
        }  
        New-UDTab -Text 'Tab2' -Id 'tab2' -Content {
            "Tab 2" 
        }  
        New-UDTab -Text 'Tab3' -Id 'tab3' -Content {
            "Tab 3" 
        } 
    )

    $hash = Invoke-UDJavaScript "window.location.hash"
    $SelectedTabIndex = 0

    if ($hash -ne $null)
    {
        for ($i=0; $i -lt $tabs.Length; $i++){
            if ($tabs[$i].id -eq $hash.TrimStart('#'))
            {
                $SelectedTabIndex = $i
            }
        }
    }

    New-UDTabs -Tabs {
        $Tabs
    }  -SelectedTabIndex $SelectedTabIndex
 }
MikeShepard commented 1 month ago

-SelectedTabIndex isn't in the Tabs doc page or online cmdlet doc for New-UDTabs

image

Also, the New-UDTabs link at the bottom of the Tabs topic goes to New-UDStepper: image

adamdriscoll commented 1 month ago

Will get those items fixed. Not sure why it didn't get into the cmdlet help because that should just be auto-generated. We even push a PR during release to update that repo.

adamdriscoll commented 1 month ago

This has been implemented in the code base as well. This work around won't be necessary in 4.3.3.

timoline commented 1 month ago

Works perfect!! (in 4.3.3) Thank you for the quick implementation.