From 064a04cf169fd9cc38c00682508d349bd667e552 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 31 Mar 2016 10:43:29 -0400 Subject: [PATCH] update to perm ui for rbac branch --- awx/ui/client/src/controllers/Projects.js | 20 +------- awx/ui/client/src/forms/Projects.js | 61 +++++------------------ 2 files changed, 13 insertions(+), 68 deletions(-) diff --git a/awx/ui/client/src/controllers/Projects.js b/awx/ui/client/src/controllers/Projects.js index c75cc5193f..c848b4d524 100644 --- a/awx/ui/client/src/controllers/Projects.js +++ b/awx/ui/client/src/controllers/Projects.js @@ -480,25 +480,7 @@ export function ProjectsAdd(Refresh, $scope, $rootScope, $compile, $location, $l url: $scope.current_url }); - var id = data.id, - url = GetBasePath('projects') + id + '/organizations/', - org = { id: $scope.organization }; - Rest.setUrl(url); - Rest.post(org) - .success(function () { - Wait('stop'); - $rootScope.flashMessage = "New project successfully created!"; - if (base === 'projects') { - ReturnToCaller(); - } - else { - ReturnToCaller(1); - } - }) - .error(function (data, status) { - ProcessErrors($scope, data, status, form, { hdr: 'Error!', - msg: 'Failed to add organization to project. POST returned status: ' + status }); - }); + $state.go("^"); }) .error(function (data, status) { Wait('stop'); diff --git a/awx/ui/client/src/forms/Projects.js b/awx/ui/client/src/forms/Projects.js index aa39d4bd7d..69f34cdbaa 100644 --- a/awx/ui/client/src/forms/Projects.js +++ b/awx/ui/client/src/forms/Projects.js @@ -151,6 +151,17 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) editRequired: false, subForm: 'sourceSubForm' }, + organization: { + label: 'Organization', + type: 'lookup', + sourceModel: 'organization', + sourceField: 'name', + ngClick: 'lookUpOrganization()', + awRequiredWhen: { + variable: "organizationrequired", + init: "true" + } + }, credential: { label: 'SCM Credential', type: 'lookup', @@ -234,50 +245,6 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) }, related: { - organizations: { - type: 'collection', - title: 'Organizations', - iterator: 'organization', - index: false, - open: false, - - actions: { - add: { - ngClick: "add('organizations')", - label: 'Add', - awToolTip: 'Add an organization', - actionClass: 'btn List-buttonSubmit', - buttonContent: '+ ADD' - } - }, - - fields: { - name: { - key: true, - label: 'Name' - }, - description: { - label: 'Description' - } - }, - - fieldActions: { - edit: { - label: 'Edit', - ngClick: "edit('organizations', organization.id, organization.name)", - icon: 'icon-edit', - awToolTip: 'Edit the organization', - 'class': 'btn btn-default' - }, - "delete": { - label: 'Delete', - ngClick: "delete('organizations', organization.id, organization.name, 'organization')", - icon: 'icon-trash', - "class": 'btn-danger', - awToolTip: 'Delete the organization' - } - } - }, permissions: { type: 'collection', title: 'Permissions', @@ -314,13 +281,9 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) relatedSets: function(urls) { return { - organizations: { - iterator: 'organization', - url: urls.organizations - }, permissions: { iterator: 'permission', - url: urls.resource_access_list + url: urls.access_list } }; }