+
diff --git a/src/ui/static/resources/js/components/repository/list-tag.directive.js b/src/ui/static/resources/js/components/repository/list-tag.directive.js
index 3430f57f0..59b7daa3a 100644
--- a/src/ui/static/resources/js/components/repository/list-tag.directive.js
+++ b/src/ui/static/resources/js/components/repository/list-tag.directive.js
@@ -28,8 +28,14 @@
vm.tags = [];
vm.retrieve = retrieve;
+ vm.selected = []
+ vm.selected[vm.repoName] = [];
+
+ vm.selectedTags = [];
+
$scope.$watch('vm.repoName', function(current, origin) {
if(current) {
+ console.log('vm.repoName triggered tags retrieval.')
vm.retrieve();
}
});
@@ -37,10 +43,47 @@
$scope.$on('refreshTags', function(e, val) {
if(val) {
vm.retrieve();
+ vm.selectedCount[vm.repoName] = 0;
+ vm.selected[val.repoName] = [];
+ vm.selectedTags = [];
}
});
- vm.deleteTag = deleteTag;
+ $scope.$watch('vm.selectedCount[vm.repoName]', function(current, previous) {
+ if(current !== previous) {
+ console.log('Watching vm.selectedCount:' + current);
+ $scope.$emit('selectedAll', {'status': (current === vm.tags.length), 'repoName': vm.repoName});
+ }
+ });
+
+ $scope.$on('gatherSelectedTags' + vm.repoName, function(e, val) {
+ if(val) {
+ console.log('RECEIVED gatherSelectedTags:' + val);
+ gatherSelectedTags();
+ }
+ })
+
+ $scope.$on('selectAll' + vm.repoName, function(e, val) {
+ (val.status) ? vm.selectedCount[val.repoName] = vm.tags.length : vm.selectedCount[val.repoName] = 0;
+ for(var i = 0; i < vm.tags.length; i++) {
+ vm.selected[val.repoName][i] = val.status;
+ }
+ gatherSelectedTags();
+ console.log('received selectAll:' + angular.toJson(val) + ', vm.selected:' + angular.toJson(vm.selected));
+ });
+
+ $scope.$watch('vm.tags', function(current) {
+ if(current) {
+ vm.tags = current;
+ }
+ });
+
+ vm.deleteTag = deleteTag;
+
+ vm.selectedCount = [];
+ vm.selectedCount[vm.repoName] = 0;
+
+ vm.selectOne = selectOne;
function retrieve() {
ListTagService(vm.repoName)
@@ -49,7 +92,6 @@
}
function getTagSuccess(data) {
-
vm.tags = data || [];
vm.tagCount[vm.repoName] = vm.tags.length;
@@ -59,6 +101,10 @@
angular.forEach(vm.tags, function(item) {
vm.toggleInProgress[vm.repoName + '|' + item] = false;
});
+
+ for(var i = 0; i < vm.tags.length; i++) {
+ vm.selected[vm.repoName][i] = false;
+ }
}
function getTagFailed(data) {
@@ -72,6 +118,28 @@
$scope.$emit('repoName', e.repoName);
$scope.$emit('tag', e.tag);
vm.deleteByTag();
+ }
+
+ function selectOne(index, tagName) {
+ vm.selected[vm.repoName][index] = !vm.selected[vm.repoName][index];
+ (vm.selected[vm.repoName][index]) ? ++vm.selectedCount[vm.repoName] : --vm.selectedCount[vm.repoName];
+ console.log('selectOne, repoName:' + vm.repoName + ', vm.selected:' + vm.selected[vm.repoName][index] + ', index:' + index + ', length:' + vm.selectedCount[vm.repoName]);
+ gatherSelectedTags();
+ }
+
+ function gatherSelectedTags() {
+ vm.selectedTags[vm.repoName] = [];
+ for(var i = 0; i < vm.tags.length; i++) {
+ (vm.selected[vm.repoName][i]) ? vm.selectedTags[vm.repoName][i] = vm.tags[i] : vm.selectedTags[vm.repoName][i] = '';
+ }
+ var tagsToDelete = [];
+ for(var i in vm.selectedTags[vm.repoName]) {
+ var tag = vm.selectedTags[vm.repoName][i];
+ if(tag !== '') {
+ tagsToDelete.push(tag);
+ }
+ }
+ $scope.$emit('selectedTags', {'repoName': vm.repoName, 'tags': tagsToDelete});
}
}
@@ -97,4 +165,4 @@
}
-})();
+})();
\ No newline at end of file
diff --git a/src/ui/static/resources/js/components/repository/pull-command.directive.html b/src/ui/static/resources/js/components/repository/pull-command.directive.html
index 2931b06fc..6b03d4a4c 100644
--- a/src/ui/static/resources/js/components/repository/pull-command.directive.html
+++ b/src/ui/static/resources/js/components/repository/pull-command.directive.html
@@ -1,7 +1,5 @@