This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

ADDING CUSTOM TABS TO THE TOP LEVEL NAV BAR with the API

Inspired by wluther​'s post on how to edit the db to create your own custom menu drop downs (Adding Custom Tabs To The Top Level Nav Bar  ) I went ahead and scripted up some tools to simplify the process.

pastedImage_0.png

The basic explanation is that when the menu bars were redone as part of the UX update last year they added a few tables to the database that we will be manipulating to add our own additional toolbars.  Obviously keep in mind that database edits of this nature are unsupported so you should take precautions such as backing up your database before you get in there and start banging around, but once you are comfortable with the concept you may find yourself using it a lot.

Essentially it boils down to adding the drop down menu you want to the table callled WebViewGroup, then adding the link you want to the table called WebView, then linking those objects together via an entry on the table called WebViewGroupWebView.

The first tool I made, AddCustomMenusInteractively.ps1, is just a quick little prompt driven powershell script that will ask you for the name of the menu you want to add entries too, if that menu doesn't exist it creates it.

Then it asks you for the URL and Title you want your link to have.  If you wanted to add multiple new entries just run the tool again and tell it to use the same menu title as you created in the previous runs.  It's currently set up to run it locally on your Orion server and passes through your Windows login credential but you can edit it to work other ways if you need.

pastedImage_2.png

***A fun new trick I recently learned is that any items you add under the Alerts & Activity or the Reports drop downs will also become check boxes in the user account settings, so you can one by one control which menus users have access to***

pastedImage_3.png

The second tool, AddCustomMenuSettingsLinks.ps1, is geared more as a time saving tool for myself.  As the SW admin I spend a ton of time bouncing between the settings menus and having to click into all settings, wait for that to load, then drill down into the next layer(s) that I needed to keep going to be where I want to be always annoyed me.  This adds a pre-populated stack of admin type links to the settings drop down.  I like putting them there because if an account isn't an admin in Orion they won't have that drop down available to them.  You can remove any links you don't need by commenting or deleting them from the big array of them around line 44.  The one big issue I learned when I made this is that can be some graphical glitches if your list is too long because the black background seems to only go to about 2/3 down the screen, the specific limit in terms of how many rows that is varies based on your screen resolution.  For my laptop it looks like about 23 rows is my max unless I zoom way out.  So staying under 20 rows in each menu is probably a reasonable practice there.

pastedImage_3.png   

pastedImage_0.png

I'd love to see anyone else post up whatever cool things you all come up with as far as these menu bars.

-Marc Netterfield

    Loop1 Systems: SolarWinds Training and Professional Services

And for the people who have a hard time downloading the links here is the text of the scripts

######################## AddCustomMenusInteractively ##################################

<#------------- CONNECT TO SWIS -------------#>

# load the snappin if it's not already loaded (step 1)

if (!(Get-PSSnapin | Where-Object { $_.Name -eq "SwisSnapin" })) {

    Add-PSSnapin "SwisSnapin"

}

$hostname = "localhost"

$swis = Connect-Swis -Hostname $hostname -Trusted

#alternative connection method

#$user = "user"

#$password = "pass"

#$swis = connect-swis -host $hostname -username $user -password $password -ignoresslerrors

<#------------- ACTUAL SCRIPT -------------#>

$MenuTitle = Read-Host -Prompt "What is the title of the drop down menu you want to work with?"

# check if that drop down already exiss

$MenuTest = get-swisdata $swis @"

SELECT ID, Name, DefaultTitle, Tags, SortOrder, OrionFeatureName, URI

FROM Orion.Web.ViewGroup

where DefaultTitle = '$MenuTitle'

"@

if (!$MenuTest) {

    $MenuProps = @{

    Name = $MenuTitle.replace(' ','')

    DefaultTitle = $MenuTitle

    Tags = "navigation"

    SortOrder = 99

}

    "`Creating new menu called $MenuTitle"

    $MenuResults = New-SwisObject -SwisConnection $swis -EntityType "Orion.Web.ViewGroup" -Properties $MenuProps

} else {

    $MenuResults = $MenuTest.URI

}

"`Menu called $MenuTitle exists..."

$ViewURL = Read-Host -Prompt "What is the URL you want to add to this menu? (You can provide full URL's or use relative links by starting the address with a '/')"

$ViewTitle = Read-Host -Prompt "What is the title you want to give to this item?"

$ViewProps = @{

    Name = $ViewTitle.replace(' ','-')

    DefaultTitle = $ViewTitle

    Type = "legacy"

    URL = $ViewURL

    IsCustom = "True"

    SortOrder = 0

    OpenInNewWindow = "False"

}

"`Creating new menu item called $ViewTitle under $MenuTitle"

$ViewResults = New-SwisObject -SwisConnection $swis -EntityType "Orion.Web.View" -Properties $ViewProps

$MenuID = get-swisdata $swis @"

SELECT ID FROM Orion.Web.ViewGroup where uri = '$MenuResults'

"@

$ViewID = get-swisdata $swis @"

SELECT ID FROM Orion.Web.View where uri = '$ViewResults'

"@

$LinkViewtoGroup = Invoke-SwisVerb $swis 'Orion.Reporting' 'ExecuteSQL' @"

INSERT WebViewGroupWebView (WebViewGroupID, WebViewID, SortOrder)

VALUES ($MenuID,$ViewID,0)

"@

