Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
ca1f06f1
Commit
ca1f06f1
authored
Oct 30, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hunting memory leaks
parent
4d420a0c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
13 deletions
+26
-13
public/app/features/dashboard/dashboard_ctrl.ts
+4
-3
public/app/features/dashboard/model.ts
+7
-0
public/app/features/dashboard/row/row.ts
+5
-1
public/app/features/dashboard/unsavedChangesSrv.js
+9
-6
public/app/features/panel/panel_ctrl.ts
+1
-3
No files found.
public/app/features/dashboard/dashboard_ctrl.ts
View file @
ca1f06f1
...
...
@@ -117,9 +117,10 @@ export class DashboardCtrl {
$timeout
.
cancel
(
resizeEventTimeout
);
resizeEventTimeout
=
$timeout
(
function
()
{
$scope
.
$broadcast
(
'render'
);
},
200
);
});
var
unbind
=
$scope
.
$on
(
'$destroy'
,
function
()
{
$scope
.
$on
(
'$destroy'
,
function
()
{
angular
.
element
(
window
).
unbind
(
'resize'
);
unbind
();
$scope
.
dashboard
.
destroy
();
});
};
...
...
@@ -129,10 +130,10 @@ export class DashboardCtrl {
}
init
(
dashboard
)
{
this
.
$scope
.
registerWindowResizeEvent
();
this
.
$scope
.
onAppEvent
(
'show-json-editor'
,
this
.
$scope
.
showJsonEditor
);
this
.
$scope
.
onAppEvent
(
'template-variable-value-updated'
,
this
.
$scope
.
templateVariableUpdated
);
this
.
$scope
.
setupDashboard
(
dashboard
);
this
.
$scope
.
registerWindowResizeEvent
();
}
}
...
...
public/app/features/dashboard/model.ts
View file @
ca1f06f1
...
...
@@ -247,6 +247,13 @@ export class DashboardModel {
moment
.
utc
(
date
).
format
(
format
);
}
destroy
()
{
this
.
events
.
removeAllListeners
();
for
(
let
row
of
this
.
rows
)
{
row
.
events
.
removeAllListeners
();
}
}
getRelativeTime
(
date
)
{
date
=
moment
.
isMoment
(
date
)
?
date
:
moment
(
date
);
...
...
public/app/features/dashboard/row/row.ts
View file @
ca1f06f1
...
...
@@ -212,7 +212,11 @@ coreModule.directive('panelDropZone', function($timeout) {
row
.
events
.
on
(
'panel-added'
,
updateState
);
row
.
events
.
on
(
'span-changed'
,
updateState
);
//scope.$watchGroup(['ctrl.row.panels.length', 'ctrl.dashboard.editMode', 'ctrl.row.span'], updateState);
scope
.
$on
(
'$destroy'
,
()
=>
{
row
.
events
.
off
(
'panel-added'
,
updateState
);
row
.
events
.
off
(
'span-changed'
,
updateState
);
});
// scope.$watchGroup(['ctrl.row.panels.length', 'ctrl.dashboard.editMode', 'ctrl.row.span'], updateState);
scope
.
$on
(
"ANGULAR_DRAG_START"
,
function
()
{
indrag
=
true
;
...
...
public/app/features/dashboard/unsavedChangesSrv.js
View file @
ca1f06f1
...
...
@@ -12,16 +12,15 @@ function(angular, _) {
function
Tracker
(
dashboard
,
scope
)
{
var
self
=
this
;
this
.
original
=
dashboard
.
getSaveModelClone
();
this
.
current
=
dashboard
;
this
.
originalPath
=
$location
.
path
();
this
.
scope
=
scope
;
// register events
scope
.
onAppEvent
(
'dashboard-saved'
,
function
()
{
self
.
original
=
self
.
current
.
getSaveModelClone
();
self
.
originalPath
=
$location
.
path
();
});
this
.
original
=
this
.
current
.
getSaveModelClone
();
this
.
originalPath
=
$location
.
path
();
}
.
bind
(
this
)
);
$window
.
onbeforeunload
=
function
()
{
if
(
self
.
ignoreChanges
())
{
return
;
}
...
...
@@ -44,6 +43,11 @@ function(angular, _) {
});
}
});
// wait for different services to patch the dashboard (missing properties)
$timeout
(
function
()
{
self
.
original
=
dashboard
.
getSaveModelClone
();
},
1000
);
}
var
p
=
Tracker
.
prototype
;
...
...
@@ -153,8 +157,7 @@ function(angular, _) {
this
.
Tracker
=
Tracker
;
this
.
init
=
function
(
dashboard
,
scope
)
{
// wait for different services to patch the dashboard (missing properties)
$timeout
(
function
()
{
new
Tracker
(
dashboard
,
scope
);
},
1200
);
new
Tracker
(
dashboard
,
scope
);
};
});
});
public/app/features/panel/panel_ctrl.ts
View file @
ca1f06f1
...
...
@@ -50,11 +50,9 @@ export class PanelCtrl {
$scope
.
$on
(
"refresh"
,
()
=>
this
.
refresh
());
$scope
.
$on
(
"render"
,
()
=>
this
.
render
());
var
unbindDestroy
=
$scope
.
$on
(
"$destroy"
,
()
=>
{
$scope
.
$on
(
"$destroy"
,
()
=>
{
this
.
events
.
emit
(
'panel-teardown'
);
this
.
events
.
removeAllListeners
();
unbindDestroy
();
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment