From 85ab5821554ce6f994e7f059c0c2778239098a5d Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Mon, 24 Jun 2013 11:43:10 -0400 Subject: [PATCH] UI clean-up --- awx/ui/static/css/ansible-ui.css | 15 +++---- awx/ui/static/js/controllers/Credentials.js | 8 ++++ awx/ui/static/js/controllers/Inventories.js | 1 + awx/ui/static/js/controllers/JobEvents.js | 1 + awx/ui/static/js/controllers/JobTemplates.js | 1 + awx/ui/static/js/controllers/Jobs.js | 1 + awx/ui/static/js/controllers/Projects.js | 42 +++++++++++--------- awx/ui/static/js/controllers/Teams.js | 4 ++ awx/ui/static/js/controllers/Users.js | 1 + awx/ui/static/js/forms/JobEvents.js | 1 + awx/ui/static/lib/ansible/form-generator.js | 4 +- 11 files changed, 53 insertions(+), 26 deletions(-) diff --git a/awx/ui/static/css/ansible-ui.css b/awx/ui/static/css/ansible-ui.css index 1372a91da7..9751c10b02 100644 --- a/awx/ui/static/css/ansible-ui.css +++ b/awx/ui/static/css/ansible-ui.css @@ -465,21 +465,21 @@ /* form displayed in modal window */ -.modal .form-horizontal .control-label { +.horizontal-narrow .control-label { float: left; width: 80px; padding-top: 5px; text-align: right; } -.modal .form-horizontal .controls { +.horizontal-narrow .controls { *display: inline-block; *padding-left: 20px; margin-left: 100px; *margin-left: 0; } -.modal .form-horizontal .controls:first-child { +.horizontal-narrow .controls:first-child { *padding-left: 100px; } @@ -490,10 +490,11 @@ /* overrides to TB modal */ .modal-header { - padding: 10px 10; + padding: 15px 10px; border-bottom: 1px solid #eee; - background-color: #36454F; - color: #A9A9A9; + /* background-color: #A9A9A9; #/ + /*color: #36454F;*/ + color: #2078be; -webkit-border-top-left-radius: 3px; -moz-border-top-left-radius: 3px; border-top-left-radius: 3px; @@ -514,7 +515,7 @@ .modal-header h3 { font-size: 22px; - font-weight: normal; + font-weight: bold; margin: 0; text-rendering: optimizeLegibility; } diff --git a/awx/ui/static/js/controllers/Credentials.js b/awx/ui/static/js/controllers/Credentials.js index 5f19b903c6..64c5eac5af 100644 --- a/awx/ui/static/js/controllers/Credentials.js +++ b/awx/ui/static/js/controllers/Credentials.js @@ -218,6 +218,14 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); } } + + // Click clear button + scope.clear = function(fld, associated) { + scope[fld] = ''; + scope[associated] = ''; + scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); + } + } CredentialsAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'CredentialForm', 'GenerateForm', diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index 601ac6cf59..40c1bdeb0e 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -23,6 +23,7 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res var mode = (paths[0] == 'inventories') ? 'edit' : 'select'; // if base path 'users', we're here to add/edit users var scope = view.inject(InventoryList, { mode: mode }); // Inject our view scope.selected = []; + $rootScope.flashMessage = null; if (scope.PostRefreshRemove) { scope.PostRefreshRemove(); diff --git a/awx/ui/static/js/controllers/JobEvents.js b/awx/ui/static/js/controllers/JobEvents.js index 6d36622cff..33f478740e 100644 --- a/awx/ui/static/js/controllers/JobEvents.js +++ b/awx/ui/static/js/controllers/JobEvents.js @@ -23,6 +23,7 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest, var view = GenerateList; var base = $location.path().replace(/^\//,'').split('/')[0]; var scope = view.inject(list, { mode: 'edit' }); + $rootScope.flashMessage = null; scope.selected = []; if (scope.RemovePostRefresh) { diff --git a/awx/ui/static/js/controllers/JobTemplates.js b/awx/ui/static/js/controllers/JobTemplates.js index 7586041d7e..9b2e56e9d3 100644 --- a/awx/ui/static/js/controllers/JobTemplates.js +++ b/awx/ui/static/js/controllers/JobTemplates.js @@ -23,6 +23,7 @@ function JobTemplatesList ($scope, $rootScope, $location, $log, $routeParams, Re var base = $location.path().replace(/^\//,'').split('/')[0]; var mode = (base == 'job_templates') ? 'edit' : 'select'; var scope = view.inject(list, { mode: mode }); + $rootScope.flashMessage = null; scope.selected = []; if (scope.PostRefreshRemove) { diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index 72b6b21f49..e56a60178c 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -20,6 +20,7 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest, var view = GenerateList; var base = $location.path().replace(/^\//,'').split('/')[0]; var scope = view.inject(list, { mode: 'edit' }); + $rootScope.flashMessage = null; scope.selected = []; if (scope.PostRefreshRemove) { diff --git a/awx/ui/static/js/controllers/Projects.js b/awx/ui/static/js/controllers/Projects.js index 7ca5f3f343..bfdee9a6e9 100644 --- a/awx/ui/static/js/controllers/Projects.js +++ b/awx/ui/static/js/controllers/Projects.js @@ -23,6 +23,7 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, var mode = (base == 'projects') ? 'edit' : 'select'; var scope = view.inject(list, { mode: mode }); scope.selected = []; + $rootScope.flashMessage = null; if (scope.PostRefreshRemove) { scope.PostRefreshRemove(); @@ -181,6 +182,7 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam Rest.setUrl(url); Rest.post(data) .success( function(data, status, headers, config) { + $rootScope.flashMessage = "New project successfully created!"; (base == 'projects') ? ReturnToCaller() : ReturnToCaller(1); }) .error( function(data, status, headers, config) { @@ -268,6 +270,7 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara // Save changes to the parent scope.formSave = function() { + $rootScope.flashMessage = null; var params = {}; for (var fld in form.fields) { params[fld] = scope[fld]; @@ -285,6 +288,7 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara // Reset the form scope.formReset = function() { + $rootScope.flashMessage = null; generator.reset(); for (var fld in master) { scope[fld] = master[fld]; @@ -293,36 +297,38 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara // Related set: Add button scope.add = function(set) { + $rootScope.flashMessage = null; $location.path('/' + base + '/' + $routeParams.id + '/' + set); }; // Related set: Edit button scope.edit = function(set, id, name) { + $rootScope.flashMessage = null; $location.path('/' + base + '/' + $routeParams.id + '/' + set + '/' + id); }; // Related set: Delete button scope['delete'] = function(set, itm_id, name, title) { var action = function() { - var url = GetBasePath('projects') + id + '/' + set + '/'; - Rest.setUrl(url); - Rest.post({ id: itm_id, disassociate: 1 }) - .success( function(data, status, headers, config) { - $('#prompt-modal').modal('hide'); - scope.search(form.related[set].iterator); - }) - .error( function(data, status, headers, config) { - $('#prompt-modal').modal('hide'); - ProcessErrors(scope, data, status, null, - { hdr: 'Error!', msg: 'Call to ' + url + ' failed. POST returned status: ' + status }); - }); - }; + var url = GetBasePath('projects') + id + '/' + set + '/'; + $rootScope.flashMessage = null; + Rest.setUrl(url); + Rest.post({ id: itm_id, disassociate: 1 }) + .success( function(data, status, headers, config) { + $('#prompt-modal').modal('hide'); + scope.search(form.related[set].iterator); + }) + .error( function(data, status, headers, config) { + $('#prompt-modal').modal('hide'); + ProcessErrors(scope, data, status, null, + { hdr: 'Error!', msg: 'Call to ' + url + ' failed. POST returned status: ' + status }); + }); + }; - Prompt({ hdr: 'Delete', - body: 'Are you sure you want to remove ' + name + ' from ' + scope.name + ' ' + title + '?', - action: action - }); - + Prompt({ hdr: 'Delete', + body: 'Are you sure you want to remove ' + name + ' from ' + scope.name + ' ' + title + '?', + action: action + }); } } diff --git a/awx/ui/static/js/controllers/Teams.js b/awx/ui/static/js/controllers/Teams.js index 72df9aeaab..01bc1d8980 100644 --- a/awx/ui/static/js/controllers/Teams.js +++ b/awx/ui/static/js/controllers/Teams.js @@ -182,6 +182,7 @@ function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, var form = TeamForm; var generator = GenerateForm; var scope = generator.inject(form, {mode: 'add', related: false}); + $rootScope.flashMessage = null; generator.reset(); LoadBreadCrumbs(); TeamLookUpOrganizationInit({ scope: scope }); @@ -195,6 +196,7 @@ function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, } Rest.post(data) .success( function(data, status, headers, config) { + $rootScope.flashMessage = "New team successfully created!"; $location.path('/teams/' + data.id); }) .error( function(data, status, headers, config) { @@ -286,6 +288,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, // Save changes to the parent scope.formSave = function() { + $rootScope.flashMessage = null; Rest.setUrl(defaultUrl + $routeParams.id +'/'); var data = {} for (var fld in form.fields) { @@ -304,6 +307,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, // Cancel scope.formReset = function() { + $rootScope.flashMessage = null; generator.reset(); for (var fld in master) { scope[fld] = master[fld]; diff --git a/awx/ui/static/js/controllers/Users.js b/awx/ui/static/js/controllers/Users.js index 132007f250..00e882898c 100644 --- a/awx/ui/static/js/controllers/Users.js +++ b/awx/ui/static/js/controllers/Users.js @@ -281,6 +281,7 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, // Save changes to the parent scope.formSave = function() { + $rootScope.flashMessage = null; Rest.setUrl(defaultUrl + id + '/'); var data = {} for (var fld in form.fields) { diff --git a/awx/ui/static/js/forms/JobEvents.js b/awx/ui/static/js/forms/JobEvents.js index ab44787dce..58a7c927ac 100644 --- a/awx/ui/static/js/forms/JobEvents.js +++ b/awx/ui/static/js/forms/JobEvents.js @@ -12,6 +12,7 @@ angular.module('JobEventFormDefinition', []) editTitle: '{{ id }} - {{ event }}', //Legend in edit mode name: 'job_events', + "class": 'horizontal-narrow', well: false, fields: { diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 05618fde87..64c45bfcfb 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -522,7 +522,9 @@ angular.module('FormGenerator', ['GeneratorHelpers']) html += "
\n"; } - html += "
' + "\n"; + html += "' + "\n"; html += "
{{ flashMessage }}
\n"; var field;