diff --git a/static/resources/css/index.css b/static/resources/css/index.css
index 463a3cc75..9cd1596ad 100644
--- a/static/resources/css/index.css
+++ b/static/resources/css/index.css
@@ -110,4 +110,5 @@ body {
.page-content {
margin: 0 20px 0 20px;
+ text-align: left;
}
diff --git a/static/resources/js/components/top-repository/top-repository.directive.html b/static/resources/js/components/top-repository/top-repository.directive.html
index e3b79fbfb..7693dc78f 100644
--- a/static/resources/js/components/top-repository/top-repository.directive.html
+++ b/static/resources/js/components/top-repository/top-repository.directive.html
@@ -1,4 +1,4 @@
-
+
@@ -9,7 +9,7 @@
// 'no_top_repositories' | tr // |
- //t.name// | //t.count// | //t.creator// |
+ //t.name// | //t.count// | //t.creator === '' ? 'N/A' : t.creator // |
diff --git a/static/resources/js/components/user/list-user.directive.html b/static/resources/js/components/user/list-user.directive.html
index f3c9e6df1..342fe3583 100644
--- a/static/resources/js/components/user/list-user.directive.html
+++ b/static/resources/js/components/user/list-user.directive.html
@@ -13,7 +13,11 @@
- // 'username' | tr // | // 'email' | tr // | // 'registration_time' | tr // | // 'operation' | tr // |
+ // 'username' | tr // |
+ // 'email' | tr // |
+ // 'registration_time' | tr // |
+ // 'administrator' | tr // |
+ // 'operation' | tr // |
@@ -21,7 +25,9 @@
//u.email// |
//u.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'// |
-
+
+ |
+
|
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 c1a1b9812..7de0ccca5 100644
--- a/static/resources/js/layout/account-setting/account-setting.controller.js
+++ b/static/resources/js/layout/account-setting/account-setting.controller.js
@@ -6,26 +6,27 @@
.module('harbor.layout.account.setting')
.controller('AccountSettingController', AccountSettingController);
- AccountSettingController.$inject = ['ChangePasswordService', '$scope', '$window', 'currentUser'];
+ AccountSettingController.$inject = ['ChangePasswordService', 'UpdateUserService', '$filter', 'trFilter', '$scope', '$window', 'currentUser'];
- function AccountSettingController(ChangePasswordService, $scope, $window, currentUser) {
+ function AccountSettingController(ChangePasswordService, UpdateUserService, $filter, trFilter, $scope, $window, currentUser) {
var vm = this;
vm.isOpen = false;
- vm.user = {};
-
+
vm.hasError = false;
vm.errorMessage = '';
vm.reset = reset;
vm.toggleChangePassword = toggleChangePassword;
- vm.changeProfile = changeProfile;
- vm.changePassword= changePassword;
+ vm.confirmToUpdate = confirmToUpdate;
+ vm.updateUser = updateUser;
vm.cancel = cancel;
-
- vm.user = currentUser.get();
-
+ $scope.user = currentUser.get();
+ var userId = $scope.user.user_id;
+
function reset() {
+ $scope.form.$setUntouched();
+ $scope.form.$setPristine();
vm.hasError = false;
vm.errorMessage = '';
}
@@ -37,25 +38,44 @@
vm.isOpen = true;
}
}
-
- function getCurrentUserFailed(data) {
- console.log('Failed get current user:' + data);
- }
- function changeProfile(user) {
- console.log(user);
- }
-
- function changePassword(user) {
- if(user && angular.isDefined(user.oldPassword) && angular.isDefined(user.password)) {
- ChangePasswordService(vm.user.user_id, user.oldPassword, user.password)
+ 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 updateUser() {
+ if(vm.isOpen){
+ ChangePasswordService(userId, vm.user.oldPassword, vm.user.password)
.success(changePasswordSuccess)
.error(changePasswordFailed);
+ }else{
+ UpdateUserService(userId, vm.user)
+ .success(updateUserSuccess)
+ .error(updateUserFailed);
+ currentUser.set(vm.user);
}
}
function changePasswordSuccess(data, status) {
- $window.location.href = '/project';
+ $window.location.href = '/dashboard';
}
function changePasswordFailed(data, status) {
@@ -66,11 +86,16 @@
}
}
+ function updateUserSuccess(data, status) {
+ $window.location.href = '/dashboard';
+ }
+
+ function updateUserFailed(data, status) {
+ console.log('Failed update user.');
+ }
+
function cancel(form) {
- if(form) {
- form.$setPristine();
- }
- $window.location.href = '/project';
+ $window.location.href = '/dashboard';
}
}
diff --git a/static/resources/js/layout/index/index.controller.js b/static/resources/js/layout/index/index.controller.js
index 56d7e2e36..4499456db 100644
--- a/static/resources/js/layout/index/index.controller.js
+++ b/static/resources/js/layout/index/index.controller.js
@@ -6,7 +6,28 @@
.module('harbor.layout.index')
.controller('IndexController', IndexController);
- function IndexController() {
+ IndexController.$inject = ['$filter', 'trFilter'];
+
+ function IndexController($filter, trFilter) {
+ var vm = this;
+
+ var indexDesc = $filter('tr')('index_desc', []);
+ var indexDesc1 = $filter('tr')('index_desc_1', []);
+ var indexDesc2 = $filter('tr')('index_desc_2', []);
+ var indexDesc3 = $filter('tr')('index_desc_3', []);
+ var indexDesc4 = $filter('tr')('index_desc_4', []);
+ var indexDesc5 = $filter('tr')('index_desc_5', []);
+
+ vm.message = '' +
+ indexDesc +
+ '
' +
+ '' +
+ '- ▪︎ ' + indexDesc1 + '
' +
+ '- ▪︎ ' + indexDesc2 + '
' +
+ '- ▪︎ ' + indexDesc3 + '
' +
+ '- ▪︎ ' + indexDesc4 + '
' +
+ '- ▪︎ ' + indexDesc5 + '
' +
+ '
';
}
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 5eb5f59eb..6af41ad28 100644
--- a/static/resources/js/services/i18n/locale_messages_en-US.js
+++ b/static/resources/js/services/i18n/locale_messages_en-US.js
@@ -14,7 +14,7 @@ var locale_messages = {
'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.',
- 'learn_more': 'Learn more...',
+ 'view_all': 'View all...',
'repositories': 'Repositories',
'project_repo_name': 'Project/Repository Name',
'creation_time': 'Creation Time',
@@ -51,8 +51,8 @@ var locale_messages = {
'public_projects': 'Public Projects',
'public': 'Public',
'public_repositories': 'Public Repositories',
- 'my_project_count': 'Projects',
- 'my_repo_count': 'Repositories',
+ 'my_project_count': 'My Projects',
+ 'my_repo_count': 'My Repositories',
'public_project_count': 'Public Projects',
'public_repo_count': 'Public Repositories',
'total_project_count': 'Total Projects',
@@ -160,5 +160,13 @@ var locale_messages = {
'destination_setting': 'Destination Setting',
'endpoint': 'Endpoint',
'test_connection': 'Test connection',
- 'add_new_destination': 'New Destination'
+ 'add_new_destination': 'New Destination',
+ 'confirm_to_change_password': 'Are you sure to change your password?',
+ 'change_profile': 'Change Profile',
+ 'confirm_to_change_profile': 'Are you sure to change your profile?',
+ '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'
};
\ 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 d8c15f437..fbaf94c1c 100644
--- a/static/resources/js/services/i18n/locale_messages_zh-CN.js
+++ b/static/resources/js/services/i18n/locale_messages_zh-CN.js
@@ -14,7 +14,7 @@ var locale_messages = {
'index_desc_3': '访问控制: 提供基于角色的访问控制,可集成企业目前拥有的用户管理系统(如:AD/LDAP)。',
'index_desc_4': '审计: 所有访问Registry服务的操作均被记录,便于日后审计。',
'index_desc_5': '管理界面: 具有友好易用图形管理界面。',
- 'learn_more': '更多...',
+ 'view_all': '显示全部...',
'repositories': '镜像仓库',
'project_repo_name': '项目/镜像仓库名称',
'creation_time': '创建时间',
@@ -51,8 +51,8 @@ var locale_messages = {
'public_projects': '公开项目',
'public': '公开',
'public_repositories': '公开镜像仓库',
- 'my_project_count': '项目',
- 'my_repo_count': '镜像仓库',
+ 'my_project_count': '我的项目',
+ 'my_repo_count': '我的镜像仓库',
'public_project_count': '公开项目',
'public_repo_count': '公开镜像仓库',
'total_project_count': '全部项目',
@@ -159,5 +159,13 @@ var locale_messages = {
'endpoint': '终端URL',
'endpoint_is_required': '终端URL为必填项。',
'test_connection': '测试连接',
- 'add_new_destination': '新建目标'
+ 'add_new_destination': '新建目标',
+ 'confirm_to_change_password': '确认要修改密码吗?',
+ 'change_profile': '修改个人信息',
+ 'confirm_to_change_profile': '确认要修改个人信息吗?',
+ 'form_is_invalid': '表单内容无效',
+ 'form_is_invalid_message': '表单内容无效,请填写必填字段。',
+ 'administrator': '管理员',
+ 'popular_repositories': '热门镜像仓库',
+ 'harbor_intro_title': '关于 Harbor'
};
\ No newline at end of file
diff --git a/static/resources/js/services/user/services.update-user.js b/static/resources/js/services/user/services.update-user.js
new file mode 100644
index 000000000..a04a86059
--- /dev/null
+++ b/static/resources/js/services/user/services.update-user.js
@@ -0,0 +1,24 @@
+(function() {
+
+ 'use strict';
+
+ angular
+ .module('harbor.services.user')
+ .factory('UpdateUserService', UpdateUserService);
+
+ UpdateUserService.$inject = ['$http'];
+
+ function UpdateUserService($http) {
+ return updateUser;
+ function updateUser(userId, user) {
+ return $http
+ .put('/api/users/' + userId, {
+ 'username': user.username,
+ 'email': user.email,
+ 'realname': user.realname,
+ 'comment': user.comment
+ });
+ }
+ }
+
+})();
\ No newline at end of file
diff --git a/views/account-settings.htm b/views/account-settings.htm
index 22b24ae99..ba8ec65dd 100644
--- a/views/account-settings.htm
+++ b/views/account-settings.htm
@@ -4,11 +4,12 @@
// 'account_setting' | tr //