Skip to content

Commit

Permalink
#27 info controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Hetal Patel committed Jan 9, 2018
1 parent 5349a80 commit 06a0517
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public String getTestCollectionInfo(final Model model, HttpServletRequest reques
final String path = "/"+extractFilePath(request);

logger.info("path ::" + path) ;
model.addAttribute("name", "This is comming from the CollectionInfoController() - Test the main controller");
model.addAttribute("Summary", "This is comming from the CollectionInfoController() - Test the main controller");
logger.info("------CollectionInfoController getTestCollectionInfo() ends !!");
return metadataController.getMetadata(model, path);
return "collections/info"; //metadataController.getMetadata(model, path);

}

Expand All @@ -57,6 +57,7 @@ public String getCollectionFileInfo(final Model model, @RequestParam("path") fin

model.addAttribute("name", "Info");
return "collections/info";
//return collectionController.getFileInfo(model, path);//"collections/info";
}

@RequestMapping(value = "/collectionMetadata/**", method = RequestMethod.GET)
Expand All @@ -67,17 +68,18 @@ public String getCollectionMetadata(final Model model, @RequestParam("path") fin

model.addAttribute("name", "Metadata");
return "collections/info";
//return metadataController.getMetadata(model, path);//"collections/info";
}

@RequestMapping(value = "/collectionPermisssionDetails/", method = RequestMethod.GET)
@RequestMapping(value = "/collectionPermisssionDetails/**", method = RequestMethod.GET)
public String getCollectionPermissionDetails(final Model model, @RequestParam("path") final String path)
throws DataGridConnectionRefusedException {

System.out.println("------CollectionInfoController collectionPermisssionDetails() starts :: " +path);

model.addAttribute("name", "Permission");

return "collections/info";
//return permissionsController.getPermissionDetails(model, path);//"collections/info";
}

