AC-331 Latest changes and cleanup from testing

This commit is contained in:
chouseknecht
2013-08-21 12:50:25 -04:00
parent b76bf268f9
commit 82833c848f
13 changed files with 216 additions and 161 deletions

View File

@@ -94,6 +94,11 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa
var defaultUrl = GetBasePath('inventory'); var defaultUrl = GetBasePath('inventory');
var form = InventoryForm; var form = InventoryForm;
var generator = GenerateForm; var generator = GenerateForm;
form.well = true,
form.formLabelSize = null;
form.formFieldSize = null;
var scope = generator.inject(form, {mode: 'add', related: false}); var scope = generator.inject(form, {mode: 'add', related: false});
scope.inventoryParseType = 'yaml'; scope.inventoryParseType = 'yaml';
@@ -398,7 +403,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
scope.inventoryEditHide = true; scope.inventoryEditHide = true;
scope.groupDeleteHide = false; scope.groupDeleteHide = false;
scope.createButtonShow = true; scope.createButtonShow = true;
//scope.group_id = node.attr('group_id'); scope.group_id = node.attr('group_id');
//scope.groupName = n.data; //scope.groupName = n.data;
//scope.groupTitle = '<h4>' + n.data + '</h4>'; //scope.groupTitle = '<h4>' + n.data + '</h4>';
//scope.groupTitle += (node.attr('description')) ? '<p>' + node.attr('description') + '</p>' : ''; //scope.groupTitle += (node.attr('description')) ? '<p>' + node.attr('description') + '</p>' : '';
@@ -413,7 +418,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
scope.createButtonShow = false; scope.createButtonShow = false;
//scope.groupName = 'All Hosts'; //scope.groupName = 'All Hosts';
//scope.groupTitle = '<h4>All Hosts</h4>'; //scope.groupTitle = '<h4>All Hosts</h4>';
//scope.group_id = null; scope.group_id = null;
} }
if (!scope.$$phase) { if (!scope.$$phase) {
@@ -463,20 +468,18 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
request: 'remove' }); request: 'remove' });
} */ } */
scope.showEvents = function(host_name, last_job) { scope.viewLastEvents = function(host_id, last_job, host_name, last_job_name) {
// When click on !Failed Events link, redirect to latest job/job_events for the host // Choose View-> Latest job events
Rest.setUrl(last_job); LoadBreadCrumbs({ path: '/jobs/' + last_job, title: last_job_name });
Rest.get() $location.url('/jobs/' + last_job + '/job_events/?host=' + escape(host_name));
.success( function(data, status, headers, config) {
LoadBreadCrumbs({ path: '/jobs/' + data.id, title: data.name });
$location.url('/jobs/' + data.id + '/job_events/?host=' + escape(host_name));
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
{ hdr: 'Error!', msg: 'Failed to lookup last job: ' + last_job + '. GET status: ' + status });
});
} }
scope.viewLastSummary = function(host_id, last_job, host_name, last_job_name) {
// Choose View-> Latest job events
LoadBreadCrumbs({ path: '/jobs/' + last_job, title: last_job_name });
$location.url('/jobs/' + last_job + '/job_host_summaries/?host=' + escape(host_name));
}
scope.toggleAllHosts = function() { scope.toggleAllHosts = function() {
scope.hostDeleteDisabled = (scope.toggleAllFlag) ? false : true; scope.hostDeleteDisabled = (scope.toggleAllFlag) ? false : true;
scope.hostDeleteDisabledClass = (scope.hostDeleteDisabled) ? "disabled" : ""; scope.hostDeleteDisabledClass = (scope.hostDeleteDisabled) ? "disabled" : "";

View File

@@ -35,6 +35,14 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams,
SearchInit({ scope: scope, set: 'jobhosts', list: list, url: defaultUrl }); SearchInit({ scope: scope, set: 'jobhosts', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl });
// Called from Inventories tab, host failed events link:
if ($routeParams.host) {
scope[list.iterator + 'SearchField'] = 'host';
scope[list.iterator + 'SearchValue'] = $routeParams.host;
scope[list.iterator + 'SearchFieldLabel'] = list.fields['host'].label;
}
scope.search(list.iterator); scope.search(list.iterator);
LoadBreadCrumbs(); LoadBreadCrumbs();

View File

@@ -14,19 +14,12 @@ angular.module('InventoryFormDefinition', [])
editTitle: '{{ inventory_name }}', editTitle: '{{ inventory_name }}',
name: 'inventory', name: 'inventory',
parseTypeName: 'inventoryParseType', parseTypeName: 'inventoryParseType',
well: false, well: true,
/*,
formLabelSize: 'col-lg-3', formLabelSize: 'col-lg-3',
formFieldSize: 'col-lg-9', formFieldSize: 'col-lg-9',*/
fields: { fields: {
has_active_failures: {
label: 'Status',
control: '<div class="job-failures-\{\{ has_active_failures \}\}">' +
'<i class="icon-exclamation-sign"></i> Contains hosts with failed jobs</div>',
type: 'custom',
ngShow: 'has_active_failures',
readonly: true
},
inventory_name: { inventory_name: {
realName: 'name', realName: 'name',
label: 'Name', label: 'Name',
@@ -116,18 +109,26 @@ angular.module('InventoryFormDefinition', [])
badgeShow: "\{\{ host.has_active_failures \}\}", badgeShow: "\{\{ host.has_active_failures \}\}",
badgeIcon: 'icon-exclamation-sign', badgeIcon: 'icon-exclamation-sign',
badgeToolTip: 'Most recent job failed', badgeToolTip: 'Most recent job failed',
badgePlacement: 'bottom' badgePlacement: 'bottom',
columnClass: 'col-lg-3'
}, },
/*description: {
label: 'Description',
ngClick: "editHost(\{\{ host.id \}\}, '\{\{ host.name \}\}')"
},*/
groups: { groups: {
label: 'Groups', label: 'Groups',
searchable: false, searchable: false,
sourceModel: 'groups', sourceModel: 'groups',
sourceField: 'name', sourceField: 'name',
nosort: true nosort: true
},
dropdown: {
type: 'DropDown',
label: 'View',
options: [
{ ngClick: 'viewJobs(\{\{ host.id \}\})', label: 'Jobs' },
{ ngClick: "viewLastEvents(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " +
"'\{\{ host.summary_fields.last_job.name \}\}')", label: 'Latest job events' },
{ ngClick: "viewLastSummary(\{\{ host.id \}\}, '\{\{ host.last_job \}\}', '\{\{ host.name \}\}', " +
"'\{\{ host.summary_fields.last_job.name \}\}')", label: 'Latest host summary' }
]
} }
}, },
fieldActions: { fieldActions: {

View File

@@ -341,14 +341,14 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
.factory('GroupsDelete', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm', .factory('GroupsDelete', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
'Prompt', 'ProcessErrors', 'GetBasePath', 'RefreshTree', 'Prompt', 'ProcessErrors', 'GetBasePath', 'RefreshTree', 'Wait',
function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors, function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
GetBasePath, RefreshTree) { GetBasePath, RefreshTree, Wait) {
return function(params) { return function(params) {
// Delete the selected group node. Disassociates it from its parent. // Delete the selected group node. Disassociates it from its parent.
var scope = params.scope; var scope = params.scope;
var group_id = params.group_id; var group_id = params.group_id;
var inventory_id = params.inventory_id; var inventory_id = params.inventory_id;
var obj = $('#tree-view li[group_id="' + group_id + '"]'); var obj = $('#tree-view li[group_id="' + group_id + '"]');
var parent = (obj.parent().last().prop('tagName') == 'LI') ? obj.parent().last() : obj.parent().parent().last(); var parent = (obj.parent().last().prop('tagName') == 'LI') ? obj.parent().last() : obj.parent().parent().last();
var url; var url;
@@ -360,16 +360,19 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
url = GetBasePath('inventory') + inventory_id + '/groups/'; url = GetBasePath('inventory') + inventory_id + '/groups/';
} }
var action_to_take = function() { var action_to_take = function() {
$('#prompt-modal').modal('hide');
Wait('start');
Rest.setUrl(url); Rest.setUrl(url);
Rest.post({ id: group_id, disassociate: 1 }) Rest.post({ id: group_id, disassociate: 1 })
.success( function(data, status, headers, config) { .success( function(data, status, headers, config) {
$('#prompt-modal').modal('hide');
scope.selectedNode = scope.selectedNode.parent().parent(); scope.selectedNode = scope.selectedNode.parent().parent();
RefreshTree({ scope: scope }); RefreshTree({ scope: scope });
Wait('stop');
}) })
.error( function(data, status, headers, config) { .error( function(data, status, headers, config) {
$('#prompt-modal').modal('hide'); //$('#prompt-modal').modal('hide');
RefreshTree({ scope: scope }); RefreshTree({ scope: scope });
Wait('stop');
ProcessErrors(scope, data, status, null, ProcessErrors(scope, data, status, null,
{ hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status }); { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status });
}); });

View File

@@ -179,7 +179,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
items: scope.treeController items: scope.treeController
} }
}); });
$(tree_id).bind("loaded.jstree", function () { $(tree_id).bind("loaded.jstree", function () {
scope['treeLoading'] = false; scope['treeLoading'] = false;
scope.$emit('treeLoaded'); scope.$emit('treeLoaded');
@@ -374,7 +374,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
// Call after GroupsEdit controller saves changes // Call after GroupsEdit controller saves changes
$('#tree-view').jstree('rename_node', node, name); $('#tree-view').jstree('rename_node', node, name);
node.attr('description', description); node.attr('description', description);
scope = angular.element(getElementById('htmlTemplate')).scope(); scope = angular.element(document.getElementById('htmlTemplate')).scope();
scope['selectedNodeName'] = name; scope['selectedNodeName'] = name;
} }
}]) }])
@@ -450,7 +450,11 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
var form = InventoryForm; var form = InventoryForm;
var defaultUrl=GetBasePath('inventory'); var defaultUrl=GetBasePath('inventory');
var scope = params.scope var scope = params.scope
form.well = false,
form.formLabelSize = 'col-lg-3';
form.formFieldSize = 'col-lg-9';
generator.inject(form, {mode: 'edit', modal: true, related: false}); generator.inject(form, {mode: 'edit', modal: true, related: false});
ParseTypeChange(scope,'inventory_variables', 'inventoryParseType'); ParseTypeChange(scope,'inventory_variables', 'inventoryParseType');

