diff --git a/static/resources/js/components/modal-dialog/modal-dialog.directive.html b/static/resources/js/components/modal-dialog/modal-dialog.directive.html index 403aa6345..af8c0702a 100644 --- a/static/resources/js/components/modal-dialog/modal-dialog.directive.html +++ b/static/resources/js/components/modal-dialog/modal-dialog.directive.html @@ -9,7 +9,7 @@ diff --git a/static/resources/js/components/modal-dialog/modal-dialog.directive.js b/static/resources/js/components/modal-dialog/modal-dialog.directive.js index 2fe689a22..be3d70c52 100644 --- a/static/resources/js/components/modal-dialog/modal-dialog.directive.js +++ b/static/resources/js/components/modal-dialog/modal-dialog.directive.js @@ -10,6 +10,7 @@ function ModalDialogController($scope) { var vm = this; + vm.confirmOnly = false; } function modalDialog() { @@ -21,7 +22,8 @@ 'contentType': '@', 'title': '@', 'message': '@', - 'action': '&' + 'action': '&', + 'confirmOnly': '@' }, 'controller': ModalDialogController, 'controllerAs': 'vm', @@ -49,11 +51,22 @@ } }); + scope.$on('showDialog', function(e, val) { + console.log('modal-dialog show:' + ctrl.show); + if(val) { + element.find('#myModal').modal('show'); + }else{ + element.find('#myModal').modal('hide'); + } + + }); + element.find('#btnOk').on('click', clickHandler); function clickHandler(e) { ctrl.action(); element.find('#myModal').modal('hide'); + ctrl.show = false; } } } diff --git a/static/resources/js/layout/account-setting/account-setting.controller.js b/static/resources/js/layout/account-setting/account-setting.controller.js index 7de0ccca5..ab6eca485 100644 --- a/static/resources/js/layout/account-setting/account-setting.controller.js +++ b/static/resources/js/layout/account-setting/account-setting.controller.js @@ -17,7 +17,7 @@ vm.reset = reset; vm.toggleChangePassword = toggleChangePassword; - vm.confirmToUpdate = confirmToUpdate; + vm.confirm = confirm; vm.updateUser = updateUser; vm.cancel = cancel; @@ -39,43 +39,32 @@ } } - function confirmToUpdate(user) { - vm.user = user; - if(vm.isOpen) { - if(vm.user && angular.isDefined(user.oldPassword) && angular.isDefined(user.password)) { - vm.modalTitle = $filter('tr')('change_password', []); - vm.modalMessage = $filte('tr')('confirm_to_change_password', []); - return true; - } - }else{ - if(vm.user && angular.isDefined(vm.user.username) && angular.isDefined(vm.user.password) && - angular.isDefined(vm.user.realname)) { - vm.modalTitle = $filter('tr')('change_profile', []); - vm.modalMessage = $filter('tr')('confirm_to_change_profile', []); - return true; - } - } - - vm.modalTitle = $filter('tr')('form_is_invalid'); - vm.modalMessage = $filter('tr')('form_is_invalid_message', []); - return false; + function confirm() { + $window.location.href = '/dashboard'; } - function updateUser() { + function updateUser(user) { if(vm.isOpen){ - ChangePasswordService(userId, vm.user.oldPassword, vm.user.password) - .success(changePasswordSuccess) - .error(changePasswordFailed); + if(user && angular.isDefined(user.oldPassword) && angular.isDefined(user.password)) { + ChangePasswordService(userId, user.oldPassword, user.password) + .success(changePasswordSuccess) + .error(changePasswordFailed); + } }else{ - UpdateUserService(userId, vm.user) - .success(updateUserSuccess) - .error(updateUserFailed); - currentUser.set(vm.user); + if(user && angular.isDefined(user.username) && angular.isDefined(user.password) && + angular.isDefined(user.realname)) { + UpdateUserService(userId, user) + .success(updateUserSuccess) + .error(updateUserFailed); + currentUser.set(user); + } } } function changePasswordSuccess(data, status) { - $window.location.href = '/dashboard'; + vm.modalTitle = $filter('tr')('change_password', []); + vm.modalMessage = $filter('tr')('successful_changed_password', []); + $scope.$broadcast('showDialog', true); } function changePasswordFailed(data, status) { @@ -87,7 +76,9 @@ } function updateUserSuccess(data, status) { - $window.location.href = '/dashboard'; + vm.modalTitle = $filter('tr')('change_profile', []); + vm.modalMessage = $filter('tr')('successful_changed_profile', []); + $scope.$broadcast('showDialog', true); } function updateUserFailed(data, status) { 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 f4b8027a4..622611319 100644 --- a/static/resources/js/layout/forgot-password/forgot-password.controller.js +++ b/static/resources/js/layout/forgot-password/forgot-password.controller.js @@ -6,17 +6,20 @@ .module('harbor.layout.forgot.password') .controller('ForgotPasswordController', ForgotPasswordController); - ForgotPasswordController.$inject = ['SendMailService', '$window']; + ForgotPasswordController.$inject = ['SendMailService', '$window', '$scope']; - function ForgotPasswordController(SendMailService, $window) { + function ForgotPasswordController(SendMailService, $window, $scope) { var vm = this; vm.hasError = false; + vm.show = false; vm.errorMessage = ''; vm.reset = reset; vm.sendMail = sendMail; + vm.confirm = confirm; + function reset(){ vm.hasError = false; vm.errorMessage = ''; @@ -31,7 +34,7 @@ } function sendMailSuccess(data, status) { - $window.location.href = '/'; + $scope.$broadcast('showDialog', true); } function sendMailFailed(data) { @@ -39,6 +42,12 @@ vm.errorMessage = data; console.log('Failed send mail:' + data); } + + function confirm() { + $window.location.href = '/'; + } + + } })(); \ No newline at end of file diff --git a/static/resources/js/layout/header/header.controller.js b/static/resources/js/layout/header/header.controller.js index 754a9d3d0..3db9ad5e3 100644 --- a/static/resources/js/layout/header/header.controller.js +++ b/static/resources/js/layout/header/header.controller.js @@ -6,10 +6,24 @@ .module('harbor.layout.header') .controller('HeaderController', HeaderController); - HeaderController.$inject = ['$scope', '$window', 'getParameterByName']; + HeaderController.$inject = ['$scope', '$window', 'getParameterByName', '$location', 'currentUser']; - function HeaderController($scope, $window, getParameterByName) { + function HeaderController($scope, $window, getParameterByName, $location, currentUser) { var vm = this; + vm.user = currentUser.get(); + + if(location.pathname === '/dashboard') { + vm.defaultUrl = '/dashboard'; + }else{ + vm.defaultUrl = '/'; + } + + $scope.$watch('vm.user', function(current) { + if(current) { + vm.defaultUrl = '/dashboard'; + } + }); + if($window.location.search) { vm.searchInput = getParameterByName('q', $window.location.search); console.log('vm.searchInput at header:' + vm.searchInput); diff --git a/static/resources/js/layout/sign-up/sign-up.controller.js b/static/resources/js/layout/sign-up/sign-up.controller.js index 298325543..e708d170b 100644 --- a/static/resources/js/layout/sign-up/sign-up.controller.js +++ b/static/resources/js/layout/sign-up/sign-up.controller.js @@ -6,13 +6,14 @@ .module('harbor.layout.sign.up') .controller('SignUpController', SignUpController); - SignUpController.$inject = ['SignUpService', '$window']; + SignUpController.$inject = ['$scope', 'SignUpService', '$window']; - function SignUpController(SignUpService, $window) { + function SignUpController($scope, SignUpService, $window) { var vm = this; vm.user = {}; vm.signUp = signUp; + vm.confirm = confirm; function signUp(user) { var userObject = { @@ -26,17 +27,21 @@ .success(signUpSuccess) .error(signUpFailed); } + function signUpSuccess(data, status) { console.log('Signed up successfully:' + status); - alert('Signed up successfully'); - $window.location.href = '/'; + $scope.$broadcast('showDialog', true); } function signUpFailed(data, status) { console.log('Signed up failed.'); } + function confirm() { + $window.location.href = '/'; + } + } })(); \ 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 6af41ad28..cbc53ab28 100644 --- a/static/resources/js/services/i18n/locale_messages_en-US.js +++ b/static/resources/js/services/i18n/locale_messages_en-US.js @@ -9,11 +9,11 @@ var locale_messages = { 'user_management_and_role_assignment': 'User management and role assignment', 'why_use_harbor': 'Why use Harbor?', 'index_desc': 'Project Harbor is to build an enterprise-class, reliable registry server. Enterprises can set up a private registry server in their own environment to improve productivity as well as security. Project Harbor can be used in both development and production environment.', - 'index_desc_1': 'Security: Keep their intellectual properties within their organizations.', - 'index_desc_2': 'Efficiency: A private registry server is set up within the organization\'s network and can reduce significantly the internet traffic to the public service. ', - 'index_desc_3': 'Access Control: RBAC (Role Based Access Control) is provided. User management can be integrated with existing enterprise identity services like AD/LDAP. ', - 'index_desc_4': 'Audit: All access to the registry are logged and can be used for audit purpose.', - 'index_desc_5': 'GUI: User friendly single-pane-of-glass management console.', + 'index_desc_1': 'Security: Keep their intellectual properties within their organizations.', + 'index_desc_2': 'Efficiency: A private registry server is set up within the organization\'s network and can reduce significantly the internet traffic to the public service. ', + 'index_desc_3': 'Access Control: RBAC (Role Based Access Control) is provided. User management can be integrated with existing enterprise identity services like AD/LDAP. ', + 'index_desc_4': 'Audit: All access to the registry are logged and can be used for audit purpose.', + 'index_desc_5': 'GUI: User friendly single-pane-of-glass management console.', 'view_all': 'View all...', 'repositories': 'Repositories', 'project_repo_name': 'Project/Repository Name', @@ -161,12 +161,15 @@ var locale_messages = { 'endpoint': 'Endpoint', 'test_connection': 'Test connection', 'add_new_destination': 'New Destination', - 'confirm_to_change_password': 'Are you sure to change your password?', + 'successful_changed_password': 'Password has been changed successfully.', 'change_profile': 'Change Profile', - 'confirm_to_change_profile': 'Are you sure to change your profile?', + 'successful_changed_profile': 'User profile has been changed successfully.', 'form_is_invalid': 'Form content is invalid', 'form_is_invalid_message': 'Form content is invalid, please fill the required fields.', 'administrator': 'Administrator', 'popular_repositories': 'Popular Repositories', - 'harbor_intro_title': 'About Harbor' + 'harbor_intro_title': 'About Harbor', + 'mail_has_been_sent': 'Resetting Email has been sent.', + 'send': 'Send', + 'successful_signed_up': 'Signed up successfully.' }; \ 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 fbaf94c1c..81537c22b 100644 --- a/static/resources/js/services/i18n/locale_messages_zh-CN.js +++ b/static/resources/js/services/i18n/locale_messages_zh-CN.js @@ -9,11 +9,11 @@ var locale_messages = { 'user_management_and_role_assignment': '用户管理和角色分派', 'why_use_harbor': '为什么要使用Harbor?', 'index_desc': 'Harbor是可靠的企业级Registry服务器。企业用户可使用Harbor搭建私有容器Registry服务,提高生产效率和安全度,既可应用于生产环境,也可以在开发环境中使用。', - 'index_desc_1': '安全: 确保知识产权在自己组织内部的管控之下。', - 'index_desc_2': '效率: 搭建组织内部的私有容器Registry服务,可显著降低访问公共Registry服务的网络需求。', - 'index_desc_3': '访问控制: 提供基于角色的访问控制,可集成企业目前拥有的用户管理系统(如:AD/LDAP)。', - 'index_desc_4': '审计: 所有访问Registry服务的操作均被记录,便于日后审计。', - 'index_desc_5': '管理界面: 具有友好易用图形管理界面。', + 'index_desc_1': '安全: 确保知识产权在自己组织内部的管控之下。', + 'index_desc_2': '效率: 搭建组织内部的私有容器Registry服务,可显著降低访问公共Registry服务的网络需求。', + 'index_desc_3': '访问控制: 提供基于角色的访问控制,可集成企业目前拥有的用户管理系统(如:AD/LDAP)。', + 'index_desc_4': '审计: 所有访问Registry服务的操作均被记录,便于日后审计。', + 'index_desc_5': '管理界面: 具有友好易用图形管理界面。', 'view_all': '显示全部...', 'repositories': '镜像仓库', 'project_repo_name': '项目/镜像仓库名称', @@ -160,12 +160,15 @@ var locale_messages = { 'endpoint_is_required': '终端URL为必填项。', 'test_connection': '测试连接', 'add_new_destination': '新建目标', - 'confirm_to_change_password': '确认要修改密码吗?', + 'successful_changed_password': '修改密码操作成功。', 'change_profile': '修改个人信息', - 'confirm_to_change_profile': '确认要修改个人信息吗?', + 'successful_changed_profile': '修改个人信息操作成功。', 'form_is_invalid': '表单内容无效', 'form_is_invalid_message': '表单内容无效,请填写必填字段。', 'administrator': '管理员', 'popular_repositories': '热门镜像仓库', - 'harbor_intro_title': '关于 Harbor' + 'harbor_intro_title': '关于 Harbor', + 'mail_has_been_sent': '重置密码邮件已发送。', + 'send': '发送', + 'successful_signed_up': '注册成功。' }; \ No newline at end of file diff --git a/static/resources/js/session/session.current-user.js b/static/resources/js/session/session.current-user.js index 04b8dbbbb..6aa6b84c6 100644 --- a/static/resources/js/session/session.current-user.js +++ b/static/resources/js/session/session.current-user.js @@ -19,6 +19,9 @@ function getCurrentUserComplete(response) { if(angular.isDefined(response)) { currentUser.set(response.data); + if(location.pathname === '/') { + $window.location.href = '/dashboard'; + } } } diff --git a/views/account-settings.htm b/views/account-settings.htm index ba8ec65dd..fe45e725f 100644 --- a/views/account-settings.htm +++ b/views/account-settings.htm @@ -4,7 +4,7 @@

// 'account_setting' | tr //

- +
@@ -102,7 +102,7 @@
- +
diff --git a/views/forgot-password.htm b/views/forgot-password.htm index e8d02cc7e..547e4705e 100644 --- a/views/forgot-password.htm +++ b/views/forgot-password.htm @@ -2,10 +2,11 @@
+

// 'forgot_password' | tr //

- +
@@ -17,14 +18,14 @@
-
+
// 'email_is_required' | tr //
// vm.errorMessage | tr //
- +
diff --git a/views/header.htm b/views/header.htm deleted file mode 100644 index 148df7a3b..000000000 --- a/views/header.htm +++ /dev/null @@ -1,24 +0,0 @@ - \ No newline at end of file diff --git a/views/index.htm b/views/index.htm index 6c4177f12..d3701d2e9 100644 --- a/views/index.htm +++ b/views/index.htm @@ -39,18 +39,11 @@
- + -

+

// 'index_desc' | tr //

-
    -
  • ▪︎ // 'index_desc_1' | tr //
  • -
  • ▪︎ // 'index_desc_2' | tr //
  • -
  • ▪︎ // 'index_desc_3' | tr //
  • -
  • ▪︎ // 'index_desc_4' | tr //
  • -
  • ▪︎ // 'index_desc_5' | tr //
  • -
diff --git a/views/sections/header-content.htm b/views/sections/header-content.htm index cad6753d1..9c88081db 100644 --- a/views/sections/header-content.htm +++ b/views/sections/header-content.htm @@ -6,7 +6,7 @@ Toggle navigation - Harbor's Logo + Harbor's Logo