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.

Custom SWQL Views Manager

**Please visit, read, download, and install the new custom resource that implements hcy01uk‌'s workaround directly into the resource header.**

**          Custom SWQL Views Manager Resource          **

**     **

**If you are going to use the new resource, or the database workaround, you can remove the following 3 lines from the main query, as well as the search query**

**     **

'AddNew' AS AddNewView,

'/Orion/Admin/AddView.aspx?ReturnTo=' AS [_LinkFor_AddNewView],

'/Orion/Nodes/images/icons/icon_add.gif' AS [_IconFor_AddNewView],

**     **

**     **

Let me start by saying I am at the bottom of the SWQL code pool.  I am completely aware that I do not fully understand, nor do I know, what I am doing.  This is most likely not the best way to do this, however, I have needed something like this for a long time now, and this works for me.

For many moons now, I have been waiting and looking for a better way to manage our views. Over the years, we have gathered hundreds of views, yet the way we manage them has never properly compensated for that growth.  I find it to be somewhat of a chore to go through and manage all of these views.  Finally, I decided to just find a way to make it work better, for me.  It is not the best.  It is not proper. It is most likely far from anything that would/should resemble an actual solution.  Having said that, and once again, it works for me... for now.

This is a simple SWQL query that lists all of the views.  It provides links to view or edit each view.  There is even a link to add a new view.

I have not yet been trained in the dark art of making urls, within SWQL, automatically open in a new tab... So... I just keep it analog, and use my middle mouse button to click all my links here.

I have figured out a simple way to change the default behavior of SWQL links that use the "_LinkFor_" column alias.

Please follow the link below to read how to "fix" this behavior.

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

Also, I would love to be able to add little "widget" type icons/buttons in the title bar space of the resource. Since I am also lacking that level of knowledge, and probably commitment too, I simply went ahead and added an "AddNew" icon/button/link on each row.

The "AddNewView" column simply shows an icon/link, for each and every row, that creates a new page/view.  It has nothing to do with anything on any row, and will not link anything on any row to anything else.  Every "AddNew" icon/link is for the exact same thing, goes to the exact same place, and starts the exact same process.

The "Edit" column shows an "Edit" button, which simply takes you to the edit page of the view on the same row.  This icon/link is directly related to the row it is located on. This would provide the same results as manually going to a page, and then clicking the "Customize Page" link located in the upper righthand corner.

The "ViewTitle" column provides the value of the page, as well as a link to view the page.  Clicking this link will simply open the view. (Also, clicking on the "ViewID" field of a row will take you straight to that view/page.)

The search option should allow you to search by the following fields: ViewID, ViewKey, ViewTitle, ViewGroupName, & ViewType

npm_swql_custom_views_manager-001.PNG

As far as I know, users will still need permissions to manage views, as well as access/permissions to view the results of this query/resource. Otherwise, they should get an error, and/or not even be able to see the results of the query.

You will need to add the “Custom Query” resource to the page/view you want this on.

Then, you will need to edit the “Custom Query” resource and copy the contents of the "SWQL_Custom_Views_Manager.txt" file into both sections.

The first section only needs everything before the "WHERE" clause of the query.

The second section, the search section, requires the entire query.

npm_swql_custom_views_manager-002.PNG

Again, I already know this is not the best way, and probably not the right way... but it works for me.

Hopefully, this can help someone else out too, at least until SolarWinds finishes those upgrades on the basics... emoticons_cry.png

Thank you,

-Will

  • Great! I like the search function that is I was looking for. Thanks.

    These is a workaround to add "Add New View" in Subtitle of the Resource rather than in every rows:

    001.jpg

    Click "Custom Views Manager" to open the resource in a new windows and from the browser address bar find Resource ID, in my case 4086

    002.jpg

    Use "SQL Server Management Studio" connect to your Solarwinds Database and find out Table: "Resources", then "Edit Top 200

    Rows"

    003.jpg

    Then Click(1) "SQL" button --> add WHERE Clause (2) --> Click "!" Run(3) Query

    004.jpg

    Add the codes below to "ResourceSubTitle"

    <img src="/Orion/Nodes/images/icons/icon_add.gif"><a href="">thwack.solarwinds.com/.../AddView.aspx target="_blank">Add New View</a>

    005.jpg

    Close Query. Done

  • A very impressive use and demonstration of what can be achieve with SWQL!

    Definitely in my top 5 List!

    Thanks

    Tony

  • hcy01uk‌, you always come through... always... very cool!!

    Thanks!

    -Will

  • tony.johnson‌ yeah, with SWQL being the language of SolarWinds, so to speak, you would think they could have made a legit effort at this, right... instead we have to settle for this, put together by some noob... emoticons_devil.png

  • hcy01uk‌ It looks like, when I edit the resource and save it, after having made the modification you provided, the "Add New View" icon and link go away.  Afterwards, I have to go back in and re-apply the mod to database.  Everything still works, after re-applying, just figured I would see if you, or anyone else noticed the same thing.

    Thanks again,

    -Will

  • Yes I have the same “issue”. I did try to put the HTML codes in “Subtitle” via web console first, but Solarwinds removes all the HTML tags when you save the resource. (SW must have some rules to check the text field in its codes).  I have to modify the DB directly, not best practise but works. So if you need modify the resource you have to modify the DB again to put the link back.

    Thanks

    Patrick

  • hcy01uk‌ & tony.johnson

    Just a head up.

    I was able to take Patrick's improvement, and hardcode it into the actual resource.

    It is nothing much, but it will at least allow you to edit the query/resource, without having to reenter the fix into the database each time.

    If you have time, go and check it out ---> Custom SWQL Views Manager Resource

    Thanks, again, for all your help and comments.

    -Will

  • I love your explaination lololol!!!

  • This is really a very nice feature. Thanks

  • Hi all,

    Tested and works well, I have a special need and I don't know if some one can help?

    I want to give customize view right to a specific user who can only edit related views and not all views, this will be simple using a custom view using this SWQL query and apply limitation to the view if custom properties was available to be applied on views!!

    otherwise maybe there is a workaroud to edit the customizeview.aspx file by adding an if condition checking the admin right else the user will be redirected to a custom aspx file, I tried to understand the asp.net source but there is a lot of includes and calls to other script and I get confused, I don't know if there is any argument for the function ViewManager.GetAllViews() within ListViews.aspx.cs file if so I think maybe from here I need to start.

    Your feedback will be much appreciated.

    Regards.

    Salah