index.html now shows a drop down when opening etl files

This commit is contained in:
Kaelin Hooper
2016-08-15 17:11:33 -07:00
parent a783a74e74
commit a83144d35c
3 changed files with 35 additions and 9 deletions
@@ -44,7 +44,17 @@ namespace PerfDataService.Controllers
try
{
List<object> children = getChildrenForPath(path);
List<object> children = new List<object>();
if (Directory.Exists(path))
{
// path leads to a valid directory
children = getChildrenForPath(path);
}
else if (new FileInfo(path).Exists)
{
// path leads to a valid file (e.g. .etl.zip, .etl)
children = getDataForFile(path);
}
tree.Add("children", children);
} catch (UnauthorizedAccessException)
{
@@ -239,11 +249,16 @@ namespace PerfDataService.Controllers
catch { dir.Add("hasChildren", false); } // If this directory has an unauthorized access exception
childrenContainer.Add(dir);
}
return childrenContainer;
}
return childrenContainer;
}
public List<object> getDataForFile(string pathToItem) {
List<object> childrenContainer = new List<object>();
// IF REAL FILE (e.g. .etl.zip, .etl)
else if (new FileInfo(pathToItem).Exists)
if (new FileInfo(pathToItem).Exists)
{
// TODO: Separate this into another function, if not another endpoint
// Assume only .etl.zip for now
@@ -268,13 +283,10 @@ namespace PerfDataService.Controllers
// TODO: Create Events as child
// TODO: Create Memory Group as child
// TODO: Create Advanced Group as child
return childrenContainer;
}
// TODO: Form proper response
return null;
return childrenContainer;
}
@@ -25,6 +25,7 @@
// Load the JSON data
$(self.treeDivID).jstree({
'core': {
'check_callback': true,
'data': JSONTree.children
}
});
@@ -41,8 +42,20 @@
$(self.treeDivID).on('activate_node.jstree', function (event, node) {
nodeObject = node.node.original; // JSTree has a node within a node.. Weird.
if (nodeObject.type == "dir" || nodeObject.type == "file") {
if (nodeObject.type == "dir") {
self.changeDirectoryTreePath(nodeObject.path);
} else if (nodeObject.type == "file") {
url = self.domain + "/api/data/open?path=" + nodeObject.path;
$.get(url, function (response, status) {
json = JSON.parse(response);
for (var i = 0; i < json.children.length; ++i) {
var parent = $(self.treeDivID).jstree('get_selected');
var newNode = json.children[i];
var newNodeId = $(self.treeDivID).jstree().create_node(parent, newNode, "last");
$(self.treeDivID).jstree().open_node(parent);
}
});
} else if (nodeObject.type == "stacks") {
self.openStackWindow(nodeObject.path, nodeObject.stackType);
}
@@ -498,6 +498,7 @@
// LOAD AND DISPLAY CALLTREE DATA
if (treesToUpdate == null || treesToUpdate.includes("call-treeTree")) {
stackDelegate.getNode("ROOT", function(nodeData){
console.log(nodeData);
$("#call-treeTree tbody").empty();
// Place root node in tree