mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 08:05:43 -06:00
moved an expensive binding expression into a directive and a groupWatch
This commit is contained in:
parent
21aa1b43fd
commit
cd79b73cb0
@ -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);
|
||||
|
||||
});
|
||||
|
@ -32,7 +32,7 @@ function (angular, app, _) {
|
||||
}
|
||||
};
|
||||
|
||||
// This can be overridden by individual panels
|
||||
// This can be overridden by individual panels
|
||||
$scope.close_edit = function() {
|
||||
$scope.$broadcast('render');
|
||||
};
|
||||
@ -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" >
|
||||
|
Loading…
Reference in New Issue
Block a user