Oct 12, 2011 4:03 PM
MenuExamples ZenPack
-
Like (0)
I am trying to develop an examples ZenPack that demonstrates different ways to create and use menus with Zenoss - largely using Zenoss 3 techniques but also with some older Zenoss 2 methods.
The target is to demonstrate:
Some of this I have done and the tarball is appended here. Roughly, I have done 1 - 7.
THIS IS A WIP AND SHOULD NOT GO ANYWHERE NEAR A PRODUCTION SYSTEM.
I hope others will comment and improve on what I have done and help contribute examples.
The whole thing is based on Chet's documented ZenPack Example template - see message/61752#61752 and the rules for helping with this ZenPack is that you have to document meticulously what you do and why.
Perhaps we can then use this project to build some ZenPack training in the future?
Anyone who picks this stuff up in the next 24 hours, I am hoping to discuss it on the IRC Dev Chat at 11:00 EST tomorrow (Oct 13th 2011).
Cheers,
Jane
Well this couldn't have come at a better time for me, and this and the recent "example" zenpack have made things so much easier!
Thanks to you guys I'll hopefully have some "public-quality" zenpacks to release soon!
Regarding the "MenuExamples", though, were you able to get the "myFooterMenu.js" example to work correctly? I noticed it was commented in the configure.zcml file, and the GUI wouldn't render correctly once i uncommented it.
I'm looking for the way to add new entries to the "add components" menu at the bottom left of the Device Status page and was hoping that this example would point me in the right directon.
Still struggling with the myFooterMenu - as you say, it blows everything away if you uncomment it. I got this from one of the dev's in the dev chat, beginning of October. I've tried it on both Zenoss 3.1 and 3.2 and get the same on both - what are you using???
I'm hoping for other input to help sort this one.
Cheers,
Jane
I'm using 3.1 to develop against...may upgrade to 3.2 today or tomorrow. Looks like you're much further along than me. i've been looking through the source code since yesterday at any references to 'footer_bar', but i'm not a JS expert by any means and haven't been able to make any progress yet. Hopefully someone can chime in here and enlighten us.
Looks like the relevant piece of code that needs to be modified (for my purposes) is in :
/opt/zenoss/Products/ZenUI3/browser/resources/js/zenoss/devdetail.js
around line 700.
It says:
Ext.getCmp('footer_bar').add([{
xtype: 'ContextConfigureMenu',
id: 'component-add-menu',
iconCls: 'add',
menuIds: ['IpInterface', 'WinService', 'OSProcess', 'IpService', 'FileSystem', 'IpRouteEntry'],
listeners: {
render: function(){
this.setContext(UID);
}
}
}
I'm looking to add another item to "menuId" for a custom device component...i've looked around at other zenpacks and can't see where anyone has done this yet. Am I missing a good example somewhere, or can someone in the know please chime in?
Thanks,
Joseph
Thanks to you I've been able to get most of what I want by looking at your examples. Thank you so much for putting this zenpack together it's been very helpful!
I've run into a situation that I thought I saw you had dealt with before, but now I can't find the post. I've made my own Menu (like your "My Example Menu 1"--v3 version with "My Example One Menus from Objects").
Unlike your menu item, however, mine is a form submit dialog (2 actually, one to create the component and the other to delete selected). These function as intended, meaning I can add and delete the components.
The problem I have, though, is that after submission the device status page is loaded into the right-hand pane of the page (see screen below). Like I said I think i saw you deal with the same situation, but can't find it now. Do you remember what you did?
Here's what I'm seeing:
I'm pretty sure it must be the target URL in this line:
<input type="submit" name="deleteURLs:method" value="OK"
tal:attributes="onclick string:return $$('dialog').submit_form(
'${here/absolute_url_path}')" />
but I've tried many different things and can't figure out what it should be...
Thanks for your help,
Joseph
Hi Joseph,
Glad that some of this is helping - even if neither of us can make it all work yet! I now have 2 pieces that completely blow things away - adding the new footer menu and I have also tried to add a new menu option to the existing action icon - both are pretty disastrous so there is something we are missing to link ZenPack code into existing menus / footer bars. I also want to add to other menus - like the ones at the top-right of the device list and I suspect that the same issues will occur there.
Still hoping for further help here
In your example above, the device status page tends to be the default panel that gets loaded if "something went wrong" so that will be why you are getting that panel but it doesn't help with the "What's gone wrong" question. I don't think I've done any menus that put up dialog popups - it's something I want to do. Would you be prepared to share the code so that I can a) incorporate it into the examples (suitably changed if it does anything proprietary) b) see if I can help debug it ???
Cheers,
Jane
Thanks for your input...i am happy to share (it's a community Zenpack i'm working on anyway -- nothing fancy, just something i've wanted to do for a while (treat monitored URLs as device components that can be added/removed easily, since I have a lot of boxes that need multiple URLs monitored)
I'm using 2 "old-style" dialogs (haven't been able to get new ones to work yet) located in the /templates subfolder,
the one to add:
<tal:block metal:use-macro="here/templates/macros/page2">
<tal:block metal:fill-slot="contentPane">
<h2>Add URL</h2>
<form method="post" name="manage_addHttpComponent" tal:attributes="action context/absolute_url_path">
<table>
<tr><td>
<span id="new_id_label" style="color:white;">Name: </span>
</td><td>
<input id="newId" name="id" style="width:120px">
</td></tr>
<tr><td>
<span id="httpurl" style="color:white;">HTTP GET: </span>
</td><td>
<input name="httpUrl" style="width:120px">
</td></tr>
<tr><td>
<span id="httpjsonpost" style="color:white;">HTTP POST: </span>
</td><td>
<input name="httpJsonPost" style="width:120px">
</td></tr>
<tr><td>
<span id="httpport" style="color:white;">Port: </span>
</td><td>
<input name="httpPort" style="width:120px">
</td></tr>
<tr><td>
<span id="httpauthuser" style="color:white;">User: </span>
</td><td>
<input name="httpAuthUser" style="width:120px">
</td></tr>
<tr><td>
<span id="httpauthpassword" style="color:white;">Password: </span>
</td><td>
<input name="httpAuthPassword" style="width:120px">
</td></tr>
<tr><td>
<span id="httpfindstring" style="color:white;">String Match: </span>
</td><td>
<input name="httpFindString" style="width:120px">
</td></tr>
<div id="dialog_buttons">
<input tal:attributes="type string:submit;
value string:OK"
name="manage_addHttpComponent:method" />
<input tal:attributes="id string:dialog_cancel;
type string:button;
value string:Cancel;
onclick string:$$('dialog').hide()" />
</div>
</table>
<br>
</form>
</tal:block>
</tal:block>
and the one to delete:
<h2>Delete URLs</h2>
<br/><br/>
<p>
Are you sure you want to remove these URLs?<br/>
</p>
<br/>
<div id="dialog_buttons">
<input type="submit" name="deleteURLs:method" value="OK"
tal:attributes="onclick string:return $$('dialog').submit_form(
'${here/absolute_url_path}')" />
<input tal:attributes="id string:dialog_cancel;
type string:button;
value string:Cancel;
onclick string:$$('dialog').hide()" />
</div>
Hopefully you or someone else will be able to spot some obvious flaw that I can fix. The code "works" in that the components are added/removed and monitored as planned, but the post-submit redirect is giving the problems.
Thanks,
Joseph
Hi Joseph,
Would you mind tar'ing up your whole ZenPack and making it available? Or send it to me privately if you are happier with that. I need your methods for adding / deleting to do the tests. Presumably you have them defined somewhere else??
Cheers,
Jane
PS. Still no joy with extending the Action menu for a specific device or adding a new footer menu, though I can now add to the Action menu at the bottom of the device list panel.
PPS. Still hoping for input from devs.......
Hi Jane,
I saw your post that you had made progress on this front, but I hadn't had time to parse though what you had accomplished yet. Thanks for taking a look at my code and I hope that it helps to facilitate learning how to do the menu adds/deletes. I have it stored on github.com and available here:
https://github.com/j053ph4/ZenPacks.community.zenHttpComponent
but if you like i can pull together a tar file with the code and post it somewhere...
I was thinking of taking another look at Egor Puzanov's RDBMS zenpack as well...I'm not using it at the moment, but in the 2.5.x versions he had methods for manually adding/deleting databases that i'm not sure whether or not they carried over into the 3.x versions.
Anyways I definitely wish you luck since I would really like to know how to modify the menus as well.
Thanks,
Joseph
Major queries still outstanding are:
1) How to add to the Action menu for a specific device (menu with Push Changes, Model Device, etc)
2) How to add a whole new footer bar and append items to it
The latest version of the code is available on github at https://github.com/jcurry/ZenPacks.skills1st.MenuExamples .
This is definitely still Work In Progress - not for production environments.
All help gratefully received. I am hoping to discuss this at dev chat tomorrow (Nov 10th).
Cheers,
Jane
Hi Joseph,
I have pulled your ZenPack from github - thanks.
What is your mechanism for getting a device into your HttpDevice object class??? I see from your screenshot that your device is in /Server/Linux/WWW - do you simply set the zPythonClass to ZenPacks.community.ZenHttpComponent.HttpDevice for that class and then create devices within that class??
Cheers,
Jane
Yes, that’s exactly what I’m doing.
The odd thing is that you refresh the page by going somehwere else and returning to the ManageURLs menu then everything is fine - including the added URL. It just needs that refresh kick....
Cheers,
Jane
yes, that's what made it frustrating to me...it "works" in that I can add/delete the components, but the GUI refresh after the submit isn't being handled properly...
Follow Us On Twitter »
|
Latest from the Zenoss Blog » | Community | Products | Services Resources | Customers Partners | About Us | ||
Copyright © 2005-2011 Zenoss, Inc.
|
||||||||