mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
commit
0de88d6566
@ -4,7 +4,7 @@ function atSideNavItemLink (scope, element, attrs, ctrl) {
|
|||||||
[scope.navVm, scope.layoutVm] = ctrl;
|
[scope.navVm, scope.layoutVm] = ctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
function AtSideNavItemController ($state, $scope, strings) {
|
function AtSideNavItemController ($scope, strings) {
|
||||||
const vm = this || {};
|
const vm = this || {};
|
||||||
|
|
||||||
$scope.$watch('layoutVm.currentState', current => {
|
$scope.$watch('layoutVm.currentState', current => {
|
||||||
@ -21,10 +21,6 @@ function AtSideNavItemController ($state, $scope, strings) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
vm.go = () => {
|
|
||||||
$state.go($scope.route, {}, { reload: true });
|
|
||||||
};
|
|
||||||
|
|
||||||
vm.tooltip = {
|
vm.tooltip = {
|
||||||
popover: {
|
popover: {
|
||||||
text: strings.get(`layout.${$scope.name}`),
|
text: strings.get(`layout.${$scope.name}`),
|
||||||
@ -36,7 +32,7 @@ function AtSideNavItemController ($state, $scope, strings) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AtSideNavItemController.$inject = ['$state', '$scope', 'ComponentsStrings'];
|
AtSideNavItemController.$inject = ['$scope', 'ComponentsStrings'];
|
||||||
|
|
||||||
function atSideNavItem () {
|
function atSideNavItem () {
|
||||||
return {
|
return {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="at-Layout-sideNavItem" ng-click="vm.go()" ng-class="{'is-active': vm.isRoute}"
|
<a class="at-Layout-sideNavItem" ui-sref="{{ route }}" ng-class="{'is-active': vm.isRoute}"
|
||||||
ng-show="(!systemAdminOnly || layoutVm.isSuperUser) && layoutVm.isLoggedIn &&
|
ng-show="(!systemAdminOnly || layoutVm.isSuperUser) && layoutVm.isLoggedIn &&
|
||||||
!layoutVm.licenseIsMissing">
|
!layoutVm.licenseIsMissing">
|
||||||
<at-popover state="vm.tooltip" ng-if="!navVm.isExpanded"></at-popover>
|
<at-popover state="vm.tooltip" ng-if="!navVm.isExpanded"></at-popover>
|
||||||
@ -7,4 +7,4 @@
|
|||||||
<span class="at-Layout-sideNavItemName" ng-show="navVm.isExpanded">
|
<span class="at-Layout-sideNavItemName" ng-show="navVm.isExpanded">
|
||||||
{{ layoutVm.getString(name) }}
|
{{ layoutVm.getString(name) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</a>
|
||||||
|
@ -25,10 +25,8 @@ angular.module('credentialTypes', [
|
|||||||
function($stateProvider, stateDefinitionsProvider) {
|
function($stateProvider, stateDefinitionsProvider) {
|
||||||
let stateDefinitions = stateDefinitionsProvider.$get();
|
let stateDefinitions = stateDefinitionsProvider.$get();
|
||||||
|
|
||||||
$stateProvider.state({
|
function generateStateTree() {
|
||||||
name: 'credentialTypes.**',
|
let credentialTypesTree = stateDefinitions.generateTree({
|
||||||
url: '/credential_type',
|
|
||||||
lazyLoad: () => stateDefinitions.generateTree({
|
|
||||||
parent: 'credentialTypes',
|
parent: 'credentialTypes',
|
||||||
modes: ['add', 'edit'],
|
modes: ['add', 'edit'],
|
||||||
list: 'CredentialTypesList',
|
list: 'CredentialTypesList',
|
||||||
@ -45,7 +43,22 @@ angular.module('credentialTypes', [
|
|||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
label: N_('CREDENTIAL TYPES')
|
label: N_('CREDENTIAL TYPES')
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
return Promise.all([
|
||||||
|
credentialTypesTree
|
||||||
|
]).then((generated) => {
|
||||||
|
return {
|
||||||
|
states: _.reduce(generated, (result, definition) => {
|
||||||
|
return result.concat(definition.states);
|
||||||
|
}, [])
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
let stateTree = {
|
||||||
|
name: 'credentialTypes.**',
|
||||||
|
url: '/credential_types',
|
||||||
|
lazyLoad: () => generateStateTree()
|
||||||
|
};
|
||||||
|
$stateProvider.state(stateTree);
|
||||||
|
}
|
||||||
]);
|
]);
|
||||||
|
@ -25,10 +25,8 @@ angular.module('inventoryScripts', [
|
|||||||
function($stateProvider, stateDefinitionsProvider) {
|
function($stateProvider, stateDefinitionsProvider) {
|
||||||
let stateDefinitions = stateDefinitionsProvider.$get();
|
let stateDefinitions = stateDefinitionsProvider.$get();
|
||||||
|
|
||||||
$stateProvider.state({
|
function generateStateTree() {
|
||||||
name: 'inventoryScripts.**',
|
let inventoryScriptTree = stateDefinitions.generateTree({
|
||||||
url: '/inventory_script',
|
|
||||||
lazyLoad: () => stateDefinitions.generateTree({
|
|
||||||
parent: 'inventoryScripts',
|
parent: 'inventoryScripts',
|
||||||
modes: ['add', 'edit'],
|
modes: ['add', 'edit'],
|
||||||
list: 'InventoryScriptsList',
|
list: 'InventoryScriptsList',
|
||||||
@ -66,7 +64,23 @@ angular.module('inventoryScripts', [
|
|||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
label: N_('INVENTORY SCRIPTS')
|
label: N_('INVENTORY SCRIPTS')
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
|
return Promise.all([
|
||||||
|
inventoryScriptTree
|
||||||
|
]).then((generated) => {
|
||||||
|
return {
|
||||||
|
states: _.reduce(generated, (result, definition) => {
|
||||||
|
return result.concat(definition.states);
|
||||||
|
}, [])
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
let stateTree = {
|
||||||
|
name: 'inventoryScripts.**',
|
||||||
|
url: '/inventory_scripts',
|
||||||
|
lazyLoad: () => generateStateTree()
|
||||||
|
};
|
||||||
|
$stateProvider.state(stateTree);
|
||||||
|
}
|
||||||
]);
|
]);
|
||||||
|
@ -44,13 +44,6 @@ describe('Components | Side Nav Item', () => {
|
|||||||
expect(SideNavItemCtrl.isRoute).toBe(false);
|
expect(SideNavItemCtrl.isRoute).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('go() should call $state.go()', angular.mock.inject((_$state_) => {
|
|
||||||
spyOn(_$state_, 'go');
|
|
||||||
SideNavItemCtrl.go();
|
|
||||||
expect(_$state_.go).toHaveBeenCalled();
|
|
||||||
expect(_$state_.go).toHaveBeenCalledWith('dashboard', jasmine.any(Object), jasmine.any(Object));
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should load name, icon, and route from scope', () => {
|
it('should load name, icon, and route from scope', () => {
|
||||||
expect(SideNavItem.isolateScope().name).toBeDefined();
|
expect(SideNavItem.isolateScope().name).toBeDefined();
|
||||||
expect(SideNavItem.isolateScope().iconClass).toBeDefined();
|
expect(SideNavItem.isolateScope().iconClass).toBeDefined();
|
||||||
|
Loading…
Reference in New Issue
Block a user