-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hetal Patel
committed
Jan 9, 2018
1 parent
dd24b45
commit 5349a80
Showing
13 changed files
with
413 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
...emc-metalnx-shared/src/main/java/com/emc/metalnx/controller/CollectionInfoController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package com.emc.metalnx.controller; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.util.AntPathMatcher; | ||
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.context.WebApplicationContext; | ||
import org.springframework.web.servlet.HandlerMapping; | ||
|
||
import com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException; | ||
|
||
|
||
@Controller | ||
@Scope(WebApplicationContext.SCOPE_SESSION) | ||
@RequestMapping(value = "/collectionInfo") | ||
public class CollectionInfoController { | ||
|
||
@Autowired | ||
private CollectionController collectionController; | ||
|
||
@Autowired | ||
private MetadataController metadataController; | ||
|
||
@Autowired | ||
private PermissionsController permissionsController; | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(MetadataController.class); | ||
|
||
|
||
@RequestMapping(value = "/**", method = RequestMethod.GET) | ||
public String getTestCollectionInfo(final Model model, HttpServletRequest request) | ||
throws DataGridConnectionRefusedException { | ||
|
||
|
||
logger.info("------CollectionInfoController getTestCollectionInfo() starts !!"); | ||
final String path = "/"+extractFilePath(request); | ||
|
||
logger.info("path ::" + path) ; | ||
model.addAttribute("name", "This is comming from the CollectionInfoController() - Test the main controller"); | ||
logger.info("------CollectionInfoController getTestCollectionInfo() ends !!"); | ||
return metadataController.getMetadata(model, path); | ||
|
||
} | ||
|
||
@RequestMapping(value = "/collectionFileInfo/**", method = RequestMethod.GET) | ||
public String getCollectionFileInfo(final Model model, @RequestParam("path") final String path) | ||
throws DataGridConnectionRefusedException { | ||
System.out.println("------CollectionInfoController getCollectionFileInfo() starts :: " +path); | ||
|
||
model.addAttribute("name", "Info"); | ||
return "collections/info"; | ||
} | ||
|
||
@RequestMapping(value = "/collectionMetadata/**", method = RequestMethod.GET) | ||
public String getCollectionMetadata(final Model model, @RequestParam("path") final String path) | ||
throws DataGridConnectionRefusedException { | ||
|
||
System.out.println("------CollectionInfoController collectionMetadata() starts :: " +path); | ||
|
||
model.addAttribute("name", "Metadata"); | ||
return "collections/info"; | ||
} | ||
|
||
@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"; | ||
} | ||
|
||
private static String extractFilePath(HttpServletRequest request) { | ||
String path = (String) request.getAttribute( | ||
HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); | ||
String bestMatchPattern = (String) request.getAttribute( | ||
HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE); | ||
AntPathMatcher apm = new AntPathMatcher(); | ||
return apm.extractPathWithinPattern(bestMatchPattern, path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
src/emc-metalnx-shared/src/main/resources/static/js/collection.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
function getTestInfo(path){ | ||
console.log(" In getTestInfo() " +path); | ||
|
||
var url = "/emc-metalnx-web/collectionInfo"+path; | ||
getBreadcrumb(path); | ||
console.log("URL :: " +url); | ||
ajaxEncapsulation(url, "GET", {path: path}, displayTestDetails, null, null); | ||
} | ||
|
||
function displayTestDetails(data){ | ||
console.log("displayTestDetails()"); | ||
$('#table-loader').hide(); | ||
$('#table-loader').after(data); | ||
} | ||
function getPermDetails(path){ | ||
console.log("Collection getPermDetails() :: " +path); | ||
var url = "/emc-metalnx-web/collectionInfo"+path; | ||
console.log("URL :: " +url); | ||
ajaxEncapsulation(url, "GET", {path: path}, displayPermDetails, null, null); | ||
} | ||
|
||
function getInfoDetails(path){ | ||
console.log("Collection getInfoDetails() :: " +path); | ||
|
||
var url = "/emc-metalnx-web/collectionInfo/collectionFileInfo"+path; | ||
console.log("URL :: " +url); | ||
getBreadcrumb(path); | ||
ajaxEncapsulation(url, "GET", {path: path}, displayInfoDetails, null, null, null); | ||
} | ||
|
||
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 getInfoDetails(path){ | ||
console.log("Collection getInfoDetails() :: " +path); | ||
window.location.hash = "info"; | ||
console.log("window.location.hash :: " +window.location.hash); | ||
var url = "/emc-metalnx-web/collectionInfo/collectionFileInfo"+path; | ||
getBreadcrumb(path); | ||
console.log("URL :: " +url); | ||
ajaxEncapsulation(url, "GET", {path: path}, displayTestDetails, null, null); | ||
} | ||
function getPermDetails(path){ | ||
console.log("Collection getPermDetails() :: " +path); | ||
window.location.hash = "permission"; | ||
console.log("window.location.hash :: " +window.location.hash); | ||
var url = "/emc-metalnx-web/collectionInfo/collectionPermisssionDetails"+path; | ||
getBreadcrumb(path); | ||
console.log("URL :: " +url); | ||
ajaxEncapsulation(url, "GET", {path: path}, displayTestDetails, null, null); | ||
} | ||
function ChangeUrl(title, urlVal) { | ||
console.log("ChangeUrl()"); | ||
var str1 = "emc-metalnx-web/collections"; | ||
var url = str1.concat(urlVal); | ||
console.log("url :: " +url); | ||
if (typeof (history.pushState) != "undefined") { | ||
var obj = { Title: title, Url: url }; | ||
history.pushState(obj, obj.Title, obj.Url); | ||
} else { | ||
alert("Browser does not support HTML5."); | ||
} | ||
}*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.