diff --git a/awx/ui/client/features/applications/edit-applications.controller.js b/awx/ui/client/features/applications/edit-applications.controller.js index f7369d9023..b028eddaa3 100644 --- a/awx/ui/client/features/applications/edit-applications.controller.js +++ b/awx/ui/client/features/applications/edit-applications.controller.js @@ -83,7 +83,7 @@ function EditApplicationsController (models, $state, strings, $scope) { }; vm.form.organization._resource = 'organization'; - vm.form.organization._route = 'applications.add.organization'; + vm.form.organization._route = 'applications.edit.organization'; vm.form.organization._model = organization; vm.form.organization._placeholder = strings.get('SELECT AN ORGANIZATION'); diff --git a/awx/ui/client/features/applications/index.js b/awx/ui/client/features/applications/index.js index 4844b90609..00a2ef4b99 100644 --- a/awx/ui/client/features/applications/index.js +++ b/awx/ui/client/features/applications/index.js @@ -203,6 +203,59 @@ function ApplicationsRun ($stateExtender, strings) { } }); + $stateExtender.addState({ + name: 'applications.edit.organization', + url: '/organization?selected', + searchPrefix: 'organization', + params: { + organization_search: { + value: { + page_size: 5, + order_by: 'name', + role_level: 'admin_role' + }, + dynamic: true, + squash: '' + } + }, + data: { + basePath: 'organizations', + formChildState: true + }, + ncyBreadcrumb: { + skip: true + }, + views: { + 'organization@applications.edit': { + templateProvider: (ListDefinition, generateList) => { + const html = generateList.build({ + mode: 'lookup', + list: ListDefinition, + input_type: 'radio' + }); + + return `${html}`; + } + } + }, + resolve: { + ListDefinition: ['OrganizationList', list => list], + Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', + (list, qs, $stateParams, GetBasePath) => qs.search( + GetBasePath('organizations'), + $stateParams[`${list.iterator}_search`] + ) + ] + }, + onExit ($state) { + if ($state.transition) { + $('#form-modal').modal('hide'); + $('.modal-backdrop').remove(); + $('body').removeClass('modal-open'); + } + } + }); + $stateExtender.addState({ name: 'applications.edit.permissions', route: '/permissions?{permission_search:queryset}',