Make sure that we only save the tree reference if we have actually rendered it.
This commit is contained in:
parent
c2ed1a9e52
commit
8da4104e7b
2 changed files with 30 additions and 22 deletions
|
@ -731,11 +731,11 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi
|
|||
}
|
||||
|
||||
// Create the new tree.
|
||||
$scope.tree = new ImageHistoryTree(namespace, name, resp.images,
|
||||
var tree = new ImageHistoryTree(namespace, name, resp.images,
|
||||
getFirstTextLine, $scope.getTimeSince, ImageMetadataService.getEscapedFormattedCommand);
|
||||
|
||||
$scope.tree.draw('image-history-container');
|
||||
|
||||
$scope.tree = tree.draw('image-history-container');
|
||||
if ($scope.tree) {
|
||||
// If we already have a tag, use it
|
||||
if ($scope.currentTag) {
|
||||
$scope.tree.setTag($scope.currentTag.name);
|
||||
|
@ -757,6 +757,7 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi
|
|||
$($scope.tree).bind('hideTagMenu', function(e) {
|
||||
$scope.$apply(function() { $scope.hideTagMenu(); });
|
||||
});
|
||||
}
|
||||
|
||||
if ($routeParams.image) {
|
||||
$scope.setImage($routeParams.image);
|
||||
|
|
|
@ -196,6 +196,11 @@ ImageHistoryTree.prototype.draw = function(container) {
|
|||
var rootSvg = d3.select("#" + container).append("svg:svg")
|
||||
.attr("class", "image-tree");
|
||||
|
||||
if (!rootSvg) {
|
||||
this.container_ = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var vis = rootSvg.append("svg:g");
|
||||
if (!vis) {
|
||||
this.container_ = null;
|
||||
|
@ -266,6 +271,8 @@ ImageHistoryTree.prototype.draw = function(container) {
|
|||
|
||||
this.setTag_(this.currentTag_);
|
||||
this.setupOverscroll_();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
|
|
Reference in a new issue