mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 12:15:20 +01:00
Merge pull request #767 from wknet123/dev
Add about menu item to show version info.
This commit is contained in:
commit
4a9c3529bc
@ -113,6 +113,8 @@ func (b *BaseController) Prepare() {
|
||||
b.SelfRegistration = true
|
||||
}
|
||||
b.Data["SelfRegistration"] = b.SelfRegistration
|
||||
|
||||
b.Data["Version"] = os.Getenv("VERSION")
|
||||
}
|
||||
|
||||
// Forward to setup layout and template for content for a page.
|
||||
|
@ -20,9 +20,9 @@
|
||||
.module('harbor.optional.menu')
|
||||
.directive('optionalMenu', optionalMenu);
|
||||
|
||||
OptionalMenuController.$inject = ['$window', 'I18nService', 'LogOutService', 'currentUser', '$timeout'];
|
||||
OptionalMenuController.$inject = ['$scope', '$window', 'I18nService', 'LogOutService', 'currentUser', '$timeout', 'trFilter', '$filter'];
|
||||
|
||||
function OptionalMenuController($window, I18nService, LogOutService, currentUser, $timeout) {
|
||||
function OptionalMenuController($scope, $window, I18nService, LogOutService, currentUser, $timeoutm, trFilter, $filter) {
|
||||
var vm = this;
|
||||
|
||||
vm.currentLanguage = I18nService().getCurrentLanguage();
|
||||
@ -36,6 +36,7 @@
|
||||
vm.user = currentUser.get();
|
||||
vm.setLanguage = setLanguage;
|
||||
vm.logOut = logOut;
|
||||
vm.about = about;
|
||||
|
||||
function setLanguage(language) {
|
||||
I18nService().setCurrentLanguage(language);
|
||||
@ -54,13 +55,25 @@
|
||||
function logOutFailed(data, status) {
|
||||
console.log('Failed to log out:' + data);
|
||||
}
|
||||
function about() {
|
||||
$scope.$emit('modalTitle', $filter('tr')('about_harbor'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('current_version', [vm.version]));
|
||||
var raiseInfo = {
|
||||
'confirmOnly': true,
|
||||
'contentType': 'text/html',
|
||||
'action': function() {}
|
||||
};
|
||||
$scope.$emit('raiseInfo', raiseInfo);
|
||||
}
|
||||
}
|
||||
|
||||
function optionalMenu() {
|
||||
var directive = {
|
||||
'restrict': 'E',
|
||||
'templateUrl': '/optional_menu?timestamp=' + new Date().getTime(),
|
||||
'scope': true,
|
||||
'scope': {
|
||||
'version': '@'
|
||||
},
|
||||
'controller': OptionalMenuController,
|
||||
'controllerAs': 'vm',
|
||||
'bindToController': true
|
||||
|
@ -76,6 +76,7 @@
|
||||
|
||||
function togglePublicity(e) {
|
||||
vm.publicity = e.publicity;
|
||||
vm.target = 'repositories';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,40 @@
|
||||
vm.searchInput = getParameterByName('q', $window.location.search);
|
||||
console.log('vm.searchInput at header:' + vm.searchInput);
|
||||
}
|
||||
|
||||
$scope.$on('modalTitle', function(e, val) {
|
||||
vm.modalTitle = val;
|
||||
});
|
||||
|
||||
$scope.$on('modalMessage', function(e, val) {
|
||||
vm.modalMessage = val;
|
||||
});
|
||||
|
||||
$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);
|
||||
}
|
||||
});
|
||||
|
||||
$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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
@ -226,6 +226,9 @@ var locale_messages = {
|
||||
'stopped': 'Stopped',
|
||||
'retrying': 'Retrying',
|
||||
'error': 'Error',
|
||||
'about': 'About',
|
||||
'about_harbor': 'About Harbor',
|
||||
'current_version': '<label>Version</label> <span>$0</span>',
|
||||
'failed_to_get_project_member': 'Failed to get current project member.',
|
||||
'failed_to_delete_repo': 'Failed to delete repository. ',
|
||||
'failed_to_delete_repo_insuffient_permissions': 'Failed to delete repository, insuffient permissions.',
|
||||
|
@ -226,6 +226,9 @@ var locale_messages = {
|
||||
'stopped': '已终止',
|
||||
'retrying': '重试中',
|
||||
'error': '错误',
|
||||
'about': '关于',
|
||||
'about_harbor': '关于 Harbor',
|
||||
'current_version': '<label>当前版本</label> <span>$0</span>',
|
||||
'failed_to_get_project_member': '无法获取当前项目成员。',
|
||||
'failed_to_delete_repo': '无法删除镜像仓库。',
|
||||
'failed_to_delete_repo_insuffient_permissions': '无法删除镜像仓库,权限不足。',
|
||||
|
@ -19,23 +19,24 @@
|
||||
</a>
|
||||
<ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
|
||||
{{ if eq .AddNew true }}
|
||||
<li><a href="/add_new"><span class="glyphicon glyphicon-plus"></span> // 'add_new_title' | tr //</a></li>
|
||||
<li><a href="/add_new"><span class="glyphicon glyphicon-plus"></span> // 'add_new_title' | tr //</a></li>
|
||||
{{ end }}
|
||||
<li><a href="/account_setting"><span class="glyphicon glyphicon-pencil"></span> // 'account_setting' | tr //</a></li>
|
||||
<li><a href="/account_setting"><span class="glyphicon glyphicon-pencil"></span> // 'account_setting' | tr //</a></li>
|
||||
<li class="dropdown-submenu">
|
||||
<a tabindex="-1" href="#"><span class="glyphicon glyphicon-globe"></span> //vm.languageName//</a>
|
||||
<a tabindex="-1" href="#"><span class="glyphicon glyphicon-globe"></span> //vm.languageName//</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li ng-repeat="(key, value) in vm.supportLanguages"><a href="javascript:void(0);" ng-click="vm.setLanguage(key)">// value //</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="javascript:void(0)" ng-click="vm.about()"><span class="glyphicon glyphicon-info-sign"></span> // 'about' | tr //</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="javascript:void(0)" ng-click="vm.logOut()"><span class="glyphicon glyphicon-log-out"></span> // 'log_out' | tr //</a></li>
|
||||
<li><a href="javascript:void(0)" ng-click="vm.logOut()"><span class="glyphicon glyphicon-log-out"></span> // 'log_out' | tr //</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="dropdown">
|
||||
<a role="button" data-toggle="dropdown" class="btn btn-link" data-target="#" href="">
|
||||
<span class="glyphicon glyphicon-globe"></span> //vm.languageName//
|
||||
<span class="glyphicon glyphicon-globe"></span> //vm.languageName//
|
||||
</a>
|
||||
<ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
|
||||
<li ng-repeat="(key, value) in vm.supportLanguages"><a href="javascript:void(0);" ng-click="vm.setLanguage(key)">// value //</a></li>
|
||||
|
@ -13,6 +13,7 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<nav class="navbar navbar-default navbar-custom" ng-controller="HeaderController as vm">
|
||||
<modal-dialog modal-title="// vm.modalTitle //" modal-message="// vm.modalMessage //" confirm-only="vm.confirmOnly" action="vm.action()" content-type="// vm.contentType //"></modal-dialog>
|
||||
<div class="container container-custom">
|
||||
<!-- Brand and toggle get grouped for better mobile display -->
|
||||
<div class="navbar-header">
|
||||
@ -24,7 +25,7 @@
|
||||
</div>
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-harbor-navbar-collapse-1">
|
||||
<optional-menu login-status="//vm.loginStatus//"></optional-menu>
|
||||
<optional-menu version="{{.Version}}" login-status="//vm.loginStatus//"></optional-menu>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<navigation-header></navigation-header>
|
||||
|
Loading…
Reference in New Issue
Block a user