diff --git a/static/resources/js/components/project/publicity-button.directive.js b/static/resources/js/components/project/publicity-button.directive.js
index 5d86eb0f1..84c1f4322 100644
--- a/static/resources/js/components/project/publicity-button.directive.js
+++ b/static/resources/js/components/project/publicity-button.directive.js
@@ -6,19 +6,38 @@
.module('harbor.project')
.directive('publicityButton', publicityButton);
- PublicityButtonController.$inject = ['ToggleProjectPublicityService'];
+ PublicityButtonController.$inject = ['$scope', 'ToggleProjectPublicityService', '$filter', 'trFilter'];
- function PublicityButtonController(ToggleProjectPublicityService) {
+ function PublicityButtonController($scope, ToggleProjectPublicityService, $filter, trFilter) {
var vm = this;
vm.toggle = toggle;
- if(vm.isPublic === 1) {
- vm.isPublic = true;
- }else{
- vm.isPublic = false;
+ function toggle() {
+ if(vm.isPublic) {
+ vm.isPublic = false;
+ }else{
+ vm.isPublic = true;
+ }
+ ToggleProjectPublicityService(vm.projectId, vm.isPublic)
+ .success(toggleProjectPublicitySuccess)
+ .error(toggleProjectPublicityFailed);
}
-
- function toggle() {
+
+ function toggleProjectPublicitySuccess(data, status) {
+
+ console.log('Successful toggle project publicity.');
+ }
+
+ function toggleProjectPublicityFailed(e, status) {
+ $scope.$emit('modalTitle', $filter('tr')('error'));
+ var message;
+ if(status === 403) {
+ message = $filter('tr')('failed_to_toggle_publicity_insuffient_permissions');
+ }else{
+ message = $filter('tr')('failed_to_toggle_publicity');
+ }
+ $scope.$emit('modalMessage', message);
+ $scope.$emit('raiseError', true);
if(vm.isPublic) {
vm.isPublic = false;
@@ -26,16 +45,6 @@
vm.isPublic = true;
}
- ToggleProjectPublicityService(vm.projectId, vm.isPublic)
- .success(toggleProjectPublicitySuccess)
- .error(toggleProjectPublicityFailed);
- }
-
- function toggleProjectPublicitySuccess(data, status) {
- console.log('Successful toggle project publicity.');
- }
-
- function toggleProjectPublicityFailed(e) {
console.log('Failed to toggle project publicity:' + e);
}
}
@@ -57,7 +66,11 @@
return directive;
function link(scope, element, attr, ctrl) {
-
+ scope.$watch('vm.isPublic', function(current, origin) {
+ if(current) {
+ ctrl.isPublic = current;
+ }
+ });
}
}
diff --git a/static/resources/js/components/repository/list-tag.directive.js b/static/resources/js/components/repository/list-tag.directive.js
index 38b3abb79..c797bd5cf 100644
--- a/static/resources/js/components/repository/list-tag.directive.js
+++ b/static/resources/js/components/repository/list-tag.directive.js
@@ -31,13 +31,13 @@
function retrieve() {
ListTagService(vm.repoName)
- .then(getTagComplete)
- .catch(getTagFailed);
+ .success(getTagSuccess)
+ .error(getTagFailed);
}
- function getTagComplete(response) {
+ function getTagSuccess(data) {
- vm.tags = response.data;
+ vm.tags = data || [];
vm.tagCount[vm.repoName] = vm.tags.length;
$scope.$emit('tags', vm.tags);
@@ -48,11 +48,11 @@
});
}
- function getTagFailed(response) {
+ function getTagFailed(data) {
$scope.$emit('modalTitle', $filter('tr')('error'));
$scope.$emit('modalMessage', $filter('tr')('failed_to_get_tag') + response);
$scope.$emit('raiseError', true);
- console.log('Failed to get tag:' + response);
+ console.log('Failed to get tag:' + data);
}
function deleteTag(e) {
diff --git a/static/resources/js/components/system-management/create-destination.directive.html b/static/resources/js/components/system-management/create-destination.directive.html
index a5f1f5064..04f076570 100644
--- a/static/resources/js/components/system-management/create-destination.directive.html
+++ b/static/resources/js/components/system-management/create-destination.directive.html
@@ -49,7 +49,7 @@