update for retrieving repos and tags.

This commit is contained in:
kunw 2016-06-29 12:23:03 +08:00
parent 48c9cbd3c3
commit 149e07f51c
3 changed files with 17 additions and 14 deletions

View File

@ -14,7 +14,7 @@
<div class="sub-pane">
<div ng-if="vm.repositories.length > 0" class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<modal-dialog action="vm.deleteImage()" content-type="text/html" modal-title="//vm.modalTitle//" modal-message="//vm.modalMessage//"></modal-dialog>
<div class="panel panel-default" ng-repeat="repo in vm.repositories">
<div class="panel panel-default" ng-repeat="repo in vm.repositories" ng-show="vm.tagCount[repo] > 0">
<div class="panel-heading" role="tab" id="heading//$index + 1//">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="" href="?project_id=//vm.projectId//#collapse//$index + 1//" aria-expanded="true" aria-controls="collapse//$index+1//">

View File

@ -32,13 +32,7 @@
vm.projectId = getParameterByName('project_id', $location.absUrl());
vm.retrieve();
$scope.$on('$locationChangeStart', function() {
console.log('triggered locationChangeStart....');
vm.projectId = getParameterByName('project_id', $location.absUrl());
vm.retrieve();
});
$scope.$on('$locationChangeSuccess', function() {
vm.projectId = getParameterByName('project_id', $location.absUrl());
vm.retrieve();
@ -82,6 +76,7 @@
function getRepositoryComplete(data, status) {
vm.repositories = data || [];
$scope.$broadcast('refreshTags', true);
}
function getRepositoryFailed(response) {

View File

@ -12,18 +12,29 @@
var vm = this;
vm.tags = [];
vm.retrieve = retrieve;
$scope.$watch('vm.repoName', function(current, origin) {
if(current) {
console.log('vm.repoName in tags:' + current);
ListTagService(current)
.then(getTagComplete)
.catch(getTagFailed);
vm.retrieve();
}
});
$scope.$on('refreshTags', function(e, val) {
if(val) {
vm.retrieve();
}
});
vm.deleteByTag = deleteByTag;
function retrieve() {
ListTagService(vm.repoName)
.then(getTagComplete)
.catch(getTagFailed);
}
function getTagComplete(response) {
vm.tags = response.data;
vm.tagCount[vm.repoName] = vm.tags.length;
@ -45,7 +56,6 @@
}else {
message = $filter('tr')('alert_delete_tag', [e.tag]);
}
$scope.$emit('modalMessage', message);
}
@ -71,8 +81,6 @@
function link(scope, element, attrs, ctrl) {
}
}
})();