1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-30 22:21:13 +03:00

AC-931: Fixed typo. AC-925 clickin on failed inventory sync icon works again. Inventory Refactor: consolidated actions and status fields to a single column and simplified tool-tip text. Made 'sync' labeling more consistent, I think.

This commit is contained in:
chris Houseknecht 2014-01-15 04:31:11 -05:00
parent 298e55017f
commit ef324f2397
17 changed files with 75 additions and 78 deletions

View File

@ -76,34 +76,25 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
for (var i=0; i < scope.inventories.length; i++) {
// Set values for Failed Hosts column
scope.inventories[i].failed_hosts = scope.inventories[i].hosts_with_active_failures + ' / ' + scope.inventories[i].total_hosts;
//scope.inventories[i].failed_hosts = scope.inventories[i].hosts_with_active_failures + ' / ' + scope.inventories[i].total_hosts;
if (scope.inventories[i].hosts_with_active_failures > 0) {
scope.inventories[i].failed_hosts_tip = "Contains " + scope.inventories[i].hosts_with_active_failures +
[ (scope.inventories[i].hosts_with_active_failures == 1) ? ' host' : ' hosts' ] + ' with job failures. Click to view the offending ' +
[ (scope.inventories[i].hosts_with_active_failures == 1) ? ' host' : ' hosts' ] + '.';
scope.inventories[i].failed_hosts_link = '/#/inventories/' + scope.inventories[i].id + '/hosts?has_active_failures=true';
scope.inventories[i].failed_hosts_tip = scope.inventories[i].hosts_with_active_failures +
( (scope.inventories[i].hosts_with_active_failures == 1) ? ' host' : ' hosts' ) + ' with job failures. Click to view details.';
scope.inventories[i].failed_hosts_link = '/#/inventories/' + scope.inventories[i].id + '/';
scope.inventories[i].failed_hosts_class = 'true';
}
else {
if (scope.inventories[i].total_hosts == 0) {
// no hosts
scope.inventories[i].failed_hosts_tip = "There are no hosts in this inventory. It's a sad empty shell. Click to view the hosts page " +
"and add a host.";
scope.inventories[i].failed_hosts_link = '/#/inventories/' + scope.inventories[i].id + '/hosts';
scope.inventories[i].failed_hosts_tip = "No hosts defined. Click to add.";
scope.inventories[i].failed_hosts_link = '/#/inventories/' + scope.inventories[i].id + '/';
scope.inventories[i].failed_hosts_class = 'na';
}
else if (scope.inventories[i].total_hosts == 1) {
// on host with 0 failures
scope.inventories[i].failed_hosts_tip = "The 1 host found in this inventory is happy! There are no job failures." +
" Click to view the host.";
scope.inventories[i].failed_hosts_link = '/#/inventories/' + scope.inventories[i].id + '/hosts';
scope.inventories[i].failed_hosts_class = 'false';
}
else {
// many hosts with 0 failures
scope.inventories[i].failed_hosts_tip = "All " + scope.inventories[i].total_hosts + " hosts are happy! There are no" +
" job failures. Click to view the hosts.";
scope.inventories[i].failed_hosts_link = '/#/inventories/' + scope.inventories[i].id + '/hosts';
scope.inventories[i].failed_hosts_tip = "No job failures. Click to view details.";
scope.inventories[i].failed_hosts_link = '/#/inventories/' + scope.inventories[i].id + '/';
scope.inventories[i].failed_hosts_class = 'false';
}
}
@ -111,33 +102,25 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res
// Set values for Status column
scope.inventories[i].status = scope.inventories[i].inventory_sources_with_failures + ' / ' + scope.inventories[i].total_inventory_sources;
if (scope.inventories[i].inventory_sources_with_failures > 0) {
scope.inventories[i].status_tip = "Contains " + scope.inventories[i].inventory_sources_with_failures +
[ (scope.inventories[i].inventory_sources_with_failures == 1) ? ' group' : ' groups' ] + ' with inventory update failures. ' +
'Click to view the ' +
[ (scope.inventories[i].inventory_sources_with_failures == 1) ? ' offending group.' : ' groups.' ];
scope.inventories[i].status_link = '/#/inventories/' + scope.inventories[i].id + '/groups?status=failed';
scope.inventories[i].status_tip = scope.inventories[i].inventory_sources_with_failures + ' cloud ' +
( (scope.inventories[i].inventory_sources_with_failures == 1) ? 'source' : 'sources' ) +
' with failures. Click to view details.';
scope.inventories[i].status_link = '/#/inventories/' + scope.inventories[i].id + '/';
scope.inventories[i].status_class = 'failed';
}
else {
if (scope.inventories[i].total_inventory_sources == 0) {
// no groups are reporting a source
scope.inventories[i].status_tip = "Does not have an external inventory source. Click to view groups and " +
"and add an inventory source.";
scope.inventories[i].status_link = '/#/inventories/' + scope.inventories[i].id + '/groups';
scope.inventories[i].status_tip = "Not synced with a cloud source. Click to edit.";
scope.inventories[i].status_link = '/#/inventories/' + scope.inventories[i].id + '/';
scope.inventories[i].status_class = 'na';
}
else if (scope.inventories[i].total_inventory_sources == 1) {
// on host with 0 failures
scope.inventories[i].status_tip = "The 1 group with an inventory source is happy!. No updates have failed." +
" Click to view the group.";
scope.inventories[i].status_link = '/#/inventories/' + scope.inventories[i].id + '/groups?has_external_source=true';
scope.inventories[i].status_class = 'successful';
}
else {
// many hosts with 0 failures
scope.inventories[i].status_tip = scope.inventories[i].total_inventory_sources + " groups external inventory sources are happy! " +
" No updates have failed. Click to view the groups.";
scope.inventories[i].status_link = '/#/inventories/' + scope.inventories[i].id + '/groups?has_external_source=true';
scope.inventories[i].status_tip = 'Contains ' + scope.inventories[i].total_inventory_sources +
' cloud ' + ( (scope.inventories[i].total_inventory_sources > 0) ? 'sources' : 'source' ) +
' and no failures. Click to view details.';
scope.inventories[i].status_link = '/#/inventories/' + scope.inventories[i].id + '/';
scope.inventories[i].status_class = 'successful';
}
}

View File

@ -91,7 +91,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
var tree_id = params.tree_id;
var group_id = params.group_id;
var found = false;
var group = Find({ list: scope.group, key: 'id', val: tree_id });
var group = Find({ list: scope.groups, key: 'id', val: tree_id });
scope.showHosts(tree_id, group_id, false);
@ -274,8 +274,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
Rest.post()
.success( function(data, status, headers, config) {
Wait('stop');
Alert('Inventory Sync Cancelled', 'Your request to cancel the update was submitted to the task maanger. ' +
'Click the <i class="fa fa-refresh fa-lg"></i> to check the sync status.', 'alert-info');
Alert('Inventory Sync Cancelled', 'Your request to cancel the sync process was submitted to the task manger. ' +
'Click the <i class="fa fa-refresh fa-lg"></i> button to monitor the status.', 'alert-info');
})
.error( function(data, status, headers, config) {
Wait('stop');
@ -299,8 +299,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
}
else {
Wait('stop');
Alert('Cancel Inventory Sync', 'Either you do not have access or the sync process completed. ' +
'Click the <i class="fa fa-refresh fa-lg"></i> to view the latest status.', 'alert-info');
Alert('Cancel Inventory Sync', 'Either you do not have access or the sync process completed.<br /> ' +
'Click the <i class="fa fa-refresh fa-lg"></i> button to view the latest status.', 'alert-info');
}
})
.error( function(data, status, headers, config) {
@ -1080,8 +1080,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
if (last_update == undefined || last_update == null || last_update == ''){
Wait('stop');
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');
Alert('Missing Configuration', 'The selected group is not configured for inventory sync. ' +
'Edit the group and provide Source information.', 'alert-info');
}
else {
// Retrieve detail record and prepopulate the form
@ -1110,12 +1110,12 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
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');
scope.formModalHeader = group_name + '<span class="subtitle"> - Inventory Sync</span>';
if (!scope.$$phase) {
scope.$digest();
}
})
.error( function(data, status, headers, config) {
Wait('stop');

View File

@ -421,7 +421,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
}
scope.removeHostReloadComplete = scope.$on('HostReloadComplete', function(e) {
Wait('stop');
Alert('Update Started', 'The request to start the inventory update process was submitted. Monitor progress of the update process ' +
Alert('Update Started', 'Your request to start the inventory sync process was submitted. Monitor progress ' +
'by clicking the <i class="fa fa-refresh fa-lg"></i> button.', 'alert-info');
scope.removeHostReloadComplete();
});

View File

@ -59,7 +59,7 @@ angular.module('CloudCredentialsListDefinition', [])
icon: 'fa-edit',
label: 'Edit',
"class": 'btn-sm',
awToolTip: 'View/Edit credential',
awToolTip: 'Edit credential',
dataPlacement: 'top'
},

View File

@ -73,7 +73,7 @@ angular.module('CredentialsListDefinition', [])
icon: 'fa-edit',
label: 'Edit',
"class": 'btn-sm',
awToolTip: 'View/Edit credential',
awToolTip: 'Edit credential',
dataPlacement: 'top'
},

View File

@ -44,7 +44,7 @@ angular.module('GroupListDefinition', [])
ngClick: "editGroup(\{\{ group.id \}\})",
icon: 'icon-edit',
"class": 'btn-xs',
awToolTip: 'View/Edit group',
awToolTip: 'Edit group',
dataPlacement: 'top'
},

