|
From: <jt...@hy...> - 2007-03-24 00:15:06
|
Author: jtravis Date: 2007-03-23 16:15:02 -0800 (Fri, 23 Mar 2007) New Revision: 3845 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=3845 Added: trunk/ui_plugins/ trunk/ui_plugins/hqu_livedata/ trunk/ui_plugins/hqu_livedata/LiveController.groovy trunk/ui_plugins/hqu_livedata/index.gsp trunk/ui_plugins/hqu_livedata/showResource.gsp Log: Add ui plugins directory and example hqu_livedata Added: trunk/ui_plugins/hqu_livedata/LiveController.groovy =================================================================== --- trunk/ui_plugins/hqu_livedata/LiveController.groovy (rev 0) +++ trunk/ui_plugins/hqu_livedata/LiveController.groovy 2007-03-24 00:15:02 UTC (rev 3845) @@ -0,0 +1,24 @@ +import org.hyperic.hq.ui.rendit.BaseController + +import org.hyperic.util.config.ConfigResponse + +public class LiveController extends BaseController { + def index = { + render(args:[platforms:resourceHelper.allPlatforms]) + } + + def showResource = { params -> + def platId = Integer.parseInt(params['id'][0]) + def plat = resourceHelper.find(platform:platId) + def cmds = liveDataHelper.getCommands(plat) + def command = params['command'] + def result + + if (command != null) { + command = command[0] + result = liveDataHelper.getData(plat, command, [:]).XMLResult + } + + render(args:[resource:plat, cmds:cmds, result:result, command:command]) + } +} Added: trunk/ui_plugins/hqu_livedata/index.gsp =================================================================== --- trunk/ui_plugins/hqu_livedata/index.gsp (rev 0) +++ trunk/ui_plugins/hqu_livedata/index.gsp 2007-03-24 00:15:02 UTC (rev 3845) @@ -0,0 +1,11 @@ +<html> +<body> + <h1>Platform LiveData</h1> + + <ul> + <% for (plat in platforms) { %> + <li> <%= link_to plat.name, [action:'showResource'], + [id:plat.id] %> </li> + <% } %> +</body> +</html> Added: trunk/ui_plugins/hqu_livedata/showResource.gsp =================================================================== --- trunk/ui_plugins/hqu_livedata/showResource.gsp (rev 0) +++ trunk/ui_plugins/hqu_livedata/showResource.gsp 2007-03-24 00:15:02 UTC (rev 3845) @@ -0,0 +1,25 @@ +<html> +<body> + <h1>LiveData commands for <%= resource.name %> + (<%= resource.appdefResourceTypeValue.name %>)</h1> + + <p> + <%= link_to "<-- Go Back", [action:'index'], [:] %> + </p> + Available commands: + <ul> + <% for (c in cmds) { %> + <li> + <%= link_to c, [:], [id:resource.id, command:c] %> + </li> + <% } %> + </ul> + + <% if (result != null) { %> + <b>$command</b> result:<br/> + <pre> +<%= h(result) %> + </pre> + <% } %> +</body> +</html> |