View File

@@ -112,6 +112,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
scope[iterator + 'Loading'] = true; scope[iterator + 'Loading'] = true;
scope[iterator + 'SearchParms'] = ''; scope[iterator + 'SearchParms'] = '';
var url = defaultUrl; var url = defaultUrl;
if ( (scope[iterator + 'SelectShow'] == false && scope[iterator + 'SearchValue'] != '' && scope[iterator + 'SearchValue'] != undefined) || if ( (scope[iterator + 'SelectShow'] == false && scope[iterator + 'SearchValue'] != '' && scope[iterator + 'SearchValue'] != undefined) ||
(scope[iterator + 'SelectShow'] && scope[iterator + 'SearchSelectValue']) || (scope[iterator + 'SelectShow'] && scope[iterator + 'SearchSelectValue']) ||
(list.fields[scope[iterator + 'SearchField']].searchType && list.fields[scope[iterator + 'SearchField']].searchType == 'gtzero') ) { (list.fields[scope[iterator + 'SearchField']].searchType && list.fields[scope[iterator + 'SearchField']].searchType == 'gtzero') ) {
@@ -156,6 +157,11 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
else { else {
scope[iterator + 'SearchParams'] = (sort_order) ? 'order_by=' + escape(sort_order) : ""; scope[iterator + 'SearchParams'] = (sort_order) ? 'order_by=' + escape(sort_order) : "";
} }
if (iterator == 'inventory' && scope.inventoryFailureFilter) {
scope[iterator + 'SearchParams'] += '&has_active_failures=true';
}
scope[iterator + 'Page'] = (page) ? parseInt(page) - 1 : 0; scope[iterator + 'Page'] = (page) ? parseInt(page) - 1 : 0;
if (/\/$/.test(url)) { if (/\/$/.test(url)) {
url += '?' + scope[iterator + 'SearchParams']; url += '?' + scope[iterator + 'SearchParams'];

View File

@@ -21,7 +21,11 @@ angular.module('InventoriesListDefinition', [])
fields: { fields: {
name: { name: {
key: true, key: true,
label: 'Name' label: 'Name',
badgeShow: "\{\{ inventory.has_active_failures \}\}",
badgeIcon: 'icon-exclamation-sign',
badgeToolTip: 'Contains hosts with active job failures',
badgePlacement: 'bottom'
}, },
description: { description: {
label: 'Description' label: 'Description'
@@ -32,7 +36,8 @@ angular.module('InventoriesListDefinition', [])
sourceModel: 'organization', sourceModel: 'organization',
sourceField: 'name', sourceField: 'name',
excludeModal: true excludeModal: true
}, }
/*,
has_active_failures: { has_active_failures: {
label: 'Failed Jobs?', label: 'Failed Jobs?',
showValue: false, showValue: false,
@@ -45,7 +50,7 @@ angular.module('InventoriesListDefinition', [])
searchType: 'boolean', searchType: 'boolean',
searchOptions: [{ name: "No", value: 0 }, { name: "Yes", value: 1 }], searchOptions: [{ name: "No", value: 0 }, { name: "Yes", value: 1 }],
excludeModal: true excludeModal: true
} }*/
}, },
actions: { actions: {

View File

@@ -179,8 +179,6 @@ a:hover {
text-decoration: none; text-decoration: none;
} }
.site-footer { .site-footer {
width: 100%; width: 100%;
padding-top: 20px; padding-top: 20px;
@@ -225,10 +223,6 @@ a:hover {
text-align: center; text-align: center;
} }
.login-header { .login-header {
text-align: center; text-align: center;
} }
@@ -620,7 +614,7 @@ input[type="text"].job-successful {
} }
.host-badge { .field-badge {
color: @red; color: @red;
font-size: 12px; font-size: 12px;
} }

View File

@@ -533,7 +533,7 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Hos
html += "<a href=\"\" class=\"activate\">" + data.results[i].name + "</a> "; html += "<a href=\"\" class=\"activate\">" + data.results[i].name + "</a> ";
html += "<a href=\"\" aw-tool-tip=\"Contains hosts with failed jobs\" ng-show=\"" + html += "<a href=\"\" aw-tool-tip=\"Contains hosts with failed jobs\" ng-show=\"" +
data.results[i].has_active_failures + "\" data-placement=\"bottom\">" + data.results[i].has_active_failures + "\" data-placement=\"bottom\">" +
"<i class=\"host-badge icon-exclamation-sign\"></i></a></li>\n"; "<i class=\"field-badge icon-exclamation-sign\"></i></a></li>\n";
} }
html = (html !== '') ? "<ul>" + html + "</ul>\n" : ""; html = (html !== '') ? "<ul>" + html + "</ul>\n" : "";
var compiled = $compile(html)(scope); var compiled = $compile(html)(scope);
@@ -580,7 +580,7 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Hos
"><a href=\"\" class=\"expand\"><i class=\"icon-caret-right\"></i></a> " + "><a href=\"\" class=\"expand\"><i class=\"icon-caret-right\"></i></a> " +
"<a href=\"\" class=\"activate active\">{{ treeData[0].name }}</a> " + "<a href=\"\" class=\"activate active\">{{ treeData[0].name }}</a> " +
"<a href=\"\" aw-tool-tip=\"Contains hosts with failed jobs\" ng-show=\"\{\{ treeData[0].failures \}\}\" data-placement=\"bottom\">" + "<a href=\"\" aw-tool-tip=\"Contains hosts with failed jobs\" ng-show=\"\{\{ treeData[0].failures \}\}\" data-placement=\"bottom\">" +
"<i class=\"host-badge icon-exclamation-sign\"></i></a>" + "<i class=\"field-badge icon-exclamation-sign\"></i></a>" +
"</li>\n" + "</li>\n" +
"</ul>\n"; "</ul>\n";
var compiled = $compile(html)(scope); var compiled = $compile(html)(scope);

View File

@@ -63,7 +63,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
// From here use 'scope' to manipulate the form, as the form is not in '$scope' // From here use 'scope' to manipulate the form, as the form is not in '$scope'
$compile(element)(this.scope); $compile(element)(this.scope);
if (!options.buildTree == false && !options.html) { if (!options.buildTree && !options.html) {
// Reset the scope to prevent displaying old data from our last visit to this form // Reset the scope to prevent displaying old data from our last visit to this form
for (var fld in form.fields) { for (var fld in form.fields) {
this.scope[fld] = null; this.scope[fld] = null;
@@ -72,6 +72,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
this.scope[set] = null; this.scope[set] = null;
} }
if ( ((!options.modal) && options.related) || this.form.forceListeners ) { if ( ((!options.modal) && options.related) || this.form.forceListeners ) {
console.log('adding listeners');
this.addListeners(); this.addListeners();
} }
if (options.mode == 'add') { if (options.mode == 'add') {
@@ -1052,20 +1053,6 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
} }
} }
html += "<td>";
html += "<div class=\"btn-group btn-group-sm\">\n";
html += "<button type=\"button\" class=\"btn btn-default btn-mini dropdown-toggle\" data-toggle=\"dropdown\">";
html += "View <span class=\"caret\"></span></button>\n";
html += "<ul class=\"dropdown-menu pull-right\" role=\"menu\" aria-labelledby=\"dropdownMenu1\">\n";
html += "<li role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" href=\"#\">Action</a></li>\n";
html += "<li role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" href=\"#\">Another action</a></li>\n";
html += "<li role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" href=\"#\">Something else here</a></li>\n";
html += "<li role=\"presentation\" class=\"divider\"></li>\n";
html += "<li role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" href=\"#\">Separated link</a></li>\n";
html += "</ul>\n";
html += "</div>\n";
html += "</td>\n";
html += "</tr>\n"; html += "</tr>\n";
// Message for when a related collection is empty // Message for when a related collection is empty

View File

@@ -91,7 +91,38 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
} }
}) })
.factory('Column', ['Attr', 'Icon', function(Attr, Icon) {
.factory('DropDown', ['Attr', 'Icon', function(Attr, Icon) {
return function(params) {
var list = params['list'];
var fld = params['fld'];
var options = params['options'];
var base = params['base'];
var field = list['fields'][fld];
html = "<td>\n";
html += "<div class=\"btn-group btn-group-sm\">\n";
html += "<button type=\"button\" class=\"btn btn-default btn-mini dropdown-toggle\" data-toggle=\"dropdown\">";
html += field.label;
html += " <span class=\"caret\"></span></button>\n";
html += "<ul class=\"dropdown-menu pull-right\" role=\"menu\" aria-labelledby=\"dropdownMenu1\">\n";
for (var i=0; i < field.options.length; i++) {
html += "<li role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" ";
html += "ng-click=\"" + field.options[i].ngClick + "\" ";
html += "href=\"\">" + field.options[i].label + "</a></li>\n";
}
html += "</ul>\n";
html += "</div>\n";
html += "</td>\n";
return html;
}
}])
.factory('Column', ['Attr', 'Icon', 'DropDown', function(Attr, Icon, DropDown) {
return function(params) { return function(params) {
var list = params['list']; var list = params['list'];
var fld = params['fld']; var fld = params['fld'];
@@ -101,93 +132,99 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
var field = list['fields'][fld]; var field = list['fields'][fld];
var html = ''; var html = '';
html += "<td class=\"" + fld + "-column"; if (field.type !== undefined && field.type == 'DropDown') {
html += (field['class']) ? " " + field['class'] : ""; html = DropDown(params);
html += (field['columnClass']) ? " " + field['columnClass'] : "";
html += "\" ";
html += (field.ngClass) ? Attr(field, 'ngClass') : "";
html += (options.mode == 'lookup' || options.mode == 'select') ? " ng-click=\"toggle_" + list.iterator +"({{ " + list.iterator + ".id }})\"" : "";
html += ">\n";
// Add ngShow
html += (field.ngShow) ? "<span " + Attr(field,'ngShow') + ">" : "";
// Add collapse/expand icon --used on job_events page
if (list['hasChildren'] && field.hasChildren) {
html += "<span class=\"level-\{\{ " + list.iterator + ".event_level \}\}\"><a href=\"\" ng-click=\"\{\{ " + list.iterator + ".ngclick \}\}\"> " +
"<i class=\"\{\{ " + list.iterator + ".ngicon \}\}\" ng-show=\"'\{\{ " +
list.iterator + ".related.children \}\}' !== ''\" ></i></a> ";
}
// Start the Link
if ((field.key || field.link || field.linkTo || field.ngClick ) && options['mode'] != 'lookup' && options['mode'] != 'select') {
if (field.linkTo) {
html += "<a href=\"#" + field.linkTo + "\">";
}
else if (field.ngClick) {
html += "<a href=\"\"" + Attr(field, 'ngClick') + "\">";
}
else if (field.link == undefined || field.link) {
html += "<a href=\"#/" + base + "/{{" + list.iterator + ".id }}\">";
}
}
// Add icon:
if (field.ngShowIcon) {
html += "<i ng-show=\"" + field.ngShowIcon + "\" class=\"" + field.icon + "\"></i> ";
} }
else { else {
if (field.icon) { html += "<td class=\"" + fld + "-column";
html += Icon(field.icon) + " "; html += (field['class']) ? " " + field['class'] : "";
} html += (field['columnClass']) ? " " + field['columnClass'] : "";
} html += "\" ";
html += (field.ngClass) ? Attr(field, 'ngClass') : "";
html += (options.mode == 'lookup' || options.mode == 'select') ? " ng-click=\"toggle_" + list.iterator +"({{ " + list.iterator + ".id }})\"" : "";
html += ">\n";
// Add data binds // Add ngShow
if (field.showValue == undefined || field.showValue == true) { html += (field.ngShow) ? "<span " + Attr(field,'ngShow') + ">" : "";
if (field.ngBind) {
html += "{{ " + field.ngBind + " }}"; // Add collapse/expand icon --used on job_events page
} if (list['hasChildren'] && field.hasChildren) {
else { html += "<span class=\"level-\{\{ " + list.iterator + ".event_level \}\}\"><a href=\"\" ng-click=\"\{\{ " + list.iterator + ".ngclick \}\}\"> " +
html += "{{" + list.iterator + "." + fld + "}}"; "<i class=\"\{\{ " + list.iterator + ".ngicon \}\}\" ng-show=\"'\{\{ " +
} list.iterator + ".related.children \}\}' !== ''\" ></i></a> ";
} }
// Add additional text:
if (field.text) {
html += field.text;
}
if (list['hasChildren'] && field.hasChildren) { // Start the Link
html += "</span>"; if ((field.key || field.link || field.linkTo || field.ngClick ) && options['mode'] != 'lookup' && options['mode'] != 'select') {
} if (field.linkTo) {
html += "<a href=\"#" + field.linkTo + "\">";
// close the link }
if ((field.key || field.link || field.linkTo || field.ngClick ) else if (field.ngClick) {
&& options.mode != 'lookup' && options.mode != 'select') { html += "<a href=\"\"" + Attr(field, 'ngClick') + "\">";
html += "</a>"; }
} else if (field.link == undefined || field.link) {
html += "<a href=\"#/" + base + "/{{" + list.iterator + ".id }}\">";
}
}
// close ngShow // Add icon:
html += (field.ngShow) ? "</span>" : ""; if (field.ngShowIcon) {
html += "<i ng-show=\"" + field.ngShowIcon + "\" class=\"" + field.icon + "\"></i> ";
// Specific to Job Events page -showing event detail/results
html += (field.appendHTML) ? "<div ng-show=\"" + field.appendHTML + " !== null\" " +
"ng-bind-html-unsafe=\"" + field.appendHTML + "\" " +
"class=\"level-\{\{ " + list.iterator + ".event_level \}\}-detail\" " +
"></div>\n" : "";
// Badge
if (field.badgeIcon) {
if (field.badgeToolTip) {
html += "<a href=\"\" aw-tool-tip=\"Most recent job failed\"";
html += (field.badgePlacement) ? " data-placement=\"" + field.badgePlacement + "\"" : "";
html += " ng-show=\"" + field.badgeShow + "\">";
html += " <i class=\"host-badge " + field.badgeIcon + "\"></i></a>\n";
} }
else { else {
html += " <i class=\"host-badge " + field.badgeIcon + "\" "; if (field.icon) {
html += "ng-show=\"" + field.badgeShow + "\"></i>\n"; html += Icon(field.icon) + " ";
} }
}
// Add data binds
if (field.showValue == undefined || field.showValue == true) {
if (field.ngBind) {
html += "{{ " + field.ngBind + " }}";
}
else {
html += "{{" + list.iterator + "." + fld + "}}";
}
}
// Add additional text:
if (field.text) {
html += field.text;
}
if (list['hasChildren'] && field.hasChildren) {
html += "</span>";
}
// close the link
if ((field.key || field.link || field.linkTo || field.ngClick )
&& options.mode != 'lookup' && options.mode != 'select') {
html += "</a>";
}
// close ngShow
html += (field.ngShow) ? "</span>" : "";
// Specific to Job Events page -showing event detail/results
html += (field.appendHTML) ? "<div ng-show=\"" + field.appendHTML + " !== null\" " +
"ng-bind-html-unsafe=\"" + field.appendHTML + "\" " +
"class=\"level-\{\{ " + list.iterator + ".event_level \}\}-detail\" " +
"></div>\n" : "";
// Badge
if (field.badgeIcon) {
if (field.badgeToolTip) {
html += "<a href=\"\" aw-tool-tip=\"" + field.badgeToolTip + "\"";
html += (field.badgePlacement) ? " data-placement=\"" + field.badgePlacement + "\"" : "";
html += (field.badgeShow) ? " ng-show=\"" + field.badgeShow + "\"" : ""
html += ">";
html += " <i class=\"field-badge " + field.badgeIcon + "\"></i></a>\n";
}
else {
html += " <i class=\"field-badge " + field.badgeIcon + "\" ";
html += "ng-show=\"" + field.badgeShow + "\"></i>\n";
}
}
} }
return html += "</td>\n"; return html += "</td>\n";
@@ -195,6 +232,7 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
} }
}]) }])
.factory('SearchWidget', function() { .factory('SearchWidget', function() {
return function(params) { return function(params) {
// //

View File

@@ -142,6 +142,7 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
if (options.mode != 'lookup' && (list.well == undefined || list.well == 'true')) { if (options.mode != 'lookup' && (list.well == undefined || list.well == 'true')) {
html += "<div class=\"well\">\n"; html += "<div class=\"well\">\n";
} }
if (options.mode == 'lookup' || options.id != undefined) { if (options.mode == 'lookup' || options.id != undefined) {
html += SearchWidget({ iterator: list.iterator, template: list, mini: true , size: 'col-lg-8' }); html += SearchWidget({ iterator: list.iterator, template: list, mini: true , size: 'col-lg-8' });
@@ -164,6 +165,12 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
} }
} }
} }
if (list.name == 'inventories' && options.mode !== 'select') {
html += "<label class=\"checkbox-inline pull-right\"><input type=\"checkbox\" ng-model=\"inventoryFailureFilter\" " +
"ng-change=\"search('inventory')\" > Show only inventories with failed jobs</label>\n";
}
//select instructions //select instructions
if (options.mode == 'select' && list.selectInstructions) { if (options.mode == 'select' && list.selectInstructions) {
var btn = { var btn = {

View File

@@ -104,26 +104,25 @@
</head> </head>
<body> <body>
<div class="navbar navbar-inverse navbar-fixed-top main-menu"> <div class="navbar navbar-inverse navbar-fixed-top main-menu" role="navigation">
<div class="container"> <div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#organizations"><img class="logo" src="{{ STATIC_URL }}img/logo.png" /></a> <a class="navbar-brand" href="#organizations"><img class="logo" src="{{ STATIC_URL }}img/logo.png" /></a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse"> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> </button>
</button> </div>
<div class="nav-collapse navbar-responsive-collapse">
<div class="nav-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav pull-right"> <ul class="nav navbar-nav pull-right">
<li ng-show="current_user.username != null && current_user.username != undefined"> <li ng-show="current_user.username != null && current_user.username != undefined">
<a href="" ng-click="viewCurrentUser()" ng-bind="'Hello! ' + current_user.username"></a></li> <a href="" ng-click="viewCurrentUser()" ng-bind="'Hello! ' + current_user.username"></a></li>
<li ng-show="userLoggedIn == true"><a href="" ng-click="viewLicense()">View License</a></li> <li ng-show="userLoggedIn == true"><a href="" ng-click="viewLicense()">View License</a></li>
<li ng-show="userLoggedIn == true"><a href="#/logout">Logout</a></li> <li ng-show="userLoggedIn == true"><a href="#/logout">Logout</a></li>
</ul> </ul>
</div><!-- nav-collapse --> </div><!-- nav-collapse -->
</div><!-- container --> </div>
</div><!-- navbar --> </div><!-- navbar -->
<div class="container main-container"> <div class="container main-container">
@@ -219,7 +218,7 @@
<div class="modal-body" id="form-modal-body"></div> <div class="modal-body" id="form-modal-body"></div>
<div class="modal-footer"> <div class="modal-footer">
<button ng-show="formModalInfo !== undefined && formModalInfo != ''" ng-click="formModalInfoAction()" <button ng-show="formModalInfo !== undefined && formModalInfo != ''" ng-click="formModalInfoAction()"
class="btn btn-mini pull-left"><i class="icon-zoom-in"></i> <span ng-bind="formModalInfo"></span></button> class="btn btn-sm pull-left"><i class="icon-zoom-in"></i> <span ng-bind="formModalInfo"></span></button>
<a href="#" ng-show="formModalCancelShow" data-target="#form-modal" data-dismiss="modal" class="btn btn-default">Cancel</a> <a href="#" ng-show="formModalCancelShow" data-target="#form-modal" data-dismiss="modal" class="btn btn-default">Cancel</a>
<a href="" ng-bind="formModalActionLabel" ng-click="formModalAction()" ng-disabled="formModalActionDisabled" class="btn btn-primary"></a> <a href="" ng-bind="formModalActionLabel" ng-click="formModalAction()" ng-disabled="formModalActionDisabled" class="btn btn-primary"></a>
</div> </div>
@@ -238,7 +237,7 @@
<div class="modal-body" id="form-modal2-body"></div> <div class="modal-body" id="form-modal2-body"></div>
<div class="modal-footer"> <div class="modal-footer">
<a href="" ng-bind="formModal2Info" ng-show="formModal2Info !== undefined && formModal2Info != ''" ng-click="formModal2InfoAction()" <a href="" ng-bind="formModal2Info" ng-show="formModal2Info !== undefined && formModal2Info != ''" ng-click="formModal2InfoAction()"
class="btn btn-small pull-left"><i class="icon-zoom-in"></i> <span ng-bind="formModal2Info"></span></a> class="btn btn-sm pull-left"><i class="icon-zoom-in"></i> <span ng-bind="formModal2Info"></span></a>
<a href="#" ng-show="formModal2CancelShow" data-target="#form-modal2" data-dismiss="modal" class="btn btn-default">Cancel</a> <a href="#" ng-show="formModal2CancelShow" data-target="#form-modal2" data-dismiss="modal" class="btn btn-default">Cancel</a>
<a href="" ng-bind="formModal2ActionLabel" ng-click="formModal2Action()" class="btn btn-primary"></a> <a href="" ng-bind="formModal2ActionLabel" ng-click="formModal2Action()" class="btn btn-primary"></a>
</div> </div>