-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
125 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
console/org.linkedin.glu.console-webapp/grails-app/views/commands/_command.gsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
%{-- | ||
- Copyright (c) 2012 Yan Pujante | ||
- | ||
- Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
- use this file except in compliance with the License. You may obtain a copy of | ||
- the License at | ||
- | ||
- http://www.apache.org/licenses/LICENSE-2.0 | ||
- | ||
- Unless required by applicable law or agreed to in writing, software | ||
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
- License for the specific language governing permissions and limitations under | ||
- the License. | ||
--}% | ||
|
||
<g:if test="${command}"> | ||
<div id="shell-${command.commandId}"><div class="shell span16"><a class="close" href="#" onclick="toggleShowHide('#shell-${command.commandId}')">×</a><div class="cli"><span class="prompt">${command.username.encodeAsHTML()}@${command.agent.encodeAsHTML()}#</span> <span class="command">${command.command.encodeAsHTML()}</span> <g:if test="${command.redirectStderr}">2>&1 </g:if><span class="date">[<cl:formatDate time="${command.startTime}"/>]</span> <span class="exitValue">[${'$'}?=${command.exitValue?.encodeAsHTML()}]</span></div><g:if test="${!isCommandRunning}"><g:each in="['stdin', 'stderr', 'stdout']" var="streamType"><g:if test="${command.getTotalBytesCount(streamType) > 0}"><div id="${command.commandId}-${streamType}" class="${streamType}"><cl:renderCommandBytes command="${command}" streamType="${streamType}" onclick="renderCommandStream('${command.commandId}', '${streamType}', '${command.commandId}-${streamType}')"/></div></g:if></g:each><div class="cli"><span class="prompt">${command.username.encodeAsHTML()}@${command.agent.encodeAsHTML()}#</span> <span class="date">[<cl:formatDate time="${command.endTime}"/>]</span></div></g:if><g:else><img src="${resource(dir:'images',file:'spinner.gif')}" alt="Spinner" /></g:else></div><g:if test="${isCommandRunning}"><g:javascript>setTimeout("renderCommand('${command.commandId}', 'shell-${command.commandId}')", '${params.refreshRate ?: 2000}')</g:javascript></g:if></div> | ||
</g:if> |
32 changes: 32 additions & 0 deletions
32
console/org.linkedin.glu.console-webapp/grails-app/views/commands/_command_js.gsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
%{-- | ||
- Copyright (c) 2012 Yan Pujante | ||
- | ||
- Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
- use this file except in compliance with the License. You may obtain a copy of | ||
- the License at | ||
- | ||
- http://www.apache.org/licenses/LICENSE-2.0 | ||
- | ||
- Unless required by applicable law or agreed to in writing, software | ||
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
- License for the specific language governing permissions and limitations under | ||
- the License. | ||
--}% | ||
<g:javascript> | ||
function renderCommandStream(commandId, streamType, success) | ||
{ | ||
%{--YP Implementation note: this is obviously hacky, but there does not seem to be a way to use g.remoteFunction + javascript variables in all places! | ||
|
||
${g.remoteFunction(controller: 'commands', id: <javascript commandId>, action: 'stream', params: [streamType: <javascript streamType>], update:[success: '<javascript variable>'])} | ||
|
||
--}% | ||
jQuery.ajax({type:'GET',data:{'streamType': streamType}, url:'/console/commands/' + commandId + '/stream',success:function(data,textStatus){jQuery('#' + success).html(data);},error:function(XMLHttpRequest,textStatus,errorThrown){}}); | ||
} | ||
function renderCommand(commandId, success) { | ||
if(!isHidden('#' + success)) | ||
{ | ||
jQuery.ajax({type:'GET',url:'/console/commands/renderCommand/' + commandId,success:function(data,textStatus){jQuery('#' + success).parent().html(data);},error:function(XMLHttpRequest,textStatus,errorThrown){}}); | ||
} | ||
} | ||
</g:javascript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters