mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-02 23:23:45 +01:00
33 lines
845 B
JavaScript
33 lines
845 B
JavaScript
(function() {
|
|
|
|
'use strict';
|
|
|
|
angular
|
|
.module('harbor.layout.header')
|
|
.controller('HeaderController', HeaderController);
|
|
|
|
HeaderController.$inject = ['$scope', '$window', 'getParameterByName', '$location', 'currentUser'];
|
|
|
|
function HeaderController($scope, $window, getParameterByName, $location, currentUser) {
|
|
var vm = this;
|
|
vm.user = currentUser.get();
|
|
|
|
if(location.pathname === '/dashboard') {
|
|
vm.defaultUrl = '/dashboard';
|
|
}else{
|
|
vm.defaultUrl = '/';
|
|
}
|
|
|
|
$scope.$watch('vm.user', function(current) {
|
|
if(current) {
|
|
vm.defaultUrl = '/dashboard';
|
|
}
|
|
});
|
|
|
|
if($window.location.search) {
|
|
vm.searchInput = getParameterByName('q', $window.location.search);
|
|
console.log('vm.searchInput at header:' + vm.searchInput);
|
|
}
|
|
}
|
|
|
|
})(); |