diff --git a/awx/ui/client/src/controllers/Credentials.js b/awx/ui/client/src/controllers/Credentials.js index 63ef391bd5..33bb40495b 100644 --- a/awx/ui/client/src/controllers/Credentials.js +++ b/awx/ui/client/src/controllers/Credentials.js @@ -102,9 +102,10 @@ export function CredentialsList($scope, $rootScope, $location, $log, Rest.setUrl(url); Rest.destroy() .success(function () { - $scope.search(list.iterator); - if (new RegExp('/' + id + '$').test($location.$$url)) { - $state.go('^'); + if (parseInt($state.params.credential_id) === id) { + $state.go("^", null, {reload: true}); + } else { + $scope.search(list.iterator); } }) .error(function (data, status) { diff --git a/awx/ui/client/src/controllers/Projects.js b/awx/ui/client/src/controllers/Projects.js index 0512ebe45e..2bc3af4a8c 100644 --- a/awx/ui/client/src/controllers/Projects.js +++ b/awx/ui/client/src/controllers/Projects.js @@ -244,11 +244,13 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams, Wait('start'); var url = defaultUrl + id + '/'; Rest.setUrl(url); + console.log($state); Rest.destroy() .success(function () { - $scope.search(list.iterator); - if (new RegExp('/' + id + '$').test($location.$$url)) { - $state.go('^'); + if (parseInt($state.params.id) === id) { + $state.go("^", null, {reload: true}); + } else { + $scope.search(list.iterator); } }) .error(function (data, status) { @@ -802,13 +804,7 @@ export function ProjectsEdit($scope, $rootScope, $compile, $location, $log, Rest.put(params) .success(function() { Wait('stop'); - /*$scope.scm_update_tooltip = "Start an SCM update"; - $scope.scm_type_class = ""; - if (Empty($scope.scm_type)) { - $scope.scm_update_tooltip = 'Manual projects do not require an SCM update'; - $scope.scm_type_class = "btn-disabled"; - }*/ - ReturnToCaller(); + $state.go($state.current, {}, {reload: true}); }) .error(function (data, status) { ProcessErrors($scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update project: ' + id + '. PUT status: ' + status }); diff --git a/awx/ui/client/src/controllers/Teams.js b/awx/ui/client/src/controllers/Teams.js index a430a7fb6a..4d73d09642 100644 --- a/awx/ui/client/src/controllers/Teams.js +++ b/awx/ui/client/src/controllers/Teams.js @@ -97,9 +97,10 @@ export function TeamsList($scope, $rootScope, $location, $log, $stateParams, .success(function () { Wait('stop'); $('#prompt-modal').modal('hide'); - $scope.search(list.iterator); - if (new RegExp('/' + id + '$').test($location.$$url)) { - $state.go('^'); + if (parseInt($state.params.team_id) === id) { + $state.go("^", null, {reload: true}); + } else { + $scope.search(list.iterator); } }) .error(function (data, status) { @@ -297,7 +298,7 @@ export function TeamsEdit($scope, $rootScope, $location, Rest.setUrl(defaultUrl + id + '/'); var data = processNewData(form.fields); Rest.put(data).success(function(){ - $state.go('teams', null, {reload: true}); + $state.go($state.current, null, {reload: true}); }) .error(function (data, status) { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve user: ' + diff --git a/awx/ui/client/src/controllers/Users.js b/awx/ui/client/src/controllers/Users.js index 0a03e8b02a..bf1f86feec 100644 --- a/awx/ui/client/src/controllers/Users.js +++ b/awx/ui/client/src/controllers/Users.js @@ -111,9 +111,10 @@ export function UsersList($scope, $rootScope, $location, $log, $stateParams, Rest.setUrl(url); Rest.destroy() .success(function () { - $scope.search(list.iterator); - if (new RegExp('/' + id + '$').test($location.$$url)) { - $state.go('^'); + if (parseInt($state.params.user_id) === id) { + $state.go("^", null, {reload: true}); + } else { + $scope.search(list.iterator); } }) .error(function (data, status) { @@ -391,7 +392,7 @@ export function UsersEdit($scope, $rootScope, $location, Rest.setUrl(defaultUrl + id + '/'); var data = processNewData(form.fields); Rest.put(data).success(function(){ - $state.go('users', null, {reload: true}); + $state.go($state.current, null, {reload: true}); }) .error(function (data, status) { ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve user: ' + diff --git a/awx/ui/client/src/helpers/Credentials.js b/awx/ui/client/src/helpers/Credentials.js index 81037560e2..b065b1fd55 100644 --- a/awx/ui/client/src/helpers/Credentials.js +++ b/awx/ui/client/src/helpers/Credentials.js @@ -307,14 +307,7 @@ angular.module('CredentialsHelper', ['Utilities']) Rest.put(data) .success(function () { Wait('stop'); - var base = $location.path().replace(/^\//, '').split('/')[0]; - if (base === 'credentials') { - ReturnToCaller(); - } - else { - ReturnToCaller(1); - } - + $state.go($state.current, {}, {reload: true}); }) .error(function (data, status) { Wait('stop'); diff --git a/awx/ui/client/src/inventories/edit/inventory-edit.controller.js b/awx/ui/client/src/inventories/edit/inventory-edit.controller.js index 1fb202b6db..0b3e92d7fc 100644 --- a/awx/ui/client/src/inventories/edit/inventory-edit.controller.js +++ b/awx/ui/client/src/inventories/edit/inventory-edit.controller.js @@ -132,7 +132,7 @@ function InventoriesEdit($scope, $rootScope, $compile, $location, Rest.put(data) .success(function () { Wait('stop'); - $location.path('/inventories/'); + $state.go($state.current, {}, {reload: true}); }) .error(function (data, status) { ProcessErrors($scope, data, status, form, { hdr: 'Error!', 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 54fc4fd3eb..096ea2ad31 100644 --- a/awx/ui/client/src/inventories/list/inventory-list.controller.js +++ b/awx/ui/client/src/inventories/list/inventory-list.controller.js @@ -322,9 +322,10 @@ function InventoriesList($scope, $rootScope, $location, $log, Rest.setUrl(url); Rest.destroy() .success(function () { - $scope.search(list.iterator); - if (new RegExp('/' + id + '$').test($location.$$url)) { - $state.go('^'); + if (parseInt($state.params.inventory_id) === id) { + $state.go("^", null, {reload: true}); + } else { + $scope.search(list.iterator); } }) .error(function (data, status) { diff --git a/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js b/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js index 5cb1f53f12..581abf95c0 100644 --- a/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js +++ b/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js @@ -52,14 +52,14 @@ // no inventory source set, just create a new group // '' is the value supplied for Manual source type case null || '': - GroupManageService.put(group).then(() => $state.go('^', null, {reload: true})); + GroupManageService.put(group).then(() => $state.go($state.current, null, {reload: true})); break; // create a new group and create/associate an inventory source // equal to case 'rax' || 'ec2' || 'azure' || 'azure_rm' || 'vmware' || 'foreman' || 'cloudforms' || 'openstack' || 'custom' default: GroupManageService.put(group) .then(() => GroupManageService.putInventorySource(params, groupData.related.inventory_source)) - .then(() => $state.go('^', null, {reload: true})); + .then(() => $state.go($state.current, null, {reload: true})); break; } }; 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 e17a43f3be..8f066d4788 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 @@ -48,12 +48,26 @@ case 'promote': GroupManageService.promote($scope.toDelete.id, $stateParams.inventory_id) .then(() => { + if (parseInt($state.params.group_id) === $scope.toDelete.id) { + $state.go("inventoryManage", null, {reload: true}); + } else { + $state.go($state.current, null, {reload: true}); + } $('#group-delete-modal').modal('hide'); + $('body').removeClass('modal-open'); + $('.modal-backdrop').remove(); }); break; - case 'delete': + default: GroupManageService.delete($scope.toDelete.id).then(() => { + if (parseInt($state.params.group_id) === $scope.toDelete.id) { + $state.go("inventoryManage", null, {reload: true}); + } else { + $state.go($state.current, null, {reload: true}); + } $('#group-delete-modal').modal('hide'); + $('body').removeClass('modal-open'); + $('.modal-backdrop').remove(); }); } }; diff --git a/awx/ui/client/src/inventories/manage/hosts/hosts-add.controller.js b/awx/ui/client/src/inventories/manage/hosts/hosts-add.controller.js index 1eefe86020..3b620fb950 100644 --- a/awx/ui/client/src/inventories/manage/hosts/hosts-add.controller.js +++ b/awx/ui/client/src/inventories/manage/hosts/hosts-add.controller.js @@ -29,11 +29,11 @@ // 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', null, {reload: true}); + $state.go('inventoryManage.editHost', {host_id: res.data.id}, {reload: true}); }); } else{ - $state.go('inventoryManage', null, {reload: true}); + $state.go('inventoryManage.editHost', {host_id: res.data.id}, {reload: true}); } }); }; diff --git a/awx/ui/client/src/inventories/manage/hosts/hosts-edit.controller.js b/awx/ui/client/src/inventories/manage/hosts/hosts-edit.controller.js index 8e764d95d5..7241cc6069 100644 --- a/awx/ui/client/src/inventories/manage/hosts/hosts-edit.controller.js +++ b/awx/ui/client/src/inventories/manage/hosts/hosts-edit.controller.js @@ -25,7 +25,7 @@ enabled: $scope.host.enabled }; HostManageService.put(host).then(function(){ - $state.go('^', null, {reload: true}); + $state.go($state.current, null, {reload: true}); }); }; var init = function(){ 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 13540fb489..74532071c2 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 @@ -24,7 +24,11 @@ Wait('start'); HostManageService.delete(id).then(() => { $('#prompt-modal').modal('hide'); - $state.go($state.current.name, null, {reload: true}); + if (parseInt($state.params.host_id) === id) { + $state.go("inventoryManage", null, {reload: true}); + } else { + $state.go($state.current.name, null, {reload: true}); + } Wait('stop'); }); }; @@ -81,4 +85,4 @@ $scope.search(list.iterator); }; init(); - }]; \ No newline at end of file + }]; diff --git a/awx/ui/client/src/inventory-scripts/add/add.controller.js b/awx/ui/client/src/inventory-scripts/add/add.controller.js index 522dbe1129..de3be842b3 100644 --- a/awx/ui/client/src/inventory-scripts/add/add.controller.js +++ b/awx/ui/client/src/inventory-scripts/add/add.controller.js @@ -49,8 +49,8 @@ export default organization: scope.organization, script: scope.script }) - .success(function () { - $state.go('inventoryScripts', {}, {reload: true}); + .success(function (data) { + $state.go('inventoryScripts.edit', {inventory_script_id: data.id}, {reload: true}); Wait('stop'); }) .error(function (data, status) { diff --git a/awx/ui/client/src/inventory-scripts/edit/edit.controller.js b/awx/ui/client/src/inventory-scripts/edit/edit.controller.js index 5b585ec49d..3a899cd5a4 100644 --- a/awx/ui/client/src/inventory-scripts/edit/edit.controller.js +++ b/awx/ui/client/src/inventory-scripts/edit/edit.controller.js @@ -84,7 +84,7 @@ export default script: $scope.script }) .success(function () { - $state.transitionTo('inventoryScripts'); + $state.go($state.current, null, {reload: true}); Wait('stop'); }) .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 c7a2b3e404..c4e83cf0c9 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', '$location', + 'Rest' , 'ProcessErrors', 'Prompt', '$state', function( $rootScope,Wait, GenerateList, inventoryScriptsListObject, GetBasePath, SearchInit, PaginateInit, - Rest, ProcessErrors, Prompt, $state, $location + Rest, ProcessErrors, Prompt, $state ) { var scope = $rootScope.$new(), defaultUrl = GetBasePath('inventory_scripts'), @@ -58,9 +58,10 @@ export default Rest.setUrl(url); Rest.destroy() .success(function () { - scope.search(list.iterator); - if (new RegExp('/' + id + '$').test($location.$$url)) { - $state.go('^'); + if (parseInt($state.params.inventory_script_id) === id) { + $state.go("^", null, {reload: true}); + } else { + scope.search(list.iterator); } }) .error(function (data, status) { diff --git a/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js b/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js index 054a7312f9..b37820c96b 100644 --- a/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js +++ b/awx/ui/client/src/job-templates/edit/job-templates-edit.controller.js @@ -480,7 +480,7 @@ export default }); function saveCompleted() { - $state.go('jobTemplates', null, {reload: true}); + $state.go($state.current, {}, {reload: true}); } if ($scope.removeTemplateSaveSuccess) { 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 3d1e144921..31c2f1739c 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 @@ -77,9 +77,10 @@ export default Rest.setUrl(url); Rest.destroy() .success(function () { - $scope.search(list.iterator); - if (new RegExp('/' + id + '$').test($location.$$url)) { - $state.go('^'); + if (parseInt($state.params.template_id) === id) { + $state.go("^", null, {reload: true}); + } else { + $scope.search(list.iterator); } }) .error(function (data) { diff --git a/awx/ui/client/src/notifications/edit/edit.controller.js b/awx/ui/client/src/notifications/edit/edit.controller.js index c81b7220c0..4ff9f55bf3 100644 --- a/awx/ui/client/src/notifications/edit/edit.controller.js +++ b/awx/ui/client/src/notifications/edit/edit.controller.js @@ -212,7 +212,7 @@ export default Rest.setUrl(url+ id+'/'); Rest.put(params) .success(function () { - $state.go('notifications', {}, {reload: true}); + $state.go($state.current, null, {reload: true}); Wait('stop'); }) .error(function (data, status) { 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 0167b32d3f..5f2fb028a6 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', '$location', + 'ngToast', '$compile', '$filter', function( $rootScope,Wait, GenerateList, NotificationTemplatesList, GetBasePath, SearchInit, PaginateInit, Rest, ProcessErrors, Prompt, $state, GetChoices, Empty, Find, ngToast, - $compile, $filter, $location) { + $compile, $filter) { var scope = $rootScope.$new(), defaultUrl = GetBasePath('notification_templates'), list = NotificationTemplatesList, @@ -182,9 +182,10 @@ export default Rest.setUrl(url); Rest.destroy() .success(function () { - scope.search(list.iterator); - if (new RegExp('/' + id + '$').test($location.$$url)) { - $state.go('^'); + if (parseInt($state.params.notification_template_id) === id) { + $state.go("^", null, {reload: true}); + } else { + scope.search(list.iterator); } }) .error(function (data, status) { diff --git a/awx/ui/client/src/notifications/notification-templates-list/list.route.js b/awx/ui/client/src/notifications/notification-templates-list/list.route.js index 48678df468..de322316dc 100644 --- a/awx/ui/client/src/notifications/notification-templates-list/list.route.js +++ b/awx/ui/client/src/notifications/notification-templates-list/list.route.js @@ -8,7 +8,7 @@ import {templateUrl} from '../../shared/template-url/template-url.factory'; export default { name: 'notifications', - route: '/notifications', + route: '/notification_templates', templateUrl: templateUrl('notifications/notification-templates-list/list'), controller: 'notificationTemplatesListController' }; diff --git a/awx/ui/client/src/organizations/add/organizations-add.controller.js b/awx/ui/client/src/organizations/add/organizations-add.controller.js index ce71664a41..87c450e903 100644 --- a/awx/ui/client/src/organizations/add/organizations-add.controller.js +++ b/awx/ui/client/src/organizations/add/organizations-add.controller.js @@ -41,13 +41,8 @@ export default ['$scope', '$rootScope', '$compile', '$location', }) .success(function(data) { Wait('stop'); - $scope.$emit("ReloadOrganzationCards", data.id); - if (base === 'organizations') { - $rootScope.flashMessage = "New organization successfully created!"; - $location.path('/organizations/' + data.id); - } else { - ReturnToCaller(1); - } + $rootScope.$broadcast("EditIndicatorChange", "organizations", data.id); + $state.go('organizations.edit', {organization_id: data.id}, {reload: true}); }) .error(function(data, status) { ProcessErrors($scope, data, status, form, { @@ -58,7 +53,6 @@ export default ['$scope', '$rootScope', '$compile', '$location', }; $scope.formCancel = function() { - $scope.$emit("ReloadOrganzationCards"); $scope.$emit("ShowOrgListHeader"); $state.transitionTo('organizations'); }; diff --git a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js index aa6f727b86..8b63401a31 100644 --- a/awx/ui/client/src/organizations/edit/organizations-edit.controller.js +++ b/awx/ui/client/src/organizations/edit/organizations-edit.controller.js @@ -27,9 +27,9 @@ export default ['$scope', '$rootScope', '$compile', '$location', $scope.$parent.activeMode = 'edit'; - $scope.$emit("HideOrgListHeader"); + $scope.$parent.activeCard = parseInt(id); - $scope.$emit("ReloadOrganzationCards", id); + $scope.$emit("HideOrgListHeader"); $scope.organization_id = id; @@ -116,12 +116,11 @@ export default ['$scope', '$rootScope', '$compile', '$location', } Rest.setUrl(defaultUrl + id + '/'); Rest.put(params) - .success(function (data) { + .success(function () { Wait('stop'); $scope.organization_name = $scope.name; master = params; - $rootScope.flashMessage = "Your changes were successfully saved!"; - $scope.$emit("ReloadOrganzationCards", data.id); + $state.go($state.current, {}, {reload: true}); }) .error(function (data, status) { ProcessErrors($scope, data, status, OrganizationForm, { hdr: 'Error!', @@ -130,26 +129,22 @@ export default ['$scope', '$rootScope', '$compile', '$location', }; $scope.formCancel = function () { - $scope.$emit("ReloadOrganzationCards"); - $scope.$emit("ShowOrgListHeader"); $state.transitionTo('organizations'); + $scope.$emit("ShowOrgListHeader"); }; // Related set: Add button $scope.add = function (set) { - $rootScope.flashMessage = null; $location.path('/' + base + '/' + $stateParams.organization_id + '/' + set); }; // Related set: Edit button $scope.edit = function (set, id) { - $rootScope.flashMessage = null; $location.path('/' + set + '/' + id); }; // Related set: Delete button $scope['delete'] = function (set, itm_id, name, title) { - $rootScope.flashMessage = null; var action = function () { Wait('start'); diff --git a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js index a0ae7a28f0..388dbf55fe 100644 --- a/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js +++ b/awx/ui/client/src/organizations/linkout/addUsers/addUsers.controller.js @@ -65,7 +65,6 @@ export default ['$scope', '$rootScope', 'ProcessErrors', 'UserList', 'generateLi $q.all(requests) .then(function () { Wait('stop'); - $scope.$emit('ReloadOrganzationCards', $scope.$parent.org_id); $scope.$parent.search('user'); $scope.closeModal(); }, function (error) { diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js index 12d4baee54..f5eae34cee 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-admins.controller.js @@ -93,6 +93,7 @@ export default ['$stateParams', '$scope', 'UserList', 'Rest', '$state', 'generat }; $scope.formCancel = function(){ + $scope.$emit("ReloadOrgListView"); $state.go('organizations'); }; diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js index d7cf318f8c..3814e132f9 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-inventories.controller.js @@ -336,6 +336,7 @@ export default ['$scope', '$rootScope', '$location', '$log', }; $scope.formCancel = function(){ + $scope.$parent.activeCard = null; $state.go('organizations'); }; 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 1145b0b906..58a8c60a17 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 @@ -84,6 +84,7 @@ export default ['$scope', '$rootScope', '$location', '$log', }; $scope.formCancel = function(){ + $scope.$parent.activeCard = null; $state.go('organizations'); }; diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js index 94e84954af..b87be7045e 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js @@ -343,6 +343,7 @@ export default ['$scope', '$rootScope', '$location', '$log', }; $scope.formCancel = function(){ + $scope.$parent.activeCard = null; $state.go('organizations'); }; diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js index 442eb59e9e..c1518d2849 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-teams.controller.js @@ -87,6 +87,7 @@ export default ['$scope', '$rootScope', '$location', '$log', '$stateParams', }; $scope.formCancel = function(){ + $scope.$parent.activeCard = null; $state.go('organizations'); }; } diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js index cb77646ddc..80109a4f19 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-users.controller.js @@ -92,6 +92,7 @@ }; $scope.formCancel = function(){ + $scope.$parent.activeCard = null; $state.go('organizations'); }; diff --git a/awx/ui/client/src/organizations/list/organizations-list.controller.js b/awx/ui/client/src/organizations/list/organizations-list.controller.js index 65eb1062e9..18b0226519 100644 --- a/awx/ui/client/src/organizations/list/organizations-list.controller.js +++ b/awx/ui/client/src/organizations/list/organizations-list.controller.js @@ -27,9 +27,6 @@ export default ['$stateParams', '$scope', '$rootScope', '$location', var val = {}, url = '/#/organizations/' + card.id + '/'; val.name = card.name; val.id = card.id; - if (card.id + "" === cards.activeCard) { - val.isActiveCard = true; - } val.description = card.description || undefined; val.links = []; val.links.push({ @@ -73,14 +70,9 @@ export default ['$stateParams', '$scope', '$rootScope', '$location', }; $scope.$on("ReloadOrgListView", function() { - if ($state.$current.self.name === "organizations") { - delete $scope.activeCard; - if ($scope.orgCards) { - $scope.orgCards = $scope.orgCards.map(function(card) { - delete card.isActiveCard; - return card; - }); - } + if ($state.$current.self.name === "organizations" || + $state.$current.self.name === "organizations.add") { + $scope.activeCard = null; } }); @@ -118,10 +110,19 @@ export default ['$stateParams', '$scope', '$rootScope', '$location', Rest.setUrl(url); Rest.destroy() .success(function() { - if ($state.current.name !== "organzations") { - $state.transitionTo("organizations"); + Wait('stop'); + if ($state.current.name !== "organizations") { + if ($state.current + .name === 'organizations.edit' && + id === parseInt($state.params + .organization_id)) { + $state.go("organizations", {}, {reload: true}); + } else { + $state.go($state.current, {}, {reload: true}); + } + } else { + $state.go($state.current, {}, {reload: true}); } - $scope.$emit("ReloadOrganzationCards"); }) .error(function(data, status) { ProcessErrors($scope, data, status, null, { diff --git a/awx/ui/client/src/organizations/orgcards.block.less b/awx/ui/client/src/organizations/orgcards.block.less index 1446a16636..c9c82ccd25 100644 --- a/awx/ui/client/src/organizations/orgcards.block.less +++ b/awx/ui/client/src/organizations/orgcards.block.less @@ -19,6 +19,11 @@ margin-top: 10px; margin-bottom: 0px; } + +.OrgCards-search .TagSearch-bar { + margin-bottom: 0px; +} + .OrgCards .List-pagination{ width: 100%; } diff --git a/awx/ui/client/src/shared/list-generator/list-generator.factory.js b/awx/ui/client/src/shared/list-generator/list-generator.factory.js index e5970fb1c7..94ec78468e 100644 --- a/awx/ui/client/src/shared/list-generator/list-generator.factory.js +++ b/awx/ui/client/src/shared/list-generator/list-generator.factory.js @@ -172,8 +172,12 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate // respond to changes to the edit indicator from // the stateChangeStart event in app.js this.scope.$on("EditIndicatorChange", function(e, list, id) { - e.targetScope.listBeingEdited = list; - e.targetScope.rowBeingEdited = id; + if (list === "organizations") { + e.targetScope.activeCard = parseInt(id); + } else { + e.targetScope.listBeingEdited = list; + e.targetScope.rowBeingEdited = id; + } }); this.scope.$on("RemoveIndicator", function(e) { @@ -364,6 +368,9 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate } html += (list.searchRowActions) ? "