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.

This commit is contained in:
chouseknecht 2013-05-17 06:38:37 -04:00
parent 66f93364b1
commit 0f4a4b6cb9
13 changed files with 53 additions and 21 deletions

View File

@ -231,4 +231,15 @@
.no-padding {
margin: 0;
padding: 0;
}
}
.search-widget {
display: inline-block;
}
.list-actions {
display: inline-block;
vertical-align: top;
margin-left: 15px;
margin-top: 3px;
}

View File

@ -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({

View File

@ -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: {

View File

@ -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'
}
},

View File

@ -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'
}
},

View File

@ -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'
}
},

View File

@ -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'
}
},

View File

@ -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'
}

View File

@ -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'
}
},

View File

@ -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'
}
},

View File

@ -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'
}
},

View File

@ -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 <i class=\"icon-plus\"></i> 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'
}
},

View File

@ -129,19 +129,20 @@ angular.module('ListGenerator', ['GeneratorHelpers',])
if (options.mode != 'lookup') {
//actions
base = $location.path().replace(/^\//,'').split('/')[0];
html += "<div class=\"text-right\">\n";
html += "<div class=\"list-actions\">\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 += "<button " + this.attr(list.actions[action], 'ngClick') +
this.attr(list.actions[action], 'class');
"class=\"btn-small " + list.actions[action].class + "\" ";
html += (list.actions[action].awToolTip) ? this.attr(list.actions[action],'awToolTip') : "";
html += " >" + this.icon(list.actions[action].icon) + "</button> ";
}
}
}
if (options.mode == 'select') {
html += " <button class=\"btn btn-mini btn-success\" ng-click=\"finishSelection()\"><i class=\"icon-ok\"></i> Finished</button>\n";
html += " <button class=\"btn btn-small btn-success\" aw-tool-tip=\"Complete your selection\" " +
"ng-click=\"finishSelection()\"><i class=\"icon-ok\"></i> Finished</button>\n";
}
html += "</div>\n";
}
@ -174,14 +175,27 @@ angular.module('ListGenerator', ['GeneratorHelpers',])
html += ">\n";
html += "<td class=\"index-column\">{{ $index + (" + list.iterator + "Page * " + list.iterator + "PageSize) + 1 }}.</td>\n";
var cnt = 2;
var base = (list.base) ? list.base : list.name;
for (fld in list.fields) {
cnt++;
if (! list.fields[fld].ngBind) {
html += "<td class=\"" + fld + "-column\">{{" + list.iterator + "." + fld + "}}</td>\n";
html += "<td class=\"" + fld + "-column\">";
if (list.fields[fld].key) {
html += "<a href=\"#/" + base + "/{{" + list.iterator + ".id }}\">";
}
html += "{{" + list.iterator + "." + fld + "}}";
html += (list.fields[fld].key) ? "</a>" : "";
html += "</td>\n";
}
else {
html += "<td class=\"" + fld + "-column\">{{ " + list.fields[fld].ngBind + " }}</td>\n";
}
html += "<td class=\"" + fld + "-column\">";
if (list.fields[fld].key) {
html += "<a href=\"#/" + base + "/{{" + list.iterator + ".id }}\">";
}
html += "{{ " + list.fields[fld].ngBind + " }}";
html += (list.fields[fld].key) ? "</a>" : "";
html += "</td>\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;
}