Dispose of the existing image tree so that a new one can be drawn in its place
This commit is contained in:
parent
8a0d6d05b4
commit
e047b5e11e
2 changed files with 18 additions and 3 deletions
|
@ -402,11 +402,16 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location, $tim
|
||||||
};
|
};
|
||||||
|
|
||||||
var listImages = function() {
|
var listImages = function() {
|
||||||
if ($scope.imageHistory) { return; }
|
|
||||||
|
|
||||||
var imageFetch = Restangular.one('repository/' + namespace + '/' + name + '/image/');
|
var imageFetch = Restangular.one('repository/' + namespace + '/' + name + '/image/');
|
||||||
imageFetch.get().then(function(resp) {
|
imageFetch.get().then(function(resp) {
|
||||||
$scope.imageHistory = resp.images;
|
$scope.imageHistory = resp.images;
|
||||||
|
|
||||||
|
// Dispose of any existing tree.
|
||||||
|
if ($scope.tree) {
|
||||||
|
$scope.tree.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the new tree.
|
||||||
$scope.tree = new ImageHistoryTree(namespace, name, resp.images,
|
$scope.tree = new ImageHistoryTree(namespace, name, resp.images,
|
||||||
$scope.getCommentFirstLine, $scope.getTimeSince);
|
$scope.getCommentFirstLine, $scope.getTimeSince);
|
||||||
|
|
||||||
|
@ -418,7 +423,7 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location, $tim
|
||||||
}
|
}
|
||||||
|
|
||||||
$($scope.tree).bind('tagChanged', function(e) {
|
$($scope.tree).bind('tagChanged', function(e) {
|
||||||
$scope.$apply(function() { $scope.setTag(e.tag, true); });
|
$scope.$apply(function() { $scope.setTag(e.tag, true); });
|
||||||
});
|
});
|
||||||
$($scope.tree).bind('imageChanged', function(e) {
|
$($scope.tree).bind('imageChanged', function(e) {
|
||||||
$scope.$apply(function() { $scope.setImage(e.image); });
|
$scope.$apply(function() { $scope.setImage(e.image); });
|
||||||
|
|
|
@ -809,6 +809,16 @@ ImageFileChangeTree.prototype.notifyResized = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disposes of the tree.
|
||||||
|
*/
|
||||||
|
ImageFileChangeTree.prototype.dispose = function() {
|
||||||
|
var container = this.container_ ;
|
||||||
|
$('#' + container).removeOverscroll();
|
||||||
|
document.getElememtById(container).innerHTML = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the tree.
|
* Draws the tree.
|
||||||
*/
|
*/
|
||||||
|
|
Reference in a new issue