Creating a Custom Widget that can be called from a Custom HTML page

Build a Custom HTML page in Javascript. Want to execute an SWIS call to delete a record when a button is clicked on that page.

I either need to open a connection to the database from within Javascript, or create a custom widget that can be called from that page with an argument that is the id of the record to delete.

How can this be done?

Parents Reply
  • Is that directly in SQL?  I wouldn't make direct edits to the database - especially not with any type of script.  The underlying structure can change between versions, which is why we are recommending doing the work via the API.

    It still would be helpful to have a screenshot of what you are talking about in the web console.

  • This is a node for a specific node. There is an "Add Note" link, but no "Delete Note" link. The "Edit" link applies to the widget, not to the Note.

    According to SolarWinds "What we're working on" there is currently no way to delete notes within the Web Console. There isn't any reference to an SWIS service that would execute a Note deletion. My custom HTML page lists the nodes that have notes attached to them (therefore no need to search for Nodes with Notes in the Web Console), but I need a mechanism to perform the deletion. I currently have a "Delete" button for each note, with the note ID as an argument. 

    But if there is no SolarWinds Orion mechanism to delete the Note, the only choice is to execute an SQL directly against the database to do the deletion.

    Unless there's something I'm missing?



  • I honestly have never used Node Notes before, but I really need to recommend it.

    If you want to delete them you can use the Remove-SwisObject function and provide it the full URI of the Note (not the Node).

    You can get the list of all notes with:

    SELECT NodeNoteID
         , Note
         , NodeID
         , AccountID
         , TimeStamp
         , Uri
    FROM Orion.NodeNotes

    Then if I wanted to remove the #6 entry in (in this case), I would do:

    # use Certificate based authentication if I'm running directly on the Orion server
    $SwisConnection = Connect-Swis -ComputerName "myorionserver.domain.local" -Certificate
    # or use username/password if running elsewhere
    # $SwisConnection = Connect-Swis -ComputerName "myorionserver.domain.local" -Username 'admin' -Password 'MyC0mpl3xP@ssword'
    # Remove-SwisObject only needs to parameters:
    # the SwisConnection (so it knows 'where' to do the work
    # the URI of the thing to remove
    Remove-SwisObject -SwisConnection $SwisConnection -Uri "swis://KMSORION01v.kmsigma.local/Orion/Orion.NodeNotes/NodeNoteID=6,NodeID=1016"

    I know that I can use Remove-SwisObject (and Set-SwisObject) because the documentation in SWQL Studio tells me it can be deleted and updated.

    As far as doing this in JavaScript... sorry, I'm not a web developer - I don't know how you would do this.