mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Navigate to list view if you delete an object you are editing
This patch covers all the cases I could find of places where you could delete items that you are currently editing. When this happens, we should now exit the edit mode and return to the list view for whatever we were viewing. Related to #1742
This commit is contained in:
parent
0067e7006f
commit
f24818148c
@ -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!',
|
||||
|
@ -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!',
|
||||
|
@ -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');
|
||||
|
@ -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!',
|
||||
|
@ -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 {
|
||||
|
@ -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!',
|
||||
|
@ -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!',
|
||||
|
@ -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');
|
||||
|
@ -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!',
|
||||
|
Loading…
Reference in New Issue
Block a user