View File

@ -44,7 +44,7 @@ angular.module('HostListDefinition', [])
ngClick: "editHost(\{\{ host.id \}\})",
icon: 'icon-edit',
"class": 'btn-xs',
awToolTip: 'View/Edit host',
awToolTip: 'Edit host',
dataPlacement: 'top'
},

View File

@ -31,8 +31,8 @@ angular.module('InventoriesListDefinition', [])
sourceField: 'name',
excludeModal: true
},
failed_hosts: {
label: 'Failed Hosts',
/*failed_hosts: {
label: 'Failures',
ngHref: "\{\{ inventory.failed_hosts_link \}\}",
badgeIcon: "\{\{ 'fa icon-failures-' + inventory.failed_hosts_class \}\}",
badgeNgHref: "\{\{ inventory.failed_hosts_link \}\}",
@ -48,7 +48,7 @@ angular.module('InventoriesListDefinition', [])
status: {
label: 'Status',
ngHref: "\{\{ inventory.status_link \}\}",
badgeIcon: "\{\{ 'fa icon-cloud-' + inventory.status_class \}\}",
badgeIcon: "\{\{ 'fa fa-cloud icon-cloud-' + inventory.status_class \}\}",
badgeNgHref: "\{\{ inventory.status_link \}\}",
badgePlacement: 'left',
badgeTipPlacement: 'top',
@ -58,24 +58,25 @@ angular.module('InventoriesListDefinition', [])
searchable: false,
excludeModal: true,
sortField: "inventory_sources_with_failures"
},
},*/
has_inventory_sources: {
label: 'Has external sources?',
label: 'Cloud sourced',
searchSingleValue: true,
searchType: 'boolean',
searchValue: 'true',
searchOnly: true
},
has_active_failures: {
label: 'Has failed hosts?',
label: 'Failed hosts',
searchSingleValue: true,
searchType: 'boolean',
searchValue: 'true',
searchOnly: true
},
inventory_sources_with_failures: {
label: 'Has inventory update failures?',
label: 'Sync failures',
searchType: 'gtzero',
searchValue: 'true',
searchOnly: true
}
},
@ -96,22 +97,33 @@ angular.module('InventoriesListDefinition', [])
},
fieldActions: {
status: {
//label: 'Status',
ngHref: "\{\{ inventory.status_link \}\}",
iconClass: "\{\{ 'fa fa-cloud icon-cloud-' + inventory.status_class \}\}",
awToolTip: "\{\{ inventory.status_tip \}\}",
dataPlacement: "top"
},
failed_hosts: {
//label: 'Failures',
ngHref: "\{\{ inventory.failed_hosts_link \}\}",
iconClass: "\{\{ 'fa icon-failures-' + inventory.failed_hosts_class \}\}",
awToolTip: "\{\{ inventory.failed_hosts_tip \}\}",
dataPlacement: "top",
},
edit: {
label: 'Edit',
ngClick: "editInventory(\{\{ inventory.id \}\})",
icon: 'icon-edit',
"class": 'btn-xs btn-default',
awToolTip: 'Edit inventory',
dataPlacement: 'top'
},
"delete": {
label: 'Delete',
ngClick: "deleteInventory(\{\{ inventory.id \}\},'\{\{ inventory.name \}\}')",
icon: 'icon-trash',
"class": 'btn-xs btn-danger',
awToolTip: 'Delete inventory',
dataPlacement: 'top'
},
}
/*,
dropdown: {
type: 'DropDown',
label: 'Jobs',
@ -122,5 +134,6 @@ angular.module('InventoriesListDefinition', [])
{ ngClick: "viewFailedJobs(\{\{ inventory.id \}\})", label: 'Failed' }
]
}
*/
}
});

