diff --git a/awx/ui/client/src/controllers/Credentials.js b/awx/ui/client/src/controllers/Credentials.js index db1b3a3527..fa3ca54c10 100644 --- a/awx/ui/client/src/controllers/Credentials.js +++ b/awx/ui/client/src/controllers/Credentials.js @@ -103,6 +103,9 @@ export function CredentialsList($scope, $rootScope, $location, $log, Rest.destroy() .success(function () { $scope.search(list.iterator); + if (new RegExp('/' + id + '$').test($location.$$url)) { + $state.transitionTo($state.current.name.replace(/[.][a-zA-Z]+$/, "")); /* go to the list view */ + } }) .error(function (data, status) { ProcessErrors($scope, data, status, null, { hdr: 'Error!', diff --git a/awx/ui/client/src/controllers/Projects.js b/awx/ui/client/src/controllers/Projects.js index 089fda112a..2d706fa8f4 100644 --- a/awx/ui/client/src/controllers/Projects.js +++ b/awx/ui/client/src/controllers/Projects.js @@ -247,6 +247,9 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams, Rest.destroy() .success(function () { $scope.search(list.iterator); + if (new RegExp('/' + id + '$').test($location.$$url)) { + $state.transitionTo($state.current.name.replace(/[.][a-zA-Z]+$/, "")); /* go to the list view */ + } }) .error(function (data, status) { ProcessErrors($scope, data, status, null, { hdr: 'Error!', diff --git a/awx/ui/client/src/controllers/Teams.js b/awx/ui/client/src/controllers/Teams.js index e2be443712..afdef86d0c 100644 --- a/awx/ui/client/src/controllers/Teams.js +++ b/awx/ui/client/src/controllers/Teams.js @@ -98,6 +98,9 @@ export function TeamsList($scope, $rootScope, $location, $log, $stateParams, Wait('stop'); $('#prompt-modal').modal('hide'); $scope.search(list.iterator); + if (new RegExp('/' + id + '$').test($location.$$url)) { + $state.transitionTo($state.current.name.replace(/[.][a-zA-Z]+$/, "")); /* go to the list view */ + } }) .error(function (data, status) { Wait('stop'); diff --git a/awx/ui/client/src/controllers/Users.js b/awx/ui/client/src/controllers/Users.js index bd1a8ecfc5..a0628a9812 100644 --- a/awx/ui/client/src/controllers/Users.js +++ b/awx/ui/client/src/controllers/Users.js @@ -112,6 +112,9 @@ export function UsersList($scope, $rootScope, $location, $log, $stateParams, Rest.destroy() .success(function () { $scope.search(list.iterator); + if (new RegExp('/' + id + '$').test($location.$$url)) { + $state.transitionTo($state.current.name.replace(/[.][a-zA-Z]+$/, "")); /* go to the list view */ + } }) .error(function (data, status) { ProcessErrors($scope, data, status, null, { hdr: 'Error!', diff --git a/awx/ui/client/src/helpers/Schedules.js b/awx/ui/client/src/helpers/Schedules.js index 72761011a7..5f0c589e32 100644 --- a/awx/ui/client/src/helpers/Schedules.js +++ b/awx/ui/client/src/helpers/Schedules.js @@ -429,8 +429,8 @@ export default * }) * */ - .factory('DeleteSchedule', ['GetBasePath','Rest', 'Wait', 'ProcessErrors', 'Prompt', 'Find', - function(GetBasePath, Rest, Wait, ProcessErrors, Prompt, Find) { + .factory('DeleteSchedule', ['GetBasePath','Rest', 'Wait', 'ProcessErrors', 'Prompt', 'Find', '$location', '$state', + function(GetBasePath, Rest, Wait, ProcessErrors, Prompt, Find, $location, $state) { return function(params) { var scope = params.scope, @@ -456,6 +456,9 @@ export default .success(function () { $('#prompt-modal').modal('hide'); scope.$emit(callback, id); + if (new RegExp('/' + id + '$').test($location.$$url)) { + $location.url($location.url().replace(/[/][0-9]+$/, "")) // go to list view + } }) .error(function (data, status) { try { diff --git a/awx/ui/client/src/inventories/list/inventory-list.controller.js b/awx/ui/client/src/inventories/list/inventory-list.controller.js index f38e99239f..c27b7c7252 100644 --- a/awx/ui/client/src/inventories/list/inventory-list.controller.js +++ b/awx/ui/client/src/inventories/list/inventory-list.controller.js @@ -323,6 +323,9 @@ function InventoriesList($scope, $rootScope, $location, $log, Rest.destroy() .success(function () { $scope.search(list.iterator); + if (new RegExp('/' + id + '$').test($location.$$url)) { + $state.transitionTo($state.current.name.replace(/[.][a-zA-Z]+$/, "")); /* go to the list view */ + } }) .error(function (data, status) { ProcessErrors( $scope, data, status, null, { hdr: 'Error!', diff --git a/awx/ui/client/src/inventory-scripts/list/list.controller.js b/awx/ui/client/src/inventory-scripts/list/list.controller.js index 293bd7c4a4..bd73527328 100644 --- a/awx/ui/client/src/inventory-scripts/list/list.controller.js +++ b/awx/ui/client/src/inventory-scripts/list/list.controller.js @@ -7,11 +7,11 @@ export default [ '$rootScope','Wait', 'generateList', 'inventoryScriptsListObject', 'GetBasePath' , 'SearchInit' , 'PaginateInit', - 'Rest' , 'ProcessErrors', 'Prompt', '$state', + 'Rest' , 'ProcessErrors', 'Prompt', '$state', '$location', function( $rootScope,Wait, GenerateList, inventoryScriptsListObject, GetBasePath, SearchInit, PaginateInit, - Rest, ProcessErrors, Prompt, $state + Rest, ProcessErrors, Prompt, $state, $location ) { var scope = $rootScope.$new(), defaultUrl = GetBasePath('inventory_scripts'), @@ -59,6 +59,9 @@ export default Rest.destroy() .success(function () { scope.search(list.iterator); + if (new RegExp('/' + id + '$').test($location.$$url)) { + $state.transitionTo($state.current.name.replace(/[.][a-zA-Z]+$/, "")); /* go to the list view */ + } }) .error(function (data, status) { ProcessErrors(scope, data, status, null, { hdr: 'Error!', diff --git a/awx/ui/client/src/job-templates/list/job-templates-list.controller.js b/awx/ui/client/src/job-templates/list/job-templates-list.controller.js index 366f89ddf3..845aba1fd7 100644 --- a/awx/ui/client/src/job-templates/list/job-templates-list.controller.js +++ b/awx/ui/client/src/job-templates/list/job-templates-list.controller.js @@ -78,6 +78,9 @@ export default Rest.destroy() .success(function () { $scope.search(list.iterator); + if (new RegExp('/' + id + '$').test($location.$$url)) { + $state.transitionTo($state.current.name.replace(/[.][a-zA-Z]+$/, "")); /* go to the list view */ + } }) .error(function (data) { Wait('stop'); diff --git a/awx/ui/client/src/notifications/notification-templates-list/list.controller.js b/awx/ui/client/src/notifications/notification-templates-list/list.controller.js index 5c64299c70..b67a192cb0 100644 --- a/awx/ui/client/src/notifications/notification-templates-list/list.controller.js +++ b/awx/ui/client/src/notifications/notification-templates-list/list.controller.js @@ -8,12 +8,12 @@ export default [ '$rootScope','Wait', 'generateList', 'NotificationTemplatesList', 'GetBasePath' , 'SearchInit' , 'PaginateInit', 'Rest' , 'ProcessErrors', 'Prompt', '$state', 'GetChoices', 'Empty', 'Find', - 'ngToast', '$compile', '$filter', + 'ngToast', '$compile', '$filter', '$location', function( $rootScope,Wait, GenerateList, NotificationTemplatesList, GetBasePath, SearchInit, PaginateInit, Rest, ProcessErrors, Prompt, $state, GetChoices, Empty, Find, ngToast, - $compile, $filter) { + $compile, $filter, $location) { var scope = $rootScope.$new(), defaultUrl = GetBasePath('notification_templates'), list = NotificationTemplatesList, @@ -183,6 +183,9 @@ export default Rest.destroy() .success(function () { scope.search(list.iterator); + if (new RegExp('/' + id + '$').test($location.$$url)) { + $state.transitionTo($state.current.name.replace(/[.][a-zA-Z]+$/, "")); /* go to the list view */ + } }) .error(function (data, status) { ProcessErrors(scope, data, status, null, { hdr: 'Error!',