feat(profiling): refactorign profiling code, #5286

This commit is contained in:
Torkel Ödegaard
2016-06-08 06:51:01 +02:00
parent 2a7d2ffccb
commit c739428c30
9 changed files with 143 additions and 114 deletions

View File

@@ -35,10 +35,6 @@ function (angular, $, config, moment) {
};
$scope.setupDashboard = function(data) {
$rootScope.performance.dashboardLoadStart = new Date().getTime();
$rootScope.performance.panelsInitialized = 0;
$rootScope.performance.panelsRendered = 0;
var dashboard = dashboardSrv.create(data.dashboard, data.meta);
dashboardSrv.setCurrent(dashboard);
@@ -68,7 +64,7 @@ function (angular, $, config, moment) {
});
}
$scope.appEvent("dashboard-loaded", $scope.dashboard);
$scope.appEvent("dashboard-initialized", $scope.dashboard);
}).catch(function(err) {
if (err.data && err.data.message) { err.message = err.data.message; }
$scope.appEvent("alert-error", ['Dashboard init failed', 'Template variables could not be initialized: ' + err.message]);
@@ -84,7 +80,6 @@ function (angular, $, config, moment) {
};
$scope.broadcastRefresh = function() {
$rootScope.performance.panelsRendered = 0;
$rootScope.$broadcast('refresh');
};

View File

@@ -47,6 +47,8 @@ function (angular, moment, _, $, kbn, dateMath, impressionStore) {
}
promise.then(function(result) {
$rootScope.appEvent("dashboard-fetched", result.dashboard);
if (result.meta.dashboardNotFound !== true) {
impressionStore.impressions.addDashboardImpression(result.dashboard.id);
}

View File

@@ -51,13 +51,6 @@ function (angular, _, $) {
$scope.onAppEvent('panel-initialized', function(evt, payload) {
self.registerPanel(payload.scope);
if ($scope.profilingEnabled) {
$scope.performance.panelsInitialized++;
if ($scope.performance.panelsInitialized === $scope.performance.panelCount) {
$scope.performance.allPanelsInitialized = new Date().getTime();
}
}
});
this.update(this.getQueryStringState());