mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
AC-503 Cloud inventory process results now visible.
This commit is contained in:
parent
252a623a1d
commit
b97fbe1905
@ -71,7 +71,8 @@ angular.module('ansible', [
|
||||
'License',
|
||||
'HostGroupsFormDefinition',
|
||||
'ObjectCountWidget',
|
||||
'JobsHelper'
|
||||
'JobsHelper',
|
||||
'InventoryStatusDefinition'
|
||||
])
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.
|
||||
|
||||
44
awx/ui/static/js/forms/InventoryStatus.js
Normal file
44
awx/ui/static/js/forms/InventoryStatus.js
Normal file
@ -0,0 +1,44 @@
|
||||
/*********************************************
|
||||
* Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
*
|
||||
* InventoryStatus.js
|
||||
* Form definition for Inventory Status -JSON view
|
||||
*
|
||||
*
|
||||
*/
|
||||
angular.module('InventoryStatusDefinition', [])
|
||||
.value(
|
||||
'InventoryStatusForm', {
|
||||
|
||||
name: 'inventory_update',
|
||||
editTitle: 'Inventory Status',
|
||||
well: false,
|
||||
'class': 'horizontal-narrow',
|
||||
|
||||
fields: {
|
||||
created: {
|
||||
label: 'Created',
|
||||
type: 'text',
|
||||
readonly: true
|
||||
},
|
||||
status: {
|
||||
label: 'Status',
|
||||
type: 'text',
|
||||
readonly: true
|
||||
},
|
||||
result_stdout: {
|
||||
label: 'Std Out',
|
||||
type: 'textarea',
|
||||
ngShow: "result_stdout",
|
||||
readonly: true,
|
||||
rows: 15
|
||||
},
|
||||
result_traceback: {
|
||||
label: 'Traceback',
|
||||
type: 'textarea',
|
||||
ngShow: "result_traceback",
|
||||
readonly: true,
|
||||
rows: 15
|
||||
}
|
||||
}
|
||||
}); //Form
|
||||
@ -126,9 +126,9 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
|
||||
|
||||
.factory('InventoryStatus', [ '$rootScope', '$routeParams', 'Rest', 'Alert', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventorySummary',
|
||||
'GenerateList', 'ClearScope', 'SearchInit', 'PaginateInit', 'Refresh', 'InventoryUpdate', 'GroupsEdit',
|
||||
'GenerateList', 'ClearScope', 'SearchInit', 'PaginateInit', 'Refresh', 'InventoryUpdate', 'GroupsEdit', 'ShowUpdateStatus',
|
||||
function($rootScope, $routeParams, Rest, Alert, ProcessErrors, GetBasePath, FormatDate, InventorySummary, GenerateList, ClearScope, SearchInit,
|
||||
PaginateInit, Refresh, InventoryUpdate, GroupsEdit) {
|
||||
PaginateInit, Refresh, InventoryUpdate, GroupsEdit, ShowUpdateStatus) {
|
||||
return function(params) {
|
||||
//Build a summary of a given inventory
|
||||
|
||||
@ -214,11 +214,14 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
for (var opt in list.fields['status'].searchOptions) {
|
||||
if (list.fields['status'].searchOptions[opt].value == $routeParams['status']) {
|
||||
scope[list.iterator + 'SearchSelectValue'] = list.fields['status'].searchOptions[opt];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scope.search(list.iterator);
|
||||
|
||||
scope.ShowUpdateStatus = ShowUpdateStatus;
|
||||
|
||||
// Click on group name
|
||||
scope.GroupsEdit = function(group_id) {
|
||||
@ -810,7 +813,76 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
show: true
|
||||
});
|
||||
}
|
||||
}]);
|
||||
}])
|
||||
|
||||
|
||||
.factory('ShowUpdateStatus', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GenerateForm',
|
||||
'Prompt', 'ProcessErrors', 'GetBasePath', 'FormatDate', 'InventoryStatusForm',
|
||||
function($rootScope, $location, $log, $routeParams, Rest, Alert, GenerateForm, Prompt, ProcessErrors, GetBasePath,
|
||||
FormatDate, InventoryStatusForm) {
|
||||
return function(params) {
|
||||
|
||||
var group_name = params.group_name;
|
||||
var last_update = params.last_update;
|
||||
var generator = GenerateForm;
|
||||
var form = InventoryStatusForm;
|
||||
var scope;
|
||||
|
||||
if (last_update == undefined || last_update == null || last_update == ''){
|
||||
Alert('Missing Configuration', 'The selected group is not configured for inventory updates. ' +
|
||||
'You must first edit the group, provide Source settings, and then run an update.', 'alert-info');
|
||||
}
|
||||
else {
|
||||
// Retrieve detail record and prepopulate the form
|
||||
Rest.setUrl(last_update);
|
||||
Rest.get()
|
||||
.success( function(data, status, headers, config) {
|
||||
// load up the form
|
||||
scope = generator.inject(form, { mode: 'edit', modal: true, related: false});
|
||||
generator.reset();
|
||||
var results = data;
|
||||
for (var fld in form.fields) {
|
||||
if (results[fld]) {
|
||||
if (fld == 'created') {
|
||||
scope[fld] = FormatDate(new Date(results[fld]));
|
||||
}
|
||||
else {
|
||||
scope[fld] = results[fld];
|
||||
}
|
||||
}
|
||||
//else {
|
||||
// if (results.summary_fields.project[fld]) {
|
||||
// scope[fld] = results.summary_fields.project[fld]
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
scope.formModalAction = function() {
|
||||
$('#form-modal').modal("hide");
|
||||
}
|
||||
|
||||
scope.formModalActionLabel = 'OK';
|
||||
scope.formModalCancelShow = false;
|
||||
scope.formModalInfo = false;
|
||||
scope.formModalHeader = group_name + '<span class="subtitle"> - Inventory Update</span>';
|
||||
|
||||
$('#form-modal .btn-success').removeClass('btn-success').addClass('btn-none');
|
||||
$('#form-modal').addClass('skinny-modal');
|
||||
|
||||
if (!scope.$$phase) {
|
||||
scope.$digest();
|
||||
}
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
$('#form-modal').modal("hide");
|
||||
ProcessErrors(scope, data, status, null,
|
||||
{ hdr: 'Error!', msg: 'Failed to retrieve last update: ' + last_update + '. GET status: ' + status });
|
||||
});
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -55,9 +55,13 @@ angular.module('InventorySummaryDefinition', [])
|
||||
},
|
||||
status: {
|
||||
label: 'Update<br>Status',
|
||||
ngClick: "ShowUpdateStatus({ last_update: '{{ group.related.last_update }}', group_name: '{{ group.summary_fields.group.name }}' })",
|
||||
searchType: 'select',
|
||||
badgeIcon: 'icon-cloud',
|
||||
badgeToolTip: "\{\{ group.status_badge_tooltip \}\}",
|
||||
badgeToolTip: "\{\{ group.status_badge_tooltip \}\}",
|
||||
awToolTip: "\{\{ group.status_badge_tooltip \}\}",
|
||||
dataPlacement: 'top',
|
||||
badgeTipPlacement: 'top',
|
||||
badgePlacement: 'left',
|
||||
badgeClass: "\{\{ 'icon-cloud-' + group.status_badge_class \}\}",
|
||||
searchOptions: [
|
||||
|
||||
@ -70,6 +70,7 @@
|
||||
<script src="{{ STATIC_URL }}js/forms/JobEventData.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/forms/License.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/forms/HostGroups.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/forms/InventoryStatus.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/lists/Users.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/lists/Organizations.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/lists/Admins.js"></script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user