mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 20:00:43 -03:30
Merge pull request #11998 from mabashian/344-host-count
Adds total host count to inv and smart inv details views
This commit is contained in:
commit
0cc9b84ead
@ -78,6 +78,7 @@ function InventoryDetail({ inventory }) {
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
<Detail label={t`Total hosts`} value={inventory.total_hosts} />
|
||||
{instanceGroups && instanceGroups.length > 0 && (
|
||||
<Detail
|
||||
fullWidth
|
||||
|
||||
@ -85,6 +85,7 @@ describe('<InventoryDetail />', () => {
|
||||
expectDetailToMatch(wrapper, 'Name', mockInventory.name);
|
||||
expectDetailToMatch(wrapper, 'Description', mockInventory.description);
|
||||
expectDetailToMatch(wrapper, 'Type', 'Inventory');
|
||||
expectDetailToMatch(wrapper, 'Total hosts', mockInventory.total_hosts);
|
||||
const link = wrapper.find('Detail[label="Organization"]').find('Link');
|
||||
|
||||
const org = wrapper.find('Detail[label="Organization"]');
|
||||
|
||||
@ -28,6 +28,7 @@ function SmartInventoryDetail({ inventory }) {
|
||||
id,
|
||||
modified,
|
||||
name,
|
||||
total_hosts,
|
||||
variables,
|
||||
summary_fields: {
|
||||
created_by,
|
||||
@ -116,6 +117,7 @@ function SmartInventoryDetail({ inventory }) {
|
||||
label={t`Smart host filter`}
|
||||
value={<Label variant="outline">{host_filter}</Label>}
|
||||
/>
|
||||
<Detail label={t`Total hosts`} value={total_hosts} />
|
||||
{instanceGroups.length > 0 && (
|
||||
<Detail
|
||||
fullWidth
|
||||
|
||||
@ -57,6 +57,7 @@ describe('<SmartInventoryDetail />', () => {
|
||||
assertDetail('Organization', 'Default');
|
||||
assertDetail('Smart host filter', 'name__icontains=local');
|
||||
assertDetail('Instance groups', 'mock instance group');
|
||||
assertDetail('Total hosts', '2');
|
||||
expect(wrapper.find(`Detail[label="Activity"] Sparkline`)).toHaveLength(
|
||||
1
|
||||
);
|
||||
|
||||
@ -3,76 +3,76 @@
|
||||
"type": "inventory",
|
||||
"url": "/api/v2/inventories/2/",
|
||||
"related": {
|
||||
"created_by": "/api/v2/users/1/",
|
||||
"modified_by": "/api/v2/users/1/",
|
||||
"hosts": "/api/v2/inventories/2/hosts/",
|
||||
"groups": "/api/v2/inventories/2/groups/",
|
||||
"root_groups": "/api/v2/inventories/2/root_groups/",
|
||||
"variable_data": "/api/v2/inventories/2/variable_data/",
|
||||
"script": "/api/v2/inventories/2/script/",
|
||||
"tree": "/api/v2/inventories/2/tree/",
|
||||
"inventory_sources": "/api/v2/inventories/2/inventory_sources/",
|
||||
"update_inventory_sources": "/api/v2/inventories/2/update_inventory_sources/",
|
||||
"activity_stream": "/api/v2/inventories/2/activity_stream/",
|
||||
"job_templates": "/api/v2/inventories/2/job_templates/",
|
||||
"ad_hoc_commands": "/api/v2/inventories/2/ad_hoc_commands/",
|
||||
"access_list": "/api/v2/inventories/2/access_list/",
|
||||
"object_roles": "/api/v2/inventories/2/object_roles/",
|
||||
"instance_groups": "/api/v2/inventories/2/instance_groups/",
|
||||
"copy": "/api/v2/inventories/2/copy/",
|
||||
"organization": "/api/v2/organizations/1/"
|
||||
"created_by": "/api/v2/users/1/",
|
||||
"modified_by": "/api/v2/users/1/",
|
||||
"hosts": "/api/v2/inventories/2/hosts/",
|
||||
"groups": "/api/v2/inventories/2/groups/",
|
||||
"root_groups": "/api/v2/inventories/2/root_groups/",
|
||||
"variable_data": "/api/v2/inventories/2/variable_data/",
|
||||
"script": "/api/v2/inventories/2/script/",
|
||||
"tree": "/api/v2/inventories/2/tree/",
|
||||
"inventory_sources": "/api/v2/inventories/2/inventory_sources/",
|
||||
"update_inventory_sources": "/api/v2/inventories/2/update_inventory_sources/",
|
||||
"activity_stream": "/api/v2/inventories/2/activity_stream/",
|
||||
"job_templates": "/api/v2/inventories/2/job_templates/",
|
||||
"ad_hoc_commands": "/api/v2/inventories/2/ad_hoc_commands/",
|
||||
"access_list": "/api/v2/inventories/2/access_list/",
|
||||
"object_roles": "/api/v2/inventories/2/object_roles/",
|
||||
"instance_groups": "/api/v2/inventories/2/instance_groups/",
|
||||
"copy": "/api/v2/inventories/2/copy/",
|
||||
"organization": "/api/v2/organizations/1/"
|
||||
},
|
||||
"summary_fields": {
|
||||
"organization": {
|
||||
"id": 1,
|
||||
"name": "Default",
|
||||
"description": ""
|
||||
"organization": {
|
||||
"id": 1,
|
||||
"name": "Default",
|
||||
"description": ""
|
||||
},
|
||||
"created_by": {
|
||||
"id": 1,
|
||||
"username": "admin",
|
||||
"first_name": "",
|
||||
"last_name": ""
|
||||
},
|
||||
"modified_by": {
|
||||
"id": 1,
|
||||
"username": "admin",
|
||||
"first_name": "",
|
||||
"last_name": ""
|
||||
},
|
||||
"object_roles": {
|
||||
"admin_role": {
|
||||
"description": "Can manage all aspects of the inventory",
|
||||
"name": "Admin",
|
||||
"id": 27
|
||||
},
|
||||
"created_by": {
|
||||
"id": 1,
|
||||
"username": "admin",
|
||||
"first_name": "",
|
||||
"last_name": ""
|
||||
"update_role": {
|
||||
"description": "May update the inventory",
|
||||
"name": "Update",
|
||||
"id": 28
|
||||
},
|
||||
"modified_by": {
|
||||
"id": 1,
|
||||
"username": "admin",
|
||||
"first_name": "",
|
||||
"last_name": ""
|
||||
"adhoc_role": {
|
||||
"description": "May run ad hoc commands on the inventory",
|
||||
"name": "Ad Hoc",
|
||||
"id": 29
|
||||
},
|
||||
"object_roles": {
|
||||
"admin_role": {
|
||||
"description": "Can manage all aspects of the inventory",
|
||||
"name": "Admin",
|
||||
"id": 27
|
||||
},
|
||||
"update_role": {
|
||||
"description": "May update the inventory",
|
||||
"name": "Update",
|
||||
"id": 28
|
||||
},
|
||||
"adhoc_role": {
|
||||
"description": "May run ad hoc commands on the inventory",
|
||||
"name": "Ad Hoc",
|
||||
"id": 29
|
||||
},
|
||||
"use_role": {
|
||||
"description": "Can use the inventory in a job template",
|
||||
"name": "Use",
|
||||
"id": 30
|
||||
},
|
||||
"read_role": {
|
||||
"description": "May view settings for the inventory",
|
||||
"name": "Read",
|
||||
"id": 31
|
||||
}
|
||||
"use_role": {
|
||||
"description": "Can use the inventory in a job template",
|
||||
"name": "Use",
|
||||
"id": 30
|
||||
},
|
||||
"user_capabilities": {
|
||||
"edit": true,
|
||||
"delete": true,
|
||||
"copy": true,
|
||||
"adhoc": true
|
||||
"read_role": {
|
||||
"description": "May view settings for the inventory",
|
||||
"name": "Read",
|
||||
"id": 31
|
||||
}
|
||||
},
|
||||
"user_capabilities": {
|
||||
"edit": true,
|
||||
"delete": true,
|
||||
"copy": true,
|
||||
"adhoc": true
|
||||
}
|
||||
},
|
||||
"created": "2019-10-04T15:29:11.542911Z",
|
||||
"modified": "2019-10-04T15:29:11.542924Z",
|
||||
@ -83,7 +83,7 @@
|
||||
"host_filter": "name__icontains=local",
|
||||
"variables": "",
|
||||
"has_active_failures": false,
|
||||
"total_hosts": 1,
|
||||
"total_hosts": 2,
|
||||
"hosts_with_active_failures": 0,
|
||||
"total_groups": 0,
|
||||
"groups_with_active_failures": 0,
|
||||
@ -91,4 +91,4 @@
|
||||
"total_inventory_sources": 0,
|
||||
"inventory_sources_with_failures": 0,
|
||||
"pending_deletion": false
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user