NetIQ Operations Center - Hiding Nodestyles (elements)

NetIQ Operations Center - Hiding Nodestyles (elements)

I had a question earlier today, the customer created a custom NodeStyle (IE: element icon) and within the Service Model View, they wanted the element to not show up unless it had children elements.

I've discussed a few different things with Nodestyles in my blogs before, the idea is that you want to create custom icons for your elements such as something like this:

2015-01-15_1022

Back to the topic, you have created a Nodestyle, and you want to make elements without children elements not show up for that view.   It is common to hide things based on the condition of an element such as only showing elements that are Critical and/or Major condition, but there is no out of box clicking option to hide them based on not having children.

In order to test my theory, I went under Administration/Graphics/Nodes and created a new nodestyle for my test.   I then clicked on the basic box example it provides and within the Palette, I clicked the Critical/Red box under Visibility.

The outcome of that is, the box (sample nodestyle) gets a group tag placed around it with a "display" variable set to "inline".
<g id="node" display="inline">

Then within the group there is a "bind" tag that determines the element condition and hides or unhides it.   When you clicked the Critical box under visibility, the following bind tag is added to your drawing:
<bind:value default="inline" property="condition" MOS_bindtype="visibility" set="none" default.edit="inline" attr="display" set.edit="inline" when="Critical"/>

Along with the group tag <g> and the bind tag that was just added, you are on your way. the next step is to completely replace that bind line with the following:
<bind:value attr="display"><![CDATA[var result='inline'
if( element.children.length == 0 )
{
result = 'none';
}
result]]></bind:value>

This bind tag is assigned to the "display" variable.  We either want it as "inline" (display element) or "none" (do not display).   There is a small java script that checks the element.children.length variable.  If the array of children is empty (ie: zero), then set result to 'none'.

That's pretty much it.   While editing the element nodestyle, if you set a preview element, you can test it right there.  If you select an element with children, the box (nodestyle example) shows, if you select a preview element with no children, the box will disappear.

Based on my testing this seems like a viable solution to the question.  I did basic testing and it appears to work fine.   I do not foresee performance impact from doing it this way, but I guess if you have a huge view it may have impact.   Basically... TEST, TEST, TEST before going to production.

- Tobin

 

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2015-02-13 16:30
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.