View File

@ -47,7 +47,7 @@ angular.module('OrganizationListDefinition', [])
ngClick: "editOrganization(\{\{ organization.id \}\})",
icon: 'icon-edit',
"class": 'btn-xs btn-default',
awToolTip: 'View/Edit organization',
awToolTip: 'Edit organization',
dataPlacement: 'top'
},

View File

@ -62,7 +62,7 @@ angular.module('PermissionListDefinition', [])
ngClick: "editPermission(\{\{ permission.id \}\})",
icon: 'icon-edit',
"class": 'btn-xs btn-default',
awToolTip: 'View/Edit permission',
awToolTip: 'Edit permission',
dataPlacement: 'top'
},

View File

@ -95,7 +95,7 @@ angular.module('ProjectsListDefinition', [])
ngClick: "editProject(\{\{ project.id \}\})",
icon: 'icon-edit',
"class": 'btn-xs btn-default',
awToolTip: 'View/edit project properties',
awToolTip: 'Edit project properties',
dataPlacement: 'top'
},
scm_update: {

View File

@ -54,7 +54,7 @@ angular.module('TeamsListDefinition', [])
ngClick: "editTeam(\{\{ team.id \}\})",
icon: 'icon-edit',
"class": 'btn-xs btn-default',
awToolTip: 'View/Edit team',
awToolTip: 'Edit team',
dataPlacement: 'top'
},

