Skip to content

Commit

Permalink
#27 collection tabs and summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Hetal Patel committed Jan 23, 2018
1 parent 681f4cb commit 1b7f4f7
Show file tree
Hide file tree
Showing 10 changed files with 412 additions and 230 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -37,9 +44,6 @@
@RequestMapping(value = "/collectionInfo")
public class CollectionInfoController {

@Autowired
private LoggedUserUtils loggedUserUtils;

@Autowired
CollectionService collectionService;

Expand Down Expand Up @@ -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')";
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
Expand Down
58 changes: 38 additions & 20 deletions src/emc-metalnx-shared/src/main/resources/static/js/collection.js
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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) {
Expand Down
Loading

0 comments on commit 1b7f4f7

Please sign in to comment.