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 Children
  • Thanks Dan.

    Trouble is, I'm building a method for deleting Notes from specific Nodes. From what I've found, there is no JSON service to accomplish that, as there isn't even a Delete option on the Notes themselves.

    For this reason, I have built a custom HTML that uses JSON and Javascript to put the data up, but currently have no way to delete the erroneous Notes. If there isn't a way to execute SWIS to do this from within Javascript, then it would seem to be something that has to be executed directly against the SQL database.

    I have tried to use ADO RecordSet, but the Javascript doesn't seem to recognize it, at least not in the custom HTML page.

    Open to options here.....

  • Do you have a screenshot of the 'notes' in question?  These could be in many places (custom properties, alert objects, incidents, etc.).  Knowing what notes you are referencing would allow us to provide a better answer.

  • 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?

    Thanks,

    Thomas

  • 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.