From 1b7f4f7ffcba20af1742a0a68e5ec65867423793 Mon Sep 17 00:00:00 2001 From: Hetal Patel Date: Tue, 23 Jan 2018 14:35:49 -0500 Subject: [PATCH] #27 collection tabs and summary --- .../services/irods/IRODSServicesImpl.java | 2 +- .../controller/CollectionController.java | 2 +- .../controller/CollectionInfoController.java | 32 ++- .../controller/PermissionsController.java | 4 +- .../main/resources/static/js/collection.js | 58 +++-- .../views/collections/collectionInfo.html | 217 ++++++------------ .../resources/views/collections/fileInfo.html | 80 +++++++ .../resources/views/collections/info.html | 190 +++++++++++---- .../resources/views/collections/summary.html | 49 ++++ .../webapp/WEB-INF/applicationContext.xml | 8 +- 10 files changed, 412 insertions(+), 230 deletions(-) create mode 100644 src/emc-metalnx-shared/src/main/resources/views/collections/fileInfo.html create mode 100644 src/emc-metalnx-shared/src/main/resources/views/collections/summary.html diff --git a/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/irods/IRODSServicesImpl.java b/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/irods/IRODSServicesImpl.java index 277edcd88..4fc4e3eef 100755 --- a/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/irods/IRODSServicesImpl.java +++ b/src/emc-metalnx-services/src/main/java/com/emc/metalnx/services/irods/IRODSServicesImpl.java @@ -107,7 +107,7 @@ public TicketAdminService getTicketAdminService() throws DataGridConnectionRefus } @Override - public TrashOperationsAO getTrashOperationsAO() throws DataGridConnectionRefusedException, JargonException { + public TrashOperationsAO getTrashOperationsAO() throws DataGridConnectionRefusedException, JargonException { return irodsAccessObjectFactory.getTrashOperationsAO(irodsAccount); } diff --git a/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionController.java b/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionController.java index 4f1729ba5..822fbdae6 100755 --- a/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionController.java +++ b/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionController.java @@ -495,7 +495,7 @@ public String getFileInfo(final Model model, final String path) System.out.println("currentCollection.getName() == "+ dataGridObj.getName()); System.out.println("CollectionController getInfoFile() ends !!"); - return "collections/collectionInfo"; + return "collections/info :: infoView"; //return "collections/info"; } diff --git a/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionInfoController.java b/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionInfoController.java index dc893b8ba..0f6d54c16 100644 --- a/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionInfoController.java +++ b/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionInfoController.java @@ -1,7 +1,11 @@ package com.emc.metalnx.controller; +import java.io.IOException; +import java.io.InputStream; + import javax.servlet.http.HttpServletRequest; +import org.apache.commons.io.IOUtils; import org.irods.jargon.core.connection.IRODSAccount; import org.irods.jargon.core.exception.JargonException; import org.irods.jargon.core.pub.domain.IRODSDomainObject; @@ -13,12 +17,15 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; +import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.util.AntPathMatcher; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.servlet.HandlerMapping; @@ -37,9 +44,6 @@ @RequestMapping(value = "/collectionInfo") public class CollectionInfoController { - @Autowired - private LoggedUserUtils loggedUserUtils; - @Autowired CollectionService collectionService; @@ -81,8 +85,14 @@ public String getTestCollectionInfo(final Model model, HttpServletRequest reques model.addAttribute("iconToDisplay", iconToDisplay); model.addAttribute("dataProfile", dataProfile); + String template = ""; - return "collections/info"; + if(!dataProfile.isFile()) + template = "collections/collectionInfo"; + if(dataProfile.isFile()) + template = "collections/fileInfo"; + + return template; //:: mainPage(page='collections/collectionInfo', fragment='collectionInfo')"; //"main :: mainPage(page='some-page', fragment='somePage')"; @@ -141,11 +151,19 @@ public String getCollectionFileInfo(final Model model, @RequestParam("path") model.addAttribute("iconToDisplay", iconToDisplay); model.addAttribute("dataProfile", dataProfile); - logger.info("CollectionInfoController getCollectionFileInfo() ends !!"); - - return "collections/collectionInfo"; + logger.info("getCollectionFileInfo() ends !!"); + return "collections/info :: infoView"; + //return "collections/info"; } + @RequestMapping(value = "/getFile/",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) + public @ResponseBody byte[] getFile() throws IOException { + logger.info("getFile() starts!!"); + InputStream in = getClass() + .getResourceAsStream("C:/Users/hetalben/opt/etc/test-data/github-git-cheat-sheet.pdf"); + logger.info("getFile() ends!!"); + return IOUtils.toByteArray(in); + } /* * @RequestMapping(value = "/collectionMetadata/", method = RequestMethod.POST) diff --git a/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/PermissionsController.java b/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/PermissionsController.java index 571897fd9..449efee72 100755 --- a/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/PermissionsController.java +++ b/src/emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/PermissionsController.java @@ -189,9 +189,7 @@ public String getPermissionDetails(final Model model, @RequestParam("path") fina System.out.println("permissionOnCurrentPath =======" + cs.getPermissionsForPath(path)); System.out.println("------Permission Conroller - /getPermissionDetail/ ends------"); - return "permissions/permissionDetails :: permissionDetails"; - //return "permissions/permissionDetails"; - + return "permissions/permissionDetails :: permissionDetails"; } @RequestMapping(value = "/changePermissionForGroup/") diff --git a/src/emc-metalnx-shared/src/main/resources/static/js/collection.js b/src/emc-metalnx-shared/src/main/resources/static/js/collection.js index 7be9de1cb..ef424eaec 100644 --- a/src/emc-metalnx-shared/src/main/resources/static/js/collection.js +++ b/src/emc-metalnx-shared/src/main/resources/static/js/collection.js @@ -1,5 +1,4 @@ -function getCollectionSummary(path){ - console.log(" In getTestInfo() " +path); +function getCollectionSummary(path){ var url = "/emc-metalnx-web/collectionInfo"+path; getBreadcrumb(path); console.log("URL :: " +url); @@ -8,59 +7,78 @@ function getCollectionSummary(path){ function displayCollectionSummary(data){ console.log("displayTestDetails()"); - $("#summary").html(data); - //alert([[${ currentPath }]]); - //getInfoDetails(path); - displayInfoDetails(data); - //$("#info").html(data); + $("#summary").html(data); + //displayInfoDetails(data); } function getInfoDetails(path){ - console.log("Collection getInfoDetails() starts !!"); - window.location.hash = "info"; - console.log("Path :: " +path); - //var url = "/emc-metalnx-web/collectionInfo/collectionFileInfo/"; - //var url = "/emc-metalnx-web/collections/info/"; + $("#info").hide(); + $("#table-loader").show(); + window.location.hash = "info"; var url = "/emc-metalnx-web/collectionInfo/collectionFileInfo/"; - //getBreadcrumb(path); ajaxEncapsulation(url, "POST", {path: path}, displayInfoDetails, null, null, null); } function getMetadata(path){ + $("#metadata").hide(); + $("#table-loader").show(); console.log("Collection getMetadata() :: " +path); window.location.hash = "metadata"; - console.log("window.location.hash :: " +window.location.hash); var url = "/emc-metalnx-web/metadata/getMetadata/"; - console.log("url " +url); - //getBreadcrumb(path); ajaxEncapsulation(url , "POST", {path: path}, displayMetadata, null, null, null); } function getPermissionDetails(path){ + $("#permission").hide(); + $("#table-loader").show(); console.log("Collection getPermDetails() :: " +path); window.location.hash = "permission"; - var url = "/emc-metalnx-web/permissions/getPermissionDetails/"; - console.log("URL :: " +url); - //getBreadcrumb(path); + var url = "/emc-metalnx-web/permissions/getPermissionDetails/"; ajaxEncapsulation(url, "POST", {path: path}, displayPermissionDetails, null, null); } function displayInfoDetails(data){ + $("#table-loader").hide(); $("#info").html(data); + $("#info").show(); } function displayMetadata(data){ + $("#table-loader").hide(); $("#metadata").html(data); + $("#metadata").show(); } function displayPermissionDetails(data){ + $("#table-loader").hide(); $('#permission').html(data); - + //alert('showing content menu'); + $("#permission").show(); } +function showPreview(){ + alert("Show Preview"); + + $.ajax({ + type : "POST", + url : "/emc-metalnx-web/collectionInfo/getFile/", + timeout : 100000, + success : function(data) { + console.log("SUCCESS: ", data); + console.log(data); + }, + error : function(e) { + console.log("ERROR: ", e); + console.log(e); + }, + done : function(e) { + console.log("DONE"); + } + }); +} /* function ChangeUrl(title, urlVal) { diff --git a/src/emc-metalnx-shared/src/main/resources/views/collections/collectionInfo.html b/src/emc-metalnx-shared/src/main/resources/views/collections/collectionInfo.html index 2992be201..60d7337dd 100755 --- a/src/emc-metalnx-shared/src/main/resources/views/collections/collectionInfo.html +++ b/src/emc-metalnx-shared/src/main/resources/views/collections/collectionInfo.html @@ -1,156 +1,83 @@ - - - - - - -
- -
- this is collection Info -
-
-