private static String extractFilePath(HttpServletRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function ajaxEncapsulation(url, method, params, successFunction, errorFunction,
if (contentType == null || typeof contentType === 'undefined') {
contentType = "application/x-www-form-urlencoded; charset=UTF-8";
}

console.log("calling ajaxEncapsulation - ajax.js");
$.ajax({
url: url,
type: method,
Expand Down
68 changes: 50 additions & 18 deletions src/emc-metalnx-shared/src/main/resources/static/js/collection.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
function getTestInfo(path){
console.log(" In getTestInfo() " +path);

var url = "/emc-metalnx-web/collectionInfo"+path;
getBreadcrumb(path);
console.log("URL :: " +url);
Expand All @@ -12,32 +11,64 @@ function displayTestDetails(data){
$('#table-loader').hide();
$('#table-loader').after(data);
}
function getPermDetails(path){

function getMetadata(){
console.log("Collection getMetadata() :: " +path);
var path ="/zone1/home/test1/CollectionServiceImplTestTestRoot";
window.location.hash = "metadata";
console.log("window.location.hash :: " +window.location.hash);
var url = "/emc-metalnx-web/collectionInfo/collectionMetadata"+path;
console.log(1);
//getBreadcrumb(path);
ajaxEncapsulation(url, "GET", {path: path}, displayMetadata, null, null);
}

function getInfoDetails(){
console.log("Collection getInfoDetails() starts !!");
var path ="/zone1/home/test1/CollectionServiceImplTestTestRoot";
console.log("Path :: " +path);
var url = "/emc-metalnx-web/collectionInfo/collectionFileInfo"+path;
//console.log("URL :: " +url);

//getBreadcrumb(path);
ajaxEncapsulation(url, "GET", {path: path}, displayInfoDetails, null, null, null);
console.log("Collection getInfoDetails() ends !!");
}

function getPermDetails(){
console.log("Collection getPermDetails() :: " +path);
var url = "/emc-metalnx-web/collectionInfo"+path;
var path ="/zone1/home/test1/CollectionServiceImplTestTestRoot";
var url = "/emc-metalnx-web/collectionInfo/collectionPermisssionDetails"+path;
console.log("URL :: " +url);
ajaxEncapsulation(url, "GET", {path: path}, displayPermDetails, null, null);
}

function getInfoDetails(path){
console.log("Collection getInfoDetails() :: " +path);
function displayMetadata(data){
$('#table-loader').hide();
$('#table-loader').after(data);
$("#uploadIcon").prop("disabled", true);
$("#uploadIcon").addClass("disabled");
$("#showCollectionFormBtn").prop("disabled", true);
$("#showCollectionFormBtn").addClass("disabled");
}

var url = "/emc-metalnx-web/collectionInfo/collectionFileInfo"+path;
console.log("URL :: " +url);
getBreadcrumb(path);
ajaxEncapsulation(url, "GET", {path: path}, displayInfoDetails, null, null, null);
function displayInfoDetails(data){
//alert("displayInfoDetails");
$("#table-loader").hide();
$("#table-loader").after(data);
}

function getMetadata(path){
console.log("Collection getMetadata() :: " +path);
window.location.hash = "metadata";
console.log("window.location.hash :: " +window.location.hash);
var url = "/emc-metalnx-web/collectionInfo/collectionMetadata"+path;
console.log(1);
getBreadcrumb(path);
ajaxEncapsulation(url, "GET", {path: path}, displayTestDetails, null, null);
function displayPermDetails(data){
$('#table-loader').hide();
$("#table-loader").after(data);
$("#uploadIcon").prop("disabled", true);
$("#uploadIcon").addClass("disabled");
$("#showCollectionFormBtn").prop("disabled", true);
$("#showCollectionFormBtn").addClass("disabled");
}



/*function getInfoDetails(path){
console.log("Collection getInfoDetails() :: " +path);
window.location.hash = "info";
Expand Down Expand Up @@ -73,4 +104,5 @@ function ChangeUrl(title, urlVal) {
} else {
alert("Browser does not support HTML5.");
}
}*/
}*/

Original file line number Diff line number Diff line change
Expand Up @@ -920,11 +920,11 @@ <h4 class="modal-title" th:text="#{upload.label}"></h4>
}, null, null, null);
}

function displayInfoDetails(data){
/* function displayInfoDetails(data){
//alert("displayInfoDetails");
$("#table-loader").hide();
$("#table-loader").after(data);
}
} */
function goBackHistory(steps){
ajaxEncapsulation(
'/emc-metalnx-web/collections/goBackHistory/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ <h4 class="modal-title" th:text="#{ticket.form.title.create}"></h4>
},
{
"render": function ( data, type, full, meta ) {
return '<a href="/emc-metalnx-web/collectionInfo'+full.path+'" name="' + full.path +'" onclick= getTestInfo("'+full.path+'") ><i class="'+full.iconToDisplay+'"></i> <span>info</span></a>';
return '<a href="/emc-metalnx-web/collectionInfo'+full.path+'" name="' + full.path +'" onclick=getTestInfo("'+full.path+'") ><i class="'+full.iconToDisplay+'"></i> <span>info</span></a>';
},
"width": "13%",
"targets": 6
Expand Down Expand Up @@ -756,7 +756,7 @@ <h4 class="modal-title" th:text="#{ticket.form.title.create}"></h4>
ajaxEncapsulation("/emc-metalnx-web/collectionInfo/collectionMetadata/", "POST", {path: path}, displayMetadata, null, null, null);
}*/

function displayMetadata(data){
/* function displayMetadata(data){
$('#table-loader').hide();
$('#table-loader').after(data);
$("#uploadIcon").prop("disabled", true);
Expand All @@ -772,7 +772,7 @@ <h4 class="modal-title" th:text="#{ticket.form.title.create}"></h4>
$("#uploadIcon").addClass("disabled");
$("#showCollectionFormBtn").prop("disabled", true);
$("#showCollectionFormBtn").addClass("disabled");
}
} */

$('a[data-target="#uploadModal"]').click(function(){
$('#uploadDestinationPath').val([[${ currentPath }]]);
Expand Down
137 changes: 63 additions & 74 deletions src/emc-metalnx-shared/src/main/resources/views/collections/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,123 +3,112 @@
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.thymeleaf.org" lang="en"
layout:decorator="template">

<body>
<div layout:fragment="content">
<div id="summary">
<p>This is the summary tab.</p>
<span th:text="${name}"></span>
<span th:text="${Summary}"></span>
</div>

<!-- <div id="tabs" th:unless="${collectionAndDataObject.isCollection()}">-->
<div id="tabs">
<ul>
<li><a href="#metadata" th:onclick="'javascript:getMetadata()'"> <span><i class="fa fa-tags"></i></span>
<span title="Metadata">Metadata</span>
</a></li>

<ul>
<li><a href="#metadata"
th:onclick="'javascript:getMetadata(\'' + ${collectionAndDataObject.path} + '\');'">
<span><i class="fa fa-tags"></i></span> <span title="Metadata">Metadata</span>
</a></li>

<li><a href="#info"
th:onclick="'javascript:getInfoDetails(\'' + ${collectionAndDataObject.path} + '\');'">
<span><i class="fa fa-info-circle"></i></span> <span
title="File information">Info</span>
</a></li>

<li><a href="#permission" id="permissions"
th:onclick="'javascript:getPermDetails(\'' + ${collectionAndDataObject.path} + '\');'">
<span><i class="fa fa-lock"></i></span> <span title="Permissions">Permissions</span>
</a></li>


</ul>

<div class="content_menu">
<div id="metadata">
<span th:text="${name}">This is metadata.</span>
</div>
<li><a href="#info" th:onclick="'javascript:getInfoDetails()'"> <span><i
class="fa fa-info-circle"></i></span> <span title="File information">Info</span>
</a></li>

<div id="info">
<span th:text="${name}"> This is info.</span>
</div>
<li><a href="#permission" id="permissions" th:onclick="'javascript:getPermDetails()'"> <span><i
class="fa fa-lock"></i></span> <span title="Permissions">Permissions</span>
</a></li>

<div id="permission">
<span th:text="${name}">This is permission.</span>
</div>
</ul>

<div class="content_menu">
<div id="metadata">
<span th:text="${name}"> This is metadata</span>
</div>

<!-- <div class="content_menu">
<div id="metadata" th:if="${metadataFlag}">
<th:block th:include="metadata/metadataTable :: metadataTable"></th:block>
</div>
<div id="info">
<span th:text="${name}">This is info</span>
</div>

<div id="info" th:if="${infoFlag}">
<th:block th:include="collections/collectionInfo :: collectionInfo"></th:block>
</div>
<div id="permission">
<span th:text="${name}">This is permission</span>
</div>

<div id="permission" th:if="${permissionFlag}">
<th:block th:include="permissions/permissionDetails :: permissionDetails"></th:block>
</div>
</div>


</div> -->

<!-- <div id="tabs" th:unless="${collectionAndDataObject.isCollection()}">
<ul>
<li><a href="#metadata"> <span><i class="fa fa-tags"></i></span>
<span title="Metadata">Metadata</span>
<!-- <ul>
<li><a href="#metadata"
th:onclick="'javascript:getMetadata(\'' + ${collectionAndDataObject.path} + '\');'">
<span><i class="fa fa-tags"></i></span> <span title="Metadata">Metadata</span>
</a></li>
<li><a href="#info"> <span><i
class="fa fa-info-circle"></i></span> <span title="File information">Info</span>
<li><a href="#info"
th:onclick="'javascript:getInfoDetails(\'' + ${collectionAndDataObject.path} + '\');'">
<span><i class="fa fa-info-circle"></i></span> <span
title="File information">Info</span>
</a></li>
<li><a href="#permission" id="permissions"> <span><i
class="fa fa-lock"></i></span> <span title="Permissions">Permissions</span>
<li><a href="#permission" id="permissions"
th:onclick="'javascript:getPermDetails(\'' + ${collectionAndDataObject.path} + '\');'">
<span><i class="fa fa-lock"></i></span> <span title="Permissions">Permissions</span>
</a></li>
</ul>
</ul>
<div class="content_menu">
<div id="metadata">
<span>This is metadata</span>
<div id="metadata" th:if="${metadataFlag}">
<th:block th:include="metadata/metadataTable :: metadataTable"></th:block>
</div>
<div id="info">
<span>This is info</span>
<div id="info" th:if="${infoFlag}">
<th:block th:include="collections/collectionInfo :: collectionInfo"></th:block>
</div>
<div id="permission">
<span>This is permission</span>
<div id="permission" th:if="${permissionFlag}">
<th:block
th:include="permissions/permissionDetails :: permissionDetails"></th:block>
</div>
</div>-->
</div>
</div> -->
</div>


<!-- JQuery UI CSS -->
<link href="../static/css/jquery-ui.min.css" rel="stylesheet"
th:href="@{/css/jquery-ui.min.css}" />
<!-- jQuery UI Version 1.11.4 -->
<script src="../static/js/jquery-1.11.4.js"
th:src="@{/js/jquery-ui.min.js}"></script>
<!-- JQuery UI CSS -->
<link href="../static/css/jquery-ui.min.css" rel="stylesheet"
th:href="@{/css/jquery-ui.min.css}" />
<!-- jQuery UI Version 1.11.4 -->
<script src="../static/js/jquery-1.11.4.js"
th:src="@{/js/jquery-ui.min.js}"></script>

<script type="text/javascript" th:src="@{/js/collection.js}"></script>
<script>
<script type="text/javascript" th:src="@{/js/collection.js}"></script>
<script>
$(document).ready(function(e) {
$("#tabs").tabs();

/* var tab_a_selector = 'ul.ui-tabs-nav a';
/* vvar tab_a_selector = 'ul.ui-tabs-nav a';
$(tab_a_selector).click(function() {
var href = this.href;
alert("href subnews :: " +href);
$("#subnews").load(href);
window.location.hash = "subnav";
alert("window.location.hash :: " +window.location.hash);
alert("href subnews :: " +href);
//$("#subnews").load(href);
// window.location.hash = "subnav";
var hash = this.hash.substr(1);
getInfoDetails([[${collectionAndDataObject.path}]]);
e.preventDefault();
}); */
}); */
});
</script>
</div>
Expand Down

0 comments on commit 06a0517

Please sign in to comment.