Commit cd79b73c by Torkel Ödegaard

moved an expensive binding expression into a directive and a groupWatch

parent 21aa1b43
......@@ -84,10 +84,6 @@ function (angular, $, config, _) {
};
};
$scope.row_style = function(row) {
return { 'min-height': row.collapse ? '5px' : row.height };
};
$scope.panel_path =function(type) {
if(type) {
return 'app/panels/'+type.replace(".","/");
......
......@@ -78,10 +78,8 @@ function (angular, config, _, $) {
$scope.initProfiling = function() {
var count = 0;
console.log("registering digest counter");
$scope.$watch(function digestCounter() {
console.log(1);
count++;
}, function() {
});
......@@ -96,6 +94,11 @@ function (angular, config, _, $) {
var timeTaken = $rootScope.performance.allPanelsInitialized - $rootScope.performance.dashboardLoadStart;
console.log("Dashboard::Performance - All panels initialized in " + timeTaken + " ms");
var rootDigestStart = window.performance.now();
$rootScope.$apply();
console.log("Dashboard::Performance Root Digest " + (window.performance.now() - rootDigestStart));
}, 3000);
});
......
......@@ -108,4 +108,12 @@ function (angular, app, _) {
});
module.directive('rowHeight', function() {
return function(scope, element) {
scope.$watchGroup(['row.collapse', 'row.height'], function() {
element[0].style.minHeight = scope.row.collapse ? '5px' : scope.row.height;
});
};
});
});
......@@ -27,7 +27,7 @@
<div>
<div class="grafana-container container">
<!-- Rows -->
<div class="grafana-row" ng-controller="RowCtrl" ng-repeat="(row_name, row) in dashboard.rows" ng-style="row_style(row)">
<div class="grafana-row" ng-controller="RowCtrl" ng-repeat="(row_name, row) in dashboard.rows" row-height>
<div class="row-control">
<div class="row-control-inner" style="padding:0px;margin:0px;position:relative;">
<div class="row-close" ng-show="row.collapse" data-placement="bottom" >
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment