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
|
@ -10,6 +10,7 @@ angular.module('quay').directive('repoPanelTags', function () {
|
|||
restrict: 'C',
|
||||
scope: {
|
||||
'repository': '=repository',
|
||||
'repositoryTags': '=repositoryTags',
|
||||
'selectedTags': '=selectedTags',
|
||||
'historyFilter': '=historyFilter',
|
||||
'imagesResource': '=imagesResource',
|
||||
|
@ -64,14 +65,14 @@ angular.module('quay').directive('repoPanelTags', function () {
|
|||
};
|
||||
|
||||
var setTagState = function() {
|
||||
if (!$scope.repository || !$scope.selectedTags) { return; }
|
||||
if (!$scope.repositoryTags || !$scope.selectedTags) { return; }
|
||||
|
||||
// Build a list of all the tags, with extending information.
|
||||
var allTags = [];
|
||||
for (var tag in $scope.repository.tags) {
|
||||
if (!$scope.repository.tags.hasOwnProperty(tag)) { continue; }
|
||||
for (var tag in $scope.repositoryTags) {
|
||||
if (!$scope.repositoryTags.hasOwnProperty(tag)) { continue; }
|
||||
|
||||
var tagData = $scope.repository.tags[tag];
|
||||
var tagData = $scope.repositoryTags[tag];
|
||||
var tagInfo = $.extend(tagData, {
|
||||
'name': tag,
|
||||
'last_modified_datetime': TableService.getReversedTimestamp(tagData.last_modified),
|
||||
|
@ -233,17 +234,21 @@ angular.module('quay').directive('repoPanelTags', function () {
|
|||
if (!selectedTags || !$scope.repository || !$scope.imageMap) { return; }
|
||||
|
||||
$scope.checkedTags.setChecked(selectedTags.map(function(tag) {
|
||||
return $scope.repository.tags[tag];
|
||||
return $scope.repositoryTags[tag];
|
||||
}));
|
||||
}, true);
|
||||
|
||||
$scope.$watch('repository', function(updatedRepoObject, previousRepoObject) {
|
||||
if (updatedRepoObject.tags === previousRepoObject.tags) { return; }
|
||||
|
||||
// Process each of the tags.
|
||||
setTagState();
|
||||
loadRepoSignatures();
|
||||
}, true);
|
||||
});
|
||||
|
||||
$scope.$watch('repositoryTags', function(tags) {
|
||||
// Process each of the tags.
|
||||
setTagState();
|
||||
loadRepoSignatures();
|
||||
});
|
||||
|
||||
$scope.loadImageVulnerabilities = function(image_id, imageData) {
|
||||
VulnerabilityService.loadImageVulnerabilities($scope.repository, image_id, function(resp) {
|
||||
|
|
Reference in a new issue