Fix UI rendering issue when creating/deleting tags from the UI (#3269)
### Description of Changes Tag operations in UI would not be rendered properly when using the paginated tags endpoint. When a user would create/delete a tag from the repo-panel-tags, `digest` would be called. This caused the `$scope.repository.tags` to be removed. To fix this: * Bind the tags directly to the scope instead of the repository * Change references to scope.repository.tags to use scope.repositoryTags ---
This commit is contained in:
parent
bb01e08d44
commit
8b25d5b77b
7 changed files with 69 additions and 37 deletions
|
@ -30,7 +30,8 @@
|
|||
'repository': null,
|
||||
'imageLoader': imageLoader,
|
||||
'builds': null,
|
||||
'historyFilter': ''
|
||||
'historyFilter': '',
|
||||
'repositoryTags': null
|
||||
};
|
||||
|
||||
$scope.repositoryTags = {};
|
||||
|
@ -41,19 +42,20 @@
|
|||
UserService.updateUserIn($scope);
|
||||
|
||||
// Watch the repository to filter any tags removed.
|
||||
$scope.$watch('viewScope.repository', function(repository) {
|
||||
$scope.$watch('viewScope.repositoryTags', function(repository) {
|
||||
if (!repository) { return; }
|
||||
$scope.viewScope.selectedTags = filterTags($scope.viewScope.selectedTags);
|
||||
});
|
||||
|
||||
var filterTags = function(tags) {
|
||||
return (tags || []).filter(function(tag) {
|
||||
return !!$scope.viewScope.repository.tags[tag];
|
||||
return !!$scope.viewScope.repositoryTags[tag];
|
||||
});
|
||||
};
|
||||
|
||||
var loadRepositoryTags = function() {
|
||||
loadPaginatedRepositoryTags(1);
|
||||
$scope.viewScope.repositoryTags = $scope.repositoryTags;
|
||||
};
|
||||
|
||||
var loadPaginatedRepositoryTags = function(page) {
|
||||
|
@ -82,6 +84,7 @@
|
|||
var loadRepository = function() {
|
||||
// Mark the images to be reloaded.
|
||||
$scope.viewScope.images = null;
|
||||
loadRepositoryTags();
|
||||
|
||||
var params = {
|
||||
'repository': $scope.namespace + '/' + $scope.name,
|
||||
|
@ -91,9 +94,6 @@
|
|||
|
||||
$scope.repositoryResource = ApiService.getRepoAsResource(params).get(function(repo) {
|
||||
if (repo != undefined) {
|
||||
loadRepositoryTags();
|
||||
repo.tags = $scope.repositoryTags;
|
||||
|
||||
$scope.repository = repo;
|
||||
$scope.viewScope.repository = repo;
|
||||
|
||||
|
|
Reference in a new issue