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