- -

-
-
-
-
-
-
- - - - - -
- - -
-
- -
- -
-
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
+ + + + +
+ +
+
+
+ + + -
- this is File Info -
-
-

- -

-
-
-
+
+ +
+ +

-
-
- - - - - -
- - -
-
- -
- -
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
+ +
+ +
-
+
+ +
+ +
+ This is Collection tab. +
+ +
-
+ + + + + + + +
+ - - - + \ No newline at end of file diff --git a/src/emc-metalnx-shared/src/main/resources/views/collections/fileInfo.html b/src/emc-metalnx-shared/src/main/resources/views/collections/fileInfo.html new file mode 100644 index 000000000..77c8e5012 --- /dev/null +++ b/src/emc-metalnx-shared/src/main/resources/views/collections/fileInfo.html @@ -0,0 +1,80 @@ + + + + +
+ +
+ +
+ +
+ + +
+ +
+ +

+
+ +
+ + +
+ +
+ +
+ +
+ This is File tab. +
+ + +
+
+ + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/src/emc-metalnx-shared/src/main/resources/views/collections/info.html b/src/emc-metalnx-shared/src/main/resources/views/collections/info.html index 99fd914f2..4472098c5 100644 --- a/src/emc-metalnx-shared/src/main/resources/views/collections/info.html +++ b/src/emc-metalnx-shared/src/main/resources/views/collections/info.html @@ -1,64 +1,156 @@ + - + + - -
-
-
- Summary :: -
+
+ +
+ this is collection Info +
+
+

