From 49584d6efc6a10fa0b76ce81b2638d424f2208a8 Mon Sep 17 00:00:00 2001 From: Adam Young Date: Mon, 23 Aug 2010 22:32:23 -0400 Subject: hashchange We now catch the hashchange event and use that to drive most of the site. To trigger page transitions, modify location.hash. Params start with # not ?. Removed user-group.inc. converted tabs to spaces trivial imlementation of add and details for netgroup and hostgroup lots of bug fixes based on routing problems and the refactorings. --- install/static/hostgroup.js | 57 ++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 22 deletions(-) (limited to 'install/static/hostgroup.js') diff --git a/install/static/hostgroup.js b/install/static/hostgroup.js index 64eeb3afc..290460d81 100644 --- a/install/static/hostgroup.js +++ b/install/static/hostgroup.js @@ -1,35 +1,48 @@ function setupHostgroup(facet){ if (facet == "details"){ - setupHostgroupDetails(); + hostgroupDetailsForm.setup(); + }else if (facet == "add"){ + hostgroupBuilder.setup(); }else{ - setupHostgroupSearch(); + hostgroupSearchForm.setup(); } } -function setupHostgroupDetails(){ - var detailsForm = new DetailsForm(); -} +var hostgroup_details_list = + [['identity', 'Hostgroup Details', [ + ['cn', 'Hostgroup Name'], + ['description', 'Description']]]]; -function setupHostgroupSearch(){ +var hostgroupDetailsForm = new DetailsForm("hostgroup",hostgroup_details_list,"cn","sampledata/hostgroupshow.json") ; - var columns = [ - {title:"Hostgroup",column:"cn",render: function(current,cell){ - renderDetailColumn(current,cell,current[this.column],"hostgroup"); - }}, - {title:"Description", column:"description",render: renderSimpleColumn}]; - var hostgroupSearchForm = new SearchForm("hostgroup", "find", columns); - $("#query").unbind(); +function hostgroupAddOptionsFunction (){ + var options = { + name: $('#pkey').val(), + description: $('#description').val() + }; + return options; +} - $("#query").click(function(){ - sampleData = "sampledata/hostgrouplist.json"; - executeSearch(hostgroupSearchForm); - }); - $("#new").unbind(); - $("#new").click( function() { - alert("New Hostgroup..."); - }); +var hostgroupAddProperties = + [{title: 'Hostgroup Name', id: 'pkey', type: 'text'}, + {title: 'Description', id: 'description', type: 'text'}]; -} +var hostgroupBuilder = new EntityBuilder("hostgroup",hostgroupAddProperties,hostgroupAddOptionsFunction); + + +var hostgroupSearchColumns = [ + { + title:"Hostgroup", + column:"cn", + render: function(current,cell){ + renderPkeyColumn(hostgroupDetailsForm, current,cell); + } + }, + {title:"Description", column:"description",render: renderSimpleColumn}]; + +var hostgroupSearchForm = + new SearchForm("hostgroup", "find", hostgroupSearchColumns, + "sampledata/hostgrouplist.json"); -- cgit