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.

Make ALL Links, In A SWQL Custom Query Resource, Open In New Tabs By Default

This is a super simple, single file, single line, edit.

ESTIMATED TIME TO INSTALL/PERFORM MODIFICATION: <1 Minute

DIFFICULTY LEVEL:1-Youngling

  1. Youngling (Easiest/Most Basic; no coding experience required, no config wizard required, no system restart required, no system downtime.)
  2. Padawan (Easy/Basic; no coding experience required, possible config wizard required, possible system/services restart required, limited/no downtime.)
  3. Jedi Knight (Moderately Difficult/Advanced; some coding experience required/recommended, config wizard required, possible system/services restart required, limited/short duration downtime.)
  4. Jedi Master (Most Difficult/Advanced; advanced coding experience required, config wizard required, system/services restarts required, 30+ minutes downtime/maintenance window recommended, and other things that I do not even know I would need to know, required...)

For all of those "tabbers", "shift-clickers", and "middle-button mashers" out there, that know the only way to truly use a tabbed browser, is to open so many tabs that you can even see the tabs anymore... this one is for you... And, of course, by you, I mean us...

This simple little modification may have been mentioned elsewhere before, however, I was not fortunate enough to have found it before I figured out how to do it. So, if it has been mentioned before, well, here it is again...

This modification will change the default behavior when clicking on a link within a SWQL Custom Query resource. (Any link, formed within the query, using the "_LinkFor_" alias.)

By default, clicking on a link will load the link in the same page/tab as the source was in.

The new behavior, after making this change, when clicking on a link, will load the link destination in a new tab/page, without the need to shift-click, or middle-mouse button click.

THINGS TO KNOW:

  • I have countless SWQL Custom Query resources scattered throughout my SolarWinds environment.
  • I cannot stand directly clicking links, having them open in the same page/tab.
  • If I can still see the icons on the tabs of Chrome, then I must be sleeping.
  • I am a very inexperienced, and untrained, amateur (with the exception being all things Star Wars related, which does you absolutely no good here...)
    • Always backup your system/files BEFORE making any changes, and/or test with a demo/dev system before making changes to your production environment.
    • Please don't break your system, then blame it on me.
      • If you break your system, then blame it on me, please know, "I don't give a care...", "I told you so...", and/or "Nanna nanna boo boo, stick your head in doo doo..." will most likely be my response...

**WARNING! THE INFORMATION YOU ARE ABOUT TO READ COMES FROM THE MIND OF AN UNTRAINED AMATEUR, AND IS MOST LIKELY FAR, FAR FROM THE BEST PRACTICE**

Filename:

CustomQuery.js

File Location:

\inetpub\SolarWinds\Orion\NetPerfMon\Resources\Misc\

Open the file, and look for the line that has "if (cellInfo.linkColumn) {" (it should be on/around line 160)

The change you will be making will need to be done on the next line, line 161.

Change the RED part, of the line below,

            element = $('<a/>').attr('href', rowArray[cellInfo.linkColumn]);

To match the GREEN part, of the line below,

            element = $('<a Target="_blank" />').attr('href', rowArray[cellInfo.linkColumn]);

Save your file, and you are done!

HERE IS HOW THE DEFAULT CODE LOOKS, BEFORE ANY CHANGES:

        var element;

        if (cellInfo.linkColumn) {

            element = $('<a/>').attr('href', rowArray[cellInfo.linkColumn]);

        } else {

            element = $('<span/>');

        }

AND HERE IS HOW THE CODE SHOULD LOOK AFTER YOUR CHANGE:

        var element;

        if (cellInfo.linkColumn) {

            element = $('<a Target="_blank" />').attr('href', rowArray[cellInfo.linkColumn]);

        } else {

            element = $('<span/>');

        }

Now, you should be able to use the "_LinkFor_" column alias in your SWQL query, on a Custom Query resource, and when you click the link, on the query results, it should, by default, automatically open in a new tab/window.

If you have any questions, or comments, please leave them below, and I will do my best to follow up with you.

Thank you,

-Will

