@@ -34,7 +33,7 @@
-
+
|
diff --git a/static/resources/js/components/user/list-user.directive.js b/static/resources/js/components/user/list-user.directive.js
index 73bc82dfb..bb6274bbf 100644
--- a/static/resources/js/components/user/list-user.directive.js
+++ b/static/resources/js/components/user/list-user.directive.js
@@ -6,9 +6,9 @@
.module('harbor.user')
.directive('listUser', listUser);
- ListUserController.$inject = ['$scope', 'ListUserService', 'DeleteUserService'];
+ ListUserController.$inject = ['$scope', 'ListUserService', 'DeleteUserService', '$filter', 'trFilter'];
- function ListUserController($scope, ListUserService, DeleteUserService) {
+ function ListUserController($scope, ListUserService, DeleteUserService, $filter, $trFilter) {
$scope.subsSubPane = 226;
@@ -34,6 +34,17 @@
function confirmToDelete(userId) {
vm.selectedUserId = userId;
+
+ $scope.$emit('modalTitle', $filter('tr')('confirm_to_delete_user_title'));
+ $scope.$emit('modalMessage', $filter('tr')('confirm_to_delete_user'));
+
+ var emitInfo = {
+ 'confirmOnly': false,
+ 'contentType': 'text/plain',
+ 'action': vm.deleteUser
+ };
+
+ $scope.$emit('raiseInfo', emitInfo);
}
function retrieve() {
@@ -48,6 +59,9 @@
}
function deleteUserFailed(data, status) {
+ $scope.$emit('modalTitle', $filter('tr')('error'));
+ $scope.$emit('modalMessage', $filter('tr')('failed_delete_user'));
+ $scope.$emit('raiseError', true);
console.log('Failed delete user.');
}
@@ -56,6 +70,9 @@
}
function listUserFailed(data, status) {
+ $scope.$emit('modalTitle', $filter('tr')('error'));
+ $scope.$emit('modalMessage', $filter('tr')('failed_list_user'));
+ $scope.$emit('raiseError', true);
console.log('Failed list user:' + data);
}
}
diff --git a/static/resources/js/components/user/toggle-admin.directive.js b/static/resources/js/components/user/toggle-admin.directive.js
index 68274cbe7..e9adcbd67 100644
--- a/static/resources/js/components/user/toggle-admin.directive.js
+++ b/static/resources/js/components/user/toggle-admin.directive.js
@@ -6,9 +6,9 @@
.module('harbor.user')
.directive('toggleAdmin', toggleAdmin);
- ToggleAdminController.$inject = ['$scope', 'ToggleAdminService'];
+ ToggleAdminController.$inject = ['$scope', 'ToggleAdminService', '$filter', 'trFilter'];
- function ToggleAdminController($scope, ToggleAdminService) {
+ function ToggleAdminController($scope, ToggleAdminService, $filter, trFilter) {
var vm = this;
vm.isAdmin = (vm.hasAdminRole == 1) ? true : false;
@@ -31,6 +31,9 @@
}
function toggleAdminFailed(data, status) {
+ $scope.$emit('modalTitle', $filter('tr')('error'));
+ $scope.$emit('modalMessage', $filter('tr')('failed_toggle_admin'));
+ $scope.$emit('raiseError', true);
console.log('Failed toggle admin:' + data);
}
}
diff --git a/static/resources/js/layout/admin-option/admin-option.controller.js b/static/resources/js/layout/admin-option/admin-option.controller.js
index c16082d15..7a39ea3ea 100644
--- a/static/resources/js/layout/admin-option/admin-option.controller.js
+++ b/static/resources/js/layout/admin-option/admin-option.controller.js
@@ -6,22 +6,74 @@
.module('harbor.layout.admin.option')
.controller('AdminOptionController', AdminOptionController);
- AdminOptionController.$inject = ['$scope'];
+ AdminOptionController.$inject = ['$scope', '$timeout', '$location'];
- function AdminOptionController($scope) {
+ function AdminOptionController($scope, $timeout, $location) {
$scope.subsSubPane = 296;
var vm = this;
vm.toggle = false;
+ vm.target = 'users';
vm.toggleAdminOption = toggleAdminOption;
+
+ $scope.$on('$locationChangeSuccess', function(e) {
+ if($location.path() === '') {
+ vm.target = 'users';
+ vm.toggle = false;
+ }else{
+ vm.target = 'system_management';
+ vm.toggle = true;
+ }
+ });
+
+ //Message dialog handler for admin-options.
+ $scope.$on('modalTitle', function(e, val) {
+ vm.modalTitle = val;
+ });
- function toggleAdminOption() {
- if(vm.toggle) {
- vm.toggle = false;
- }else{
- vm.toggle = true;
+ $scope.$on('modalMessage', function(e, val) {
+ vm.modalMessage = val;
+ });
+
+ $scope.$on('raiseError', function(e, val) {
+ if(val) {
+ vm.action = function() {
+ $scope.$broadcast('showDialog', false);
+ };
+ vm.contentType = 'text/plain';
+ vm.confirmOnly = true;
+
+ $timeout(function() {
+ $scope.$broadcast('showDialog', true);
+ }, 350);
}
+ });
+
+ $scope.$on('raiseInfo', function(e, val) {
+ if(val) {
+ vm.action = function() {
+ val.action();
+ $scope.$broadcast('showDialog', false);
+ }
+ vm.contentType = val.contentType;
+ vm.confirmOnly = val.confirmOnly;
+
+ $scope.$broadcast('showDialog', true);
+ }
+ });
+
+
+ function toggleAdminOption(e) {
+ switch(e.target) {
+ case 'users':
+ vm.toggle = false;
+ break;
+ case 'system_management':
+ vm.toggle = true;
+ break;
+ }
+ vm.target = e.target;
}
}
diff --git a/static/resources/js/layout/details/details.controller.js b/static/resources/js/layout/details/details.controller.js
index dc114fbf7..974ae16e3 100644
--- a/static/resources/js/layout/details/details.controller.js
+++ b/static/resources/js/layout/details/details.controller.js
@@ -6,9 +6,9 @@
.module('harbor.details')
.controller('DetailsController', DetailsController);
- DetailsController.$inject = ['$scope'];
+ DetailsController.$inject = ['$scope', '$timeout'];
- function DetailsController($scope) {
+ function DetailsController($scope, $timeout) {
var vm = this;
vm.publicity = false;
@@ -19,6 +19,42 @@
vm.sectionDefaultHeight = {'min-height': '579px'};
+ //Message dialog handler for details.
+ $scope.$on('modalTitle', function(e, val) {
+ vm.modalTitle = val;
+ });
+
+ $scope.$on('modalMessage', function(e, val) {
+ vm.modalMessage = val;
+ });
+
+ $scope.$on('raiseError', function(e, val) {
+ if(val) {
+ vm.action = function() {
+ $scope.$broadcast('showDialog', false);
+ };
+ vm.contentType = 'text/plain';
+ vm.confirmOnly = true;
+
+ $timeout(function() {
+ $scope.$broadcast('showDialog', true);
+ }, 350);
+ }
+ });
+
+ $scope.$on('raiseInfo', function(e, val) {
+ if(val) {
+ vm.action = function() {
+ val.action();
+ $scope.$broadcast('showDialog', false);
+ }
+ vm.contentType = val.contentType;
+ vm.confirmOnly = val.confirmOnly;
+
+ $scope.$broadcast('showDialog', true);
+ }
+ });
+
function togglePublicity(e) {
vm.publicity = e.publicity;
}
diff --git a/static/resources/js/layout/forgot-password/forgot-password.controller.js b/static/resources/js/layout/forgot-password/forgot-password.controller.js
index 5c1c4ab3f..f3b466f0e 100644
--- a/static/resources/js/layout/forgot-password/forgot-password.controller.js
+++ b/static/resources/js/layout/forgot-password/forgot-password.controller.js
@@ -36,7 +36,7 @@
$scope.$broadcast('showDialog', false);
};
vm.contentType = 'text/plain';
- vm.confirmOnly = true;
+ vm.confirmOnly = true;
$scope.$broadcast('showDialog', true);
}
});
@@ -73,7 +73,7 @@
if(status === 500) {
$scope.$emit('modalTitle', $filter('tr')('error'));
- $scope.$emit('modalMessage', $filter('tr')('failed_send_mail'));
+ $scope.$emit('modalMessage', $filter('tr')('failed_send_email'));
$scope.$emit('raiseError', true);
}
console.log('Failed send mail:' + data);
diff --git a/static/resources/js/layout/index/index.controller.js b/static/resources/js/layout/index/index.controller.js
index e590588bb..600beee48 100644
--- a/static/resources/js/layout/index/index.controller.js
+++ b/static/resources/js/layout/index/index.controller.js
@@ -6,9 +6,9 @@
.module('harbor.layout.index')
.controller('IndexController', IndexController);
- IndexController.$inject = ['$scope', '$filter', 'trFilter'];
+ IndexController.$inject = ['$scope', '$filter', 'trFilter', '$timeout'];
- function IndexController($scope, $filter, trFilter) {
+ function IndexController($scope, $filter, trFilter, $timeout) {
$scope.subsHeight = 110;
$scope.subsSection = 32;
@@ -27,8 +27,8 @@
var indexDesc4 = $filter('tr')('index_desc_4', []);
var indexDesc5 = $filter('tr')('index_desc_5', []);
- vm.modalTitle = $filter('tr')('harbor_intro_title');
- vm.modalMessage = '
'+
+ $scope.$emit('modalTitle', $filter('tr')('harbor_intro_title'));
+ $scope.$emit('modalMessage', '
'+
indexDesc +
'
' +
'
' +
@@ -37,16 +37,18 @@
'- ▪︎ ' + indexDesc3 + '
' +
'- ▪︎ ' + indexDesc4 + '
' +
'- ▪︎ ' + indexDesc5 + '
' +
- '
';
- vm.contentType = 'text/html';
- vm.confirmOnly = true;
- $scope.$broadcast('showDialog', true);
- vm.action = function() {
- $scope.$broadcast('showDialog', false);
- }
+ '');
+ var emitInfo = {
+ 'contentType': 'text/html',
+ 'confirmOnly': true,
+ 'action': function() {
+ $scope.$broadcast('showDialog', false);
+ }
+ };
+ $scope.$emit('raiseInfo', emitInfo);
}
- //Error message dialog handler for index.
+ //Message dialog handler for index.
$scope.$on('modalTitle', function(e, val) {
vm.modalTitle = val;
});
@@ -61,10 +63,27 @@
$scope.$broadcast('showDialog', false);
};
vm.contentType = 'text/plain';
- vm.confirmOnly = true;
- $scope.$broadcast('showDialog', true);
+ vm.confirmOnly = true;
+
+ $timeout(function() {
+ $scope.$broadcast('showDialog', true);
+ }, 350);
}
});
+
+ $scope.$on('raiseInfo', function(e, val) {
+ if(val) {
+ vm.action = function() {
+ val.action();
+ $scope.$broadcast('showDialog', false);
+ }
+ vm.contentType = val.contentType;
+ vm.confirmOnly = val.confirmOnly;
+
+ $scope.$broadcast('showDialog', true);
+ }
+ });
+
}
})();
\ No newline at end of file
diff --git a/static/resources/js/services/i18n/locale_messages_en-US.js b/static/resources/js/services/i18n/locale_messages_en-US.js
index e03ac5a6b..f23a16631 100644
--- a/static/resources/js/services/i18n/locale_messages_en-US.js
+++ b/static/resources/js/services/i18n/locale_messages_en-US.js
@@ -226,5 +226,11 @@ var locale_messages = {
'failed_reset_pasword': 'Failed reset password.',
'failed_in_search': 'Failed in search.',
'failed_sign_up': 'Failed sign up.',
- 'failed_add_user': 'Failed add user'
+ 'failed_add_user': 'Failed add user.',
+ 'failed_delete_user': 'Failed delete user.',
+ 'failed_list_user': 'Failed list user data.',
+ 'failed_toggle_admin': 'Failed toggle admin user.',
+ 'failed_list_destination': 'Failed list destinations.',
+ 'failed_list_replication': 'Failed list replication policies.',
+ 'failed_toggle_policy': 'Failed toggle replication policy.'
};
\ No newline at end of file
diff --git a/static/resources/js/services/i18n/locale_messages_zh-CN.js b/static/resources/js/services/i18n/locale_messages_zh-CN.js
index 2210969da..696d7bb40 100644
--- a/static/resources/js/services/i18n/locale_messages_zh-CN.js
+++ b/static/resources/js/services/i18n/locale_messages_zh-CN.js
@@ -222,9 +222,15 @@ var locale_messages = {
'failed_get_stat': '获取统计数据失败。',
'failed_get_top_repo': '获取Top镜像仓库数据失败。',
'failed_get_user_log': '获取用户日志数据失败。',
- 'failed_send_mail': '发送邮件失败。',
+ 'failed_send_email': '发送邮件失败。',
'failed_reset_pasword': '重置邮件失败。',
'failed_in_search': '搜索操作失败。',
'failed_sign_up': '注册用户失败。',
- 'failed_add_user': '新增用户失败。'
+ 'failed_add_user': '新增用户失败。',
+ 'failed_delete_user': '删除用户失败。',
+ 'failed_list_user': '获取用户数据失败。',
+ 'failed_toggle_admin': '切换管理员用户失败。',
+ 'failed_list_destination': '获取目标数据失败。',
+ 'failed_list_replication': '获取复制策略数据失败。',
+ 'failed_toggle_policy': '切换复制策略状态失败。'
};
\ No newline at end of file
diff --git a/views/admin-options.htm b/views/admin-options.htm
index 08cf26a23..00e4a7100 100644
--- a/views/admin-options.htm
+++ b/views/admin-options.htm
@@ -1,16 +1,17 @@
+
diff --git a/views/repository.htm b/views/repository.htm
index 219c214ba..7e5f45fe6 100644
--- a/views/repository.htm
+++ b/views/repository.htm
@@ -1,4 +1,5 @@