diff --git a/awx/ui/client/src/inventories/adhoc/adhoc.controller.js b/awx/ui/client/src/inventories/adhoc/adhoc.controller.js index 4b8e25c051..fcff3cb3a1 100644 --- a/awx/ui/client/src/inventories/adhoc/adhoc.controller.js +++ b/awx/ui/client/src/inventories/adhoc/adhoc.controller.js @@ -169,7 +169,7 @@ function adhocController($q, $scope, $stateParams, ParseTypeChange({ scope: $scope, field_id: 'adhoc_extra_vars' , variable: "extra_vars"}); $scope.formCancel = function(){ - $state.go('inventoryManage'); + $state.go('^'); }; // remove all data input into the form and reset the form back to defaults diff --git a/awx/ui/client/src/inventories/groups/add/groups-add.controller.js b/awx/ui/client/src/inventories/groups/add/groups-add.controller.js index 7b995e7f6a..2afb50be49 100644 --- a/awx/ui/client/src/inventories/groups/add/groups-add.controller.js +++ b/awx/ui/client/src/inventories/groups/add/groups-add.controller.js @@ -53,7 +53,7 @@ export default ['$state', '$stateParams', '$scope', 'GroupForm', return GroupManageService.associateGroup(res.data, _.last($stateParams.group)) .then(() => $state.go('^', null, { reload: true })); } else { - $state.go('inventoryManage.editGroup', { group_id: res.data.group }, { reload: true }); + $state.go('^.edit', { group_id: res.data.id }, { reload: true }); } }); diff --git a/awx/ui/client/src/inventories/groups/groups.list.js b/awx/ui/client/src/inventories/groups/groups.list.js index 76c847c01b..bbf1280824 100644 --- a/awx/ui/client/src/inventories/groups/groups.list.js +++ b/awx/ui/client/src/inventories/groups/groups.list.js @@ -50,8 +50,9 @@ export default { mode: 'all', ngDisabled: '!groupsSelected', ngClick: 'setAdhocPattern()', - awToolTip: "Select an inventory source by clicking the check box beside it. The inventory source can be a single group or host, a selection of multiple hosts, or a selection of multiple groups.", + awToolTip: "Select an inventory source by clicking the check box beside it. The inventory source can be a single group or a selection of multiple groups.", dataTipWatch: "adhocCommandTooltip", + dataPlacement: 'top', actionClass: 'btn List-buttonDefault', buttonContent: 'RUN COMMANDS', showTipWhenDisabled: true, diff --git a/awx/ui/client/src/inventories/groups/list/groups-list.controller.js b/awx/ui/client/src/inventories/groups/list/groups-list.controller.js index 003e9ef65c..ba36eb6d7a 100644 --- a/awx/ui/client/src/inventories/groups/list/groups-list.controller.js +++ b/awx/ui/client/src/inventories/groups/list/groups-list.controller.js @@ -35,7 +35,7 @@ // https://github.com/ncuillery/angular-breadcrumb/issues/42 for a little more information on the // problem that this solves. $scope.ncyBreadcrumbIgnore = true; - if($state.current.name === "inventoryManage.editGroup") { + if($state.current.name === "inventories.edit.groups") { $scope.rowBeingEdited = $state.params.group_id; $scope.listBeingEdited = "groups"; } @@ -79,18 +79,6 @@ {hosts_status_class: hosts_status.class}); } - $scope.groupSelect = function(id){ - var group = $stateParams.group === undefined ? [id] : _($stateParams.group).concat(id).value(); - $state.go('inventoryManage', { - inventory_id: $stateParams.inventory_id, - group: group, - group_search: { - page_size: '20', - page: '1', - order_by: 'name', - } - }, {reload: true}); - }; $scope.createGroup = function(){ $state.go('inventories.edit.groups.add'); }; @@ -116,7 +104,7 @@ // Remove the event handler so that we don't end up with multiple bindings $('#group-delete-modal').off('hidden.bs.modal'); // Reload the inventory manage page and show that the group has been removed - $state.go('inventoryManage', null, {reload: true}); + $state.go('.', null, {reload: true}); }); switch($scope.deleteOption){ @@ -124,7 +112,7 @@ GroupManageService.promote($scope.toDelete.id, $stateParams.inventory_id) .then(() => { if (parseInt($state.params.group_id) === $scope.toDelete.id) { - $state.go("inventoryManage", null, {reload: true}); + $state.go("^", null, {reload: true}); } else { $state.go($state.current, null, {reload: true}); } @@ -136,7 +124,7 @@ default: GroupManageService.delete($scope.toDelete.id).then(() => { if (parseInt($state.params.group_id) === $scope.toDelete.id) { - $state.go("inventoryManage", null, {reload: true}); + $state.go("^", null, {reload: true}); } else { $state.go($state.current, null, {reload: true}); } @@ -202,22 +190,15 @@ }); }; $scope.showFailedHosts = function() { - $state.go('inventoryManage', {failed: true}, {reload: true}); - }; - $scope.scheduleGroup = function(id) { - // Add this group's id to the array of group id's so that it gets - // added to the breadcrumb trail - var groupsArr = $stateParams.group ? $stateParams.group : []; - groupsArr.push(id); - $state.go('inventoryManage.editGroup.schedules', {group_id: id, group: groupsArr}, {reload: true}); + // TODO: implement }; $scope.copyMoveGroup = function(id){ - $state.go('inventoryManage.copyMoveGroup', {group_id: id, groups: $stateParams.groups}); + // TODO: implement }; var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) { - if (toState.name === "inventoryManage.editGroup") { + if (toState.name === "inventories.edit.groups.edit") { $scope.rowBeingEdited = toParams.group_id; $scope.listBeingEdited = "groups"; } diff --git a/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-list.controller.js b/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-list.controller.js index 7f7425ee84..541c517b15 100644 --- a/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-list.controller.js +++ b/awx/ui/client/src/inventories/groups/nested-groups/nested-groups-list.controller.js @@ -35,7 +35,7 @@ // https://github.com/ncuillery/angular-breadcrumb/issues/42 for a little more information on the // problem that this solves. $scope.ncyBreadcrumbIgnore = true; - if($state.current.name === "inventoryManage.editGroup") { + if($state.current.name === "inventories.edit.groups.edit.nested_groups.edit") { $scope.rowBeingEdited = $state.params.group_id; $scope.listBeingEdited = "groups"; } @@ -63,18 +63,6 @@ {hosts_status_class: hosts_status.class}); } - $scope.groupSelect = function(id){ - var group = $stateParams.group === undefined ? [id] : _($stateParams.group).concat(id).value(); - $state.go('inventoryManage', { - inventory_id: $stateParams.inventory_id, - group: group, - group_search: { - page_size: '20', - page: '1', - order_by: 'name', - } - }, {reload: true}); - }; $scope.createGroup = function(){ $state.go('inventories.edit.groups.add'); }; @@ -100,7 +88,7 @@ // Remove the event handler so that we don't end up with multiple bindings $('#group-delete-modal').off('hidden.bs.modal'); // Reload the inventory manage page and show that the group has been removed - $state.go('inventoryManage', null, {reload: true}); + $state.go('.', null, {reload: true}); }); switch($scope.deleteOption){ @@ -108,7 +96,7 @@ GroupManageService.promote($scope.toDelete.id, $stateParams.inventory_id) .then(() => { if (parseInt($state.params.group_id) === $scope.toDelete.id) { - $state.go("inventoryManage", null, {reload: true}); + $state.go("^", null, {reload: true}); } else { $state.go($state.current, null, {reload: true}); } @@ -120,7 +108,7 @@ default: GroupManageService.delete($scope.toDelete.id).then(() => { if (parseInt($state.params.group_id) === $scope.toDelete.id) { - $state.go("inventoryManage", null, {reload: true}); + $state.go("^", null, {reload: true}); } else { $state.go($state.current, null, {reload: true}); } @@ -186,14 +174,7 @@ }); }; $scope.showFailedHosts = function() { - $state.go('inventoryManage', {failed: true}, {reload: true}); - }; - $scope.scheduleGroup = function(id) { - // Add this group's id to the array of group id's so that it gets - // added to the breadcrumb trail - var groupsArr = $stateParams.group ? $stateParams.group : []; - groupsArr.push(id); - $state.go('inventoryManage.editGroup.schedules', {group_id: id, group: groupsArr}, {reload: true}); + // TODO: implement }; // $scope.$parent governed by InventoryManageController, for unified multiSelect options $scope.$on('multiSelectList.selectionChanged', (event, selection) => { @@ -202,11 +183,11 @@ }); $scope.copyMoveGroup = function(id){ - $state.go('inventoryManage.copyMoveGroup', {group_id: id, groups: $stateParams.groups}); + // TODO: implement }; var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) { - if (toState.name === "inventoryManage.editGroup") { + if (toState.name === "inventories.edit.groups.edit.nested_groups.edit") { $scope.rowBeingEdited = toParams.group_id; $scope.listBeingEdited = "groups"; } diff --git a/awx/ui/client/src/inventories/hosts/add/host-add.controller.js b/awx/ui/client/src/inventories/hosts/add/host-add.controller.js deleted file mode 100644 index 8e5b36ee7d..0000000000 --- a/awx/ui/client/src/inventories/hosts/add/host-add.controller.js +++ /dev/null @@ -1,14 +0,0 @@ -/************************************************* - * Copyright (c) 2017 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - -function HostsAdd() { - -console.log('inside host add'); - -} - -export default [ HostsAdd -]; diff --git a/awx/ui/client/src/inventories/hosts/add/main.js b/awx/ui/client/src/inventories/hosts/add/main.js deleted file mode 100644 index 9f1f083b96..0000000000 --- a/awx/ui/client/src/inventories/hosts/add/main.js +++ /dev/null @@ -1,11 +0,0 @@ -/************************************************* - * Copyright (c) 2017 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - -import controller from './host-add.controller'; - -export default -angular.module('hostsAdd', []) - .controller('HostAddController', controller); diff --git a/awx/ui/client/src/inventories/hosts/main.js b/awx/ui/client/src/inventories/hosts/main.js index fe21c6a43e..39d36fb762 100644 --- a/awx/ui/client/src/inventories/hosts/main.js +++ b/awx/ui/client/src/inventories/hosts/main.js @@ -4,7 +4,6 @@ * All Rights Reserved *************************************************/ - import hostAdd from './add/main'; import hostEdit from './edit/main'; import hostList from './list/main'; import HostsList from './host.list'; @@ -16,7 +15,6 @@ export default angular.module('host', [ - hostAdd.name, hostEdit.name, hostList.name, SmartInventory.name, diff --git a/awx/ui/client/src/inventories/main.js b/awx/ui/client/src/inventories/main.js index e4dc100382..f2dc2fc58e 100644 --- a/awx/ui/client/src/inventories/main.js +++ b/awx/ui/client/src/inventories/main.js @@ -36,12 +36,9 @@ angular.module('inventory', [ .service('InventoryManageService', InventoryManageService) .config(['$stateProvider', 'stateDefinitionsProvider', '$stateExtenderProvider', function($stateProvider, stateDefinitionsProvider, $stateExtenderProvider) { - // When stateDefinition.lazyLoad() resolves, states matching name.** or /url** will be de-registered and replaced with resolved states - // This means inventoryManage states will not be registered correctly on page refresh, unless they're registered at the same time as the inventories state tree let stateDefinitions = stateDefinitionsProvider.$get(), stateExtender = $stateExtenderProvider.$get(); - function generateInventoryStates() { let basicInventoryAdd = stateDefinitions.generateTree({ @@ -138,6 +135,93 @@ angular.module('inventory', [ } }; + let listSchedules = { + name: 'inventories.edit.inventory_sources.edit.schedules', + url: '/schedules', + searchPrefix: 'schedule', + ncyBreadcrumb: { + label: N_('SCHEDULES') + }, + resolve: { + Dataset: ['ScheduleList', 'QuerySet', '$stateParams', 'GetBasePath', 'inventorySourceData', + function(list, qs, $stateParams, GetBasePath, inventorySourceData) { + let path = `${inventorySourceData.related.schedules}`; + return qs.search(path, $stateParams[`${list.iterator}_search`]); + } + ], + ParentObject: ['inventorySourceData', function(inventorySourceData) { + return inventorySourceData; + }], + UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q', + function(Rest, GetBasePath, $stateParams, $q) { + Rest.setUrl(GetBasePath('unified_jobs')); + var val = $q.defer(); + Rest.options() + .then(function(data) { + val.resolve(data.data); + }, function(data) { + val.reject(data); + }); + return val.promise; + }], + ScheduleList: ['SchedulesList', 'inventorySourceData', + (SchedulesList, inventorySourceData) => { + let list = _.cloneDeep(SchedulesList); + list.basePath = `${inventorySourceData.related.schedules}`; + return list; + } + ] + }, + views: { + // clear form template when views render in this substate + 'form': { + templateProvider: () => '' + }, + // target the un-named ui-view @ root level + '@': { + templateProvider: function(ScheduleList, generateList, ParentObject) { + // include name of parent resource in listTitle + ScheduleList.listTitle = `${ParentObject.name}
` + N_('SCHEDULES'); + let html = generateList.build({ + list: ScheduleList, + mode: 'edit' + }); + html = generateList.wrapPanel(html); + return "
" + generateList.insertFormView() + html + "
"; + }, + controller: 'schedulerListController' + } + } + }; + + let addSchedule = { + name: 'inventories.edit.inventory_sources.edit.schedules.add', + url: '/add', + ncyBreadcrumb: { + label: N_("CREATE SCHEDULE") + }, + views: { + 'form': { + controller: 'schedulerAddController', + templateUrl: templateUrl("scheduler/schedulerForm") + } + } + }; + + let editSchedule = { + name: 'inventories.edit.inventory_sources.edit.schedules.edit', + url: '/:schedule_id', + ncyBreadcrumb: { + label: "{{schedule_obj.name}}" + }, + views: { + 'form': { + templateUrl: templateUrl("scheduler/schedulerForm"), + controller: 'schedulerEditController', + } + } + }; + return Promise.all([ basicInventoryAdd, basicInventoryEdit, @@ -180,7 +264,10 @@ angular.module('inventory', [ } }), stateExtender.buildDefinition(adHocRoute), - stateExtender.buildDefinition(adhocCredentialLookup) + stateExtender.buildDefinition(adhocCredentialLookup), + stateExtender.buildDefinition(listSchedules), + stateExtender.buildDefinition(addSchedule), + stateExtender.buildDefinition(editSchedule) ]) }; }); diff --git a/awx/ui/client/src/inventories/related-hosts/add/host-add.controller.js b/awx/ui/client/src/inventories/related-hosts/add/host-add.controller.js index 6bb5d0ab40..7b9eb9ba3b 100644 --- a/awx/ui/client/src/inventories/related-hosts/add/host-add.controller.js +++ b/awx/ui/client/src/inventories/related-hosts/add/host-add.controller.js @@ -52,10 +52,10 @@ export default ['$state', '$stateParams', '$scope', 'RelatedHostsFormDefinition' // assign the host to current group if not at the root level if ($stateParams.group) { HostManageService.associateGroup(res.data, _.last($stateParams.group)).then(function() { - $state.go('inventoryManage.editHost', { host_id: res.data.id }, { reload: true }); + $state.go('^.edit', { host_id: res.data.id }, { reload: true }); }); } else { - $state.go('inventoryManage.editHost', { host_id: res.data.id }, { reload: true }); + $state.go('^.edit', { host_id: res.data.id }, { reload: true }); } }); }; diff --git a/awx/ui/client/src/inventories/related-hosts/related-host.list.js b/awx/ui/client/src/inventories/related-hosts/related-host.list.js index e936e3c590..1b0a970086 100644 --- a/awx/ui/client/src/inventories/related-hosts/related-host.list.js +++ b/awx/ui/client/src/inventories/related-hosts/related-host.list.js @@ -87,8 +87,9 @@ export default { mode: 'all', ngDisabled: '!hostsSelected', ngClick: 'setAdhocPattern()', - awToolTip: "Select an inventory source by clicking the check box beside it. The inventory source can be a single group or host, a selection of multiple hosts, or a selection of multiple groups.", + awToolTip: "Select an inventory source by clicking the check box beside it. The inventory source can be a single host or a selection of multiple hosts.", dataTipWatch: "adhocCommandTooltip", + dataPlacement: 'top', actionClass: 'btn List-buttonDefault', buttonContent: 'RUN COMMANDS', showTipWhenDisabled: true, diff --git a/awx/ui/client/src/inventories/sources/add/sources-add.controller.js b/awx/ui/client/src/inventories/sources/add/sources-add.controller.js index 32dc70a7e6..15813fe765 100644 --- a/awx/ui/client/src/inventories/sources/add/sources-add.controller.js +++ b/awx/ui/client/src/inventories/sources/add/sources-add.controller.js @@ -50,31 +50,31 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', }; $scope.formSave = function() { - var params, source, json_data; + var params, json_data; json_data = ToJSON($scope.parseType, $scope.variables, true); + params = { + name: $scope.name, + description: $scope.description, + inventory: inventoryData.id, + instance_filters: $scope.instance_filters, + source_script: $scope.inventory_script, + credential: $scope.credential, + overwrite: $scope.overwrite, + overwrite_vars: $scope.overwrite_vars, + update_on_launch: $scope.update_on_launch, + update_cache_timeout: $scope.update_cache_timeout || 0, + variables: json_data, + // comma-delimited strings + group_by: _.map($scope.group_by, 'value').join(','), + source_regions: _.map($scope.source_regions, 'value').join(',') + }; + if ($scope.source) { - params = { - name: $scope.name, - description: $scope.description, - inventory: inventoryData.id, - instance_filters: $scope.instance_filters, - source_vars: $scope[$scope.source.value + '_variables'] === '---' || $scope[$scope.source.value + '_variables'] === '{}' ? null : $scope[$scope.source.value + '_variables'], - source_script: $scope.inventory_script, - source: $scope.source.value, - credential: $scope.credential, - overwrite: $scope.overwrite, - overwrite_vars: $scope.overwrite_vars, - update_on_launch: $scope.update_on_launch, - update_cache_timeout: $scope.update_cache_timeout || 0, - variables: json_data, - // comma-delimited strings - group_by: _.map($scope.group_by, 'value').join(','), - source_regions: _.map($scope.source_regions, 'value').join(',') - }; - source = $scope.source.value; + params.source_vars = $scope[$scope.source.value + '_variables'] === '---' || $scope[$scope.source.value + '_variables'] === '{}' ? null : $scope[$scope.source.value + '_variables']; + params.source = $scope.source.value; } else { - source = null; + params.source = null; } // switch (source) { // // no inventory source set, just create a new group @@ -109,7 +109,7 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', // _.assign(params, { group: res.data.id }), res.data.related.inventory_source)) // .then(res => $state.go('inventoryManage.editGroup', { group_id: res.data.group }, { reload: true })); SourcesService.post(params).then(function(){ - $state.go('.', null, {reload: true}); + $state.go('^.edit', null, {reload: true}); }); // break; // } diff --git a/awx/ui/client/src/inventories/sources/edit/build-sources-edit-state.factory.js b/awx/ui/client/src/inventories/sources/edit/build-sources-edit-state.factory.js index 29b988f349..5862650f27 100644 --- a/awx/ui/client/src/inventories/sources/edit/build-sources-edit-state.factory.js +++ b/awx/ui/client/src/inventories/sources/edit/build-sources-edit-state.factory.js @@ -14,7 +14,7 @@ export default ['$stateExtender', 'templateUrl', '$injector', breadcrumbLabel = (field.iterator.replace('_', ' ') + 's').toUpperCase(), stateConfig = { name: `${formStateDefinition.name}.${list.iterator}s.edit`, - url: `/edit/:source_id`, + url: `/edit/:inventory_source_id`, ncyBreadcrumb: { parent: `${formStateDefinition.name}`, label: `${breadcrumbLabel}` @@ -36,7 +36,7 @@ export default ['$stateExtender', 'templateUrl', '$injector', return definition; }], inventorySourceData: ['$stateParams', 'SourcesService', function($stateParams, SourcesService) { - return SourcesService.get({id: $stateParams.source_id }).then(res => res.data.results[0]); + return SourcesService.get({id: $stateParams.inventory_source_id }).then(res => res.data.results[0]); }] } }; diff --git a/awx/ui/client/src/inventories/sources/edit/sources-edit.controller.js b/awx/ui/client/src/inventories/sources/edit/sources-edit.controller.js index 978be62478..220e89a0f9 100644 --- a/awx/ui/client/src/inventories/sources/edit/sources-edit.controller.js +++ b/awx/ui/client/src/inventories/sources/edit/sources-edit.controller.js @@ -7,11 +7,11 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', 'rbacUiControlService', 'ToJSON', 'ParseTypeChange', 'GroupManageService', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', - 'inventorySourceData', 'SourcesService', + 'inventorySourceData', 'SourcesService', 'inventoryData', function($state, $stateParams, $scope, ParseVariableString, rbacUiControlService, ToJSON,ParseTypeChange, GroupManageService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, - inventorySourceData, SourcesService) { + inventorySourceData, SourcesService, inventoryData) { init(); @@ -76,39 +76,37 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', $state.go('^'); }; $scope.formSave = function() { - var params, source, json_data; + var params, json_data; json_data = ToJSON($scope.parseType, $scope.variables, true); + params = { + name: $scope.name, + description: $scope.description, + inventory: inventoryData.id, + instance_filters: $scope.instance_filters, + source_script: $scope.inventory_script, + credential: $scope.credential, + overwrite: $scope.overwrite, + overwrite_vars: $scope.overwrite_vars, + update_on_launch: $scope.update_on_launch, + update_cache_timeout: $scope.update_cache_timeout || 0, + variables: json_data, + // comma-delimited strings + group_by: _.map($scope.group_by, 'value').join(','), + source_regions: _.map($scope.source_regions, 'value').join(',') + }; + if ($scope.source) { - // inventory_source fields - params = { - id: $scope.id, - variables: json_data, - name: $scope.name, - description: $scope.description, - inventory: $scope.inventory, - source: $scope.source.value, - credential: $scope.credential, - overwrite: $scope.overwrite, - overwrite_vars: $scope.overwrite_vars, - source_script: $scope.inventory_script, - update_on_launch: $scope.update_on_launch, - update_cache_timeout: $scope.update_cache_timeout || 0, - // comma-delimited strings - group_by: _.map($scope.group_by, 'value').join(','), - source_regions: _.map($scope.source_regions, 'value').join(','), - instance_filters: $scope.instance_filters, - source_vars: $scope[$scope.source.value + '_variables'] === '---' || $scope[$scope.source.value + '_variables'] === '{}' ? null : $scope[$scope.source.value + '_variables'] - }; - source = $scope.source.value; + params.source_vars = $scope[$scope.source.value + '_variables'] === '---' || $scope[$scope.source.value + '_variables'] === '{}' ? null : $scope[$scope.source.value + '_variables']; + params.source = $scope.source.value; } else { - source = null; + params.source = null; } // switch (source) { // no inventory source set, just create a new group // '' is the value supplied for Manual source type // case null || '': - SourcesService.put(params).then(() => $state.go($state.current, null, { reload: true })); + SourcesService.put(params).then(() => $state.go('.', null, { reload: true })); // break; // // create a new group and create/associate an inventory source // // equal to case 'rax' || 'ec2' || 'azure' || 'azure_rm' || 'vmware' || 'satellite6' || 'cloudforms' || 'openstack' || 'custom' diff --git a/awx/ui/client/src/inventories/sources/list/sources-list.controller.js b/awx/ui/client/src/inventories/sources/list/sources-list.controller.js index 21c9003f5b..78411433d1 100644 --- a/awx/ui/client/src/inventories/sources/list/sources-list.controller.js +++ b/awx/ui/client/src/inventories/sources/list/sources-list.controller.js @@ -39,10 +39,6 @@ // https://github.com/ncuillery/angular-breadcrumb/issues/42 for a little more information on the // problem that this solves. $scope.ncyBreadcrumbIgnore = true; - if($state.current.name === "inventoryManage.editGroup") { - $scope.rowBeingEdited = $state.params.group_id; - $scope.listBeingEdited = "groups"; - } $scope.inventory_id = $stateParams.inventory_id; _.forEach($scope[list.name], buildStatusIndicators); @@ -79,23 +75,11 @@ {status: inventory_source ? inventory_source.status : null}); } - $scope.groupSelect = function(id){ - var group = $stateParams.group === undefined ? [id] : _($stateParams.group).concat(id).value(); - $state.go('inventoryManage', { - inventory_id: $stateParams.inventory_id, - group: group, - group_search: { - page_size: '20', - page: '1', - order_by: 'name', - } - }, {reload: true}); - }; $scope.createSource = function(){ $state.go('inventories.edit.inventory_sources.add'); }; $scope.editSource = function(id){ - $state.go('inventories.edit.inventory_sources.edit', {source_id: id}); + $state.go('inventories.edit.inventory_sources.edit', {inventory_source_id: id}); }; $scope.deleteSource = function(inventory_source){ var body = '
Are you sure you want to permanently delete the inventory source below from the inventory?
' + $filter('sanitize')(inventory_source.name) + '
'; @@ -129,42 +113,6 @@ }); }; - $scope.$on(`ws-jobs`, function(e, data){ - var group = Find({ list: $scope.groups, key: 'id', val: data.group_id }); - - if (group === undefined || group === null) { - group = {}; - } - - if(data.status === 'failed' || data.status === 'successful'){ - let path; - if($stateParams && $stateParams.group && $stateParams.group.length > 0) { - path = GetBasePath('groups') + _.last($stateParams.group) + '/children'; - } - else { - //reaches here if the user is on the root level group - path = GetBasePath('inventory') + $stateParams.inventory_id + '/root_groups'; - } - qs.search(path, $state.params[`${list.iterator}_search`]) - .then(function(searchResponse) { - $scope[`${list.iterator}_dataset`] = searchResponse.data; - $scope[list.name] = $scope[`${list.iterator}_dataset`].results; - // _.forEach($scope[list.name], buildStatusIndicators); - }); - } else { - var status = GetSyncStatusMsg({ - status: data.status, - has_inventory_sources: group.has_inventory_sources, - source: group.source - }); - group.status = data.status; - group.status_class = status.class; - group.status_tooltip = status.tooltip; - group.launch_tooltip = status.launch_tip; - group.launch_class = status.launch_class; - } - }); - $scope.cancelUpdate = function (id) { GroupsCancelUpdate({ scope: $scope, id: id }); }; @@ -174,40 +122,10 @@ group_id: id }); }; - $scope.showFailedHosts = function() { - $state.go('inventoryManage', {failed: true}, {reload: true}); - }; - $scope.scheduleGroup = function(id) { + $scope.scheduleSource = function(id) { // Add this group's id to the array of group id's so that it gets // added to the breadcrumb trail - var groupsArr = $stateParams.group ? $stateParams.group : []; - groupsArr.push(id); - $state.go('inventoryManage.editGroup.schedules', {group_id: id, group: groupsArr}, {reload: true}); + $state.go('inventories.edit.inventory_sources.edit.schedules', {inventory_source_id: id}, {reload: true}); }; - // $scope.$parent governed by InventoryManageController, for unified multiSelect options - $scope.$on('multiSelectList.selectionChanged', (event, selection) => { - $scope.$parent.groupsSelected = selection.length > 0 ? true : false; - $scope.$parent.groupsSelectedItems = selection.selectedItems; - }); - - $scope.copyMoveGroup = function(id){ - $state.go('inventoryManage.copyMoveGroup', {group_id: id, groups: $stateParams.groups}); - }; - - var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) { - if (toState.name === "inventoryManage.editGroup") { - $scope.rowBeingEdited = toParams.group_id; - $scope.listBeingEdited = "groups"; - } - else { - delete $scope.rowBeingEdited; - delete $scope.listBeingEdited; - } - }); - - // Remove the listener when the scope is destroyed to avoid a memory leak - $scope.$on('$destroy', function() { - cleanUpStateChangeListener(); - }); }]; diff --git a/awx/ui/client/src/inventories/sources/sources.list.js b/awx/ui/client/src/inventories/sources/sources.list.js index cfd714072f..c8c44bf571 100644 --- a/awx/ui/client/src/inventories/sources/sources.list.js +++ b/awx/ui/client/src/inventories/sources/sources.list.js @@ -12,7 +12,6 @@ export default { wellOverride: true, index: false, hover: true, - multiSelect: true, trackBy: 'inventory_source.id', basePath: 'api/v2/inventories/{{$stateParams.inventory_id}}/inventory_sources/', diff --git a/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js index 88e90f6007..c08c8f2838 100644 --- a/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js +++ b/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js @@ -157,7 +157,7 @@ export default // If we are on the inventory manage page or any child state of that // page then we want to stay on that page. Otherwise go to the stdout // view. - if(!$state.includes('inventoryManage')) { + if(!$state.includes('inventories.edit')) { goTojobResults('inventorySyncStdout'); } } diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index 63d813ff12..8691596e52 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -1493,7 +1493,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat if(this.mode === "edit"){ html += `
` + + let detailsTabSelected = this.form.activeEditState ? `$state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.$current.data.formChildState` : `$state.is('${this.form.stateTree}.edit') || $state.$current.data.formChildState`; + html += `ng-class="{'is-selected': ${detailsTabSelected} }">` + `${details}
`; for (itm in this.form.related) { @@ -1506,7 +1507,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat `aw-tip-placement="${collection.dataPlacement}" ` + `data-tip-watch="${collection.dataTipWatch}" `; } - html += `ng-class="{'is-selected' : $state.is('${this.form.activeEditState}.${itm}') || $state.is('${this.form.stateTree}.edit.${itm}') ` ; + let relatedTabSelected = this.form.activeEditState ? `$state.includes('${this.form.activeEditState}.${itm}') || $state.includes('${this.form.stateTree}.edit.${itm}')` : `$state.includes('${this.form.stateTree}.edit.${itm}')`; + html += `ng-class="{'is-selected' : ${relatedTabSelected}` ; if(this.form.related[itm].disabled){ html += `, 'Form-tab--disabled' : ${this.form.related[itm].disabled }`; }