Jun 30, 2011 10:55 AM
Components UI not drawing
-
Like (0)
I've been working on a ZenPack which will handle reading policies from our Netscreen and displaying them as components on the device. So far I've got the custom class created, the modeler plugin gathering the data, and everything applying fine. The UI however is giving me trouble.
If I leave off the javascript resource, then a default component UI is drawn and that works fine - it just doesn't display things I want it to, but that at least shows I've got the data in the right places. As soon as I add the resource, however, I get nothing at all. Clicking on the component results in a blank screen (shot below) and a JS error which isn't very helpful. As a side note, the next component I click on gives another JS error ("Cannot call method 'un' of Null") but the one after that works fine, and I can then click any other working component to get the display working properly.
Everything created for this zenpack is in http://www.astro.princeton.edu/~huston/zenoss including the pack itself, and HTML versions of the important files. Please note it is still a work in progress, so there's no performance data collected or graphed yet (that's next once the UI is working), and things haven't been commented too much yet - including attribution to Jane Curry since many of the files were pulled directly from the BridgeMIB zenpack and edited as needed.
Damnit just realized vim didn't output the HTML correctly; those files will be fixed momentarily.
I grabbed the ZenPack and was able to reproduce the two errors you describe.
The first issue is that your Info object doesn't include the "hasMonitor"
attribute. You need to remove that from your list of fields
in NetscreenPolicyPanel in policy.js. You're not using it anyway, so it
shouldn't be a problem to remove it.
The second issue is that the ComponentGridPanel can't figure out which field
to use as the "autoExpandColumn" because the "name" field is used by
default, but you didn't include that in the columns. I would recommend
adding this line to the configuration for NetscreenPolicyPanel in policy.js.
Specifically add the following line immediately beneath componentType:
'NetscreenPolicy'
autoExpandColumn: 'nsPlyName',
While not related to any of the errors you're experiencing I noticed that
you had commas trailing the last elements of dictionaries and arrays in
policy.js. This is a common mistake to make when going between Python (which
allows it) and Javascript (which doesn't.) Chrome and Firefox are tolerant
of this, but other browsers are not. Specific examples of this include the
comma after the last elements of the fields list and after the last element
in each of your column definitions.
Sweet! Thanks for that. New error now, but it's a trace so I can at least start working towards it:
2011-07-05T10:23:33 ERROR extdirect -1Traceback (most recent call last):File "/opt/zenoss/Products/ZenUtils/extdirect/router.py", line 128, in _processDirectRequestresult = _targetfn(**data)File "/opt/zenoss/Products/Zuul/routers/device.py", line 59, in getComponentsdata = Zuul.marshal(comps, keys=keys)File "/opt/zenoss/Products/Zuul/__init__.py", line 116, in marshalfor o in obj:File "/opt/zenoss/Products/Zuul/utils.py", line 93, in unbrainreturn item.getObject()File "/opt/zenoss/lib/python/Products/ZCatalog/CatalogBrains.py", line 92, in getObjecttarget = parent.restrictedTraverse(path[-1])File "/opt/zenoss/lib/python/OFS/Traversable.py", line 310, in restrictedTraversereturn self.unrestrictedTraverse(path, default, restricted=True)File "/opt/zenoss/lib/python/OFS/Traversable.py", line 293, in unrestrictedTraverseraise eNotFound: -1
I didn't get that problem. I don't think it's related to any current code
issues in your ZenPack. It's more likely related to some brokenish objects
sitting around from earlier development. If you can delete the device you've
been testing with and recreate it you might have better luck.
Tried that, no such. Deleted then modeled it and got the same error again. Unfortunately the only changes between the zenpack I'd posted and what I'm running now are the changes you suggested, so I'm not sure what's going on (but I get that error even if I remove policy.js entirely from the path, so this isn't related to the previous problem at all). I'll look for a previous backup and see if I had changed something before and forgot, otherwise another reinstall of the VM may be in order (though I don't think I could have hosed this one that badly with only the UI tweaks).
Well, but I think there is problem in code editing
No, there were no other errors in the code. At some point the VM must have had some corruptions, because reinstalling made it work again. Since from here on all changes will be simply UI tweaks, I shouldn't run into this problem again.
Follow Us On Twitter »
|
Latest from the Zenoss Blog » | Community | Products | Services Resources | Customers Partners | About Us | ||
Copyright © 2005-2011 Zenoss, Inc.
|
||||||||