diff --git a/static/i18n/locale_zh-CN.ini b/static/i18n/locale_zh-CN.ini index 7bd9a96..e48394a 100644 --- a/static/i18n/locale_zh-CN.ini +++ b/static/i18n/locale_zh-CN.ini @@ -2,7 +2,7 @@ reset_email_hint = 请点击下面的链接进行重置密码操作 reset_email_subject = 重置您的密码 page_title_index = Harbor -page_title_dashboard = 消息中心 - Harbor +page_title_dashboard = 控制面板 - Harbor page_title_account_setting = 个人设置 - Harbor page_title_reset_password = 重置密码 - Harbor page_title_change_password = 修改密码 - Harbor diff --git a/static/resources/css/header.css b/static/resources/css/header.css index 50c94da..ffad4be 100644 --- a/static/resources/css/header.css +++ b/static/resources/css/header.css @@ -25,14 +25,14 @@ nav .container-custom { } .navbar-form { - margin-top: 0; - padding-right: 0; + margin-top: 0; + padding-right: 0; } .search-icon { - background: url("/static/resources/img/magnitude-glass.jpg") no-repeat 97% 6px; - background-size: 1.5em; - background-color: #FFFFFF; + background: url("/static/resources/img/magnitude-glass.jpg") no-repeat 97% 6px; + background-size: 1.5em; + background-color: #FFFFFF; } .nav-custom li { @@ -67,49 +67,61 @@ nav .container-custom { } .dropdown-submenu { - position: relative; + position: relative; } .dropdown-submenu>.dropdown-menu { - top: 0; - left: 100%; - margin-top: -6px; - margin-left: -1px; - -webkit-border-radius: 0 6px 6px 6px; - -moz-border-radius: 0 6px 6px; - border-radius: 0 6px 6px 6px; + top: 0; + left: 100%; + margin-top: -6px; + margin-left: -1px; + -webkit-border-radius: 0 6px 6px 6px; + -moz-border-radius: 0 6px 6px; + border-radius: 0 6px 6px 6px; } .dropdown-submenu:hover>.dropdown-menu { - display: block; + display: block; } .dropdown-submenu>a:after { - display: block; - content: " "; - float: right; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; - border-width: 5px 0 5px 5px; - border-left-color: #ccc; - margin-top: 5px; - margin-right: -10px; + display: block; + content: " "; + float: right; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 5px 0 5px 5px; + border-left-color: #ccc; + margin-top: 5px; + margin-right: -10px; } .dropdown-submenu:hover>a:after { - border-left-color: #fff; + border-left-color: #fff; } .dropdown-submenu.pull-left { - float: none; + float: none; } .dropdown-submenu.pull-left>.dropdown-menu { - left: -100%; - margin-left: 10px; - -webkit-border-radius: 6px 0 6px 6px; - -moz-border-radius: 6px 0 6px 6px; - border-radius: 6px 0 6px 6px; -} \ No newline at end of file + left: -100%; + margin-left: 10px; + -webkit-border-radius: 6px 0 6px 6px; + -moz-border-radius: 6px 0 6px 6px; + border-radius: 6px 0 6px 6px; +} + +.loading-progress { + display: inline-block; + position: relative; + background-image: url('/static/resources/img/loading.gif'); + background-position: center; + background-size: 107px; + width: 1em; + height: 1.2em; + margin-bottom: 2px; + vertical-align: middle; +} \ No newline at end of file diff --git a/static/resources/js/components/loading-progress/loading-progress.directive.js b/static/resources/js/components/loading-progress/loading-progress.directive.js index 934ad1b..dd52c1a 100644 --- a/static/resources/js/components/loading-progress/loading-progress.directive.js +++ b/static/resources/js/components/loading-progress/loading-progress.directive.js @@ -11,7 +11,7 @@ 'restrict': 'EA', 'scope': { 'toggleInProgress': '=', - 'hideTarget': '=' + 'hideTarget': '@' }, 'link': link }; @@ -19,29 +19,33 @@ return directive; function link(scope, element, attrs) { - var spinner = $('
') - .css({'display': 'inline-block'}) - .css({'position': 'relative'}) - .css({'background-image': 'url(/static/resources/img/loading.gif)'}) - .css({'background-position': 'center'}) - .css({'background-size': '107px'}) - .css({'width': '1.2em'}) - .css({'height': '1.2em'}) - .css({'margin': '0 0 1px 8px'}) - .css({'vertical-align': 'middle'}); + var spinner = $(''); + + function convertToBoolean(val) { + return val === 'true' ? true : false; + } + var hideTarget = convertToBoolean(scope.hideTarget); + + console.log('loading-progress, toggleInProgress:' + scope.toggleInProgress + ', hideTarget:' + hideTarget); + + var pristine = element.html(); + scope.$watch('toggleInProgress', function(current) { if(scope.toggleInProgress) { - element.append(spinner); element.attr('disabled', 'disabled'); - if(scope.hideTarget) { + if(hideTarget) { + element.html(spinner); + }else{ + spinner = spinner.css({'margin-left': '5px'}); element.append(spinner); - element.hide(); } }else{ - scope.hideTarget = false; - element.show(); - element.find('div').remove(); + if(hideTarget) { + element.html(pristine); + }else{ + element.find('.loading-progress').remove(); + } element.removeAttr('disabled'); } }); diff --git a/static/resources/js/components/replication/create-policy.directive.html b/static/resources/js/components/replication/create-policy.directive.html index 6b06458..c3c4fe3 100644 --- a/static/resources/js/components/replication/create-policy.directive.html +++ b/static/resources/js/components/replication/create-policy.directive.html @@ -85,7 +85,7 @@
- +
@@ -97,7 +97,7 @@
diff --git a/static/resources/js/components/replication/create-policy.directive.js b/static/resources/js/components/replication/create-policy.directive.js index 10db764..1506182 100644 --- a/static/resources/js/components/replication/create-policy.directive.js +++ b/static/resources/js/components/replication/create-policy.directive.js @@ -42,8 +42,8 @@ vm.pingAvailable = true; vm.pingMessage = ''; - vm.toggleInProgress0 = false; - vm.toggleInProgress1 = false; + vm.pingTIP = false; + vm.saveTIP = false; vm.closeError = closeError; vm.toggleErrorMessage = false; @@ -149,7 +149,7 @@ } function saveOrUpdatePolicy() { - vm.toggleInProgress1 = true; + vm.saveTIP = true; switch(vm.action) { case 'ADD_NEW': @@ -163,7 +163,7 @@ .error(updateReplicationPolicyFailed); break; default: - vm.toggleInProgress = false; + vm.saveTIP = false; } } @@ -189,7 +189,7 @@ vm.pingAvailable = false; vm.pingMessage = $filter('tr')('pinging_target'); - vm.toggleInProgress0 = true; + vm.pingTIP = true; PingDestinationService(target) .success(pingDestinationSuccess) @@ -257,12 +257,12 @@ console.log('Failed list replication policy:' + data); } function createReplicationPolicySuccess(data, status) { - vm.toggleInProgress1 = false; + vm.saveTIP = false; console.log('Successful create replication policy.'); vm.reload(); } function createReplicationPolicyFailed(data, status) { - vm.toggleInProgress1 = false; + vm.saveTIP = false; if(status === 409) { vm.errorMessages.push($filter('tr')('policy_already_exists')); }else{ @@ -271,12 +271,12 @@ console.log('Failed create replication policy.'); } function updateReplicationPolicySuccess(data, status) { - vm.toggleInProgress1 = false; console.log('Successful update replication policy.'); vm.reload(); + vm.saveTIP = false; } function updateReplicationPolicyFailed(data, status) { - vm.toggleInProgress1 = false; + vm.saveTIP = false; if(status === 409) { vm.errorMessages.push($filter('tr')('policy_already_exists')); }else{ @@ -307,12 +307,12 @@ function pingDestinationSuccess(data, status) { vm.pingAvailable = true; vm.pingMessage = $filter('tr')('successful_ping_target', []); - vm.toggleInProgress0 = false; + vm.pingTIP = false; } function pingDestinationFailed(data, status) { vm.pingAvailable = true; vm.pingMessage = $filter('tr')('failed_ping_target', []) + (data && data.length > 0 ? ':' + data : '.'); - vm.toggleInProgress0 = false; + vm.pingTIP = false; } } diff --git a/static/resources/js/components/replication/list-replication.directive.html b/static/resources/js/components/replication/list-replication.directive.html index 89359da..f748c88 100644 --- a/static/resources/js/components/replication/list-replication.directive.html +++ b/static/resources/js/components/replication/list-replication.directive.html @@ -63,7 +63,7 @@
- +
@@ -91,7 +91,7 @@
- +
diff --git a/static/resources/js/components/replication/list-replication.directive.js b/static/resources/js/components/replication/list-replication.directive.js index f606968..aef9935 100644 --- a/static/resources/js/components/replication/list-replication.directive.js +++ b/static/resources/js/components/replication/list-replication.directive.js @@ -39,6 +39,7 @@ vm.searchReplicationPolicy = searchReplicationPolicy; vm.searchReplicationJob = searchReplicationJob; + vm.refreshReplicationJob = refreshReplicationJob; vm.retrievePolicy = retrievePolicy; vm.retrieveJob = retrieveJob; @@ -56,15 +57,26 @@ vm.pickUp = pickUp; + vm.searchJobTIP = false; + vm.refreshJobTIP = false; + function searchReplicationPolicy() { vm.retrievePolicy(); } function searchReplicationJob() { if(vm.lastPolicyId !== -1) { + vm.searchJobTIP = true; vm.retrieveJob(vm.lastPolicyId); } } + + function refreshReplicationJob() { + if(vm.lastPolicyId !== -1) { + vm.refreshJobTIP = true; + vm.retrieveJob(vm.lastPolicyId); + } + } function retrievePolicy() { ListReplicationPolicyService('', vm.projectId, vm.replicationPolicyName) @@ -102,11 +114,14 @@ } } }); + vm.searchJobTIP = false; + vm.refreshJobTIP = false; } function listReplicationJobFailed(data, status) { console.log('Failed list replication job:' + data); - vm.refreshPending = false; + vm.searchJobTIP = false; + vm.refreshJobTIP = false; } function addReplication() { diff --git a/static/resources/js/components/sign-in/sign-in.directive.js b/static/resources/js/components/sign-in/sign-in.directive.js index e1f63ff..0e75d11 100644 --- a/static/resources/js/components/sign-in/sign-in.directive.js +++ b/static/resources/js/components/sign-in/sign-in.directive.js @@ -21,6 +21,8 @@ vm.doContinue = doContinue; vm.doLogOut = doLogOut; + vm.signInTIP = false; + function reset() { vm.hasError = false; vm.errorMessage = ''; @@ -28,6 +30,7 @@ function doSignIn(user) { if(user && angular.isDefined(user.principal) && angular.isDefined(user.password)) { + vm.signInTIP = true; SignInService(user.principal, user.password) .success(signedInSuccess) .error(signedInFailed); @@ -39,6 +42,7 @@ } function signedInFailed(data, status) { + vm.signInTIP = false; if(status === 401) { vm.hasError = true; vm.errorMessage = 'username_or_password_is_incorrect'; 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 e4b82d3..a5f1f50 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 @@
- +
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 eefb0a1..d646db5 100644 --- a/static/resources/js/components/system-management/create-destination.directive.js +++ b/static/resources/js/components/system-management/create-destination.directive.js @@ -29,6 +29,8 @@ vm.toggleErrorMessage = false; vm.errorMessages = []; + vm.pingTIP = false; + $scope.$watch('destination.endpoint', function(current) { if(current) { vm.notAvailable = false; @@ -124,6 +126,8 @@ } function pingDestination() { + + vm.pingTIP = true; vm.pingAvailable = false; var target = { @@ -143,10 +147,12 @@ function pingDestinationSuccess(data, status) { vm.pingAvailable = true; + vm.pingTIP = false; vm.pingMessage = $filter('tr')('successful_ping_target', []); } function pingDestinationFailed(data, status) { - vm.pingAvailable = true; + + vm.pingTIP = false; vm.pingMessage = $filter('tr')('failed_ping_target', []) + (data && data.length > 0 ? ':' + data : '.'); } } 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 a70f386..3d5d020 100644 --- a/static/resources/js/services/i18n/locale_messages_zh-CN.js +++ b/static/resources/js/services/i18n/locale_messages_zh-CN.js @@ -90,7 +90,7 @@ var locale_messages = { 'from': '起始', 'to': '结束', 'timestamp': '时间戳', - 'dashboard': '消息中心', + 'dashboard': '控制面板', 'admin_options': '管理员选项', 'account_setting': '个人设置', 'log_out': '注销', diff --git a/static/vendors/spinner/spinner.min.js b/static/vendors/spinner/spinner.min.js deleted file mode 100644 index bd3ae4f..0000000 --- a/static/vendors/spinner/spinner.min.js +++ /dev/null @@ -1,2 +0,0 @@ -// http://spin.js.org/#v2.3.2 -!function(a,b){"object"==typeof module&&module.exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return m[e]||(k.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",k.cssRules.length),m[e]=1),e}function d(a,b){var c,d,e=a.style;if(b=b.charAt(0).toUpperCase()+b.slice(1),void 0!==e[b])return b;for(d=0;d',c)}k.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:k+" "+k,coordorigin:-j+" "+-j}),{width:k,height:k})}function h(a,h,i){b(m,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~h}),b(e(c("roundrect",{arcsize:d.corners}),{width:j,height:d.scale*d.width,left:d.scale*d.radius,top:-d.scale*d.width>>1,filter:i}),c("fill",{color:g(d.color,a),opacity:d.opacity}),c("stroke",{opacity:0}))))}var i,j=d.scale*(d.length+d.width),k=2*d.scale*j,l=-(d.width+d.length)*d.scale*2+"px",m=e(f(),{position:"absolute",top:l,left:l});if(d.shadow)for(i=1;i<=d.lines;i++)h(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(i=1;i<=d.lines;i++)h(i);return b(a,m)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d>1)+"px"})}for(var i,k=0,l=(f.lines-1)*(1-f.direction)/2;k - - diff --git a/views/sign-in.htm b/views/sign-in.htm index 1721345..6ac8b0a 100644 --- a/views/sign-in.htm +++ b/views/sign-in.htm @@ -31,7 +31,7 @@
- + {{ if eq .AuthMode "db_auth" }} {{ end }}