mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 18:51:06 -03:30
AC-503 latest cloud inventory changes
This commit is contained in:
@@ -128,6 +128,12 @@ function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
var type = node.attr('type');
|
var type = node.attr('type');
|
||||||
var url;
|
var url;
|
||||||
|
|
||||||
|
if ($rootScope.timer) {
|
||||||
|
// Kill any linger timers from the inventory summary page
|
||||||
|
clearInterval($rootScope.timer);
|
||||||
|
$rootScope.timer = null;
|
||||||
|
}
|
||||||
|
|
||||||
scope['nodeSelectValue'] = n;
|
scope['nodeSelectValue'] = n;
|
||||||
scope['selectedNode'] = node;
|
scope['selectedNode'] = node;
|
||||||
scope['selectedNodeName'] = node.attr('name');
|
scope['selectedNodeName'] = node.attr('name');
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'GroupListDefinition',
|
angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'GroupListDefinition',
|
||||||
'SearchHelper', 'PaginateHelper', 'ListGenerator', 'AuthService', 'GroupsHelper',
|
'SearchHelper', 'PaginateHelper', 'ListGenerator', 'AuthService', 'GroupsHelper',
|
||||||
'InventoryHelper', 'SelectionHelper', 'JobSubmissionHelper'
|
'InventoryHelper', 'SelectionHelper', 'JobSubmissionHelper', 'RefreshHelper'
|
||||||
])
|
])
|
||||||
|
|
||||||
.factory('getSourceTypeOptions', [ function() {
|
.factory('getSourceTypeOptions', [ function() {
|
||||||
@@ -56,7 +56,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
GetBasePath('inventory') + inventory_id + '/groups/';
|
GetBasePath('inventory') + inventory_id + '/groups/';
|
||||||
|
|
||||||
SelectionInit({ scope: scope, list: list, url: url });
|
SelectionInit({ scope: scope, list: list, url: url });
|
||||||
var finish = scope.formModalAction;
|
|
||||||
scope.formModalAction = function() {
|
scope.formModalAction = function() {
|
||||||
var groups = [];
|
var groups = [];
|
||||||
for (var j=0; j < scope.selected.length; j++) {
|
for (var j=0; j < scope.selected.length; j++) {
|
||||||
@@ -94,6 +94,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var finish = scope.formModalAction;
|
||||||
|
|
||||||
if (scope.PostRefreshRemove) {
|
if (scope.PostRefreshRemove) {
|
||||||
scope.PostRefreshRemove();
|
scope.PostRefreshRemove();
|
||||||
}
|
}
|
||||||
@@ -123,6 +125,112 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
|
|
||||||
|
.factory('InventoryStatus', [ '$rootScope', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventorySummary',
|
||||||
|
'GenerateList', 'ClearScope', 'SearchInit', 'PaginateInit', 'Refresh', 'InventoryUpdate',
|
||||||
|
function($rootScope, Rest, Alert, ProcessErrors, GetBasePath, FormatDate, InventorySummary, GenerateList, ClearScope, SearchInit,
|
||||||
|
PaginateInit, Refresh, InventoryUpdate) {
|
||||||
|
return function(params) {
|
||||||
|
//Build a summary of a given inventory
|
||||||
|
|
||||||
|
ClearScope('tree-form');
|
||||||
|
|
||||||
|
$('#tree-form').hide().empty();
|
||||||
|
var view = GenerateList;
|
||||||
|
var list = InventorySummary;
|
||||||
|
var scope = view.inject(InventorySummary, { mode: 'summary', id: 'tree-form', breadCrumbs: false });
|
||||||
|
var defaultUrl = GetBasePath('inventory') + scope['inventory_id'] + '/inventory_sources/';
|
||||||
|
|
||||||
|
if (scope.PostRefreshRemove) {
|
||||||
|
scope.PostRefreshRemove();
|
||||||
|
}
|
||||||
|
scope.PostRefreshRemove = scope.$on('PostRefresh', function() {
|
||||||
|
for (var i=0; i < scope.groups.length; i++) {
|
||||||
|
var last_update = (scope.groups[i].last_updated == null) ? '' : FormatDate(new Date(scope.groups[i].last_updated));
|
||||||
|
var source = 'Manual';
|
||||||
|
var stat;
|
||||||
|
var stat_class;
|
||||||
|
|
||||||
|
switch (scope.groups[i].status) {
|
||||||
|
case 'never updated':
|
||||||
|
stat = 'never';
|
||||||
|
stat_class = 'never';
|
||||||
|
break;
|
||||||
|
case 'none':
|
||||||
|
stat = 'n/a';
|
||||||
|
stat_class = 'na';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
stat = scope.groups[i].status;
|
||||||
|
stat_class = stat;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (scope.groups[i].source) {
|
||||||
|
case 'file':
|
||||||
|
source = 'File';
|
||||||
|
break;
|
||||||
|
case 'ec2':
|
||||||
|
source = 'Amazon EC2';
|
||||||
|
break;
|
||||||
|
case 'rackspace':
|
||||||
|
source = 'Rackspace';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
scope.groups[i].status = stat;
|
||||||
|
scope.groups[i].source = source;
|
||||||
|
scope.groups[i].last_updated = last_update;
|
||||||
|
scope.groups[i].status_class = stat_class;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
SearchInit({ scope: scope, set: 'groups', list: list, url: defaultUrl });
|
||||||
|
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
||||||
|
scope.search(list.iterator);
|
||||||
|
|
||||||
|
scope.refresh = function() {
|
||||||
|
scope['groupSearchSpin'] = true;
|
||||||
|
scope['groupLoading'] = true;
|
||||||
|
Refresh({ scope: scope, set: 'groups', iterator: 'group', url: scope['current_url'] });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the update process
|
||||||
|
scope.updateGroup = function(id) {
|
||||||
|
for (var i=0; i < scope.groups.length; i++) {
|
||||||
|
if (scope.groups[i].id == id) {
|
||||||
|
if (scope.groups[i].source == "" || scope.groups[i].source == null) {
|
||||||
|
Alert('Missing Configuration', 'The selected group is not configured for updates. You must first edit the group, provide Source settings, ' +
|
||||||
|
'and then run an update.', 'alert-info');
|
||||||
|
}
|
||||||
|
else if (scope.groups[i].status == 'updating') {
|
||||||
|
Alert('Update in Progress', 'The inventory update process is currently running for group <em>' +
|
||||||
|
scope.groups[i].summary_fields.group.name + '</em>. Use the Refresh button to monitor the status.', 'alert-info');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (scope.groups[i].source == 'Amazon EC2') {
|
||||||
|
scope.sourceUsernameLabel = 'Access Key ID';
|
||||||
|
scope.sourcePasswordLabel = 'Secret Access Key';
|
||||||
|
scope.sourcePasswordConfirmLabel = 'Confirm Secret Access Key';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
scope.sourceUsernameLabel = 'Username';
|
||||||
|
scope.sourcePasswordLabel = 'Password';
|
||||||
|
scope.sourcePasswordConfirmLabel = 'Confirm Password';
|
||||||
|
}
|
||||||
|
InventoryUpdate({
|
||||||
|
scope: scope,
|
||||||
|
group_id: id,
|
||||||
|
url: scope.groups[i].related.update,
|
||||||
|
group_name: scope.groups[i].summary_fields.group.name,
|
||||||
|
group_source: scope.groups[i].source
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
|
|
||||||
.factory('GroupsAdd', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
|
.factory('GroupsAdd', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm',
|
||||||
'Prompt', 'ProcessErrors', 'GetBasePath', 'RefreshTree', 'ParseTypeChange', 'GroupsEdit',
|
'Prompt', 'ProcessErrors', 'GetBasePath', 'RefreshTree', 'ParseTypeChange', 'GroupsEdit',
|
||||||
function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
|
function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'CredentialFormDefinition', 'CredentialsListDefinition',
|
angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'CredentialFormDefinition', 'CredentialsListDefinition',
|
||||||
'LookUpHelper', 'ProjectFormDefinition', 'JobSubmissionHelper', 'GroupFormDefinition'])
|
'LookUpHelper', 'ProjectFormDefinition', 'JobSubmissionHelper', 'GroupFormDefinition', 'GroupsHelper' ])
|
||||||
|
|
||||||
.factory('PromptPasswords', ['CredentialForm', 'JobTemplateForm', 'ProjectsForm', '$compile', 'Rest', '$location', 'ProcessErrors', 'GetBasePath',
|
.factory('PromptPasswords', ['CredentialForm', 'JobTemplateForm', 'ProjectsForm', '$compile', 'Rest', '$location', 'ProcessErrors', 'GetBasePath',
|
||||||
'Alert',
|
'Alert',
|
||||||
@@ -107,7 +107,9 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
fld = passwords[i];
|
fld = passwords[i];
|
||||||
scope[fld] = '';
|
scope[fld] = '';
|
||||||
html += "<div class=\"form-group\">\n";
|
html += "<div class=\"form-group\">\n";
|
||||||
html += "<label class=\"control-label col-lg-3 normal-weight\" for=\"" + fld + '">* ' + field.label + '</label>' + "\n";
|
html += "<label class=\"control-label col-lg-3 normal-weight\" for=\"" + fld + "\">* ";
|
||||||
|
html += (field.labelBind) ? scope[field.labelBind] : field.label;
|
||||||
|
html += "</label>\n";
|
||||||
html += "<div class=\"col-lg-9\">\n";
|
html += "<div class=\"col-lg-9\">\n";
|
||||||
html += "<input type=\"password\" ";
|
html += "<input type=\"password\" ";
|
||||||
html += "ng-model=\"" + fld + '" ';
|
html += "ng-model=\"" + fld + '" ';
|
||||||
@@ -128,7 +130,9 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
field = (form.fields[field.associated]) ? form.fields[field.associated] : ProjectsForm.fields[field.associated];
|
field = (form.fields[field.associated]) ? form.fields[field.associated] : ProjectsForm.fields[field.associated];
|
||||||
scope[fld] = '';
|
scope[fld] = '';
|
||||||
html += "<div class=\"form-group\">\n";
|
html += "<div class=\"form-group\">\n";
|
||||||
html += "<label class=\"control-label col-lg-3 normal-weight\" for=\"" + fld + '">* ' + field.label + '</label>' + "\n";
|
html += "<label class=\"control-label col-lg-3 normal-weight\" for=\"" + fld + "\">* ";
|
||||||
|
html += (field.labelBind) ? scope[field.labelBind] : field.label;
|
||||||
|
html += "</label>\n";
|
||||||
html += "<div class=\"col-lg-9\">\n";
|
html += "<div class=\"col-lg-9\">\n";
|
||||||
html += "<input type=\"password\" ";
|
html += "<input type=\"password\" ";
|
||||||
html += "ng-model=\"" + fld + '" ';
|
html += "ng-model=\"" + fld + '" ';
|
||||||
@@ -357,8 +361,9 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
|
|
||||||
|
|
||||||
// Sumbit Inventory Update request
|
// Sumbit Inventory Update request
|
||||||
.factory('InventoryUpdate',['PromptPasswords', '$compile', 'Rest', '$location', 'GetBasePath', 'ProcessErrors', 'Alert', 'GroupForm',
|
.factory('InventoryUpdate',['PromptPasswords', '$compile', 'Rest', '$location', 'GetBasePath', 'ProcessErrors', 'Alert',
|
||||||
function(PromptPasswords, $compile, Rest, $location, GetBasePath, ProcessErrors, Alert, GroupForm) {
|
'GroupForm', 'InventorySummary',
|
||||||
|
function(PromptPasswords, $compile, Rest, $location, GetBasePath, ProcessErrors, Alert, GroupForm, InventorySummary) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
|
|
||||||
var scope = params.scope;
|
var scope = params.scope;
|
||||||
@@ -370,7 +375,10 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
}
|
}
|
||||||
scope.removeUpdateSubmitted = scope.$on('UpdateSubmitted', function() {
|
scope.removeUpdateSubmitted = scope.$on('UpdateSubmitted', function() {
|
||||||
// Refresh the project list after update request submitted
|
// Refresh the project list after update request submitted
|
||||||
scope.refresh();
|
//$location.path(GetBasePath('inventories') + inventory_id + '/groups'
|
||||||
|
InventorySummary({ scope: scope });
|
||||||
|
$('#tree-form').show();
|
||||||
|
//scope.refresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (scope.removeInventorySubmit) {
|
if (scope.removeInventorySubmit) {
|
||||||
@@ -392,37 +400,8 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
Rest.get()
|
Rest.get()
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
if (data.can_update) {
|
if (data.can_update) {
|
||||||
var extra_html = '';
|
var extra_html = "<div class=\"inventory-passwd-msg\">Starting inventory update for the <em>" + params.group_name +
|
||||||
/*
|
"</em> group. Please provide the " + params.group_source + " credentials:</div>\n";
|
||||||
for (var i=0; i < scope.projects.length; i++) {
|
|
||||||
if (scope.projects[i].id == project_id) {
|
|
||||||
extra_html += "<div class=\"form-group\">\n";
|
|
||||||
extra_html += "<label class=\"control-label col-lg-3 normal-weight\" for=\"scm_url\">SCM URL</label>\n";
|
|
||||||
extra_html += "<div class=\"col-lg-9\">\n";
|
|
||||||
extra_html += "<input type=\"text\" readonly";
|
|
||||||
extra_html += ' name=\"scm_url\" ';
|
|
||||||
extra_html += "class=\"form-control\" ";
|
|
||||||
extra_html += "value=\"" + scope.projects[i].scm_url + "\" ";
|
|
||||||
extra_html += "/>";
|
|
||||||
extra_html += "</div>\n";
|
|
||||||
extra_html += "</div>\n";
|
|
||||||
if (scope.projects[i].scm_username) {
|
|
||||||
extra_html += "<div class=\"form-group\">\n";
|
|
||||||
extra_html += "<label class=\"control-label col-lg-3 normal-weight\" for=\"scm_username\">SCM Username</label>\n";
|
|
||||||
extra_html += "<div class=\"col-lg-9\">\n";
|
|
||||||
extra_html += "<input type=\"text\" readonly";
|
|
||||||
extra_html += ' name=\"scm_username\" ';
|
|
||||||
extra_html += "class=\"form-control\" ";
|
|
||||||
extra_html += "value=\"" + scope.projects[i].scm_username + "\" ";
|
|
||||||
extra_html += "/>";
|
|
||||||
extra_html += "</div>\n";
|
|
||||||
extra_html += "</div>\n";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
extra_html += "</p>";
|
|
||||||
*/
|
|
||||||
scope.$emit('InventorySubmit', data.passwords_needed_to_update, extra_html);
|
scope.$emit('InventorySubmit', data.passwords_needed_to_update, extra_html);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -667,106 +667,5 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi
|
|||||||
}
|
}
|
||||||
return newData;
|
return newData;
|
||||||
}
|
}
|
||||||
}])
|
|
||||||
|
|
||||||
.factory('InventoryStatus', [ '$rootScope', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventorySummary',
|
|
||||||
'GenerateList', 'ClearScope',
|
|
||||||
function($rootScope, Rest, Aler, ProcessErrors, GetBasePath, FormatDate, InventorySummary, GenerateList, ClearScope) {
|
|
||||||
return function(params) {
|
|
||||||
//Build a summary of a given inventory
|
|
||||||
|
|
||||||
ClearScope('tree-form');
|
|
||||||
|
|
||||||
$('#tree-form').hide().empty();
|
|
||||||
var view = GenerateList;
|
|
||||||
var scope = view.inject(InventorySummary, { mode: 'summary', id: 'tree-form', breadCrumbs: false });
|
|
||||||
var total;
|
|
||||||
var cnt=0;
|
|
||||||
var groups = new Array();
|
|
||||||
|
|
||||||
if (scope.RemoveGroupsLoaded) {
|
|
||||||
scope.RemoveGroupsLoaded();
|
|
||||||
}
|
|
||||||
scope.RemoveGroupsLoaded = scope.$on('GroupsLoaded', function() {
|
|
||||||
// Using this sort of indirect method of updating scope['groups'] works. Pushing data directly into
|
|
||||||
// scope['groups'] directly causes it to grow exponentially with duplicates each time user navigates away
|
|
||||||
// and comes back -despite emptying/resetting/initializing.
|
|
||||||
scope['groups'] = groups;
|
|
||||||
if (!scope.$$phase) {
|
|
||||||
scope.$apply();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function checkSource(url) {
|
|
||||||
Rest.setUrl(url);
|
|
||||||
Rest.get()
|
|
||||||
.success( function(data, status, headers, config) {
|
|
||||||
|
|
||||||
var last_update = (data.last_updated == null) ? '' : FormatDate(new Date(data.last_updated));
|
|
||||||
var source = 'Manual';
|
|
||||||
var stat;
|
|
||||||
|
|
||||||
switch (data.status) {
|
|
||||||
case 'never updated':
|
|
||||||
stat = 'never';
|
|
||||||
break;
|
|
||||||
case 'none':
|
|
||||||
stat = 'na';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
stat = data.status;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(data.source) {
|
|
||||||
case 'file':
|
|
||||||
source = 'File';
|
|
||||||
break;
|
|
||||||
case 'ec2':
|
|
||||||
source = 'Amazon EC2';
|
|
||||||
break;
|
|
||||||
case 'rackspace':
|
|
||||||
source = 'Rackspace';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
groups.push({
|
|
||||||
name: data.summary_fields.group.name,
|
|
||||||
description: data.summary_fields.group.description,
|
|
||||||
failures: data.summary_fields.group.hosts_with_active_failures,
|
|
||||||
source: source,
|
|
||||||
last_update: last_update,
|
|
||||||
status: stat,
|
|
||||||
has_active_failures: data.summary_fields.group.has_active_failures
|
|
||||||
});
|
|
||||||
|
|
||||||
cnt++;
|
|
||||||
|
|
||||||
if (cnt >= total) {
|
|
||||||
scope.$emit('GroupsLoaded');
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
.error( function(data, status, headers, config) {
|
|
||||||
ProcessErrors(scope, data, status, null,
|
|
||||||
{ hdr: 'Error!', msg: 'Call to ' + url + ' failed. POST status: ' + status });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = GetBasePath('inventory') + scope['inventory_id'] + '/groups/';
|
|
||||||
Rest.setUrl(url);
|
|
||||||
Rest.get()
|
|
||||||
.success( function(data, status, headers, config) {
|
|
||||||
total = data.count;
|
|
||||||
for (var i=0; i < data.results.length; i++) {
|
|
||||||
if (data.results[i].related.inventory_source) {
|
|
||||||
checkSource(data.results[i].related.inventory_source);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.error( function(data, status, headers, config) {
|
|
||||||
ProcessErrors(scope, data, status, null,
|
|
||||||
{ hdr: 'Error!', msg: 'Call to ' + url + ' failed. POST status: ' + status });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|||||||
@@ -125,6 +125,11 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
scope[iterator + 'SearchParams'] = list.fields[scope[iterator + 'SearchField']].sourceModel + '__' +
|
scope[iterator + 'SearchParams'] = list.fields[scope[iterator + 'SearchField']].sourceModel + '__' +
|
||||||
list.fields[scope[iterator + 'SearchField']].sourceField + '__';
|
list.fields[scope[iterator + 'SearchField']].sourceField + '__';
|
||||||
}
|
}
|
||||||
|
else if ( (list.fields[scope[iterator + 'SearchField']].searchType == 'select') &&
|
||||||
|
(scope[iterator + 'SearchSelectValue'].value == '' ||
|
||||||
|
scope[iterator + 'SearchSelectValue'].value == null) ) {
|
||||||
|
scope[iterator + 'SearchParams'] = scope[iterator + 'SearchField'];
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
scope[iterator + 'SearchParams'] = scope[iterator + 'SearchField'] + '__';
|
scope[iterator + 'SearchParams'] = scope[iterator + 'SearchField'] + '__';
|
||||||
}
|
}
|
||||||
@@ -138,6 +143,11 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
list.fields[scope[iterator + 'SearchField']].searchType == 'gtzero' ) {
|
list.fields[scope[iterator + 'SearchField']].searchType == 'gtzero' ) {
|
||||||
scope[iterator + 'SearchParams'] += 'gt=0';
|
scope[iterator + 'SearchParams'] += 'gt=0';
|
||||||
}
|
}
|
||||||
|
else if ( (list.fields[scope[iterator + 'SearchField']].searchType == 'select') &&
|
||||||
|
(scope[iterator + 'SearchSelectValue'].value == '' ||
|
||||||
|
scope[iterator + 'SearchSelectValue'].value == null) ) {
|
||||||
|
scope[iterator + 'SearchParams'] += '=';
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
scope[iterator + 'SearchParams'] += scope[iterator + 'SearchType'] + '=';
|
scope[iterator + 'SearchParams'] += scope[iterator + 'SearchType'] + '=';
|
||||||
}
|
}
|
||||||
@@ -145,7 +155,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
|||||||
if ( list.fields[scope[iterator + 'SearchField']].searchType &&
|
if ( list.fields[scope[iterator + 'SearchField']].searchType &&
|
||||||
(list.fields[scope[iterator + 'SearchField']].searchType == 'boolean'
|
(list.fields[scope[iterator + 'SearchField']].searchType == 'boolean'
|
||||||
|| list.fields[scope[iterator + 'SearchField']].searchType == 'select') ) {
|
|| list.fields[scope[iterator + 'SearchField']].searchType == 'select') ) {
|
||||||
scope[iterator + 'SearchParams'] += scope[iterator + 'SearchSelectValue'].value;
|
scope[iterator + 'SearchParams'] += scope[iterator + 'SearchSelectValue'].value;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//if ( list.fields[scope[iterator + 'SearchField']].searchType == undefined ||
|
//if ( list.fields[scope[iterator + 'SearchField']].searchType == undefined ||
|
||||||
|
|||||||
@@ -23,36 +23,88 @@ angular.module('InventorySummaryDefinition', [])
|
|||||||
key: true,
|
key: true,
|
||||||
label: 'Group',
|
label: 'Group',
|
||||||
noLink: true,
|
noLink: true,
|
||||||
|
ngBind: "group.summary_fields.group.name",
|
||||||
|
sourceModel: 'group',
|
||||||
|
sourceField: 'name',
|
||||||
badges: [
|
badges: [
|
||||||
{ //Active Failures
|
{ //Active Failures
|
||||||
icon: "\{\{ 'icon-failures-' + group.has_active_failures \}\}",
|
icon: "\{\{ 'icon-failures-' + group.summary_fields.group.has_active_failures \}\}",
|
||||||
toolTip: 'Indicates if inventory contains hosts with active failures',
|
toolTip: 'Indicates if inventory contains hosts with active failures',
|
||||||
toolTipPlacement: 'bottom'
|
toolTipPlacement: 'bottom'
|
||||||
},
|
},
|
||||||
{ //Cloud Status
|
{ //Cloud Status
|
||||||
icon: "\{\{ 'icon-cloud-' + group.status \}\}",
|
icon: "\{\{ 'icon-cloud-' + group.status_class \}\}",
|
||||||
toolTip: 'Indicates if inventory contains hosts with active failures',
|
toolTip: 'Indicates status of inventory update process',
|
||||||
toolTipPlacement: 'bottom'
|
toolTipPlacement: 'bottom'
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
failures: {
|
failures: {
|
||||||
label: 'Active<br />Failures'
|
label: 'Active<br>Failures',
|
||||||
|
ngBind: "group.summary_fields.group.hosts_with_active_failures",
|
||||||
|
sourceModel: 'group',
|
||||||
|
sourceField: 'hosts_with_active_failures',
|
||||||
|
searchField: 'group__has_active_failures',
|
||||||
|
searchType: 'boolean',
|
||||||
|
searchOptions: [{ name: "yes", value: 1 }, { name: "no", value: 0 }]
|
||||||
},
|
},
|
||||||
source: {
|
source: {
|
||||||
label: 'Source'
|
label: 'Source',
|
||||||
|
searchType: 'select',
|
||||||
|
searchOptions: [
|
||||||
|
{ name: "Amazon EC2", value: "ec2" },
|
||||||
|
{ name: "Local Script", value: "file" },
|
||||||
|
{ name: "Manual", value: "" },
|
||||||
|
{ name: "Rackspace", value: "rackspace" }]
|
||||||
},
|
},
|
||||||
last_update: {
|
last_updated: {
|
||||||
label: 'Last<br />Updated'
|
label: 'Last<br>Updated',
|
||||||
|
searchable: false
|
||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
label: 'Update<br />Status'
|
label: 'Update<br>Status',
|
||||||
|
searchType: 'select',
|
||||||
|
searchOptions: [
|
||||||
|
{ name: "failed", value: "failed" },
|
||||||
|
{ name: "never", value: "never updated" },
|
||||||
|
{ name: "n/a", value: "none" },
|
||||||
|
{ name: "successful", value: "successful" },
|
||||||
|
{ name: "updating", value: "updating" }]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
refresh: {
|
||||||
|
awRefresh: true,
|
||||||
|
mode: 'all'
|
||||||
|
},
|
||||||
|
help: {
|
||||||
|
awPopOver:
|
||||||
|
"<dl>\n" +
|
||||||
|
"<dt>failed</dt><dd>Errors were encountered with the most recent inventory update.</dd>\n" +
|
||||||
|
"<dt>n/a</dt><dd>The group is not configured for inventory update.</dd>\n" +
|
||||||
|
"<dt>never</dt><dd>The inventory update has never run for the group.</dd>\n" +
|
||||||
|
"<dt>successful</dt><dd>The most recent inventory update ran to completion without incident.</dd>\n" +
|
||||||
|
"<dt>updating</dt><dd>The inventory update is currently running.</dd>\n" +
|
||||||
|
"</dl>\n",
|
||||||
|
dataPlacement: 'left',
|
||||||
|
dataContainer: 'body',
|
||||||
|
icon: "icon-question-sign",
|
||||||
|
mode: 'all',
|
||||||
|
'class': 'btn-xs btn-info btn-help pull-right',
|
||||||
|
awToolTip: 'Click for help',
|
||||||
|
dataTitle: 'Update Status',
|
||||||
|
iconSize: 'large'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
fieldActions: {
|
fieldActions: {
|
||||||
|
group_update: {
|
||||||
|
label: 'Update',
|
||||||
|
icon: 'icon-cloud-download',
|
||||||
|
"class": 'btn-xs btn-success',
|
||||||
|
ngClick: 'updateGroup(\{\{ group.id \}\})',
|
||||||
|
awToolTip: 'Perform an update on this group'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -667,7 +667,7 @@ select.field-mini-height {
|
|||||||
.icon-cloud-never:before,
|
.icon-cloud-never:before,
|
||||||
.icon-cloud-updating:before,
|
.icon-cloud-updating:before,
|
||||||
.icon-cloud-failed:before,
|
.icon-cloud-failed:before,
|
||||||
.icon-cloud-success:before {
|
.icon-cloud-successful:before {
|
||||||
content: "\f0c2";
|
content: "\f0c2";
|
||||||
}
|
}
|
||||||
.icon-cloud-na {
|
.icon-cloud-na {
|
||||||
@@ -779,6 +779,16 @@ select.field-mini-height {
|
|||||||
|
|
||||||
/* Inventory-> Groups */
|
/* Inventory-> Groups */
|
||||||
|
|
||||||
|
.inventory-passwd-msg {
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.groups-issue {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.inventory-content {
|
.inventory-content {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
@@ -792,7 +802,6 @@ select.field-mini-height {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tree-view-container {
|
.tree-view-container {
|
||||||
min-height: 650px;
|
|
||||||
padding: 0 0 10px 0;
|
padding: 0 0 10px 0;
|
||||||
|
|
||||||
.col-lg-4 {
|
.col-lg-4 {
|
||||||
@@ -821,23 +830,9 @@ select.field-mini-height {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
#tree-form:before {
|
|
||||||
content: "";
|
|
||||||
border-color: transparent transparent #e3e3e3 transparent;
|
|
||||||
border-style: solid;
|
|
||||||
border-width: 15px;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
position: relative;
|
|
||||||
top: -34px;
|
|
||||||
left: 28px;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#tree-form {
|
#tree-form {
|
||||||
display: none;
|
display: none;
|
||||||
padding: 15px 10px 0 10px;
|
padding: 15px 10px 10px 10px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
border: 1px solid #e3e3e3;
|
border: 1px solid #e3e3e3;
|
||||||
background-color: #e3e3e3;
|
background-color: #e3e3e3;
|
||||||
@@ -845,7 +840,7 @@ select.field-mini-height {
|
|||||||
|
|
||||||
.form-title {
|
.form-title {
|
||||||
color: #888;
|
color: #888;
|
||||||
padding-left: 10px;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr {
|
hr {
|
||||||
|
|||||||
@@ -462,8 +462,8 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
|
|||||||
for ( var fld in form.fields) {
|
for ( var fld in form.fields) {
|
||||||
if (form.fields[fld].searchable == undefined || form.fields[fld].searchable == true) {
|
if (form.fields[fld].searchable == undefined || form.fields[fld].searchable == true) {
|
||||||
html += "<li><a href=\"\" ng-click=\"setSearchField('" + iterator + "','";
|
html += "<li><a href=\"\" ng-click=\"setSearchField('" + iterator + "','";
|
||||||
html += fld + "','" + form.fields[fld].label + "')\">"
|
html += fld + "','" + form.fields[fld].label.replace(/\<br\>/g,' ') + "')\">"
|
||||||
+ form.fields[fld].label + "</a></li>\n";
|
+ form.fields[fld].label.replace(/\<br\>/g,' ') + "</a></li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
html += "</ul>\n";
|
html += "</ul>\n";
|
||||||
|
|||||||
@@ -178,57 +178,79 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
|
|||||||
html += "<hr class=\"form-title-hr\">\n";
|
html += "<hr class=\"form-title-hr\">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.mode !== 'summary') {
|
/*
|
||||||
|
if (list.editTitle.match(/^Inventory Summary/)) {
|
||||||
|
html += "<div class=\"row groups-issue\">\n";
|
||||||
|
html += "<div class=\"col-lg-12\">\n";
|
||||||
|
html += "<label class=\"checkbox-inline pull-right\"><input type=\"checkbox\" ng-model=\"groupFailureFilter\" " +
|
||||||
|
"ng-change=\"search()\" id=\"groups-issue-chbox\"> Show only groups with errors</label>\n";
|
||||||
|
html += "</div>\n";
|
||||||
|
html += "</div>\n";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if ( options.mode == 'lookup' || options.id != undefined ) {
|
if (options.mode == 'summary') {
|
||||||
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-6' });
|
||||||
|
}
|
||||||
|
else if (options.mode == 'lookup' || options.id != undefined) {
|
||||||
|
html += SearchWidget({ iterator: list.iterator, template: list, mini: true , size: 'col-lg-8' });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
html += SearchWidget({ iterator: list.iterator, template: list, mini: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.mode != 'lookup') {
|
||||||
|
//actions
|
||||||
|
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||||
|
|
||||||
|
html += "<div class=\"list-actions ";
|
||||||
|
if (options.mode == 'summary') {
|
||||||
|
html += 'col-lg-5';
|
||||||
|
}
|
||||||
|
else if (options.id != undefined) {
|
||||||
|
html += "col-lg-3";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
html += SearchWidget({ iterator: list.iterator, template: list, mini: true });
|
html += "col-lg-7 col-md-5";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.mode != 'lookup') {
|
html += "\">\n";
|
||||||
//actions
|
for (action in list.actions) {
|
||||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
if (list.actions[action].mode == 'all' || list.actions[action].mode == options.mode) {
|
||||||
html += "<div class=\"list-actions ";
|
if ( (list.actions[action].basePaths == undefined) ||
|
||||||
html += (options.id != undefined) ? "col-lg-3" : "col-lg-7 col-md-5";
|
(list.actions[action].basePaths && list.actions[action].basePaths.indexOf(base) > -1) ) {
|
||||||
html += "\">\n";
|
html += this.button(list.actions[action], action);
|
||||||
for (action in list.actions) {
|
|
||||||
if (list.actions[action].mode == 'all' || list.actions[action].mode == options.mode) {
|
|
||||||
if ( (list.actions[action].basePaths == undefined) ||
|
|
||||||
(list.actions[action].basePaths && list.actions[action].basePaths.indexOf(base) > -1) ) {
|
|
||||||
html += this.button(list.actions[action], action);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (list.name == 'inventories' && options.mode !== 'select') {
|
if (list.name == 'inventories' && options.mode !== 'select') {
|
||||||
html += "<label class=\"checkbox-inline pull-right\"><input type=\"checkbox\" ng-model=\"inventoryFailureFilter\" " +
|
html += "<label class=\"checkbox-inline pull-right\"><input type=\"checkbox\" ng-model=\"inventoryFailureFilter\" " +
|
||||||
"ng-change=\"search('inventory')\" id=\"failed_jobs_chbox\"> Show only inventories with failed jobs</label>\n";
|
"ng-change=\"search('inventory')\" id=\"failed_jobs_chbox\"> 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 = {
|
||||||
awPopOver: list.selectInstructions,
|
awPopOver: list.selectInstructions,
|
||||||
dataPlacement: 'left',
|
dataPlacement: 'left',
|
||||||
dataContainer: 'body',
|
dataContainer: 'body',
|
||||||
icon: "icon-question-sign",
|
icon: "icon-question-sign",
|
||||||
'class': 'btn-sm btn-help btn-info',
|
'class': 'btn-sm btn-help btn-info',
|
||||||
awToolTip: 'Click for help',
|
awToolTip: 'Click for help',
|
||||||
dataTitle: 'Help',
|
dataTitle: 'Help',
|
||||||
iconSize: 'large'
|
iconSize: 'large'
|
||||||
};
|
};
|
||||||
html += this.button(btn, 'select');
|
html += this.button(btn, 'select');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
html += "<div class=\"col-lg-7\"></div>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
html += "</div>\n";
|
|
||||||
html += "</div><!-- row -->\n";
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
html += "<div class=\"col-lg-7\"></div>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
html += "</div>\n";
|
||||||
|
html += "</div><!-- row -->\n";
|
||||||
|
|
||||||
|
|
||||||
// table header row
|
// table header row
|
||||||
html += "<table id=\"" + list.name + "_table\" ";
|
html += "<table id=\"" + list.name + "_table\" ";
|
||||||
@@ -311,7 +333,7 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
|
|||||||
list.iterator + ".id }}\" ng-click=\"toggle_" + list.iterator +"({{ " + list.iterator + ".id }}, true)\" ng-true-value=\"1\" " +
|
list.iterator + ".id }}\" ng-click=\"toggle_" + list.iterator +"({{ " + list.iterator + ".id }}, true)\" ng-true-value=\"1\" " +
|
||||||
"ng-false-value=\"0\" id=\"check_{{" + list.iterator + ".id}}\" /></td>";
|
"ng-false-value=\"0\" id=\"check_{{" + list.iterator + ".id}}\" /></td>";
|
||||||
}
|
}
|
||||||
else if (options.mode == 'edit') {
|
else if (options.mode == 'edit' || options.mode == 'summary') {
|
||||||
// Row level actions
|
// Row level actions
|
||||||
html += "<td class=\"actions\">";
|
html += "<td class=\"actions\">";
|
||||||
for (action in list.fieldActions) {
|
for (action in list.fieldActions) {
|
||||||
@@ -362,9 +384,7 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
|
|||||||
html += PaginateWidget({ set: list.name, iterator: list.iterator, mini: true, mode: 'lookup' });
|
html += PaginateWidget({ set: list.name, iterator: list.iterator, mini: true, mode: 'lookup' });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (options.mode !== 'summary') {
|
html += PaginateWidget({ set: list.name, iterator: list.iterator, mini: true });
|
||||||
html += PaginateWidget({ set: list.name, iterator: list.iterator, mini: true });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
|||||||
Reference in New Issue
Block a user