From 25aae9abc631f5e4db2e2c78b2b91b2431e18584 Mon Sep 17 00:00:00 2001 From: mabashian Date: Thu, 10 Jun 2021 15:06:13 -0400 Subject: [PATCH 1/2] Fixes bug where source list page would crash if first sync was running --- .../InventorySources/InventorySourceList.jsx | 3 +- .../InventorySourceList.test.jsx | 1 - .../InventorySourceListItem.jsx | 22 +++++++------- .../InventorySourceListItem.test.jsx | 29 +++++++++++++++++++ 4 files changed, 42 insertions(+), 13 deletions(-) diff --git a/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.jsx b/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.jsx index 14c22a06b5..e3274c19a2 100644 --- a/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.jsx +++ b/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.jsx @@ -25,8 +25,7 @@ import InventorySourceListItem from './InventorySourceListItem'; import useWsInventorySources from './useWsInventorySources'; import { relatedResourceDeleteRequests } from '../../../util/getRelatedResourceDeleteDetails'; -const QS_CONFIG = getQSConfig('inventory', { - not__source: '', +const QS_CONFIG = getQSConfig('inventory_sources', { page: 1, page_size: 20, order_by: 'name', diff --git a/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.test.jsx b/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.test.jsx index 138fac4207..93b4faa962 100644 --- a/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.test.jsx +++ b/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.test.jsx @@ -115,7 +115,6 @@ describe('', () => { test('api calls should be made on mount', async () => { expect(InventoriesAPI.readSources).toHaveBeenCalledWith('1', { - not__source: '', order_by: 'name', page: 1, page_size: 20, diff --git a/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceListItem.jsx b/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceListItem.jsx index dce8c861fe..8bb3acd36e 100644 --- a/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceListItem.jsx +++ b/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceListItem.jsx @@ -94,16 +94,18 @@ function InventorySourceListItem({ {['running', 'pending', 'waiting'].includes(source?.status) ? ( - + {source.summary_fields?.current_job?.id && ( + + )} ) : ( ', () => { 'Custom virtual environment /var/lib/awx/env must be replaced by an execution environment.' ); }); + + test('should render cancel button while job is running', () => { + const onSelect = jest.fn(); + wrapper = mountWithContexts( + + + + +
+ ); + expect(wrapper.find('JobCancelButton').length).toBe(1); + }); }); From ae83032ff3a93df23b597d1d94edf738f97893ec Mon Sep 17 00:00:00 2001 From: mabashian Date: Thu, 10 Jun 2021 16:42:03 -0400 Subject: [PATCH 2/2] Swap underscore for hyphen --- .../screens/Inventory/InventorySources/InventorySourceList.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.jsx b/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.jsx index e3274c19a2..ee05909ba4 100644 --- a/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.jsx +++ b/awx/ui_next/src/screens/Inventory/InventorySources/InventorySourceList.jsx @@ -25,7 +25,7 @@ import InventorySourceListItem from './InventorySourceListItem'; import useWsInventorySources from './useWsInventorySources'; import { relatedResourceDeleteRequests } from '../../../util/getRelatedResourceDeleteDetails'; -const QS_CONFIG = getQSConfig('inventory_sources', { +const QS_CONFIG = getQSConfig('inventory-sources', { page: 1, page_size: 20, order_by: 'name',