View File

@ -56,7 +56,7 @@ angular.module('UserListDefinition', [])
ngClick: "editUser(\{\{ user.id \}\})",
icon: 'icon-edit',
"class": 'btn-xs btn-default',
awToolTip: 'View/Edit user',
awToolTip: 'Edit user',
dataPlacement: 'top'
},

View File

@ -106,11 +106,11 @@ a:focus {
.actions {
a {
font-size: 14px;
margin-left: 15px;
margin-right: 15px;
}
a:first-child {
/*a:first-child {
margin-left: 0;
}
}*/
a:hover {
cursor: pointer;
}
@ -843,12 +843,12 @@ input[type="checkbox"].checkbox-no-label {
content: "\f111";
}
.icon-failures-none,
/*.icon-failures-none,
.icon-failures-na,
.icon-failures-true,
.icon-failures-false {
font-size: 12px;
}
}*/
.badge {
padding: 2px 3px 3px 4px;

View File

@ -190,8 +190,8 @@ angular.module('InventoryTree', ['Utilities', 'RestServices', 'GroupsHelper', 'P
// Start our tree object with All Hosts
var children = [];
var sorted = SortNodes(tree_data);
for (var j=0; j < sorted[j].length; i++) {
push(sorted[j].id);
for (var j=0; j < sorted.length; j++) {
children.push(sorted[j].id);
}
var all_hosts = {
name: 'All Hosts', id: 1, group_id: null, parent: 0, description: '', show: true, ngicon: null,

View File

@ -346,6 +346,7 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
var fAction = list.fieldActions[action];
html += "<a ";
html += (fAction.href) ? "href=\"" + fAction.href + "\" " : "";
html += (fAction.ngHref) ? "ng-href=\"" + fAction.ngHref + "\" " : "";
html += (action == 'cancel') ? " class=\"red-txt\" " : "";
for (itm in fAction) {
if (itm != 'href' && itm != 'label' && itm != 'icon' && itm != 'class' && itm != 'iconClass') {