diff --git a/static/resources/css/repository.css b/static/resources/css/repository.css index 6c927ec76..29fe870cb 100644 --- a/static/resources/css/repository.css +++ b/static/resources/css/repository.css @@ -110,20 +110,34 @@ } .popover-header { - padding:8px 14px; - background-color:#f7f7f7; - border-bottom:1px solid #ebebeb; - -webkit-border-radius:5px 5px 0 0; - -moz-border-radius:5px 5px 0 0; - border-radius:5px 5px 0 0; + padding:8px 14px; + background-color:#f7f7f7; + border-bottom:1px solid #ebebeb; + -webkit-border-radius:5px 5px 0 0; + -moz-border-radius:5px 5px 0 0; + border-radius:5px 5px 0 0; } .popover-title { - height: 2.5em; - padding: 8px 14px; - margin: 0; - font-size: 14px; - background-color: #f7f7f7; - border-bottom: 1px solid #ebebeb; - border-radius: 5px 5px 0 0; + height: 2.5em; + padding: 8px 14px; + margin: 0; + font-size: 14px; + background-color: #f7f7f7; + border-bottom: 1px solid #ebebeb; + border-radius: 5px 5px 0 0; } + +.alert-custom { + position: fixed; + bottom: 24px; + z-index: 99; + width: 1110px; + padding: 10px; + background-color: #f2dede; + background-image: none; +} + +.alert-custom .close { + right: 0; +} \ No newline at end of file diff --git a/static/resources/js/components/details/retrieve-projects.directive.js b/static/resources/js/components/details/retrieve-projects.directive.js index 7b2aab4ef..a8d18e6bf 100644 --- a/static/resources/js/components/details/retrieve-projects.directive.js +++ b/static/resources/js/components/details/retrieve-projects.directive.js @@ -34,10 +34,6 @@ vm.publicity = current ? true : false; vm.isPublic = vm.publicity ? 1 : 0; vm.projectType = (vm.isPublic === 1) ? 'public_projects' : 'my_projects'; - if(vm.publicity) { - vm.isProjectMember = false; - vm.target = 'repository'; - } vm.retrieve(); }); diff --git a/static/resources/js/components/dismissable-alerts/dismissable-alerts.directive.html b/static/resources/js/components/dismissable-alerts/dismissable-alerts.directive.html new file mode 100644 index 000000000..fb0bd2a48 --- /dev/null +++ b/static/resources/js/components/dismissable-alerts/dismissable-alerts.directive.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/static/resources/js/components/dismissable-alerts/dismissable-alerts.directive.js b/static/resources/js/components/dismissable-alerts/dismissable-alerts.directive.js new file mode 100644 index 000000000..09bfa05db --- /dev/null +++ b/static/resources/js/components/dismissable-alerts/dismissable-alerts.directive.js @@ -0,0 +1,34 @@ +(function() { + + 'use strict'; + + angular + .module('harbor.dismissable.alerts') + .directive('dismissableAlerts', dismissableAlerts); + + function dismissableAlerts() { + var directive = { + 'restrict': 'E', + 'templateUrl': '/static/resources/js/components/dismissable-alerts/dismissable-alerts.directive.html', + 'link': link + }; + return directive; + function link(scope, element, attrs, ctrl) { + + scope.close = function() { + scope.toggleAlert = false; + } + scope.$on('raiseAlert', function(e, val) { + console.log('received raiseAlert:' + angular.toJson(val)); + if(val.show) { + scope.message = val.message; + scope.toggleAlert = true; + }else{ + scope.message = '' + scope.toggleAlert = false; + } + }); + } + } + +})(); \ No newline at end of file diff --git a/static/resources/js/components/dismissable-alerts/dismissable-alerts.module.js b/static/resources/js/components/dismissable-alerts/dismissable-alerts.module.js new file mode 100644 index 000000000..d6a7e614b --- /dev/null +++ b/static/resources/js/components/dismissable-alerts/dismissable-alerts.module.js @@ -0,0 +1,7 @@ +(function() { + + 'use strict'; + + angular.module('harbor.dismissable.alerts', []); + +})(); \ No newline at end of file diff --git a/static/resources/js/components/log/list-log.directive.js b/static/resources/js/components/log/list-log.directive.js index 0ee54fb34..ece319051 100644 --- a/static/resources/js/components/log/list-log.directive.js +++ b/static/resources/js/components/log/list-log.directive.js @@ -37,6 +37,7 @@ 'projectId': vm.projectId, 'username' : vm.username }; + retrieve(vm.queryParams); $scope.$on('$locationChangeSuccess', function() { diff --git a/static/resources/js/components/project-member/list-project-member.directive.js b/static/resources/js/components/project-member/list-project-member.directive.js index 39fa262e6..7c537ca1c 100644 --- a/static/resources/js/components/project-member/list-project-member.directive.js +++ b/static/resources/js/components/project-member/list-project-member.directive.js @@ -22,7 +22,7 @@ vm.deleteProjectMember = deleteProjectMember; vm.retrieve = retrieve; vm.username = ''; - + vm.projectId = getParameterByName('project_id', $location.absUrl()); vm.retrieve(); @@ -78,12 +78,7 @@ function getProjectMemberFailed(response) { console.log('Failed to get project members:' + response); vm.projectMembers = []; - vm.target = 'repositories'; -// $scope.$emit('modalTitle', $filter('tr')('error')); -// $scope.$emit('modalMessage', $filter('tr')('failed_to_get_project_member')); -// $scope.$emit('raiseError', true); - - + vm.target = 'repositories'; $location.url('repositories').search('project_id', vm.projectId); } diff --git a/static/resources/js/components/replication/create-policy.directive.js b/static/resources/js/components/replication/create-policy.directive.js index 100273cac..b1bc16a02 100644 --- a/static/resources/js/components/replication/create-policy.directive.js +++ b/static/resources/js/components/replication/create-policy.directive.js @@ -171,6 +171,7 @@ vm.policy = policy; if(vm.targetEditable) { vm.policy.targetId = vm1.selection.id; + saveDestination(); saveOrUpdatePolicy(); } } @@ -366,6 +367,8 @@ ctrl.pingMessage = ''; ctrl.pingAvailable = true; + ctrl.saveTIP = false; + ctrl.pingTIP = false; ctrl.toggleErrorMessage = false; ctrl.errorMessages = []; diff --git a/static/resources/js/components/replication/list-replication.directive.html b/static/resources/js/components/replication/list-replication.directive.html index f748c88ec..bc5a84551 100644 --- a/static/resources/js/components/replication/list-replication.directive.html +++ b/static/resources/js/components/replication/list-replication.directive.html @@ -41,8 +41,8 @@
- - + +
  diff --git a/static/resources/js/components/replication/list-replication.directive.js b/static/resources/js/components/replication/list-replication.directive.js index 0b38dfe2e..e8dbd8c9c 100644 --- a/static/resources/js/components/replication/list-replication.directive.js +++ b/static/resources/js/components/replication/list-replication.directive.js @@ -15,6 +15,7 @@ {'key': 'pending', 'value': $filter('tr')('pending')}, {'key': 'running', 'value': $filter('tr')('running')}, {'key': 'error' , 'value': $filter('tr')('error')}, + {'key': 'retrying', 'value': $filter('tr')('retrying')}, {'key': 'stopped', 'value': $filter('tr')('stopped')}, {'key': 'finished', 'value':$filter('tr')('finished')}, {'key': 'canceled', 'value': $filter('tr')('canceled')} @@ -28,7 +29,7 @@ var vm = this; vm.sectionHeight = {'min-height': '1200px'}; - + $scope.$on('$locationChangeSuccess', function() { vm.projectId = getParameterByName('project_id', $location.absUrl()); vm.retrievePolicy(); @@ -59,7 +60,7 @@ vm.searchJobTIP = false; vm.refreshJobTIP = false; - + function searchReplicationPolicy() { vm.retrievePolicy(); } @@ -102,9 +103,17 @@ function listReplicationJobSuccess(data, status) { vm.replicationJobs = data || []; + var alertInfo = { + 'show': false, + 'message': '' + }; angular.forEach(vm.replicationJobs, function(item) { for(var key in item) { - var value = item[key] + var value = item[key]; + if(key === 'status' && (value === 'error' || value === 'retrying')) { + alertInfo.show = true; + alertInfo.message = $filter('tr')('alert_job_contains_error'); + } switch(key) { case 'operation': case 'status': @@ -114,6 +123,8 @@ } } }); + + $scope.$emit('raiseAlert', alertInfo); vm.searchJobTIP = false; vm.refreshJobTIP = false; } diff --git a/static/resources/js/components/repository/list-repository.directive.js b/static/resources/js/components/repository/list-repository.directive.js index 2bd1aca68..2abd5dcb5 100644 --- a/static/resources/js/components/repository/list-repository.directive.js +++ b/static/resources/js/components/repository/list-repository.directive.js @@ -17,7 +17,7 @@ vm.filterInput = ''; vm.toggleInProgress = []; - + var hashValue = $location.hash(); if(hashValue) { var slashIndex = hashValue.indexOf('/'); diff --git a/static/resources/js/components/system-management/create-destination.directive.js b/static/resources/js/components/system-management/create-destination.directive.js index d185f3810..e9ca2f635 100644 --- a/static/resources/js/components/system-management/create-destination.directive.js +++ b/static/resources/js/components/system-management/create-destination.directive.js @@ -184,6 +184,7 @@ ctrl.pingAvailable = true; ctrl.pingMessage = ''; + ctrl.pingTIP = false; ctrl.toggleErrorMessage = false; ctrl.errorMessages = []; diff --git a/static/resources/js/harbor.module.js b/static/resources/js/harbor.module.js index 3b7e85adc..d92272c75 100644 --- a/static/resources/js/harbor.module.js +++ b/static/resources/js/harbor.module.js @@ -45,6 +45,7 @@ 'harbor.replication', 'harbor.system.management', 'harbor.loading.progress', - 'harbor.inline.help' + 'harbor.inline.help', + 'harbor.dismissable.alerts' ]); })(); \ No newline at end of file diff --git a/static/resources/js/layout/details/details.controller.js b/static/resources/js/layout/details/details.controller.js index 974ae16e3..c2d6c03c8 100644 --- a/static/resources/js/layout/details/details.controller.js +++ b/static/resources/js/layout/details/details.controller.js @@ -15,7 +15,6 @@ vm.isProjectMember = false; vm.togglePublicity = togglePublicity; - vm.target = 'repositories'; vm.sectionDefaultHeight = {'min-height': '579px'}; @@ -55,7 +54,7 @@ } }); - function togglePublicity(e) { + function togglePublicity(e) { vm.publicity = e.publicity; } } 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 b14060f44..efed44a9e 100644 --- a/static/resources/js/services/i18n/locale_messages_en-US.js +++ b/static/resources/js/services/i18n/locale_messages_en-US.js @@ -153,7 +153,9 @@ var locale_messages = { 'status': 'Status', 'logs' : 'Logs', 'enabled': 'Enabled', + 'enable': 'Enable', 'disabled': 'Disabled', + 'disable': 'Disable', 'no_replication_policies_add_new': 'No replication policies, add new replication policy.', 'no_replication_policies': 'No replication policies.', 'no_replication_jobs': 'No replication jobs.', @@ -205,6 +207,7 @@ var locale_messages = { 'finished': 'Finished', 'canceled': 'Canceled', 'stopped': 'Stopped', + 'retrying': 'Retrying', 'error': 'Error', 'failed_to_get_project_member': 'Failed to get current project member.', 'failed_to_delete_repo': 'Failed to delete repository. ', @@ -243,6 +246,7 @@ var locale_messages = { 'Developer: Developer has read and write privileges for a project.
' + 'Guest: Guest has read-only privilege for a specified project.', 'inline_help_publicity_title': 'Publicity of Project', - 'inline_help_publicity': 'Setting the project as public.' - + 'inline_help_publicity': 'Setting the project as public.', + 'alert_job_contains_error': 'There contain errors in current replication jobs results, please look into it.', + 'caution': 'Caution' }; \ 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 3d34db42a..57872fbc2 100644 --- a/static/resources/js/services/i18n/locale_messages_zh-CN.js +++ b/static/resources/js/services/i18n/locale_messages_zh-CN.js @@ -150,8 +150,10 @@ var locale_messages = { 'actions': '操作', 'status': '状态', 'logs': '日志', - 'enabled': '启用', - 'disabled': '停用', + 'enabled': '已启用', + 'enable': '启用', + 'disabled': '已停用', + 'disable': '停用', 'no_replication_policies_add_new': '没有复制策略,请新增复制策略。', 'no_replication_policies': '没有复制策略。', 'no_replications': '没有复制策略。', @@ -160,7 +162,6 @@ var locale_messages = { 'name_is_required': '名称为必填项', 'name_is_too_long': '名称长度超出限制。(最长为20个字符)', 'description_is_too_long': '描述内容长度超出限制。(最长为20个字符)', - 'enable': '启用', 'general_setting': '一般设置', 'destination_setting': '目标设置', 'endpoint': '终端URL', @@ -199,12 +200,13 @@ var locale_messages = { 'edit': '修改', 'delete': '删除', 'all': '全部', - 'transfer': '传输', - 'pending': '等待', + 'transfer': '复制', + 'pending': '等待中', 'running': '进行中', 'finished': '已完成', - 'canceled': '取消', - 'stopped': '停止', + 'canceled': '已取消', + 'stopped': '已终止', + 'retrying': '重试中', 'error': '错误', 'failed_to_get_project_member': '无法获取当前项目成员。', 'failed_to_delete_repo': '无法删除镜像仓库。', @@ -243,5 +245,7 @@ var locale_messages = { '开发人员: “开发人员” 拥有一个项目的读/写权限。
' + '来宾用户: “来宾用户”拥有特定项目的只读权限。', 'inline_help_publicity_title': '公开项目', - 'inline_help_publicity': '设置该项目为公开。' + 'inline_help_publicity': '设置该项目为公开。', + 'alert_job_contains_error': '当前复制任务中包含错误,请检查。', + 'caution': '注意' }; \ No newline at end of file diff --git a/views/repository.htm b/views/repository.htm index 7496d97e8..7aaa0291e 100644 --- a/views/repository.htm +++ b/views/repository.htm @@ -2,7 +2,7 @@
-
+
+
diff --git a/views/sections/header-include.htm b/views/sections/header-include.htm index 5f83064bf..a78d61c1b 100644 --- a/views/sections/header-include.htm +++ b/views/sections/header-include.htm @@ -240,4 +240,7 @@ - \ No newline at end of file + + + + \ No newline at end of file