From a86196cfa36a6f5a4572a80ca432df3c4f845b44 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Thu, 25 Mar 2021 17:40:56 -0400 Subject: [PATCH 1/2] Don't append a slash to file paths --- .../shared/InventorySourceSubForms/SCMSubForm.jsx | 7 ------- .../shared/InventorySourceSubForms/SCMSubForm.test.jsx | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx index a16949776a..f00d77e5c4 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx @@ -122,9 +122,6 @@ const SCMSubForm = ({ autoPopulateProject, i18n }) => { onSelect={(event, value) => { setIsOpen(false); value = value.trim(); - if (!value.endsWith('/')) { - value += '/'; - } sourcePathHelpers.setValue(value); }} aria-label={i18n._(t`Select source path`)} @@ -132,10 +129,6 @@ const SCMSubForm = ({ autoPopulateProject, i18n }) => { isCreatable onCreateOption={value => { value.trim(); - - if (!value.endsWith('/')) { - value += '/'; - } setSourcePath([...sourcePath, value]); }} > diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.test.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.test.jsx index 0d3c47f451..715d0df7cd 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.test.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.test.jsx @@ -98,7 +98,7 @@ describe('', () => { }); wrapper.update(); expect(wrapper.find('Select#source_path').prop('selections')).toEqual( - 'bar/' + 'bar' ); await act(async () => { @@ -138,7 +138,7 @@ describe('', () => { customWrapper.find('Select').invoke('onSelect')({}, 'newPath'); }); customWrapper.update(); - expect(customWrapper.find('Select').prop('selections')).toBe('newPath/'); + expect(customWrapper.find('Select').prop('selections')).toBe('newPath'); }); test('Update on project update should be disabled', async () => { const customInitialValues = { From 93d1df4e4bd36ae5208f03692adb501a1b4135e2 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Thu, 25 Mar 2021 18:31:45 -0400 Subject: [PATCH 2/2] Use custom text for setting source path --- .../Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx index f00d77e5c4..e874157d99 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx @@ -126,6 +126,7 @@ const SCMSubForm = ({ autoPopulateProject, i18n }) => { }} aria-label={i18n._(t`Select source path`)} placeholder={i18n._(t`Select source path`)} + createText={i18n._(t`Set source path to`)} isCreatable onCreateOption={value => { value.trim();