|
@@ -3,12 +3,15 @@ var app = angular.module('Results', []);
|
|
app.controller('ResultsCtrl', function ($scope) {
|
|
app.controller('ResultsCtrl', function ($scope) {
|
|
// Grab results from nodeJS served page
|
|
// Grab results from nodeJS served page
|
|
$scope.phantomasResults = window._phantomas_results;
|
|
$scope.phantomasResults = window._phantomas_results;
|
|
|
|
+ $scope.phantomasMetadata = window._phantomas_metadata.metrics;
|
|
|
|
|
|
$scope.view = 'summary';
|
|
$scope.view = 'summary';
|
|
$scope.slowRequestsOn = false;
|
|
$scope.slowRequestsOn = false;
|
|
$scope.slowRequestsLimit = 5;
|
|
$scope.slowRequestsLimit = 5;
|
|
|
|
|
|
if ($scope.phantomasResults.offenders && $scope.phantomasResults.offenders.javascriptExecutionTree) {
|
|
if ($scope.phantomasResults.offenders && $scope.phantomasResults.offenders.javascriptExecutionTree) {
|
|
|
|
+
|
|
|
|
+ // Get the execution tree from the offenders
|
|
$scope.javascript = JSON.parse($scope.phantomasResults.offenders.javascriptExecutionTree);
|
|
$scope.javascript = JSON.parse($scope.phantomasResults.offenders.javascriptExecutionTree);
|
|
|
|
|
|
// Read the main elements of the tree and sum the total time
|
|
// Read the main elements of the tree and sum the total time
|
|
@@ -25,6 +28,20 @@ app.controller('ResultsCtrl', function ($scope) {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if ($scope.phantomasResults.metrics && $scope.phantomasResults.offenders) {
|
|
|
|
+
|
|
|
|
+ // Get the Phantomas modules from metadata
|
|
|
|
+ $scope.metricsModule = {};
|
|
|
|
+ for (var metricName in $scope.phantomasMetadata) {
|
|
|
|
+ var metric = $scope.phantomasMetadata[metricName];
|
|
|
|
+ if (!$scope.metricsModule[metric.module]) {
|
|
|
|
+ $scope.metricsModule[metric.module] = {};
|
|
|
|
+ }
|
|
|
|
+ $scope.metricsModule[metric.module][metricName] = metric;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
$scope.setView = function(viewName) {
|
|
$scope.setView = function(viewName) {
|
|
$scope.view = viewName;
|
|
$scope.view = viewName;
|
|
};
|
|
};
|