mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
function AtLayoutController ($scope, strings) {
|
|
let vm = this || {};
|
|
|
|
$scope.$on('$stateChangeSuccess', function(event, next) {
|
|
vm.currentState = next.name;
|
|
});
|
|
|
|
$scope.$watch('$root.current_user', function(val) {
|
|
vm.isLoggedIn = val && val.username;
|
|
if (val) {
|
|
vm.isSuperUser = $scope.$root.user_is_superuser || $scope.$root.user_is_system_auditor;
|
|
vm.currentUsername = val.username;
|
|
vm.currentUserId = val.id;
|
|
}
|
|
});
|
|
|
|
$scope.$watch('$root.socketStatus', function(newStatus) {
|
|
vm.socketState = newStatus;
|
|
vm.socketIconClass = "icon-socket-" + $scope.socketStatus;
|
|
});
|
|
|
|
$scope.$watch('$root.licenseMissing', function(licenseMissing) {
|
|
vm.licenseIsMissing = licenseMissing;
|
|
});
|
|
|
|
vm.getString = function(string) {
|
|
try {
|
|
return strings.get(`layout.${string}`);
|
|
} catch(err) {
|
|
return strings.get(string);
|
|
}
|
|
};
|
|
}
|
|
|
|
AtLayoutController.$inject = ['$scope', 'ComponentsStrings'];
|
|
|
|
function atLayout (pathService) {
|
|
return {
|
|
restrict: 'E',
|
|
replace: true,
|
|
transclude: true,
|
|
templateUrl: pathService.getPartialPath('components/layout/layout'),
|
|
controller: AtLayoutController,
|
|
controllerAs: 'vm',
|
|
scope: {
|
|
}
|
|
};
|
|
}
|
|
|
|
atLayout.$inject = ['PathService'];
|
|
|
|
export default atLayout;
|