mirror of
https://github.com/Kae7in/perfview
synced 2026-08-09 12:09:44 +00:00
Got first context menu item working
This commit is contained in:
@@ -272,6 +272,32 @@
|
||||
onTreeNodeExpand(node, "#calleesTree");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
document.querySelector('#by-name-list').addEventListener('contextmenu', function(e) {
|
||||
let items = [
|
||||
{ title: 'Set Time Range', icon: 'ion-clock', fn: function() { setTimeRange(e); } }
|
||||
//{ title: 'Refresh Dir', icon: 'ion-refresh', fn: clicked },
|
||||
//{ title: 'Open', icon: 'ion-android-open', fn: clicked },
|
||||
//{ title: 'Close', icon: 'ion-close', fn: clicked },
|
||||
//{ title: 'Delete', icon: 'ion-android-remove-circle', fn: clicked },
|
||||
//{ title: 'Rename', icon: 'ion-edit', fn: clicked },
|
||||
//{ title: 'Merge', icon: 'ion-merge', fn: clicked },
|
||||
//{ title: 'Make Local Symbol Dir', icon: 'ion-plus-round', fn: clicked },
|
||||
//{ title: 'Zip', icon: 'ion-ios-briefcase', fn: clicked },
|
||||
//{ title: 'UnZip', icon: 'ion-ios-briefcase-outline', fn: clicked }
|
||||
]
|
||||
|
||||
basicContext.show(items, e)
|
||||
});
|
||||
|
||||
function setTimeRange(e) {
|
||||
var first = $(e.target.parentNode).find(".firstTimeRelativeMSec").text();
|
||||
var last = $(e.target.parentNode).find(".lastTimeRelativeMSec").text();
|
||||
|
||||
$("#start-filter").val(first);
|
||||
$("#end-filter").val(last);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -297,14 +323,14 @@
|
||||
+ findFlag
|
||||
+ "\">";
|
||||
|
||||
rowsToAppend = rowsToAppend + "<td class=\"name-col selectable\">" + stackData[i].name + "</td>\
|
||||
<td class=\"selectable\">" + (treeTableId == "#by-name-list" ? stackData[i].exclusiveMetricPercent : stackData[i].inclusiveMetricPercent) + "</td>\
|
||||
<td class=\"selectable\">" + (treeTableId == "#by-name-list" ? stackData[i].exclusiveMetric : stackData[i].inclusiveMetric) + "</td>\
|
||||
<td class=\"selectable\">" + (treeTableId == "#by-name-list" ? stackData[i].inclusiveMetricPercent : stackData[i].exclusiveMetricPercent) + "</td>\
|
||||
<td class=\"selectable\">" + (treeTableId == "#by-name-list" ? stackData[i].inclusiveMetric : stackData[i].exclusiveMetric) + "</td>\
|
||||
<td class=\"selectable\">" + stackData[i].exclusiveFoldedCount + "</td>\
|
||||
<td class=\"selectable\" relevant-filter-id=\"#start-filter\">" + stackData[i].firstTimeRelativeMSec + "</td>\
|
||||
<td class=\"selectable\" relevant-filter-id=\"#end-filter\">" + stackData[i].lastTimeRelativeMSec + "</td>\
|
||||
rowsToAppend = rowsToAppend + "<td class=\"name-col selectable\">" + stackData[i].name + "</td>"
|
||||
+ (treeTableId == "#by-name-list" ? "<td class=\"exclusiveMetricPercent selectable\">" + stackData[i].exclusiveMetricPercent : "<td class=\"inclusiveMetricPercent selectable\">" + stackData[i].inclusiveMetricPercent) + "</td>"
|
||||
+ (treeTableId == "#by-name-list" ? "<td class=\"exclusiveMetric selectable\">" + stackData[i].exclusiveMetric : "<td class=\"inclusiveMetric selectable\">" + stackData[i].inclusiveMetric) + "</td>"
|
||||
+ (treeTableId == "#by-name-list" ? "<td class=\"inclusiveMetricPercent selectable\">" + stackData[i].inclusiveMetricPercent : "<td class=\"exclusiveMetricPercent selectable\">" + stackData[i].exclusiveMetricPercent) + "</td>"
|
||||
+ (treeTableId == "#by-name-list" ? "<td class=\"inclusiveMetric selectable\">" + stackData[i].inclusiveMetric : "<td class=\"exclusiveMetric selectable\">" + stackData[i].exclusiveMetric) + "</td>\
|
||||
<td class=\"exclusiveFoldedCount selectable\">" + stackData[i].exclusiveFoldedCount + "</td>\
|
||||
<td class=\"firstTimeRelativeMSec selectable\" relevant-filter-id=\"#start-filter\">" + stackData[i].firstTimeRelativeMSec + "</td>\
|
||||
<td class=\"lastTimeRelativeMSec selectable\" relevant-filter-id=\"#end-filter\">" + stackData[i].lastTimeRelativeMSec + "</td>\
|
||||
</tr>";
|
||||
}
|
||||
|
||||
@@ -338,6 +364,7 @@
|
||||
});
|
||||
|
||||
function switchExclusiveAndInclusiveMetricsElements(node) {
|
||||
// TODO: Use id's of td elements instead of indexing
|
||||
var exclusiveMetricPercent = $(node.row[0].children[1]).text();
|
||||
var exclusiveMetric = $(node.row[0].children[2]).text();
|
||||
var inclusiveMetricPercent = $(node.row[0].children[3]).text();
|
||||
@@ -383,7 +410,6 @@
|
||||
});
|
||||
|
||||
|
||||
// TODO: Double click on first and last
|
||||
$(document).on("dblclick", ".is-active table tbody tr td", function (cell) {
|
||||
var filterId = $(cell.target).attr("relevant-filter-id");
|
||||
$(filterId).val($(cell.target).text());
|
||||
@@ -557,6 +583,15 @@
|
||||
$(".is-active .searchNavButtons").hide();
|
||||
$(".is-active .findContainer").hide();
|
||||
stackDelegate.clearSelectedCell();
|
||||
|
||||
// TODO: This "each" method of deleting data-find-flags could take a while on larger data sets
|
||||
$(".is-active table tbody tr").each(function(index) {
|
||||
var findFlag = $(this).attr("data-find-flag");
|
||||
|
||||
if (findFlag != undefined) {
|
||||
$(this).removeAttr("data-find-flag");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -606,25 +641,6 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector('#by-name-list').addEventListener('contextmenu', function(e) {
|
||||
console.log(e.target);
|
||||
var clicked = function() { alert('Item clicked!') }
|
||||
let items = [
|
||||
{ title: 'Set Time Range', icon: 'ion-help-buoy', fn: clicked }
|
||||
//{ title: 'Refresh Dir', icon: 'ion-refresh', fn: clicked },
|
||||
//{ title: 'Open', icon: 'ion-android-open', fn: clicked },
|
||||
//{ title: 'Close', icon: 'ion-close', fn: clicked },
|
||||
//{ title: 'Delete', icon: 'ion-android-remove-circle', fn: clicked },
|
||||
//{ title: 'Rename', icon: 'ion-edit', fn: clicked },
|
||||
//{ title: 'Merge', icon: 'ion-merge', fn: clicked },
|
||||
//{ title: 'Make Local Symbol Dir', icon: 'ion-plus-round', fn: clicked },
|
||||
//{ title: 'Zip', icon: 'ion-ios-briefcase', fn: clicked },
|
||||
//{ title: 'UnZip', icon: 'ion-ios-briefcase-outline', fn: clicked }
|
||||
]
|
||||
|
||||
basicContext.show(items, e)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user