diff --git a/awx/ui_next/src/components/StatusLabel/StatusLabel.jsx b/awx/ui_next/src/components/StatusLabel/StatusLabel.jsx
index bd0466f5ce..9074deda1a 100644
--- a/awx/ui_next/src/components/StatusLabel/StatusLabel.jsx
+++ b/awx/ui_next/src/components/StatusLabel/StatusLabel.jsx
@@ -1,7 +1,7 @@
import 'styled-components/macro';
import React from 'react';
import { oneOf } from 'prop-types';
-import { Label } from '@patternfly/react-core';
+import { Label, Tooltip } from '@patternfly/react-core';
import {
CheckCircleIcon,
ExclamationCircleIcon,
@@ -48,15 +48,19 @@ const icons = {
canceled: ExclamationTriangleIcon,
};
-export default function StatusLabel({ status }) {
+export default function StatusLabel({ status, tooltipContent = '' }) {
const label = status.charAt(0).toUpperCase() + status.slice(1);
const color = colors[status] || 'grey';
const Icon = icons[status];
return (
- : null}>
- {label}
-
+ <>
+
+ : null}>
+ {label}
+
+
+ >
);
}
diff --git a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx
index 91f7681f98..099fd78767 100644
--- a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx
+++ b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.jsx
@@ -55,6 +55,19 @@ function InventoryListItem({
inventory.inventory_sources_with_failures > 0 ? 'error' : 'success';
}
+ let tooltipContent = '';
+ if (inventory.has_inventory_sources) {
+ if (inventory.inventory_sources_with_failures > 0) {
+ tooltipContent = i18n._(
+ t`${inventory.inventory_sources_with_failures} sources with sync failures.`
+ );
+ } else {
+ tooltipContent = i18n._(t`No inventory sync failures.`);
+ }
+ } else {
+ tooltipContent = i18n._(t`Not configured for inventory sync.`);
+ }
+
return (
|
|
- {inventory.kind !== 'smart' && }
+ {inventory.kind !== 'smart' && (
+
+ )}
|
{inventory.kind === 'smart'
diff --git a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.test.jsx b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.test.jsx
index 6be246df39..179a089e52 100644
--- a/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.test.jsx
+++ b/awx/ui_next/src/screens/Inventory/InventoryList/InventoryListItem.test.jsx
@@ -7,24 +7,33 @@ import InventoryListItem from './InventoryListItem';
jest.mock('../../../api/models/Inventories');
describe('', () => {
- test('initially renders succesfully', () => {
+ const inventory = {
+ id: 1,
+ name: 'Inventory',
+ kind: '',
+ has_active_failures: true,
+ total_hosts: 10,
+ hosts_with_active_failures: 4,
+ has_inventory_sources: true,
+ total_inventory_sources: 4,
+ inventory_sources_with_failures: 5,
+ summary_fields: {
+ organization: {
+ id: 1,
+ name: 'Default',
+ },
+ user_capabilities: {
+ edit: true,
+ },
+ },
+ };
+
+ test('initially renders successfully', () => {
mountWithContexts(
{}}
@@ -34,25 +43,50 @@ describe('', () => {
);
});
+ test('should render not configured tooltip', () => {
+ const wrapper = mountWithContexts(
+
+ );
+
+ expect(wrapper.find('StatusLabel').prop('tooltipContent')).toBe(
+ 'Not configured for inventory sync.'
+ );
+ });
+
+ test('should render success tooltip', () => {
+ const wrapper = mountWithContexts(
+
+ );
+
+ expect(wrapper.find('StatusLabel').prop('tooltipContent')).toBe(
+ 'No inventory sync failures.'
+ );
+ });
+
test('should render prompt list item data', () => {
const wrapper = mountWithContexts(
{}}
@@ -61,6 +95,9 @@ describe('', () => {
);
expect(wrapper.find('StatusLabel').length).toBe(1);
+ expect(wrapper.find('StatusLabel').prop('tooltipContent')).toBe(
+ `${inventory.inventory_sources_with_failures} sources with sync failures.`
+ );
expect(
wrapper
.find('Td')
@@ -72,7 +109,7 @@ describe('', () => {
.find('Td')
.at(2)
.text()
- ).toBe('Disabled');
+ ).toBe('Error');
expect(
wrapper
.find('Td')
@@ -92,19 +129,7 @@ describe('', () => {
|