--If you are interested in customizing, and/or modifying your SolarWinds environment, CourtesyIT‌ has put together a terrific "Page of Pages" (PoP), "List of Links" (LoL), okay, you get the idea... Please visit his page, How to do various customizations with your Solarwinds‌, and discover a better way to enhance your SolarWinds environment. Make sure to bookmark, like, and rate his page, as it will help you, as well as others after you.

  • Will -

    Is this little trick still working with  latest version (2018.2) ?

    I updated my  CustomSWQLViewsManager.js  like this:

    element = $('<a Target="_blank" />').attr('href', rowArray[cellInfo.linkColumn]);

    And the links do not open in a new tab.

    BTW this is the first time I tried to implement this mod or any Orion Website Mod. I just added your mod for Custom SWQL Views Manger tonight. Pretty sweet.

    Thanks

    -marc

  • marcv​ Try changing that in the "CustomQuery.js" file instead, which should be in the same folder. It looks like I probably missed something in that custom resource, or perhaps enough somethings have changed since I put it out. I just verified it IS working, on Orion Platform 2018.2 HF6, SCM 1.0, NCM 7.8, NPM 12.3, DPAIM 11.1.0, VMAN 8.3.0, SAM 6.7.0, NetPath 1.1.3, just by making the change to the default file.

    I'm glad to hear you like it. And, more importantly, I'm glad you have started your modding adventure. Just be careful, and remember to backup early, and often!

    If you're planning on adding, editing, creating, or anything else mod related, you might want to check out the following link. It will show you an easy method to allow editing/modding default files.

    Disable Precompiled Web Pages; Making Custom Mods Great Again!

    Also, while not exactly the same in looks, this is another version of a tool to assist you in navigating your views.

    Using Your Custom HTML Resource To Build A Better Way To Navigate Your Custom Views

    I hope this helps. If you need anything else, just ask.

    Thank you,

    -Will

  • Even after updating CutomQuery.js and deleting web cache file in the ProgramData\SolarWinds dir on my additional web server and bouncing application pool on AWS on MP I sill don't have the link launcing as separate tab.

    No biggie, I can continue to right-click LOL.

    I implemented this MOD too - very nice! : Using Your Custom HTML Resource To Build A Better Way To Navigate Your Custom Views

    I'm looking through all the links you've posted for MODS and to other users' content for MODS.

    Thanks

    -marc

  • marcv Well, that seems odd. What versions of which modules are you running? (copy/paste footer from any page within your environment.)
    And, just to make sure, you're making these changes on the same server on which you are checking them? (I have been known to, on more occasions than I care to admit, work on server A, while checking my work on server B... which never ends up playing out in my favor...)

    When I get a bit more time, maybe next week, I'll see about running back through that mod to see if anything else stands out. In the mean time, let's see which version(s) you are running. Also, if you don't mind, how is your environment configured? (primary web server, additional web server(s), load balancer, etc.)

    Thank you,

    -Will

  • wluther

    I just upgraded to latest modules and HF's:

         Orion Platform 2018.2 HF6, WPM 2.2.2, NPM 12.3, DPAIM 11.1.0, SAM 6.7.0, NetPath 1.1.3

    I have a MP and AWS. I updated the CustomQuery.js file on both servers and deleted the cache file n the the ProgramData\SolarWinds  folder on the the AWS - the MP doesn't seem to have a cache file in its ProgramData\SolarWinds folder, I reset the the Applicatoin Pools on both servers.

    Those steps worked for me to get the the Custom SWQL View Manger aspx file resource added, but not when I edit the js files to change the behavior for links.

    BTW - my environment is a legacy one. Upgraded multiple, multiple times. We've been using SW since it was originally released and there's been lot's of admins over the years. I've only been involved for about the last six years.

    Thanks for any help and no rush. At his point it's a nice to have but  nothing is broke since I made the mod so that's good. :-)

    -marc

  • marcv​ What happens when you make the change in that default CustomQuery.js file, then test it on a regular customquery widget/resource? That CustomQuery.js file should be the control for all of your customquery widgets. The modified CustomSWQLViewsManager.js file, from here, should only be for the corresponding aspx file. Since you say the modded views manager widget loads up correctly, maybe just click the edit button on it, copy the query within, and paste it into a standard/default custom query widget. Then test and see if the links open in new tabs there.

  • marcv​ Hold up a minute... Just out of curiosity, which browser are you using?

    It just occurred to me, I had used Chrome, almost exclusively, over the past several years. It was not until several months ago that I updated Firefox and started using it again. I just tested in Firefox, and mine doesn't open new tabs either. Using Chrome, however, it opens new tabs as expected. I even locked the door and opened up IE to test, and it opens new tabs as well. (I closed IE as quickly as I could after verification, and sprayed down my office with Lysol and fire to get rid of any remaining traces of IE... emoticons_devil.png)

    Yeah, so let me know about the browser(s). Nothing worse than working in the wrong direction for any longer than you need to.

    -Will

  • wluther - I use Chrome - exclusively. Unless W10 opens a PDF in Edge. That way I don't have to break out the hazmat gear. LOL

  • wluther 

    Yeah I was expecting to bring joy to all clicking and not just the for View Manger page. (You know to give my index finger a break from all the right clicking it normally does.)

    I'll try again.

    To be clear - I don't have to run Configuration Wizzard for Website- only delete the cache file in PrograamData\SolarWinds and reset IIS Application Pools on both MPE and AWS?

  • marcv​ You should not actually need to run config wizard for any changes to a .js file. Running the config wizard really only adds NEW files to the add widget/resource selection page. As far as I know, once the widget/resource shows up in your system (and you can select it), you should be able to edit it, and see the results via a page refresh, without needing to run the config wizard.