diff --git a/awx/ui/client/src/controllers/Jobs.js b/awx/ui/client/src/controllers/Jobs.js index 0015216389..cc6a2842a0 100644 --- a/awx/ui/client/src/controllers/Jobs.js +++ b/awx/ui/client/src/controllers/Jobs.js @@ -13,7 +13,7 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $stateParams, - ClearScope, Find, DeleteJob, RelaunchJob, AllJobsList, ScheduledJobsList, GetBasePath, Dataset) { + ClearScope, Find, DeleteJob, RelaunchJob, AllJobsList, ScheduledJobsList, GetBasePath, Dataset, qs) { ClearScope(); @@ -93,10 +93,6 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $ RelaunchJob({ scope: $scope, id: typeId, type: job.type, name: job.name }); }; - $scope.refreshJobs = function() { - $state.go('.', null, { reload: true }); - }; - $scope.viewJobDetails = function(job) { var goToJobDetails = function(state) { @@ -126,7 +122,12 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $ }; $scope.$on('ws-jobs', function(){ - $scope.refreshJobs(); + let path = GetBasePath(list.basePath) || GetBasePath(list.name); + 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; + }); }); $scope.$on('ws-schedules', function(){ @@ -135,5 +136,5 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $ } JobsListController.$inject = ['$state', '$rootScope', '$log', '$scope', '$compile', '$stateParams', - 'ClearScope', 'Find', 'DeleteJob', 'RelaunchJob', 'AllJobsList', 'ScheduledJobsList', 'GetBasePath', 'Dataset' + 'ClearScope', 'Find', 'DeleteJob', 'RelaunchJob', 'AllJobsList', 'ScheduledJobsList', 'GetBasePath', 'Dataset','QuerySet' ]; diff --git a/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js b/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js index 3e08aef999..9ab2d6458d 100644 --- a/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js +++ b/awx/ui/client/src/inventories/manage/groups/groups-list.controller.js @@ -6,10 +6,10 @@ export default ['$scope', '$rootScope', '$state', '$stateParams', 'InventoryGroups', 'generateList', 'InventoryUpdate', 'GroupManageService', 'GroupsCancelUpdate', 'ViewUpdateStatus', 'rbacUiControlService', 'GetBasePath', - 'InventoryManageService', 'groupsUrl', 'GetSyncStatusMsg', 'GetHostsStatusMsg', 'groupsDataset', 'Find', + 'InventoryManageService', 'groupsUrl', 'GetSyncStatusMsg', 'GetHostsStatusMsg', 'groupsDataset', 'Find', 'QuerySet', function($scope, $rootScope, $state, $stateParams, InventoryGroups, generateList, InventoryUpdate, GroupManageService, GroupsCancelUpdate, ViewUpdateStatus, rbacUiControlService, GetBasePath, - InventoryManageService, groupsUrl, GetSyncStatusMsg, GetHostsStatusMsg, groupsDataset, Find){ + InventoryManageService, groupsUrl, GetSyncStatusMsg, GetHostsStatusMsg, groupsDataset, Find, qs){ let list = InventoryGroups; @@ -160,7 +160,20 @@ } if(data.status === 'failed' || data.status === 'successful'){ - $state.reload(); + 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, diff --git a/awx/ui/client/src/inventories/manage/hosts/hosts-list.controller.js b/awx/ui/client/src/inventories/manage/hosts/hosts-list.controller.js index 28089245f3..d20a4198f8 100644 --- a/awx/ui/client/src/inventories/manage/hosts/hosts-list.controller.js +++ b/awx/ui/client/src/inventories/manage/hosts/hosts-list.controller.js @@ -5,9 +5,9 @@ *************************************************/ export default ['$scope', '$rootScope', '$state', '$stateParams', 'InventoryHosts', 'generateList', 'InventoryManageService', 'HostManageService', - 'hostsUrl', 'SetStatus', 'Prompt', 'Wait', 'inventoryData', '$filter', 'hostsDataset', 'GetBasePath', 'rbacUiControlService', + 'hostsUrl', 'SetStatus', 'Prompt', 'Wait', 'inventoryData', '$filter', 'hostsDataset', 'GetBasePath', 'rbacUiControlService', 'QuerySet', function($scope, $rootScope, $state, $stateParams, InventoryHosts, generateList, InventoryManageService, HostManageService, - hostsUrl, SetStatus, Prompt, Wait, inventoryData, $filter, hostsDataset, GetBasePath, rbacUiControlService){ + hostsUrl, SetStatus, Prompt, Wait, inventoryData, $filter, hostsDataset, GetBasePath, rbacUiControlService, qs){ var list = InventoryHosts; init(); @@ -32,6 +32,17 @@ host: host})); }); + $scope.$on(`ws-jobs`, function(e, data){ + if(data.status === 'failed' || data.status === 'successful'){ + let path = hostsUrl; + 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; + }); + } + }); + // The ncy breadcrumb directive will look at this attribute when attempting to bind to the correct scope. // In this case, we don't want to incidentally bind to this scope when editing a host or a group. See: // https://github.com/ncuillery/angular-breadcrumb/issues/42 for a little more information on the diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js index 7df8a2a344..a42b9acb1d 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-job-templates.controller.js @@ -7,18 +7,22 @@ export default ['$scope', '$rootScope', '$location', '$log', '$stateParams', 'Rest', 'Alert', 'Prompt', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GetBasePath', 'JobTemplateForm', 'InitiatePlaybookRun', 'Wait', - '$compile', '$state', 'OrgJobTemplateList', 'OrgJobTemplateDataset', + '$compile', '$state', 'OrgJobTemplateList', 'OrgJobTemplateDataset', 'QuerySet', function($scope, $rootScope, $location, $log, $stateParams, Rest, Alert, Prompt, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, JobTemplateForm, InitiatePlaybookRun, Wait, - $compile, $state, OrgJobTemplateList, Dataset) { + $compile, $state, OrgJobTemplateList, Dataset, qs) { var list = OrgJobTemplateList, orgBase = GetBasePath('organizations'); $scope.$on(`ws-jobs`, function () { - // @issue old search - //$scope.search(list.iterator); + let path = GetBasePath(list.basePath) || GetBasePath(list.name); + 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; + }); }); init(); diff --git a/awx/ui/client/src/portal-mode/portal-mode-jobs.controller.js b/awx/ui/client/src/portal-mode/portal-mode-jobs.controller.js index 71e1747a8d..3ebb87cb26 100644 --- a/awx/ui/client/src/portal-mode/portal-mode-jobs.controller.js +++ b/awx/ui/client/src/portal-mode/portal-mode-jobs.controller.js @@ -9,7 +9,12 @@ export function PortalModeJobsController($scope, $rootScope, $state, $stateParam var list = PortalJobsList; $scope.$on('ws-jobs', function() { - $state.go('.', null, { reload: true }); + let path = GetBasePath(list.basePath) || GetBasePath(list.name); + 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; + }); }); init(); diff --git a/awx/ui/client/src/templates/list/templates-list.controller.js b/awx/ui/client/src/templates/list/templates-list.controller.js index a308a4c3ca..d3e07c6fda 100644 --- a/awx/ui/client/src/templates/list/templates-list.controller.js +++ b/awx/ui/client/src/templates/list/templates-list.controller.js @@ -72,10 +72,6 @@ export default ['$scope', '$rootScope', '$location', '$stateParams', 'Rest', $scope.$on(`ws-jobs`, function () { - // @issue - this is no longer quite as ham-fisted but I'd like for someone else to take a peek - // calling $state.reload(); here was problematic when launching a job because job launch also - // attempts to transition the state and they were squashing each other. - let path = GetBasePath(list.basePath) || GetBasePath(list.name); qs.search(path, $state.params[`${list.iterator}_search`]) .then(function(searchResponse) {