Qmunity: Your Colleagues. Your Connections. Your Content.
Data Center Solutions

Syndication

Print

NetIQ Operations Center - Element Navigation / Selection Javascript Example

From time to time when creating custom right-clicks for the Operations Center console, you might require a dialog that comes up with a navigatable element tree to allow the end user to select one or more elements. Suppose you needed to create a more advanced right-click that allowed the user to select an element, and then the script does some additional processing, for instance, selecting an element, then gather alarm details and opening a Help Desk ticket. The script below is the fragment you need to bring up a element navigation dialog without having to write it from scratch.

Pre-Requsites

  • You are familiar with creating Operations
  • You are familiar with javascripting
  • You are familiar with the Operations Center console, implementation, etc.

The first part of the script leverages the formula.gui.browseForDNames() method. This method takes a few paramaters. This is a clientscript operation for the Operations Center console.

parm 1: appFrame

Description: This is typically "appFrame", it is preset to the java consoles dialog.  You probably do not need to change this unless you have another dialog/frame this is getting associated with.

parm 2: "root=Elements"

Description: This is a dname starting point. This will end up as the parent element starting point for the dialog.

parm 3: "Select Element"

Description: This ends up as the text within the windows title bar.

parm 4: "Element"

Description: This is the sub-title within the dialog.

parm 5: true

Description: This turns on/off the ability for the end user to select more than one element (true = multi-select, false = single select)

// Beginning of script example

dnamesVector = formula.gui.browseForDNames(appFrame, "root=Elements","Select Element", "Elements", true);
if ( dnamesVector.size() > 0 ) {
var dnames = "";
for (var i = 0; i < dnamesVector.size(); i++) {
dnames = dnames + dnamesVector.elementAt(i) + "\n";
}
info(dnames)
}


// end of script example

Once the end user presses the OK button, a Vector array is returned with the selected elements. The next section of the script performs a for-loop to gather each selection and store off the results into the "dname" variable. Upon completion of the for-loop, the info() method is used to display the dnames of the elements that were selected by the user.

Once you have the dnames, you can do further processing by issuing a findElement and then examining element properties and/or alarms. Please refer to the script guide for other options on formula.gui.browseForDnames() and/or other methods to call.

As always, use this with care on a development system prior to implementing anything into production. Some assembly required, batteries not included, your results may vary :)


Posted Aug 27 2012, 02:56 PM by Tobin Isenberg

Join the Discussion - Sign in | Register

Footer Border
Home  |   Terms of Use  |   Privacy Policy  |   NetIQ.com  |   Attachmate.com
NetIQ, an Attachmate Business