mirror of
https://github.com/ansible/awx.git
synced 2026-05-06 17:07:36 -02:30
AC-234 create organizaions via Projects Tab
This commit is contained in:
@@ -101,6 +101,9 @@ angular.module('ansible', [
|
|||||||
when('/projects/:project_id/organizations',
|
when('/projects/:project_id/organizations',
|
||||||
{ templateUrl: urlPrefix + 'partials/projects.html', controller: OrganizationsList }).
|
{ templateUrl: urlPrefix + 'partials/projects.html', controller: OrganizationsList }).
|
||||||
|
|
||||||
|
when('/projects/:project_id/organizations/add',
|
||||||
|
{ templateUrl: urlPrefix + 'partials/projects.html', controller: OrganizationsAdd }).
|
||||||
|
|
||||||
when('/inventories',
|
when('/inventories',
|
||||||
{ templateUrl: urlPrefix + 'partials/inventories.html', controller: InventoriesList }).
|
{ templateUrl: urlPrefix + 'partials/inventories.html', controller: InventoriesList }).
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $route
|
|||||||
// Inject dynamic view
|
// Inject dynamic view
|
||||||
var form = GenerateForm;
|
var form = GenerateForm;
|
||||||
var scope = form.inject(OrganizationForm, {mode: 'add', related: false});
|
var scope = form.inject(OrganizationForm, {mode: 'add', related: false});
|
||||||
|
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||||
var defaultUrl = GetBasePath('organizations');
|
var defaultUrl = GetBasePath('organizations');
|
||||||
form.reset();
|
form.reset();
|
||||||
|
|
||||||
@@ -145,12 +146,19 @@ function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $route
|
|||||||
|
|
||||||
// Save
|
// Save
|
||||||
scope.formSave = function() {
|
scope.formSave = function() {
|
||||||
Rest.setUrl(defaultUrl);
|
var url = GetBasePath(base);
|
||||||
|
url += (base != 'organizations') ? $routeParams['project_id'] + '/organizations/' : '';
|
||||||
|
Rest.setUrl(url);
|
||||||
Rest.post({ name: $scope.name,
|
Rest.post({ name: $scope.name,
|
||||||
description: $scope.description })
|
description: $scope.description })
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
$rootScope.flashMessage = "New organization successfully created!";
|
if (base == 'organizations') {
|
||||||
$location.path('/organizations/' + data.id);
|
$rootScope.flashMessage = "New organization successfully created!";
|
||||||
|
$location.path('/organizations/' + data.id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ReturnToCaller(1);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
ProcessErrors(scope, data, status, OrganizationForm,
|
ProcessErrors(scope, data, status, OrganizationForm,
|
||||||
|
|||||||
Reference in New Issue
Block a user