diff --git a/ansibleworks/ui/static/css/ansible-ui.css b/ansibleworks/ui/static/css/ansible-ui.css index 49ef34b97f..ee17742332 100644 --- a/ansibleworks/ui/static/css/ansible-ui.css +++ b/ansibleworks/ui/static/css/ansible-ui.css @@ -306,4 +306,3 @@ } /* End Jobs Page */ - diff --git a/ansibleworks/ui/static/js/controllers/Credentials.js b/ansibleworks/ui/static/js/controllers/Credentials.js index adc130c45f..4e04125131 100644 --- a/ansibleworks/ui/static/js/controllers/Credentials.js +++ b/ansibleworks/ui/static/js/controllers/Credentials.js @@ -19,8 +19,8 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res var list = CredentialList; var defaultUrl = GetBasePath('credentials'); var view = GenerateList; - var paths = $location.path().replace(/^\//,'').split('/'); - var mode = (paths[0] == 'credentials') ? 'edit' : 'select'; // if base path 'credentials', we're here to add/edit + var base = $location.path().replace(/^\//,'').split('/')[0]; + var mode = (base == 'credentials') ? 'edit' : 'select'; // if base path 'credentials', we're here to add/edit var scope = view.inject(CredentialList, { mode: mode }); // Inject our view scope.selected = []; @@ -62,8 +62,9 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res } scope.finishSelection = function() { - Rest.setUrl(GetBasePath('base') + $location.path() + '/'); // We're assuming the path matches the api path. - // Will this always be true?? + var url = GetBasePath(base); + url += (base == 'users') ? $routeParams.user_id + '/credentials/' : $routeParams.team_id + '/credentials/'; + Rest.setUrl(url); scope.queue = []; scope.$on('callFinished', function() { @@ -77,13 +78,6 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res for (var i=0; i < scope.queue.length; i++) { if (scope.queue[i].result == 'error') { errors++; - // there is no way to know which user raised the error. no data comes - // back from the api call. - // $('td.username-column').each(function(index) { - // if ($(this).text() == scope.queue[i].username) { - // $(this).addClass("error"); - // } - // }); } } if (errors > 0) { diff --git a/ansibleworks/ui/static/js/controllers/Groups.js b/ansibleworks/ui/static/js/controllers/Groups.js index cbe73d0da8..f2b1fb5ed6 100644 --- a/ansibleworks/ui/static/js/controllers/Groups.js +++ b/ansibleworks/ui/static/js/controllers/Groups.js @@ -24,7 +24,22 @@ function GroupsList ($scope, $rootScope, $location, $log, $routeParams, Rest, var scope = view.inject(GroupList, { mode: 'select' }); // Inject our view scope.selected = []; - + + if (scope.PostRefreshRemove) { + scope.PostRefreshRemove(); + } + scope.PostRefresRemove = scope.$on('PostRefresh', function() { + if ($routeParams.group_id) { + // Remove the current group from the list of available groups, thus + // preventing a group from being added to itself + for (var i=0; i < scope.groups.length; i++) { + if (scope.groups[i].id == $routeParams.group_id) { + scope.groups.splice(i,1); + } + } + } + }); + SearchInit({ scope: scope, set: 'groups', list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl }); scope.search(list.iterator); diff --git a/ansibleworks/ui/static/js/controllers/Inventories.js b/ansibleworks/ui/static/js/controllers/Inventories.js index 2d811aab6a..f566fb0fe0 100644 --- a/ansibleworks/ui/static/js/controllers/Inventories.js +++ b/ansibleworks/ui/static/js/controllers/Inventories.js @@ -12,12 +12,12 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, InventoryList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, - ClearScope, ProcessErrors) + ClearScope, ProcessErrors, GetBasePath) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. var list = InventoryList; - var defaultUrl = '/api/v1/inventories/'; + var defaultUrl = GetBasePath('inventory'); var view = GenerateList; var paths = $location.path().replace(/^\//,'').split('/'); var mode = (paths[0] == 'inventories') ? 'edit' : 'select'; // if base path 'users', we're here to add/edit users @@ -141,7 +141,8 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res } InventoriesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'InventoryList', 'GenerateList', - 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors' ]; + 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', + 'GetBasePath' ]; function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm, diff --git a/ansibleworks/ui/static/js/controllers/JobTemplates.js b/ansibleworks/ui/static/js/controllers/JobTemplates.js index 5e7f18f95b..8d19da714f 100644 --- a/ansibleworks/ui/static/js/controllers/JobTemplates.js +++ b/ansibleworks/ui/static/js/controllers/JobTemplates.js @@ -512,7 +512,7 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route // Related set: Edit button scope.edit = function(set, id, name) { $rootScope.flashMessage = null; - $location.path('/' + base + '/' + $routeParams.id + '/' + set + '/' + id); + $location.path('/' + set + '/' + id); }; // Related set: Delete button diff --git a/ansibleworks/ui/static/js/controllers/Jobs.js b/ansibleworks/ui/static/js/controllers/Jobs.js index fd6e6475f3..a4f555431a 100644 --- a/ansibleworks/ui/static/js/controllers/Jobs.js +++ b/ansibleworks/ui/static/js/controllers/Jobs.js @@ -219,6 +219,12 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, scope[fld] = data[fld]; } } + + if (data.status != 'new') { + $('input[type="text"], textarea').attr('readonly','readonly'); + $('select').prop('disabled', 'disabled'); + $('.lookup-btn').prop('disabled', 'disabled'); + } scope.url = data.url; var related = data.related; diff --git a/ansibleworks/ui/static/js/forms/JobTemplates.js b/ansibleworks/ui/static/js/forms/JobTemplates.js index be89205d96..9334225253 100644 --- a/ansibleworks/ui/static/js/forms/JobTemplates.js +++ b/ansibleworks/ui/static/js/forms/JobTemplates.js @@ -13,6 +13,7 @@ angular.module('JobTemplateFormDefinition', []) addTitle: 'Create Job Templates', //Legend in add mode editTitle: '{{ name }}', //Legend in edit mode name: 'job_templates', + twoColumns: true, well: true, fields: { @@ -20,13 +21,15 @@ angular.module('JobTemplateFormDefinition', []) label: 'Name', type: 'text', addRequired: true, - editRequired: true + editRequired: true, + column: 1 }, description: { label: 'Description', type: 'text', addRequired: false, - editRequired: false + editRequired: false, + column: 1 }, job_type: { label: 'Job Type', @@ -34,7 +37,8 @@ angular.module('JobTemplateFormDefinition', []) ngOptions: 'type.label for type in job_type_options', default: 'run', addRequired: true, - editRequired: true + editRequired: true, + column: 1 }, inventory: { label: 'Inventory', @@ -43,7 +47,8 @@ angular.module('JobTemplateFormDefinition', []) sourceField: 'name', addRequired: true, editRequired: true, - ngClick: 'lookUpInventory()' + ngClick: 'lookUpInventory()', + column: 1 }, project: { label: 'Project', @@ -53,6 +58,7 @@ angular.module('JobTemplateFormDefinition', []) addRequired: true, editRequired: true, ngClick: 'lookUpProject()', + column: 1 }, playbook: { label: 'Playbook', @@ -60,7 +66,8 @@ angular.module('JobTemplateFormDefinition', []) ngOptions: 'book for book in playbook_options', id: 'playbook-select', addRequired: true, - editRequired: true + editRequired: true, + column: 1 }, credential: { label: 'Credential', @@ -69,7 +76,8 @@ angular.module('JobTemplateFormDefinition', []) sourceField: 'name', ngClick: 'lookUpCredential()', addRequired: false, - editRequired: false + editRequired: false, + column: 1 }, forks: { label: 'Forks', @@ -79,13 +87,15 @@ angular.module('JobTemplateFormDefinition', []) max: 100, default: 0, addRequired: false, - editRequired: false + editRequired: false, + column: 2 }, limit: { label: 'Limit', type: 'text', addRequired: false, - editRequired: false + editRequired: false, + column: 2 }, verbosity: { label: 'Verbosity', @@ -95,15 +105,17 @@ angular.module('JobTemplateFormDefinition', []) min: 0, max: 3, addRequired: false, - editRequired: false + editRequired: false, + column: 2 }, extra_vars: { label: 'Extra Variables', type: 'textarea', rows: 6, - class: 'span4', + class: 'span12', addRequired: false, - editRequired: false + editRequired: false, + column: 2 } }, diff --git a/ansibleworks/ui/static/js/forms/Jobs.js b/ansibleworks/ui/static/js/forms/Jobs.js index ed05c2b09d..4b0fc601ed 100644 --- a/ansibleworks/ui/static/js/forms/Jobs.js +++ b/ansibleworks/ui/static/js/forms/Jobs.js @@ -15,7 +15,6 @@ angular.module('JobFormDefinition', []) name: 'jobs', well: true, twoColumns: true, - allowReadonly: true, fields: { name: { @@ -113,7 +112,7 @@ angular.module('JobFormDefinition', []) label: 'Extra Variables', type: 'textarea', rows: 6, - class: 'span5', + class: 'span12', addRequired: false, editRequired: false, column: 2 diff --git a/ansibleworks/ui/static/js/forms/Organizations.js b/ansibleworks/ui/static/js/forms/Organizations.js index 407f1e8ec4..089c2e81c4 100644 --- a/ansibleworks/ui/static/js/forms/Organizations.js +++ b/ansibleworks/ui/static/js/forms/Organizations.js @@ -93,6 +93,7 @@ angular.module('OrganizationFormDefinition', []) title: 'Administrators', iterator: 'admin', // Singular form of name (e.g. thing) open: false, // Open accordion on load? + base: '/users', actions: { // Actions displayed top right of list add: { ngClick: "add('admins')", diff --git a/ansibleworks/ui/static/js/forms/Users.js b/ansibleworks/ui/static/js/forms/Users.js index 6cde143c3d..1709ecc651 100644 --- a/ansibleworks/ui/static/js/forms/Users.js +++ b/ansibleworks/ui/static/js/forms/Users.js @@ -89,6 +89,7 @@ angular.module('UserFormDefinition', []) title: 'Admin of Organizations', iterator: 'adminof', // Singular form of name (e.g. thing) open: false, // Open accordion on load? + base: '/organizations', fields: { name: { diff --git a/ansibleworks/ui/static/js/helpers/related-search.js b/ansibleworks/ui/static/js/helpers/related-search.js index f275d9138c..f65f70f52a 100644 --- a/ansibleworks/ui/static/js/helpers/related-search.js +++ b/ansibleworks/ui/static/js/helpers/related-search.js @@ -34,6 +34,8 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities','RefreshRelat } scope[form.related[set].iterator + 'SearchType'] = 'contains'; scope[form.related[set].iterator + 'SearchTypeLabel'] = 'Contains'; + scope[form.related[set].iterator + 'SelectShow'] = false; + scope[form.related[set].iterator + 'HideSearchType'] = false; } // Functions to handle search widget changes diff --git a/ansibleworks/ui/static/lib/ansible/form-generator.js b/ansibleworks/ui/static/lib/ansible/form-generator.js index f8526e96bd..bd8ece5c7a 100644 --- a/ansibleworks/ui/static/lib/ansible/form-generator.js +++ b/ansibleworks/ui/static/lib/ansible/form-generator.js @@ -365,7 +365,7 @@ angular.module('FormGenerator', ['GeneratorHelpers']) html += "' + "\n"; html += "
\n"; html += "
\n"; - html += "\n"; + html += "\n"; html += "" : ""; html += "
\n"; html += "
\n"; } @@ -477,7 +478,8 @@ angular.module('FormGenerator', ['GeneratorHelpers']) var button = this.form.buttons[btn]; //button html += "