From 0f4a4b6cb971adf74f9eaf16ae1bc8f47a258d75 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Fri, 17 May 2013 06:38:37 -0400 Subject: [PATCH] Key column on a list view is now clickable -taking you to the detail page. Moved action buttons to top of page next to search widget. Added finishing touches to job submission on job_templates list view. --- lib/ui/static/css/ansible-ui.css | 13 +++++++++- lib/ui/static/js/controllers/JobTemplates.js | 13 +++++++--- lib/ui/static/js/lists/Admins.js | 1 + lib/ui/static/js/lists/Credentials.js | 2 +- lib/ui/static/js/lists/Groups.js | 2 +- lib/ui/static/js/lists/Hosts.js | 2 +- lib/ui/static/js/lists/Inventories.js | 2 +- lib/ui/static/js/lists/JobTemplates.js | 2 +- lib/ui/static/js/lists/Organizations.js | 2 +- lib/ui/static/js/lists/Projects.js | 2 +- lib/ui/static/js/lists/Teams.js | 2 +- lib/ui/static/js/lists/Users.js | 4 +-- lib/ui/static/lib/ansible/list-generator.js | 27 +++++++++++++++----- 13 files changed, 53 insertions(+), 21 deletions(-) diff --git a/lib/ui/static/css/ansible-ui.css b/lib/ui/static/css/ansible-ui.css index 9ce20cb80b..8700722dbb 100644 --- a/lib/ui/static/css/ansible-ui.css +++ b/lib/ui/static/css/ansible-ui.css @@ -231,4 +231,15 @@ .no-padding { margin: 0; padding: 0; - } \ No newline at end of file + } + + .search-widget { + display: inline-block; + } + + .list-actions { + display: inline-block; + vertical-align: top; + margin-left: 15px; + margin-top: 3px; + } diff --git a/lib/ui/static/js/controllers/JobTemplates.js b/lib/ui/static/js/controllers/JobTemplates.js index 0b13b71feb..c41e0e5b96 100644 --- a/lib/ui/static/js/controllers/JobTemplates.js +++ b/lib/ui/static/js/controllers/JobTemplates.js @@ -128,6 +128,7 @@ function JobTemplatesList ($scope, $rootScope, $location, $log, $routeParams, Re function postJob(data) { // Once we have a credential and all required passwords, use this // to create and start a job + (scope.credentialWatchRemove) ? scope.credentialWatchRemove() : null; var dt = new Date().toISOString(); Rest.setUrl(data.related.jobs); Rest.post({ @@ -165,13 +166,17 @@ function JobTemplatesList ($scope, $rootScope, $location, $log, $routeParams, Re // Create a job record if (data.credential == '' || data.credential == null) { // Template does not have credential, prompt for one - scope.$watch('credential', function(newVal, oldVal) { + if (scope.credentialWatchRemove) { + scope.credentialWatchRemove(); + } + scope.credentialWatchRemove = scope.$watch('credential', function(newVal, oldVal) { if (newVal !== oldVal) { - console.log('credential is: ' + scope.credential); // After user selects a credential from the modal, // submit the job - data.credential = scope.credential; - postJob(data); + if (scope.credential != '' && scope.credential !== null && scope.credential !== undefined) { + data.credential = scope.credential; + postJob(data); + } } }); LookUpInit({ diff --git a/lib/ui/static/js/lists/Admins.js b/lib/ui/static/js/lists/Admins.js index 9134b86da3..e936ebc386 100644 --- a/lib/ui/static/js/lists/Admins.js +++ b/lib/ui/static/js/lists/Admins.js @@ -15,6 +15,7 @@ angular.module('AdminListDefinition', []) selectTitle: 'Add Administrators', editTitle: 'Admins', selectInstructions: 'Click the Select checkbox next to each user to be added. Click the Finished button when done.', + base: 'users', fields: { username: { diff --git a/lib/ui/static/js/lists/Credentials.js b/lib/ui/static/js/lists/Credentials.js index a12b6d6c75..a0980fc58e 100644 --- a/lib/ui/static/js/lists/Credentials.js +++ b/lib/ui/static/js/lists/Credentials.js @@ -44,7 +44,7 @@ angular.module('CredentialsListDefinition', []) mode: 'all', // One of: edit, select, all ngClick: 'addCredential()', basePaths: ['credentials'], // base path must be in list, or action not available - class: 'btn btn-mini btn-success', + class: 'btn btn-success', awToolTip: 'Create a new credential' } }, diff --git a/lib/ui/static/js/lists/Groups.js b/lib/ui/static/js/lists/Groups.js index 1b5e23cf20..e8d01e08cb 100644 --- a/lib/ui/static/js/lists/Groups.js +++ b/lib/ui/static/js/lists/Groups.js @@ -31,7 +31,7 @@ angular.module('GroupListDefinition', []) icon: 'icon-plus', mode: 'all', // One of: edit, select, all ngClick: 'addGroup()', - class: 'btn btn-mini btn-success', + class: 'btn btn-success', awToolTip: 'Create a new group' } }, diff --git a/lib/ui/static/js/lists/Hosts.js b/lib/ui/static/js/lists/Hosts.js index 173b3cc0b5..029940628b 100644 --- a/lib/ui/static/js/lists/Hosts.js +++ b/lib/ui/static/js/lists/Hosts.js @@ -31,7 +31,7 @@ angular.module('HostListDefinition', []) icon: 'icon-plus', mode: 'all', // One of: edit, select, all ngClick: 'addHost()', - class: 'btn btn-mini btn-success', + class: 'btn btn-success', awToolTip: 'Create a new host' } }, diff --git a/lib/ui/static/js/lists/Inventories.js b/lib/ui/static/js/lists/Inventories.js index c95e6afed3..e4edb30578 100644 --- a/lib/ui/static/js/lists/Inventories.js +++ b/lib/ui/static/js/lists/Inventories.js @@ -37,7 +37,7 @@ angular.module('InventoriesListDefinition', []) icon: 'icon-plus', mode: 'all', // One of: edit, select, all ngClick: 'addInventory()', - class: 'btn btn-mini btn-success', + class: 'btn btn-success', awToolTip: 'Create a new row' } }, diff --git a/lib/ui/static/js/lists/JobTemplates.js b/lib/ui/static/js/lists/JobTemplates.js index 70c50c612d..1c30d4d498 100644 --- a/lib/ui/static/js/lists/JobTemplates.js +++ b/lib/ui/static/js/lists/JobTemplates.js @@ -31,7 +31,7 @@ angular.module('JobTemplatesListDefinition', []) icon: 'icon-plus', mode: 'all', // One of: edit, select, all ngClick: 'addJobTemplate()', - class: 'btn btn-mini btn-success', + class: 'btn btn-success', basePaths: ['job_templates'], awToolTip: 'Create a new template' } diff --git a/lib/ui/static/js/lists/Organizations.js b/lib/ui/static/js/lists/Organizations.js index 449f0e6a8d..39bf8ffeca 100644 --- a/lib/ui/static/js/lists/Organizations.js +++ b/lib/ui/static/js/lists/Organizations.js @@ -30,7 +30,7 @@ angular.module('OrganizationListDefinition', []) icon: 'icon-plus', mode: 'all', // One of: edit, select, all ngClick: 'addOrganization()', - class: 'btn btn-mini btn-success', + class: 'btn btn-success', awToolTip: 'Create a new row' } }, diff --git a/lib/ui/static/js/lists/Projects.js b/lib/ui/static/js/lists/Projects.js index 923468209e..2ac0f48871 100644 --- a/lib/ui/static/js/lists/Projects.js +++ b/lib/ui/static/js/lists/Projects.js @@ -31,7 +31,7 @@ angular.module('ProjectsListDefinition', []) icon: 'icon-plus', mode: 'all', // One of: edit, select, all ngClick: 'addProject()', - class: 'btn btn-mini btn-success', + class: 'btn btn-success', awToolTip: 'Create a new project' } }, diff --git a/lib/ui/static/js/lists/Teams.js b/lib/ui/static/js/lists/Teams.js index ab4fd1e1ce..6fe15044af 100644 --- a/lib/ui/static/js/lists/Teams.js +++ b/lib/ui/static/js/lists/Teams.js @@ -37,7 +37,7 @@ angular.module('TeamsListDefinition', []) icon: 'icon-plus', mode: 'all', // One of: edit, select, all ngClick: 'addTeam()', - class: 'btn btn-mini btn-success', + class: 'btn btn-success', awToolTip: 'Create a new team' } }, diff --git a/lib/ui/static/js/lists/Users.js b/lib/ui/static/js/lists/Users.js index a23125d6f8..17169af4d1 100644 --- a/lib/ui/static/js/lists/Users.js +++ b/lib/ui/static/js/lists/Users.js @@ -15,7 +15,7 @@ angular.module('UserListDefinition', []) selectTitle: 'Add Users', editTitle: 'Users', selectInstructions: 'Check the Select checkbox next to each user to be added, and click Finished when done. Use the green button to create a new user.', - editInstructions: 'Create new users from the Organizations tab. Each Organizaton has an associated list of Users.', + editInstructions: 'Create new users from the Organizations tab. Each Organization has an associated list of Users.', fields: { username: { @@ -36,7 +36,7 @@ angular.module('UserListDefinition', []) mode: 'select', // One of: edit, select, all ngClick: 'addUser()', basePaths: ['organizations'], // base path must be in list, or action not available - class: 'btn btn-mini btn-success', + class: 'btn btn-success', awToolTip: 'Create a new user' } }, diff --git a/lib/ui/static/lib/ansible/list-generator.js b/lib/ui/static/lib/ansible/list-generator.js index d3a6997b37..1a28851f24 100644 --- a/lib/ui/static/lib/ansible/list-generator.js +++ b/lib/ui/static/lib/ansible/list-generator.js @@ -129,19 +129,20 @@ angular.module('ListGenerator', ['GeneratorHelpers',]) if (options.mode != 'lookup') { //actions base = $location.path().replace(/^\//,'').split('/')[0]; - html += "
\n"; + html += "
\n"; for (action in list.actions) { if (list.actions[action].mode == 'all' || list.actions[action].mode == options.mode) { if ( (list.basePaths == undefined) || (list.basePaths && list.basePaths.indexOf(base) > -1) ) { html += "\n"; + html += " \n"; } html += "
\n"; } @@ -174,14 +175,27 @@ angular.module('ListGenerator', ['GeneratorHelpers',]) html += ">\n"; html += "{{ $index + (" + list.iterator + "Page * " + list.iterator + "PageSize) + 1 }}.\n"; var cnt = 2; + var base = (list.base) ? list.base : list.name; for (fld in list.fields) { cnt++; if (! list.fields[fld].ngBind) { - html += "{{" + list.iterator + "." + fld + "}}\n"; + html += ""; + if (list.fields[fld].key) { + html += ""; + } + html += "{{" + list.iterator + "." + fld + "}}"; + html += (list.fields[fld].key) ? "" : ""; + html += "\n"; } else { - html += "{{ " + list.fields[fld].ngBind + " }}\n"; - } + html += ""; + if (list.fields[fld].key) { + html += ""; + } + html += "{{ " + list.fields[fld].ngBind + " }}"; + html += (list.fields[fld].key) ? "" : ""; + html += "\n"; + } } if (options.mode == 'select' ) { @@ -226,6 +240,7 @@ angular.module('ListGenerator', ['GeneratorHelpers',]) else { html += PaginateWidget({ set: list.name, iterator: list.iterator, mini: true }); } + console.log(html); return html; }