Archived community.zenoss.org | full text search
Skip navigation
1 2 Previous Next 8434 Views 23 Replies Latest reply: Dec 5, 2011 12:14 PM by j053ph4 RSS
jcurry ZenossMaster 1,021 posts since
Apr 15, 2008
Currently Being Moderated

Oct 12, 2011 4:03 PM

MenuExamples ZenPack

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:

  1. A new lefthand menu that works for all devices
  2. A new lefthand menu that is only available for specific types of device
  3. A new component menu for a new type of component
  4. A new component menu for an existing type of component
  5. If you have old-style skins page template files and newer "zcml-wired" page templates, which is used??
  6. How to override standard menus in a ZenPack?
  7. Add a new dropdown menu for a page template by shipping the menu in an object file
  8. Add a new dropdown menu for a page template without supplying the menu in an object file using Zenoss 3 methods
  9. Add a new "footer menu" - say a "My Commands" button at the bottom of the lefthand menu, alongside the existing "Commands" popup
  10. Create a new top-level menu - alongside INFRASTRUCTURE, EVENTS, etc
  11. Create a new seconday menu eg. alongside Devices, Networks, Processes under the top INFRASTRUCTURE menu

 

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

Attachments:
  • j053ph4 Rank: Green Belt 290 posts since
    Dec 19, 2008
    Currently Being Moderated
    1. Oct 13, 2011 12:22 PM (in response to jcurry)
    Re: MenuExamples ZenPack

    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.

  • j053ph4 Rank: Green Belt 290 posts since
    Dec 19, 2008
    Currently Being Moderated
    3. Oct 13, 2011 2:05 PM (in response to jcurry)
    Re: MenuExamples ZenPack

    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.

  • j053ph4 Rank: Green Belt 290 posts since
    Dec 19, 2008
    Currently Being Moderated
    4. Oct 17, 2011 10:52 AM (in response to jcurry)
    Re: MenuExamples ZenPack

    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

  • j053ph4 Rank: Green Belt 290 posts since
    Dec 19, 2008
    Currently Being Moderated
    5. Oct 19, 2011 10:16 AM (in response to jcurry)
    Re: MenuExamples ZenPack

    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:

     

    screen.png

     

     

    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

  • j053ph4 Rank: Green Belt 290 posts since
    Dec 19, 2008
    Currently Being Moderated
    7. Oct 25, 2011 10:36 AM (in response to jcurry)
    Re: MenuExamples ZenPack

    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

  • j053ph4 Rank: Green Belt 290 posts since
    Dec 19, 2008
    Currently Being Moderated
    9. Nov 8, 2011 5:54 PM (in response to jcurry)
    Re: MenuExamples ZenPack

    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

  • j053ph4 Rank: Green Belt 290 posts since
    Dec 19, 2008
    Currently Being Moderated
    12. Nov 9, 2011 12:34 PM (in response to jcurry)
    Re: MenuExamples ZenPack

    Yes, that’s exactly what I’m doing.

  • j053ph4 Rank: Green Belt 290 posts since
    Dec 19, 2008
    Currently Being Moderated
    14. Nov 9, 2011 2:04 PM (in response to jcurry)
    Re: MenuExamples ZenPack

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

1 2 Previous Next

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points