From c1f40f9cbf31ffab591ad147bc6aacef2e3b292e Mon Sep 17 00:00:00 2001 From: Akita Noek Date: Wed, 8 Jun 2016 14:33:18 -0400 Subject: [PATCH] Better "go to parent state" code --- awx/ui/client/src/controllers/Credentials.js | 2 +- awx/ui/client/src/controllers/Projects.js | 2 +- awx/ui/client/src/controllers/Teams.js | 2 +- awx/ui/client/src/controllers/Users.js | 2 +- awx/ui/client/src/inventories/list/inventory-list.controller.js | 2 +- awx/ui/client/src/inventory-scripts/list/list.controller.js | 2 +- .../src/job-templates/list/job-templates-list.controller.js | 2 +- .../notification-templates-list/list.controller.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/awx/ui/client/src/controllers/Credentials.js b/awx/ui/client/src/controllers/Credentials.js index fa3ca54c10..618879037a 100644 --- a/awx/ui/client/src/controllers/Credentials.js +++ b/awx/ui/client/src/controllers/Credentials.js @@ -104,7 +104,7 @@ export function CredentialsList($scope, $rootScope, $location, $log, .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 */ + $state.go('^'); } }) .error(function (data, status) { diff --git a/awx/ui/client/src/controllers/Projects.js b/awx/ui/client/src/controllers/Projects.js index 2d706fa8f4..dd63cc237d 100644 --- a/awx/ui/client/src/controllers/Projects.js +++ b/awx/ui/client/src/controllers/Projects.js @@ -248,7 +248,7 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams, .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 */ + $state.go('^'); } }) .error(function (data, status) { diff --git a/awx/ui/client/src/controllers/Teams.js b/awx/ui/client/src/controllers/Teams.js index afdef86d0c..a430a7fb6a 100644 --- a/awx/ui/client/src/controllers/Teams.js +++ b/awx/ui/client/src/controllers/Teams.js @@ -99,7 +99,7 @@ export function TeamsList($scope, $rootScope, $location, $log, $stateParams, $('#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 */ + $state.go('^'); } }) .error(function (data, status) { diff --git a/awx/ui/client/src/controllers/Users.js b/awx/ui/client/src/controllers/Users.js index a0628a9812..179aa2b8ad 100644 --- a/awx/ui/client/src/controllers/Users.js +++ b/awx/ui/client/src/controllers/Users.js @@ -113,7 +113,7 @@ export function UsersList($scope, $rootScope, $location, $log, $stateParams, .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 */ + $state.go('^'); } }) .error(function (data, status) { 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 c27b7c7252..54fc4fd3eb 100644 --- a/awx/ui/client/src/inventories/list/inventory-list.controller.js +++ b/awx/ui/client/src/inventories/list/inventory-list.controller.js @@ -324,7 +324,7 @@ function InventoriesList($scope, $rootScope, $location, $log, .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 */ + $state.go('^'); } }) .error(function (data, status) { 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 bd73527328..c7a2b3e404 100644 --- a/awx/ui/client/src/inventory-scripts/list/list.controller.js +++ b/awx/ui/client/src/inventory-scripts/list/list.controller.js @@ -60,7 +60,7 @@ export default .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 */ + $state.go('^'); } }) .error(function (data, status) { 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 845aba1fd7..6fe7410e4d 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 @@ -79,7 +79,7 @@ export default .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 */ + $state.go('^'); } }) .error(function (data) { 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 b67a192cb0..0167b32d3f 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 @@ -184,7 +184,7 @@ export default .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 */ + $state.go('^'); } }) .error(function (data, status) {