summaryrefslogtreecommitdiffstats
path: root/idrop-web
diff options
context:
space:
mode:
authorMike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-02-16 03:35:05 (GMT)
committer Mike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-02-16 03:35:05 (GMT)
commit4d162ce719078ee43ac130653056b951930affb4 (patch)
treed5d954cc99f60676de5fdbfa3adc499bbd197481 /idrop-web
parent28ac123d9ddab8fdf9008c386a0b3ac924668e88 (diff)
downloadQCG-Data-4d162ce719078ee43ac130653056b951930affb4.zip
QCG-Data-4d162ce719078ee43ac130653056b951930affb4.tar.gz
QCG-Data-4d162ce719078ee43ac130653056b951930affb4.tar.bz2
working on info panel for browser
Diffstat (limited to 'idrop-web')
-rw-r--r--idrop-web/grails-app/conf/BuildConfig.groovy1
-rw-r--r--idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy25
-rw-r--r--idrop-web/grails-app/views/browse/dataObjectInfo.gsp21
-rw-r--r--idrop-web/grails-app/views/browse/index.gsp4
-rw-r--r--idrop-web/grails-app/views/browse/loadTree.gsp5
-rw-r--r--idrop-web/test/unit/org/irods/mydrop/controller/BrowseControllerTests.groovy70
-rw-r--r--idrop-web/web-app/css/main.css191
-rw-r--r--idrop-web/web-app/js/mydrop/home.js12
-rw-r--r--idrop-web/web-app/js/mydrop/lingo_common.js54
9 files changed, 315 insertions, 68 deletions
diff --git a/idrop-web/grails-app/conf/BuildConfig.groovy b/idrop-web/grails-app/conf/BuildConfig.groovy
index b55bd82..19b3514 100644
--- a/idrop-web/grails-app/conf/BuildConfig.groovy
+++ b/idrop-web/grails-app/conf/BuildConfig.groovy
@@ -27,6 +27,7 @@ grails.project.dependency.resolution = {
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
test 'org.irods.jargon:jargon-test:2.4.1-SNAPSHOT'
+ test 'org.mockito:mockito-all:1.8.1'
compile 'org.irods.jargon:jargon-core:2.4.1-SNAPSHOT'
compile 'org.irods.jargon:jargon-security:2.4.1-SNAPSHOT'
compile 'org.springframework.security:spring-security-core:3.0.5.RELEASE'
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy
index d2addab..817cfb2 100644
--- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy
+++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/BrowseController.groovy
@@ -1,11 +1,12 @@
package org.irods.mydrop.controller
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.irods.jargon.core.pub.*;
-import org.irods.jargon.core.connection.*;
-import org.irods.jargon.core.exception.*;
-import grails.converters.*;
-import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry;
+import grails.converters.*
+
+import org.irods.jargon.core.connection.*
+import org.irods.jargon.core.exception.*
+import org.irods.jargon.core.pub.*
+import org.irods.jargon.core.pub.domain.DataObject
+import org.springframework.security.core.context.SecurityContextHolder
/**
@@ -97,8 +98,20 @@ class BrowseController {
}
+ log.info "fileInfo for absPath: ${absPath}"
+ CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = irodsAccessObjectFactory.getCollectionAndDataObjectListAndSearchAO(irodsAccount)
+
+ // TODO: some sort of catch and display of no data available in info?
+ def retObj = collectionAndDataObjectListAndSearchAO.getFullObjectForType(absPath)
+ def isDataObject = retObj instanceof DataObject
+ log.info "is this a data object? ${isDataObject}"
+
+ if (isDataObject) {
+ log.info("rendering as data object: ${retObj}")
+ render(view:"dataObjectInfo", model:[dataObject:retObj])
+ }
}
diff --git a/idrop-web/grails-app/views/browse/dataObjectInfo.gsp b/idrop-web/grails-app/views/browse/dataObjectInfo.gsp
new file mode 100644
index 0000000..bf895f5
--- /dev/null
+++ b/idrop-web/grails-app/views/browse/dataObjectInfo.gsp
@@ -0,0 +1,21 @@
+<fieldset id="verticalForm">
+
+<label for="collectionName">Parent
+Collection:</label> <g:textField name="collectionName"
+ value="${dataObject.collectionName}" readonly="true" /> <br />
+
+<label for="dataName">File Name:</label> <g:textField name="dataName"
+ value="${dataObject.dataName}" readonly="true" /> <br />
+
+<label for="createdAt">Created At:</label> <g:textField name="createdAt"
+ value="${dataObject.createdAt}" readonly="true" /> <br />
+
+<label for="dataSize">Size:</label> <g:textField name="dataSize"
+ value="${dataObject.dataSize}" readonly="true" /> <br />
+
+<label for="checksum">Checksum:</label> <g:textField name="checksum"
+ value="${dataObject.checksum}" readonly="true" /> <br />
+
+
+
+</fieldset> \ No newline at end of file
diff --git a/idrop-web/grails-app/views/browse/index.gsp b/idrop-web/grails-app/views/browse/index.gsp
index b49b8d3..7b0a3ef 100644
--- a/idrop-web/grails-app/views/browse/index.gsp
+++ b/idrop-web/grails-app/views/browse/index.gsp
@@ -10,8 +10,8 @@ $(function() {
<div id="browser" class="wrapper">
<div id="dataTreeView"
style="float: left; position: relative; width: auto;"><!-- no empty divs -->
-<div id="dataTreeDiv" class="colLeft"></div>
-<div id="infoDiv" class="colRight roundedContainer">info here</div>
+<div id="dataTreeDiv" class="colLeft"><!-- no empty divs --></div>
+<div id="infoDiv" class="colRight roundedContainer"><!-- no empty divs --></div>
</div>
</div> \ No newline at end of file
diff --git a/idrop-web/grails-app/views/browse/loadTree.gsp b/idrop-web/grails-app/views/browse/loadTree.gsp
index 198e6f7..0ef3671 100644
--- a/idrop-web/grails-app/views/browse/loadTree.gsp
+++ b/idrop-web/grails-app/views/browse/loadTree.gsp
@@ -1,4 +1 @@
-<g:each in="${collectionAndDataObjectList}" var="entry">
-<li><a href="${entry.formattedAbsolutePath}">${entry}</a>
-</li>
-</g:each> \ No newline at end of file
+<h1>Data Object info will be here</h1> \ No newline at end of file
diff --git a/idrop-web/test/unit/org/irods/mydrop/controller/BrowseControllerTests.groovy b/idrop-web/test/unit/org/irods/mydrop/controller/BrowseControllerTests.groovy
index a578d54..cfabb2f 100644
--- a/idrop-web/test/unit/org/irods/mydrop/controller/BrowseControllerTests.groovy
+++ b/idrop-web/test/unit/org/irods/mydrop/controller/BrowseControllerTests.groovy
@@ -1,31 +1,36 @@
+
package org.irods.mydrop.controller
import grails.test.*
+import org.irods.jargon.core.exception.JargonException
import java.util.Properties
-import org.irods.jargon.core.connection.IRODSAccount
+import org.irods.jargon.core.connection.IRODSAccount
import org.irods.jargon.core.pub.IRODSAccessObjectFactory
-import org.irods.jargon.core.pub.IRODSFileSystem;
+import org.irods.jargon.core.pub.IRODSFileSystem
+import org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO
import org.irods.jargon.core.pub.io.IRODSFile
import org.irods.jargon.core.query.CollectionAndDataObjectListingEntry
import org.irods.jargon.testutils.TestingPropertiesHelper
import org.irods.jargon.testutils.filemanip.FileGenerator
import org.irods.jargon.testutils.TestingPropertiesHelper
-import org.irods.jargon.spring.security.IRODSAuthenticationToken;
-import org.springframework.security.core.context.SecurityContextHolder;
+import org.irods.jargon.spring.security.IRODSAuthenticationToken
+import org.irods.jargon.core.pub.domain.DataObject
+import org.mockito.Mockito
+import org.springframework.security.core.context.SecurityContextHolder
import grails.converters.*
class BrowseControllerTests extends ControllerUnitTestCase {
-
+
IRODSAccessObjectFactory irodsAccessObjectFactory
IRODSAccount irodsAccount
Properties testingProperties
TestingPropertiesHelper testingPropertiesHelper
IRODSFileSystem irodsFileSystem
-
-
- protected void setUp() {
+
+
+ protected void setUp() {
super.setUp()
testingPropertiesHelper = new TestingPropertiesHelper()
testingProperties = testingPropertiesHelper.getTestProperties()
@@ -34,13 +39,13 @@ class BrowseControllerTests extends ControllerUnitTestCase {
irodsAccessObjectFactory = irodsFileSystem.getIRODSAccessObjectFactory()
def irodsAuthentication = new IRODSAuthenticationToken(irodsAccount)
SecurityContextHolder.getContext().authentication = irodsAuthentication
- }
+ }
- protected void tearDown() {
- super.tearDown()
- }
+ protected void tearDown() {
+ super.tearDown()
+ }
- void testBrowse() {
+ void testBrowse() {
controller.params.dir = "/"
controller.irodsAccessObjectFactory = irodsAccessObjectFactory
controller.irodsAccount = irodsAccount
@@ -48,10 +53,8 @@ class BrowseControllerTests extends ControllerUnitTestCase {
def controllerResponse = controller.response.contentAsString
def jsonResult = JSON.parse(controllerResponse)
assertNotNull("missing json result", jsonResult)
-
-
- }
-
+ }
+
void testAjaxDirectoryListingUnderParent() {
controller.params.dir = "/"
controller.irodsAccessObjectFactory = irodsAccessObjectFactory
@@ -60,16 +63,37 @@ class BrowseControllerTests extends ControllerUnitTestCase {
def controllerResponse = controller.response.contentAsString
def jsonResult = JSON.parse(controllerResponse)
assertNotNull("missing json result", jsonResult)
-
}
-
- void testFileInfo() {
+
+ void testFileInfoNoParam() {
controller.irodsAccessObjectFactory = irodsAccessObjectFactory
controller.irodsAccount = irodsAccount
- controller.fileInfo
+ shouldFail(JargonException) { controller.fileInfo() }
}
-
-
+ void testFileInfoWithPath() {
+ def testPath = "/testpath.txt"
+ def irodsAccessObjectFactory = Mockito.mock(IRODSAccessObjectFactory.class)
+ CollectionAndDataObjectListAndSearchAO collectionListAndSearchAO = Mockito.mock(CollectionAndDataObjectListAndSearchAO.class)
+ DataObject retObject = new DataObject()
+ retObject.setDataName(testPath)
+ Mockito.when(collectionListAndSearchAO.getFullObjectForType(testPath)).thenReturn(retObject)
+ Mockito.when(irodsAccessObjectFactory.getCollectionAndDataObjectListAndSearchAO(irodsAccount)).thenReturn(collectionListAndSearchAO)
+ controller.irodsAccessObjectFactory = irodsAccessObjectFactory
+ controller.irodsAccount = irodsAccount
+ controller.params.absPath = testPath
+ controller.fileInfo()
+
+ def mav = controller.modelAndView
+ def name = mav.viewName
+
+ assertNotNull("null mav", mav)
+ assertEquals("view name should be dataObjectInfo", "dataObjectInfo", name)
+ def dataObj = mav.model.dataObject
+ assertNotNull("null data object", dataObj)
+ assertEquals("did not find expected path", testPath, dataObj.dataName)
+
+
+ }
}
diff --git a/idrop-web/web-app/css/main.css b/idrop-web/web-app/css/main.css
index 915c7d6..2dc8d36 100644
--- a/idrop-web/web-app/css/main.css
+++ b/idrop-web/web-app/css/main.css
@@ -324,4 +324,195 @@ th.desc a {
display: block;
float: left;
padding: 10px;
+}
+
+
+/* standard form layouts */
+#columnarForm fieldset {
+ float: left;
+ display: block;
+ width: 17em;
+ margin: 0 1em 1em 0;
+ padding: 0 1em 1em 1em;
+}
+
+#columnarForm fieldset.radio {
+ width: 15em;
+ margin: 1em 0 2em 0;
+}
+
+#columnarForm fieldset.radio input {
+ clear: both;
+ float: left;
+ width: auto;
+}
+
+#columnarForm fieldset.radio label {
+ font-weight: normal;
+}
+
+#columnarForm input {
+ display: block;
+ width: 15em;
+}
+
+#columnarForm label {
+ display: block;
+ margin-bottom: 1em;
+ font-weight: bold;
+}
+
+#columnarForm label.first {
+ padding-top: 1em;
+}
+
+#columnarForm select {
+ display: block;
+}
+
+#horizontalForm fieldset {
+ display: block;
+ margin: 0 0 3em 0;
+ padding: 0 1em 1em 1em;
+}
+
+#horizontalForm fieldset.radio {
+ margin: 1em 0 2em 0;
+}
+
+#horizontalForm fieldset.radio input {
+ clear: both;
+ float: left;
+ width: auto;
+}
+
+#horizontalForm fieldset.radio label {
+ font-weight: normal;
+}
+
+#horizontalForm input {
+ display: block;
+ width: 15em;
+}
+
+#horizontalForm input.submit {
+ clear: both;
+}
+
+#horizontalForm label {
+ float: left;
+ display: block;
+ margin: 1em 1em 0 0;
+ font-weight: bold;
+}
+
+#horizontalForm select {
+ display: block;
+}
+
+#marginForm fieldset {
+ display: block;
+ margin: 0 0 1em 0;
+ border: 0 solid #FFFFFF;
+ border-top: 1px solid #000000;
+ padding: 0 1em 1em 1em;
+}
+
+#marginForm fieldset.radio {
+ margin: 0 0 0 -1em;
+ border: 0 solid #FFFFFF;
+}
+
+#marginForm fieldset.radio input {
+ position: static;
+ clear: both;
+ float: left;
+}
+
+#marginForm fieldset.radio label {
+ position: relative;
+ top: -1.25em;
+ display: inline;
+ width: auto;
+ margin: 0 0 0 8em;
+ font-weight: bold;
+ font-weight: normal;
+}
+
+#marginForm fieldset.radio legend {
+ float: left;
+ font-weight: bold;
+}
+
+#marginForm input {
+ position: relative;
+ top: -1.4em;
+ left: 8em;
+ display: block;
+}
+
+#marginForm input.submit {
+ clear: both;
+ top: 0;
+}
+
+#marginForm label {
+ clear: both;
+ float: left;
+ display: block;
+ width: 8em;
+ margin-top: -1em;
+ font-weight: bold;
+}
+
+#marginForm label.first {
+ margin-top: 1em;
+}
+
+#marginForm select {
+ position: relative;
+ top: -1.4em;
+ left: 8em;
+ display: block;
+}
+
+#verticalForm fieldset {
+ display: block;
+ width: 17em;
+ margin: 0 0 3em 0;
+ padding: 0 1em 1em 1em;
+}
+
+#verticalForm fieldset.radio {
+ width: 15em;
+ margin: 1em 0 2em 0;
+}
+
+#verticalForm fieldset.radio input {
+ clear: both;
+ float: left;
+ width: auto;
+}
+
+#verticalForm fieldset.radio label {
+ font-weight: normal;
+}
+
+#verticalForm input {
+ display: block;
+ width: 15em;
+}
+
+#verticalForm label {
+ display: block;
+ margin-bottom: 1em;
+ font-weight: bold;
+}
+
+#verticalForm label.first {
+ padding-top: 1em;
+}
+
+#verticalForm select {
+ display: block;
} \ No newline at end of file
diff --git a/idrop-web/web-app/js/mydrop/home.js b/idrop-web/web-app/js/mydrop/home.js
index 991e9e5..585c4c6 100644
--- a/idrop-web/web-app/js/mydrop/home.js
+++ b/idrop-web/web-app/js/mydrop/home.js
@@ -181,14 +181,10 @@ function nodeLoadedCallback() {
*/
function nodeSelected(event, data) {
// given the path, put in the node data
-
- alert("node selected");
- //obj = $.jstree._reference(event.target)._get_node(event.target);
- /*
- * $.jstree._reference("#root").toggle_node(event.target, false, false);
- * synchronizeDetailView(event.target, path); } else {
- * //useAjaxToRetrieveATreeNode(obj, path); }
- */
+
+ var id = data[0].id;
+ lcSendValueAndCallbackHtmlAfterErrorCheck("/browse/fileInfo?absPath=" + id, "#infoDiv",
+ "#infoDiv", null);
}
diff --git a/idrop-web/web-app/js/mydrop/lingo_common.js b/idrop-web/web-app/js/mydrop/lingo_common.js
index 08f96dc..17f39d6 100644
--- a/idrop-web/web-app/js/mydrop/lingo_common.js
+++ b/idrop-web/web-app/js/mydrop/lingo_common.js
@@ -21,7 +21,6 @@ function prepareForCall() {
$(javascriptMessageArea).html();
}
-
/*
* check HTML coming back from an AJAX call for an indication of an error, and
* if an error is found, then set the message in the div using the given id.
@@ -57,7 +56,7 @@ function checkAjaxResultForErrorAndDisplayInGivenArea(resultHtml, messageAreaId)
"Unable to access, due to expired login or no authorization");
throw ("dataAccessError");
}
-
+
if (resultHtml.indexOf(appExceptionVal) > -1) {
exceptionStart = resultHtml.indexOf("_exception") + 12;
@@ -116,7 +115,7 @@ function checkAjaxResultForError(resultHtml) {
setMessage("Unable to access, due to expired login or no authorization");
throw ("dataAccessError");
}
-
+
if (resultHtml.indexOf(appExceptionVal) > -1) {
exceptionStart = resultHtml.indexOf("_exception") + 12;
@@ -127,18 +126,19 @@ function checkAjaxResultForError(resultHtml) {
}
}
-
/*
* Send a query via ajax that results in an HTML table to be displayed as a
- * JQuery data table
+ * JQuery data table
*
- * @param getUrl - url for ajax call as GET
+ * @param getUrl - url for ajax call as GET
*
- * @param tableDiv - selector for the div where the table HTML response will be placed
+ * @param tableDiv - selector for the div where the table HTML response will be
+ * placed
*
* @param newTableId - id for the new table
*
- * @param detailsFunction - function pointer for click event handler to be attached to each table node
+ * @param detailsFunction - function pointer for click event handler to be
+ * attached to each table node
*/
function lcSendValue(getUrl, tableDiv, newTableId, detailsFunction) {
@@ -158,7 +158,7 @@ function lcSendValue(getUrl, tableDiv, newTableId, detailsFunction) {
checkAjaxResultForError(data);
lcBuildTable(data, tableDiv, newTableId, detailsFunction);
}, "html");
-
+
$(tableDiv).ajaxError(function(e, xhr, settings, exception) {
$(tableDiv).html("");
checkAjaxResultForError(xhr.responseText);
@@ -195,8 +195,7 @@ function lcBuildTable(data, tableDiv, newTableId, detailsFunction) {
}
/*
- * Close table nodes when using +/- details icon
- * @param dataTable - reference to
+ * Close table nodes when using +/- details icon @param dataTable - reference to
* jquery dataTable (not a selector, the table)
*/
function lcCloseTableNodes(dataTable) {
@@ -222,11 +221,11 @@ function lcCloseDetails(minMaxIcon, rowActionIsOn, dataTable) {
dataTable.fnClose(rowActionIsOn);
}
-
/*
* Send a query via ajax that results in html plugged into the correct div
*/
-function lcSendValueAndPlugHtmlInDiv(getUrl, resultDiv, context, postLoadFunction) {
+function lcSendValueAndPlugHtmlInDiv(getUrl, resultDiv, context,
+ postLoadFunction) {
prepareForCall();
if (getUrl.length == 0) {
@@ -234,7 +233,7 @@ function lcSendValueAndPlugHtmlInDiv(getUrl, resultDiv, context, postLoadFunctio
}
var img = document.createElement('IMG');
- img.setAttribute("src", + context + "/images/ajax-loader.gif");
+ img.setAttribute("src", +context + "/images/ajax-loader.gif");
$(resultDiv).html(img);
@@ -244,7 +243,7 @@ function lcSendValueAndPlugHtmlInDiv(getUrl, resultDiv, context, postLoadFunctio
checkAjaxResultForError(data);
lcFillInDivWithHtml(data, resultDiv, postLoadFunction);
}, "html");
-
+
$(resultDiv).ajaxError(function(e, xhr, settings, exception) {
$(resultDiv).html("");
checkAjaxResultForError(xhr.responseText);
@@ -260,11 +259,11 @@ function lcSendValueAndPlugHtmlInDiv(getUrl, resultDiv, context, postLoadFunctio
}
-
/*
* Send a query via ajax that results in html plugged into the correct div
*/
-function lcSendValueAndCallbackHtmlAfterErrorCheck(getUrl,divForAjaxError, divForLoadingGif, callbackFunction) {
+function lcSendValueAndCallbackHtmlAfterErrorCheck(getUrl, divForAjaxError,
+ divForLoadingGif, callbackFunction) {
prepareForCall();
if (getUrl.length == 0) {
@@ -281,10 +280,14 @@ function lcSendValueAndCallbackHtmlAfterErrorCheck(getUrl,divForAjaxError, divFo
$.get(context + getUrl, function(data) {
checkAjaxResultForError(data);
$(divForLoadingGif).html("");
- var myHtml = data;
- callbackFunction(myHtml);
+ if (callbackFunction != null) {
+ var myHtml = data;
+ callbackFunction(myHtml);
+ } else {
+ $(divForLoadingGif).html(data);
+ }
}, "html");
-
+
$(divForAjaxError).ajaxError(function(e, xhr, settings, exception) {
$(divForLoadingGif).html("");
checkAjaxResultForError(xhr.responseText);
@@ -298,11 +301,12 @@ function lcSendValueAndCallbackHtmlAfterErrorCheck(getUrl,divForAjaxError, divFo
}
-
/*
- * Send a query via ajax that results in json that will be returned to a callback function
+ * Send a query via ajax that results in json that will be returned to a
+ * callback function
*/
-function lcSendValueAndCallbackWithJsonAfterErrorCheck(getUrl, parms, divForAjaxError, callbackFunction) {
+function lcSendValueAndCallbackWithJsonAfterErrorCheck(getUrl, parms,
+ divForAjaxError, callbackFunction) {
prepareForCall();
if (getUrl.length == 0) {
@@ -314,7 +318,7 @@ function lcSendValueAndCallbackWithJsonAfterErrorCheck(getUrl, parms, divForAja
$.get(context + getUrl, parms, function(data) {
callbackFunction(data);
}, "json");
-
+
$(divForAjaxError).ajaxError(function(e, xhr, settings, exception) {
checkAjaxResultForError(xhr.responseText);
});
@@ -331,5 +335,5 @@ function lcFillInDivWithHtml(data, resultDiv, postLoadFunction) {
if (postLoadFunction != null) {
postLoadFunction(data);
}
-
+
}