$ClearCache = Invoke-SwisVerb $swis 'Orion.Web.Menu' 'ClearCache' -Arguments ""

############################## End #########################################

######################## AddCustomMenSettingsLinks ##################################

<#------------- CONNECT TO SWIS -------------#>

# load the snappin if it's not already loaded (step 1)

if (!(Get-PSSnapin | Where-Object { $_.Name -eq "SwisSnapin" })) {

    Add-PSSnapin "SwisSnapin"

}

$hostname = "localhost"

$swis = Connect-Swis -Hostname $hostname -Trusted

#alternative connection method

#$user = "user"

#$password = "pass"

#$swis = connect-swis -host $hostname -username $user -password $password -ignoresslerrors

<#------------- ACTUAL SCRIPT -------------#>

$MenuTitle = "Settings"

# check if that drop down already exiss

$MenuTest = get-swisdata $swis @"

SELECT ID, Name, DefaultTitle, Tags, SortOrder, OrionFeatureName, URI

FROM Orion.Web.ViewGroup

where DefaultTitle = '$MenuTitle'

"@

if (!$MenuTest) {

    $MenuProps = @{

    Name = $MenuTitle.replace(' ','')

    DefaultTitle = $MenuTitle

    Tags = "navigation"

    SortOrder = 99

}

    "`Creating new menu called $MenuTitle"

    $MenuResults = New-SwisObject -SwisConnection $swis -EntityType "Orion.Web.ViewGroup" -Properties $MenuProps

} else {

    $MenuResults = $MenuTest.URI

}

"`Menu called $MenuTitle exists..."

$Links = @(

    @{ URL = "/Orion/Nodes/Add/Default.aspx"; Title = "Add Node";},

    @{ URL = "/Orion/AgentManagement/Admin/ManageAgents.aspx"; Title = "Manage Agents";},

    @{ URL = "/Orion/Admin/Accounts/Accounts.aspx"; Title = "Manage Orion Accounts";},

    @{ URL = "/Orion/Alerts/Default.aspx"; Title = "Manage Alerts";},

    @{ URL = "/Orion/Admin/PollingSettings.aspx"; Title = "Polling Settings";},

    @{ URL = "/Orion/Admin/Credentials/CredentialManager.aspx"; Title = "Manage Orion Credentials - Windows";},

    @{ URL = "/Orion/Admin/Credentials/SNMPCredentialManager.aspx"; Title = "Manage Orion Credentials - SNMPv3";},

    @{ URL = "/Orion/Admin/CPE/Default.aspx"; Title = "Manage Custom Properties";},

    @{ URL = "/Orion/Admin/CPE/InlineEditor.aspx"; Title = "Edit Custom Properties";},

    @{ URL = "/Orion/Admin/DependenciesView.aspx"; Title = "Manage Dependencies";},

    @{ URL = "/Orion/Admin/Containers/Default.aspx"; Title = "Manage Groups";},

    @{ URL = "/Orion/Reports/Default.aspx"; Title = "Manage Reports";},

    @{ URL = "/Orion/Admin/ListViews.aspx"; Title = "Manage Views";},

    @{ URL = "/Orion/WorldMap/Manage.aspx?"; Title = "Manage Worldwide Map";},

    @{ URL = "/Orion/APM/Admin/Default.aspx"; Title = "SAM Settings";},

    @{ URL = "/Orion/APM/Admin/Applications/Default.aspx"; Title = "Manage Assigned Applications";},

    @{ URL = "/Orion/APM/Admin/ApplicationTemplates.aspx"; Title = "Manage Application Templates";},

    @{ URL = "/Orion/APM/Admin/Components/Templates.aspx"; Title = "Manage Application Components";},

    @{ URL = "/Orion/NCM/Admin/Default.aspx"; Title = "NCM Settings";},

    @{ URL = "/Orion/TrafficAnalysis/Admin/NetflowSettings.aspx"; Title = "NTA Settings";},

    @{ URL = "/Orion/Admin/Details/ModulesDetailsHost.aspx"; Title = "License Details";}

)

$Order = 1

foreach ($Link in $links) {

    $ViewURL = $Link.URL

    $ViewTitle = $Link.Title

    $ViewProps = @{

        Name = $ViewTitle.replace(' ','-')

        DefaultTitle = $ViewTitle

        Type = "legacy"

        URL = $ViewURL

        IsCustom = "True"

        SortOrder = $Order++ # alternatively you can set all your rows to have the same order and Orion will sort alphabetically

        OpenInNewWindow = "False"

    }

    "`Creating new menu item called $ViewTitle under $MenuTitle"

    $ViewResults = New-SwisObject -SwisConnection $swis -EntityType "Orion.Web.View" -Properties $ViewProps

    $MenuID = get-swisdata $swis " SELECT ID FROM Orion.Web.ViewGroup where uri = '$MenuResults' "

    $ViewID = get-swisdata $swis " SELECT ID FROM Orion.Web.View where uri = '$ViewResults' "

    $LinkViewtoGroup = Invoke-SwisVerb $swis 'Orion.Reporting' 'ExecuteSQL' @"

INSERT WebViewGroupWebView (WebViewGroupID, WebViewID, SortOrder)

VALUES ($MenuID,$ViewID,$Order)

"@

}

$ClearCache = Invoke-SwisVerb $swis 'Orion.Web.Menu' 'ClearCache' -Arguments ""

############################## End #########################################

attachments.zip
Parents Reply Children
No Data