summaryrefslogtreecommitdiffstats
path: root/idrop-web/grails-app
diff options
context:
space:
mode:
authormconway <michael_conway@unc.edu>2013-10-31 20:32:30 (GMT)
committer mconway <michael_conway@unc.edu>2013-10-31 20:32:30 (GMT)
commitaea45b0d3747163e5466630a6a5d8e989b85dfdc (patch)
treecfc52ad18f90bba948bb9c7d7467b59e84a93c1d /idrop-web/grails-app
parentc7ee3e425ae7b77524265d57e1e49db044724ae4 (diff)
downloadQCG-Data-aea45b0d3747163e5466630a6a5d8e989b85dfdc.zip
QCG-Data-aea45b0d3747163e5466630a6a5d8e989b85dfdc.tar.gz
QCG-Data-aea45b0d3747163e5466630a6a5d8e989b85dfdc.tar.bz2
[#1776] add rule queue processing views
Diffstat (limited to 'idrop-web/grails-app')
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/RuleController.groovy77
-rwxr-xr-xidrop-web/grails-app/i18n/messages.properties2
-rw-r--r--idrop-web/grails-app/services/org/irods/mydrop/service/RuleProcessingService.groovy9
-rwxr-xr-xidrop-web/grails-app/views/common/_topbar.gsp2
-rw-r--r--idrop-web/grails-app/views/rule/_ruleDelayExecQueueDetails.gsp61
-rw-r--r--idrop-web/grails-app/views/rule/delayExecQueue.gsp39
-rw-r--r--[-rwxr-xr-x]idrop-web/grails-app/views/rule/index.gsp0
7 files changed, 187 insertions, 3 deletions
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/RuleController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/RuleController.groovy
index 54c09e9..49c502c 100644
--- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/RuleController.groovy
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/RuleController.groovy
@@ -3,6 +3,8 @@ package org.irods.mydrop.controller
import org.irods.jargon.core.connection.IRODSAccount
import org.irods.jargon.core.exception.JargonException
import org.irods.jargon.core.pub.IRODSAccessObjectFactory
+import org.irods.jargon.core.pub.RuleProcessingAO
+import org.irods.jargon.core.pub.domain.DelayedRuleExecution
import org.irods.jargon.core.rule.IRODSRuleExecResult
import org.irods.jargon.ruleservice.composition.Rule
import org.irods.jargon.ruleservice.formatting.HtmlLogTableFormatter
@@ -34,6 +36,81 @@ class RuleController {
irodsAccessObjectFactory.closeSession()
}
+ /**
+ * List the contents of the delayed execution queue
+ * @return
+ */
+ def delayExecQueue() {
+ log.info("delayExecQueue()")
+ List<DelayedRuleExecution> rules = ruleProcessingService.listDelayedRuleExecutions(irodsAccount, 0)
+ render(view:"delayExecQueue", model:[rules:rules])
+ }
+
+
+ def deleteDelayExecQueue = {
+ log.info("deleteDelayExecQueue")
+
+ log.info("params: ${params}")
+
+ def rulesToDelete = params['selectDetail']
+
+ // if nothing selected, just jump out and return a message
+ if (!rulesToDelete) {
+ log.info("no rules to delete")
+ List<DelayedRuleExecution> rules = ruleProcessingService.listDelayedRuleExecutions(irodsAccount, 0)
+ render(view:"_ruleDelayExecQueueDetails", model:[rules:rules])
+ }
+
+ log.info("rulesToDelete: ${rulesToDelete}")
+
+
+ RuleProcessingAO ruleAO = irodsAccessObjectFactory.getRuleProcessingAO(irodsAccount)
+
+ if (!rulesToDelete) {
+ log.info("nothing to delete")
+ } else if (rulesToDelete instanceof Object[]) {
+ log.debug "is array"
+ rulesToDelete.each{
+ log.info "ruleToDelete: ${it}"
+ def idVal = parseRuleId(it)
+ if (idVal != -1) {
+ log.info("deleting id:${idVal}")
+ ruleAO.purgeRuleFromDelayedExecQueue(idVal)
+ }
+ }
+ } else {
+ log.debug "not array"
+ log.info "deleting: ${rulesToDelete}..."
+ def idVal = parseRuleId(rulesToDelete)
+ if (idVal != -1) {
+ log.info("deleting id:${idVal}")
+ ruleAO.purgeRuleFromDelayedExecQueue(idVal)
+ }
+
+ }
+
+ List<DelayedRuleExecution> rules = ruleProcessingService.listDelayedRuleExecutions(irodsAccount, 0)
+
+ render(view:"_ruleDelayExecQueueDetails", model:[rules:rules])
+
+ }
+
+ private int parseRuleId(String ruleId) {
+ if (!ruleId) {
+ throw new IllegalArgumentException("null ruleId")
+ }
+
+ int idx = ruleId.indexOf("select-");
+ if (idx == -1) {
+ return -1
+ }
+
+
+ return Integer.valueOf(ruleId.substring(7))
+
+ }
+
+
def updateRule() {
log.info("update rule")
log.info("params:${params}")
diff --git a/idrop-web/grails-app/i18n/messages.properties b/idrop-web/grails-app/i18n/messages.properties
index a5bdbe1..1ba19c7 100755
--- a/idrop-web/grails-app/i18n/messages.properties
+++ b/idrop-web/grails-app/i18n/messages.properties
@@ -46,6 +46,7 @@ text.first.name=First Name
text.find.path.in.tree=Open the path in the tree
text.folders.shared.with.me=Folders shared with me
text.folders.shared.by.me=Folders shared by me
+text.frequency=Frequency
text.gallery=Gallery
text.grant=Grant public access
text.guest.login=Use a guest login
@@ -57,6 +58,7 @@ text.info=Info
text.input.parameters=Input Parameters
text.idrop.lite=Idrop Lite
text.irods.uri=iRODS URI
+text.last.exec.time=Last Exec Time
text.last.name=Last Name
text.length=Size
text.login=Login
diff --git a/idrop-web/grails-app/services/org/irods/mydrop/service/RuleProcessingService.groovy b/idrop-web/grails-app/services/org/irods/mydrop/service/RuleProcessingService.groovy
index 7a1ea35..44d74a4 100644
--- a/idrop-web/grails-app/services/org/irods/mydrop/service/RuleProcessingService.groovy
+++ b/idrop-web/grails-app/services/org/irods/mydrop/service/RuleProcessingService.groovy
@@ -2,6 +2,7 @@ package org.irods.mydrop.service
import org.irods.jargon.core.connection.IRODSAccount
import org.irods.jargon.core.pub.IRODSAccessObjectFactory
+import org.irods.jargon.core.pub.RuleProcessingAO
import org.irods.jargon.core.utils.LocalFileUtils
import org.irods.jargon.core.utils.MiscIRODSUtils
import org.irods.jargon.ruleservice.composition.RuleCompositionService
@@ -35,7 +36,6 @@ class RuleProcessingService {
return ruleService.executeRuleFromParts(ruleBody, inputParameters, outputParameters)
}
-
def isRule(String rulePath) {
if (!rulePath) {
return false
@@ -52,7 +52,6 @@ class RuleProcessingService {
}
}
-
def deleteOutputParam(IRODSAccount irodsAccount, String absPath, String parameter) {
log.info("deleteOutputParam")
RuleCompositionService ruleService = new RuleCompositionServiceImpl(irodsAccessObjectFactory, irodsAccount)
@@ -77,4 +76,10 @@ class RuleProcessingService {
RuleCompositionService ruleService = new RuleCompositionServiceImpl(irodsAccessObjectFactory, irodsAccount)
return ruleService.addOutputParameterToRule(absPath, parameterName)
}
+
+ def listDelayedRuleExecutions(IRODSAccount irodsAccount, int offset) {
+ log.info("listDelayedRuleExecutions()")
+ RuleProcessingAO ruleProcessingAO = irodsAccessObjectFactory.getRuleProcessingAO(irodsAccount)
+ return ruleProcessingAO.listAllDelayedRuleExecutions(offset)
+ }
}
diff --git a/idrop-web/grails-app/views/common/_topbar.gsp b/idrop-web/grails-app/views/common/_topbar.gsp
index 75b3330..2edf9ce 100755
--- a/idrop-web/grails-app/views/common/_topbar.gsp
+++ b/idrop-web/grails-app/views/common/_topbar.gsp
@@ -29,7 +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="index">User Rules</g:link></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/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/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
index 8ee551f..8ee551f 100755..100644
--- a/idrop-web/grails-app/views/rule/index.gsp
+++ b/idrop-web/grails-app/views/rule/index.gsp