diff options
Diffstat (limited to 'idrop-web/grails-app/views')
-rw-r--r-- | idrop-web/grails-app/views/browse/dataObjectInfo.gsp | 17 | ||||
-rwxr-xr-x | idrop-web/grails-app/views/browse/index.gsp | 2 | ||||
-rwxr-xr-x | idrop-web/grails-app/views/common/_topbar.gsp | 1 | ||||
-rwxr-xr-x | idrop-web/grails-app/views/home/link.gsp | 1 | ||||
-rw-r--r-- | idrop-web/grails-app/views/rule/_ruleDelayExecQueueDetails.gsp | 61 | ||||
-rw-r--r-- | idrop-web/grails-app/views/rule/_ruleDetails.gsp | 95 | ||||
-rw-r--r-- | idrop-web/grails-app/views/rule/addParameterDialog.gsp | 154 | ||||
-rw-r--r-- | idrop-web/grails-app/views/rule/delayExecQueue.gsp | 39 | ||||
-rw-r--r-- | idrop-web/grails-app/views/rule/index.gsp | 229 | ||||
-rw-r--r-- | idrop-web/grails-app/views/rule/ruleErrorResult.gsp | 23 | ||||
-rw-r--r-- | idrop-web/grails-app/views/rule/ruleResult.gsp | 41 |
11 files changed, 660 insertions, 3 deletions
diff --git a/idrop-web/grails-app/views/browse/dataObjectInfo.gsp b/idrop-web/grails-app/views/browse/dataObjectInfo.gsp index e37c7c7..4105810 100644 --- a/idrop-web/grails-app/views/browse/dataObjectInfo.gsp +++ b/idrop-web/grails-app/views/browse/dataObjectInfo.gsp @@ -25,8 +25,6 @@ </h3> </div> - - <ul class="nav nav-tabs" id="infoTabs"> <li class="active"><a href="#info" id="infoTab"><g:message code="text.info" /></a></li> @@ -41,6 +39,11 @@ </g:if> <li><a href="#audit" id="auditTab"><g:message code="text.audit" /></a></li> + <g:if + test="${rule}"> + <li><a href="#rule" id="ruleTab"><g:message + code="text.rule" /></a></li> + </g:if> </ul> <div class="tab-content"> @@ -246,6 +249,12 @@ <div class="tab-pane" id="audit"> <div id="infoAccordionAuditInner"></div> </div> + <g:if + test="${rule}"> + <div class="tab-pane" id="rule"> + <div id="infoAccordionRuleInner"></div> + </div> + </g:if> </div> </div> @@ -285,6 +294,10 @@ showAuditView(selectedPath, "#infoAccordionAuditInner"); }); + $('#ruleTab').on('shown', function(e) { + showRuleView(selectedPath, "#infoAccordionRuleInner"); + }); + }); function callUpdateTags() { diff --git a/idrop-web/grails-app/views/browse/index.gsp b/idrop-web/grails-app/views/browse/index.gsp index ec5ac6b..ab16a69 100755 --- a/idrop-web/grails-app/views/browse/index.gsp +++ b/idrop-web/grails-app/views/browse/index.gsp @@ -8,7 +8,7 @@ <g:hiddenField name="mode" id="mode" value="${mode}"/>
<g:hiddenField name="viewStateBrowseOptionVal" id="viewStateBrowseOptionVal" value="${viewState.browseView}"/>
<g:hiddenField name="presetPath" id="presetPath" value="${viewState.rootPath}"/>
- <g:hiddenField id="viewStateSelectedPath" name="viewStateSelectedPath" value="${viewState.selectedPath}"/>
+ <g:hiddenField id="viewStateSelectedPath" name="viewStateSelectedPath" value="${absPath}"/>
<g:render template="/browse/browseTabContent" />
</div>
diff --git a/idrop-web/grails-app/views/common/_topbar.gsp b/idrop-web/grails-app/views/common/_topbar.gsp index fee43d3..2edf9ce 100755 --- a/idrop-web/grails-app/views/common/_topbar.gsp +++ b/idrop-web/grails-app/views/common/_topbar.gsp @@ -29,6 +29,7 @@ <g:message code="text.tools" /><b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="${grailsApplication.config.idrop.config.idrop.jnlp}" id="idropDesktop")>iDrop Desktop</a></li> + <li id="topbarRule" class="topbarItem"><g:link controller="rule" action="delayExecQueue">User Rules</g:link></li> </ul> </li> diff --git a/idrop-web/grails-app/views/home/link.gsp b/idrop-web/grails-app/views/home/link.gsp index d8bfef5..a7e1531 100755 --- a/idrop-web/grails-app/views/home/link.gsp +++ b/idrop-web/grails-app/views/home/link.gsp @@ -17,6 +17,7 @@ return false; } baseAbsPath = escape(baseAbsPath); + //alert(baseAbsPath); window.location.href = context + "/browse/index?mode=path&absPath=" + baseAbsPath; }); </script>
\ No newline at end of file diff --git a/idrop-web/grails-app/views/rule/_ruleDelayExecQueueDetails.gsp b/idrop-web/grails-app/views/rule/_ruleDelayExecQueueDetails.gsp new file mode 100644 index 0000000..9e9afa9 --- /dev/null +++ b/idrop-web/grails-app/views/rule/_ruleDelayExecQueueDetails.gsp @@ -0,0 +1,61 @@ + <form id="delayExecForm" name="delayExecForm"> + +<table id="delayExecQueueTable" class="table table-striped table-hover" + cellspacing="0" cellpadding="0" border="0"> + <thead> + <tr> + <th> + <div class="btn-group"> + <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Action<span + class="caret"></span></a> + <ul class="dropdown-menu"> + <li id="menuDeleteDetails"><a href="#deleteAllDetails" + onclick="deleteRulesBulkAction()"><g:message code="text.delete.all" /></a></li> + <!-- dropdown menu links --> + </ul> + </div> + + </th> + <th><g:message code="text.name" /></th> + <th><g:message code="text.user" /></th> + <th><g:message code="text.last.exec.time" /></th> + <th><g:message code="text.frequency" /></th> + + </tr> + </thead> + <tbody> + <g:each in="${rules}" var="rule"> + + <tr id="rule-${rule.id}"> + + <td><g:checkBox name="selectDetail" + value="select-${rule.id}" checked="false" /> + </td> + <td> + ${rule.name} + </td> + <td> + ${rule.userName} + </td> + <td> + ${rule.lastExecTime} + </td> + <td> + ${rule.frequency} + </td> + </tr> + </g:each> + + </tbody> + + <tfoot> + <tr> + <td></td> + <td></td> + <td></td> + <td></td> + <td></td> + </tr> + </tfoot> + </table> + </form>
\ No newline at end of file diff --git a/idrop-web/grails-app/views/rule/_ruleDetails.gsp b/idrop-web/grails-app/views/rule/_ruleDetails.gsp new file mode 100644 index 0000000..96c526d --- /dev/null +++ b/idrop-web/grails-app/views/rule/_ruleDetails.gsp @@ -0,0 +1,95 @@ + +<g:if test="${flash.error}"> + <script> + $(function() { setErrorMessage("${flash.error}"); }); + </script> + </g:if> + + <g:if test="${flash.message}"> + <script> + $(function() { setMessage("${flash.message}");}); + </script> + </g:if> + + +<div id="addParamDialogDiv"> +<!-- area for hanging dialogs --> +</div> + +<g:form name="ruleDetailsForm" id="ruleDetailsForm"> + <fieldset> + <label></label> + <g:textArea id="ruleBody" name="ruleBody" value="${rule.ruleBody}" rows="80" cols="100"/> + + <g:hiddenField name="ruleAbsPath" value="${absPath}" id="ruleAbsPath"/> + + <table class="table alert alert-info"> + <caption><g:message code="text.input.parameters"/></caption> + + <g:each in="${rule.inputParameters}"> + + <tr> + <g:hiddenField name="inputParamName" value="${it.uniqueName}" id="inputParamName"/> + <td>${it.uniqueName}</td> + <td><g:textField name="inputParamValue" id="inputParamValue" value="${it.getStringValue()}" size="80"/></td> + <td><i class='icon-remove' onclick='deleteInputParam(${"\"" + it.uniqueName + "\""})'></i></td> + </tr> + + </g:each> + </table> + <div id="inputParamsToolbar" > + <button type="button" id="addInputParameterButton" + value="addInputParameter" + onclick="callAddInputParameter()"> + <i class="icon-plus"></i><g:message code="text.add.input.parm" /> + </button> + </div> + + + <br/> + <table class="table alert alert-info"> + <caption><g:message code="text.output.parameters"/></caption> + + <g:each in="${rule.outputParameters}"> + <tr> + <g:hiddenField name="outputParamName" value="${it.uniqueName}" id="outputParamName"/> + <td>${it.uniqueName}</td> + <td><i class='icon-remove' onclick='deleteOutputParam(${"\"" + it.uniqueName + "\""})'></i></td> + </tr> + + </g:each> + + </table> + <div id="outputParamsToolbar" > + <button type="button" id="addOutputParameterButton" + value="addOutputParameter" + onclick="callAddOutputParameter()"> + <i class="icon-plus"></i><g:message code="text.add.output.parm" /> + </button> + </div> + + </fieldset> +</g:form> +<script type="text/javascript"> + +var editor = null; +$(function() { + /* var myCodeMirror = CodeMirror.fromTextArea(document.getElementById('ruleBody'),{ + mode: 'clike', + lineNumbers: true, + theme: "blackboard" + }); */ + + var uiOptions = { path : 'js/', searchMode: 'popup' } + var codeMirrorOptions = { + mode: 'text/x-rule', + lineNumbers: true, + theme: "eclipse" + } + + //then create the editor + editor = new CodeMirrorUI(document.getElementById('ruleBody'),uiOptions,codeMirrorOptions); + +}); +</script> +
\ No newline at end of file diff --git a/idrop-web/grails-app/views/rule/addParameterDialog.gsp b/idrop-web/grails-app/views/rule/addParameterDialog.gsp new file mode 100644 index 0000000..f891c31 --- /dev/null +++ b/idrop-web/grails-app/views/rule/addParameterDialog.gsp @@ -0,0 +1,154 @@ +<div id="addParameterDialog"> + + <div class="modal-header"> + <h3> + <g:message code="text.add.parameter" /> + </h3> + </div> + + <div class="modal-body"> + <label for="addParameterName"><g:message + code="text.parameter.name" />:<g:textField name="addParameterName" + id="addParameterName" /></label> + <g:hiddenField name="newParameterAbsPath" id="newParameterAbsPath" + value="${absPath }" /> + <g:if test="${isInputParameter}"> + <label for="addParameterValue"><g:message + code="text.parameter.value" />:<g:textField + name="addParameterValue" id="addParameterValue" /></label> + </g:if> + <g:hiddenField name="isInputParameter" id="isInputParameter" + value="${isInputParameter}" /> + + + </div> + + <div class="modal-footer"> + <g:if test="${isInputParameter}"> + <button type="button" id="updateNewParameterButton" value="update" + onclick="submitAddInputParameterDialog()")> + <g:message code="default.button.update.label" /> + </button> + </g:if> + <g:else> + <button type="button" id="updateNewParameterButton" value="update" + onclick="submitAddOutputParameterDialog()")> + <g:message code="default.button.update.label" /> + </button> + </g:else> + <button type="button" id="cancelAddButton" value="cancelAdd" + onclick="closeAddParameterDialog()")> + <g:message code="text.cancel" /> + </button> + </div> + +</div> + +<script> + $(function() { + $("#addParameterDialog").dialog({ + "modal" : true, + "width" : "500px" + }); + }); + + function submitAddInputParameterDialog() { + + var absPath = $("#newParameterAbsPath").val(); + if (absPath == null || absPath == "") { + setErrorMessage("no absPath for rule"); + return false; + } + + var inputParamKey = $("#addParameterName").val(); + if (inputParamKey == null || inputParamKey == "") { + setErrorMessage("no input parameter key for rule"); + return false; + } + + var inputParamValue = $("#addParameterValue").val(); + if (inputParamValue == null || inputParamValue == "") { + setErrorMessage("no input parameter value for rule"); + return false; + } + + var params = { + ruleAbsPath : absPath, + addParameterName : inputParamKey, + addParameterValue : inputParamValue + } + var url = "/rule/submitAddInputParameterDialog"; + + showBlockingPanel(); + + var jqxhr = $.post(context + url, params, "html") + .success( + function(returnedData, status, xhr) { + var continueReq = checkForSessionTimeout( + returnedData, xhr); + if (!continueReq) { + unblockPanel(); + return false; + } + $("#ruleDetailDiv").html(returnedData); + + $("#addParameterDialog").dialog("close"); + $("#addParameterDialog").html(""); + unblockPanel(); + + }).error(function(xhr, status, error) { + unblockPanel(); + + setErrorMessage(xhr.responseText); + }); + } + + function closeAddParameterDialog() { + $("#addParameterDialog").dialog("close"); + $("#addParameterDialog").html(""); + } + + function submitAddOutputParameterDialog() { + + var absPath = $("#newParameterAbsPath").val(); + if (absPath == null || absPath == "") { + setErrorMessage("no absPath for rule"); + return false; + } + + var inputParamKey = $("#addParameterName").val(); + if (inputParamKey == null || inputParamKey == "") { + setErrorMessage("no input parameter key for rule"); + return false; + } + + var params = { + ruleAbsPath : absPath, + addParameterName : inputParamKey, + } + var url = "/rule/submitAddOutputParameterDialog"; + + showBlockingPanel(); + + var jqxhr = $.post(context + url, params, "html") + .success( + function(returnedData, status, xhr) { + var continueReq = checkForSessionTimeout( + returnedData, xhr); + if (!continueReq) { + unblockPanel(); + return false; + } + $("#ruleDetailDiv").html(returnedData); + + $("#addParameterDialog").dialog("close"); + $("#addParameterDialog").html(""); + unblockPanel(); + + }).error(function(xhr, status, error) { + unblockPanel(); + + setErrorMessage(xhr.responseText); + }); + } +</script> diff --git a/idrop-web/grails-app/views/rule/delayExecQueue.gsp b/idrop-web/grails-app/views/rule/delayExecQueue.gsp new file mode 100644 index 0000000..8ad4dec --- /dev/null +++ b/idrop-web/grails-app/views/rule/delayExecQueue.gsp @@ -0,0 +1,39 @@ +<head> +<meta name="layout" content="mainNoSidebar" /> +</head> +<div id="delayExecQueueDiv"> + <g:render template="ruleDelayExecQueueDetails" /> +</div> +<script> +$(document).ready(function() { + + $.ajaxSetup({ + cache : false + }); + $("#topbarTools").addClass("active"); + }); + + +function deleteRulesBulkAction() { + + var formData = $("#delayExecForm").serializeArray(); + showBlockingPanel(); + + var jqxhr = $.post(context + "/rule/deleteDelayExecQueue", formData, "html") + .success(function(returnedData, status, xhr) { + var continueReq = checkForSessionTimeout(returnedData, xhr); + if (!continueReq) { + return false; + } + + setMessage("Delete action successful"); + $("#delayExecQueueDiv").html(returnedData); + unblockPanel(); + }).error(function(xhr, status, error) { + setErrorMessage(xhr.responseText); + unblockPanel(); + }); + +} + +</script>
\ No newline at end of file diff --git a/idrop-web/grails-app/views/rule/index.gsp b/idrop-web/grails-app/views/rule/index.gsp new file mode 100644 index 0000000..8ee551f --- /dev/null +++ b/idrop-web/grails-app/views/rule/index.gsp @@ -0,0 +1,229 @@ +<head> + +<g:javascript library="codemirror" /> +<g:javascript library="addon/search/searchcursor" /> +<g:javascript library="codemirror-ui" /> + + +<g:javascript library="clike" /> +<link rel="stylesheet" href="${resource(dir:'css',file:'codemirror.css')}" /> +<link rel="stylesheet" href="${resource(dir:'css',file:'codemirror-ui.css')}" /> + +<link rel="stylesheet" href="${resource(dir:'css',file:'eclipse.css')}" /> + +</head> +<h3><a ><g:message code="text.rule" /></a></h3> +<div id="detailsTopSection"> + + <div id="detailsToolbar" > + <button type="button" id="reloadRuleButton" class="ruleEdit" + value="reloadRule" + onclick="callReloadRule()"> + <i class="icon-refresh"></i><g:message code="default.button.reload.label" /> + </button> + <span id="saveRuleButton"><button type="button" id="saveRuleButton" class="ruleEdit" + value="saveRule" + onclick="callSaveRule()"><i class="icon-ok"></i> + <g:message code="text.update" /> + </button></span> + <span id="runRuleButton"><button type="button" id="runRuleButton" + value="runRule" + onclick="callRunRule()"><i class="icon-play"></i> + <g:message code="text.run.rule" /> + </button></span> + </button></span> + <span id="showRuleButton"><button hidden type="button" id="showRuleButton" class="ruleResultView" + value="showRule" + onclick="callShowRule()"><i class="icon-edit"></i> + <g:message code="text.edit" /> + </button></span> + </div> + </div> + + <div id="ruleDetailDiv"> + <!-- div for audit table --> + <g:render template="/rule/ruleDetails" /> + </div> + + <div id="ruleResultDiv"> + <!-- result of rule exec --> + + + </div> + + <script type="text/javascript"> + + + function deleteInputParam(param) { + + if (!param) { + return false; + } + + var absPath = $("#ruleAbsPath").val(); + if (absPath == null || absPath == "") { + setErrorMessage("no absPath for rule"); + return false; + } + + var params = { + ruleAbsPath : absPath, + inputParamName : param + } + + + var jqxhr = $.post(context + "/rule/deleteRuleInputParameter", params, "html").success( + function(returnedData, status, xhr) { + var continueReq = checkForSessionTimeout(returnedData, xhr); + if (!continueReq) { + return false; + } + setMessage("Parameter deleted"); + $("#ruleDetailDiv").html(returnedData); + }).error(function(xhr, status, error) { + setErrorMessage(xhr.responseText); + }); + } + + + function deleteOutputParam(param) { + var absPath = $("#ruleAbsPath").val(); + if (absPath == null || absPath == "") { + setErrorMessage("no absPath for rule"); + return false; + } + + var params = { + ruleAbsPath : absPath, + outputParamName : param + } + + + var jqxhr = $.post(context + "/rule/deleteRuleOutputParameter", params, "html").success( + function(returnedData, status, xhr) { + var continueReq = checkForSessionTimeout(returnedData, xhr); + if (!continueReq) { + return false; + } + setMessage("Parameter deleted"); + $("#ruleDetailDiv").html(returnedData); + }).error(function(xhr, status, error) { + setErrorMessage(xhr.responseText); + }); } + + function callSaveRule() { + editor.mirror.save(); + var formData = $("#ruleDetailsForm").serializeArray(); + var jqxhr = $.post(context + "/rule/updateRule", formData, "html").success( + function(returnedData, status, xhr) { + var continueReq = checkForSessionTimeout(returnedData, xhr); + if (!continueReq) { + return false; + } + setMessage("rule saved"); + $("#ruleDetailDiv").html(returnedData); + }).error(function(xhr, status, error) { + setErrorMessage(xhr.responseText); + }); + + + } + + function callShowRule() { + + $("#ruleDetailDiv").show("slow"); + $(".ruleEdit").show("slow"); + $("#ruleResultDiv").html(""); + $("#ruleResultDiv").hide("slow"); + $(".ruleResultView").hide("slow"); + + } + + function callReloadRule(absPath) { + var absPath = $("#ruleAbsPath").val(); + if (absPath == null || absPath == "") { + showError("no absPath for rule"); + return false; + } + + var params = { + absPath : absPath + + } + var jqxhr = $.get(context + "/rule/reloadRule", params, "html").success( + function(returnedData, status, xhr) { + var continueReq = checkForSessionTimeout(returnedData, xhr); + if (!continueReq) { + return false; + } + $("#ruleDetailDiv").html(returnedData); + }).error(function(xhr, status, error) { + setErrorMessage(xhr.responseText); + }); + + + } + + function callRunRule() { + editor.mirror.save(); + var formData = $("#ruleDetailsForm").serializeArray(); + $("#ruleDetailDiv").hide("slow"); + $(".ruleEdit").hide("slow"); + $("#ruleResultDiv").html(""); + $("#ruleResultDiv").show("slow"); + $(".ruleResultView").show("slow"); + + showBlockingPanel(); + + var jqxhr = $.post(context + "/rule/runRule", formData, "html").success( + function(returnedData, status, xhr) { + var continueReq = checkForSessionTimeout(returnedData, xhr); + if (!continueReq) { + unblockPanel(); + return false; + } + $("#ruleResultDiv").html(returnedData); + unblockPanel(); + + + + }).error(function(xhr, status, error) { + unblockPanel(); + + setErrorMessage(xhr.responseText); + }); + } + + function callAddInputParameter() { + + var absPath = $("#ruleAbsPath").val(); + if (absPath == null || absPath == "") { + setErrorMessage("no absPath for rule"); + return false; + } + + var params = { + ruleAbsPath : absPath + } + var url = "/rule/addRuleInputParameterDialog"; + + lcSendValueWithParamsAndPlugHtmlInDiv(url, params, "#addParamDialogDiv", null); + } + + function callAddOutputParameter() { + var absPath = $("#ruleAbsPath").val(); + if (absPath == null || absPath == "") { + setErrorMessage("no absPath for rule"); + return false; + } + + var params = { + ruleAbsPath : absPath + } + var url = "/rule/addRuleOutputParameterDialog"; + + lcSendValueWithParamsAndPlugHtmlInDiv(url, params, "#addParamDialogDiv", null); + } + + + </script> diff --git a/idrop-web/grails-app/views/rule/ruleErrorResult.gsp b/idrop-web/grails-app/views/rule/ruleErrorResult.gsp new file mode 100644 index 0000000..fb05fbf --- /dev/null +++ b/idrop-web/grails-app/views/rule/ruleErrorResult.gsp @@ -0,0 +1,23 @@ + +<div class="container"> + <div class="row-fluid content"> + <div class="span12 alert alert-error"> + <h2><g:message code="error.in.rule.execution" /></h2> + </div> + </div> + <div class="row-fluid content alert alert-success"> + <div class="span12"> + ${message} + </div> + </div> + <div class="row-fluid content alert alert-error"> + <div class="span12"> + ${stackTrace} + </div> + </div> +</div> + + + + + diff --git a/idrop-web/grails-app/views/rule/ruleResult.gsp b/idrop-web/grails-app/views/rule/ruleResult.gsp new file mode 100644 index 0000000..077a950 --- /dev/null +++ b/idrop-web/grails-app/views/rule/ruleResult.gsp @@ -0,0 +1,41 @@ + +<div class="container"> + <div class="row-fluid content"> + <div class="span12"> + + <table class="table"> + <g:each in="${ruleResult.outputParameterResults.keySet()}"> + + <g:if test="${it == "ruleExecOut" || it == "ruleExecErrorOut" }"> + </g:if> + <g:else> + <tr> + <td> + ${it} + </td> + <td> + ${ruleResult.outputParameterResults.get(it).resultObject} + </td> + </tr> + </g:else> + </g:each> + </table> + + </div> + </div> + <div class="row-fluid content alert alert-success"> + <div class="span12"> + ${execOut} + </div> + </div> + <div class="row-fluid content alert alert-error"> + <div class="span12"> + ${errorOut} + </div> + </div> +</div> + + + + + |