Skip to content

Commit

Permalink
#222: fixed issue when role is USER
Browse files Browse the repository at this point in the history
- workaround for grails bug http://jira.grails.org/browse/GRAILS-10293
  • Loading branch information
ypujante committed Aug 14, 2013
1 parent 9520a96 commit 197512b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class UrlMappings
public static final String MODULE = "org.linkedin.glu.console.conf.UrlMappings"
public static final Logger log = LoggerFactory.getLogger(MODULE);

private static def role = { path ->
private static Closure<RoleName> role = { path ->
def userRole = ConsoleConfig.getInstance().console.security.roles."${path}"
if(!userRole)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<g:set var="max" value="${params.max ?: '25'}"/>
<g:set var="isFirstPage" value="${offset == '0'}"/>
<g:javascript>
<g:if test="${isFirstPage}">
function shouldRefresh()
{
return document.getElementById('autoRefresh').checked;
Expand All @@ -43,7 +42,7 @@ function autoRefresh()
{
if(shouldRefresh())
{
setTimeout('refresh()', ${params.refreshRate ?: '2000'});
setTimeout('refreshHistory()', ${params.refreshRate ?: '2000'});
show('#autoRefreshSpinner');
showHide();
}
Expand All @@ -52,18 +51,21 @@ function autoRefresh()
hide('#autoRefreshSpinner');
}
}
function refreshHistory()
{
${g.remoteFunction(controller: 'commands', action: 'renderHistory', params: [agentId: params.id, offset: offset, max: max], update:[success: 'asyncDetailsHistory', failure: 'asyncErrorHistory'], onComplete: 'autoRefresh();')}
}
function refreshCommand()
{
<g:if test="${params.commandId}">
${g.remoteFunction(controller: 'commands', action: 'renderCommand', id: params.commandId, update:[success: 'asyncDetailsCommand', failure: 'asyncErrorCommand'])}
</g:if>
}
function refresh()
{
if(shouldRefresh())
{
${g.remoteFunction(controller: 'commands', action: 'renderHistory', params: [agentId: params.id, offset: offset, max: max], update:[success: 'asyncDetails', failure: 'asyncError'], onComplete: 'autoRefresh();')}
}
else
{
hide('#autoRefreshSpinner');
}
refreshCommand();
refreshHistory();
}
</g:if>
function showHide()
{
<g:each in="${filters.keySet()}" var="filter">
Expand Down Expand Up @@ -97,23 +99,21 @@ function showHide()
</div>

<g:if test="${params.commandId}">
<div><g:include controller="commands" action="renderCommand" id="${params.commandId}"/></div>
<div>
<div id="asyncDetailsCommand"></div>
<div id="asyncErrorCommand"></div>
</div>
</g:if>

<h4><g:if test="${isFirstPage}">Auto Refresh: <cl:checkBoxInitFromParams name="autoRefresh" id="autoRefresh" onclick="autoRefresh();"/>
<img src="${resource(dir:'images',file:'spinner.gif')}" alt="Spinner" id="autoRefreshSpinner"/></g:if>
<h4>Auto Refresh: <g:if test="${isFirstPage}"><cl:checkBoxInitFromParams name="autoRefresh" id="autoRefresh" onclick="autoRefresh();"/>
<img src="${resource(dir:'images',file:'spinner.gif')}" alt="Spinner" id="autoRefreshSpinner"/></g:if><g:else><g:checkBox name="autoRefresh" id="autoRefresh" disabled="true" checked="false"/></g:else>
<g:each in="${filters}" var="filter">
| ${filter.value}: <cl:checkBoxInitFromParams name="${filter.key}" id="${filter.key}" onclick="showHide();"/>
</g:each>
</h4>

<g:if test="${isFirstPage}">
<div id="asyncDetails"></div>
<div id="asyncError"></div>
</g:if>
<g:else>
<g:include controller="commands" action="renderHistory" params="[agentId: params.id, offset: offset, max: max]"/>
</g:else>
<div id="asyncDetailsHistory"></div>
<div id="asyncErrorHistory"></div>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
<g:set var="isFirstPage" value="${offset == '0'}"/>
<g:render template="/commands/command_js"/>
<g:javascript>
<g:if test="${isFirstPage}">
function shouldRefresh()
{
return document.getElementById('autoRefresh').checked;
Expand All @@ -48,7 +47,7 @@ function autoRefresh()
{
if(shouldRefresh())
{
setTimeout('refresh()', ${params.refreshRate ?: '2000'});
setTimeout('refreshHistory()', ${params.refreshRate ?: '2000'});
show('#autoRefreshSpinner');
showHide();
}
Expand All @@ -57,18 +56,14 @@ function autoRefresh()
hide('#autoRefreshSpinner');
}
}
function refreshHistory()
{
${g.remoteFunction(controller: 'commands', action: 'renderHistory', params: [offset: offset, max: max], update:[success: 'asyncDetailsHistory', failure: 'asyncErrorHistory'], onComplete: 'autoRefresh();')}
}
function refresh()
{
if(shouldRefresh())
{
${g.remoteFunction(controller: 'commands', action: 'renderHistory', params: [offset: offset, max: max], update:[success: 'asyncDetails', failure: 'asyncError'], onComplete: 'autoRefresh();')}
}
else
{
hide('#autoRefreshSpinner');
}
refreshHistory();
}
</g:if>
function showHide()
{
<g:each in="${filters.keySet()}" var="filter">
Expand All @@ -87,19 +82,14 @@ function showHide()
<div><g:include controller="commands" action="renderCommand" id="${params.commandId}"/></div>
</g:if>

<h4><g:if test="${isFirstPage}">Auto Refresh: <cl:checkBoxInitFromParams name="autoRefresh" id="autoRefresh" onclick="autoRefresh();"/>
<img src="${resource(dir:'images',file:'spinner.gif')}" alt="Spinner" id="autoRefreshSpinner"/></g:if>
<h4>Auto Refresh: <g:if test="${isFirstPage}"><cl:checkBoxInitFromParams name="autoRefresh" id="autoRefresh" onclick="autoRefresh();"/>
<img src="${resource(dir:'images',file:'spinner.gif')}" alt="Spinner" id="autoRefreshSpinner"/></g:if><g:else><g:checkBox name="autoRefresh" id="autoRefresh" disabled="true" checked="false"/></g:else>
<g:each in="${filters}" var="filter">
| ${filter.value}: <cl:checkBoxInitFromParams name="${filter.key}" id="${filter.key}" onclick="showHide();"/>
</g:each>
</h4>
<g:if test="${isFirstPage}">
<div id="asyncDetails"></div>
<div id="asyncError"></div>
</g:if>
<g:else>
<g:include controller="commands" action="renderHistory" params="[offset: offset, max: max]"/>
</g:else>
<div id="asyncDetailsHistory"></div>
<div id="asyncErrorHistory"></div>

</body>
</html>

0 comments on commit 197512b

Please sign in to comment.