+ +

+
+
+
+
+
+ -
-
+
+
-
  • - Permissions -
  • - -
    -
    - - +
    + this is File Info +
    +
    +

    + +

    +
    +
    +
    +
    + +
    +
    + +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    -
    - - - - - - -
    - - \ No newline at end of file + + + + diff --git a/src/emc-metalnx-shared/src/main/resources/views/collections/summary.html b/src/emc-metalnx-shared/src/main/resources/views/collections/summary.html new file mode 100644 index 000000000..4336f207e --- /dev/null +++ b/src/emc-metalnx-shared/src/main/resources/views/collections/summary.html @@ -0,0 +1,49 @@ + + + + +
    +
    +
    +
    +
    +
    + + + + +
    +
    +
    + + +
    + + +
    +
    +
    +
    + +
    + diff --git a/src/emc-metalnx-web/src/main/webapp/WEB-INF/applicationContext.xml b/src/emc-metalnx-web/src/main/webapp/WEB-INF/applicationContext.xml index 20dbf9643..f8e1f8b67 100755 --- a/src/emc-metalnx-web/src/main/webapp/WEB-INF/applicationContext.xml +++ b/src/emc-metalnx-web/src/main/webapp/WEB-INF/applicationContext.xml @@ -31,8 +31,8 @@ - file:/etc/irods-ext/metalnx.properties - + + file:///C:/Users/hetalben/opt/etc/irods-ext/metalnx.properties @@ -41,8 +41,8 @@ - - + +