From 73358ee58c211e55608e09e1b45e1eeed8ec8df7 Mon Sep 17 00:00:00 2001 From: Viktor Tsvetkov <142901247+vtsvetkov-splunk@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:38:12 +0100 Subject: [PATCH 1/2] feat(checkboxGroup): correctly parsing values with spaces (#1034) --- .../CheckboxGroup/checkboxGroup.utils.test.ts | 11 +++++++++++ .../components/CheckboxGroup/checkboxGroup.utils.ts | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/src/components/CheckboxGroup/checkboxGroup.utils.test.ts b/ui/src/components/CheckboxGroup/checkboxGroup.utils.test.ts index 7ab1de3a4..0641b96ff 100644 --- a/ui/src/components/CheckboxGroup/checkboxGroup.utils.test.ts +++ b/ui/src/components/CheckboxGroup/checkboxGroup.utils.test.ts @@ -23,6 +23,17 @@ describe('parseValue', () => { expect(resultMap.get('collect_file')?.inputValue).toBe(1); expect(resultMap.get('collect_task')?.inputValue).toBe(1); }); + + it('should correctly parse a collection string with spaces into a Map', () => { + const collection = 'ec2_volumes/3600, ec2_instances/1800, ec2_reserved_instances/900'; + const resultMap = parseValue(collection); + + expect(resultMap.size).toBe(3); + expect(resultMap.get('ec2_volumes')?.inputValue).toBe(3600); + expect(resultMap.get('ec2_instances')?.inputValue).toBe(1800); + expect(resultMap.get('ec2_reserved_instances')?.inputValue).toBe(900); + }); + it('should return an empty Map for undefined collection', () => { const resultMap = parseValue(); expect(resultMap.size).toBe(0); diff --git a/ui/src/components/CheckboxGroup/checkboxGroup.utils.ts b/ui/src/components/CheckboxGroup/checkboxGroup.utils.ts index 698475b32..cb102c3f0 100644 --- a/ui/src/components/CheckboxGroup/checkboxGroup.utils.ts +++ b/ui/src/components/CheckboxGroup/checkboxGroup.utils.ts @@ -22,7 +22,7 @@ export function parseValue(collection?: string): ValueByField { const splitValues = collection.split(','); splitValues.forEach((rawValue) => { - const [field, inputValue] = rawValue.split('/'); + const [field, inputValue] = rawValue.trim().split('/'); const parsedInputValue = inputValue === '' ? undefined : Number(inputValue); if (!field || Number.isNaN(parsedInputValue)) { throw new Error(`Value is not parsable: ${collection}`); From 559cfd627e9262dbf96cf9eb79e830fa2ac6264a Mon Sep 17 00:00:00 2001 From: srv-rr-github-token <94607705+srv-rr-github-token@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:08:37 +0000 Subject: [PATCH 2/2] chore(release): 5.37.0 # [5.37.0](https://github.com/splunk/addonfactory-ucc-generator/compare/v5.36.2...v5.37.0) (2024-01-31) ### Features * **checkboxGroup:** correctly parsing values with spaces ([#1034](https://github.com/splunk/addonfactory-ucc-generator/issues/1034)) ([73358ee](https://github.com/splunk/addonfactory-ucc-generator/commit/73358ee58c211e55608e09e1b45e1eeed8ec8df7)) --- NOTICE | 6 +++--- docs/CHANGELOG.md | 7 +++++++ pyproject.toml | 2 +- splunk_add_on_ucc_framework/__init__.py | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/NOTICE b/NOTICE index 61b5eb60a..7a2132944 100644 --- a/NOTICE +++ b/NOTICE @@ -7,9 +7,9 @@ The following 3rd-party software packages may be used by or distributed with addonfactory-ucc-generator. Any information relevant to third-party vendors listed below are collected using common, reasonable means. -Date generated: 2024-1-12 +Date generated: 2024-1-31 -Revision ID: 21ee4ae7effd49933a7f5c885b1524085219be00 +Revision ID: 73358ee58c211e55608e09e1b45e1eeed8ec8df7 ================================================================================ ================================================================================ @@ -11472,4 +11472,4 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -Report Generated by FOSSA on 2024-1-12 +Report Generated by FOSSA on 2024-1-31 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index be837a397..98375327c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,10 @@ +# [5.37.0](https://github.com/splunk/addonfactory-ucc-generator/compare/v5.36.2...v5.37.0) (2024-01-31) + + +### Features + +* **checkboxGroup:** correctly parsing values with spaces ([#1034](https://github.com/splunk/addonfactory-ucc-generator/issues/1034)) ([73358ee](https://github.com/splunk/addonfactory-ucc-generator/commit/73358ee58c211e55608e09e1b45e1eeed8ec8df7)) + ## [5.36.2](https://github.com/splunk/addonfactory-ucc-generator/compare/v5.36.1...v5.36.2) (2024-01-12) diff --git a/pyproject.toml b/pyproject.toml index f8f10ea44..258cf249b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ [tool.poetry] name = "splunk_add_on_ucc_framework" -version = "5.36.2" +version = "5.37.0" description = "Splunk Add-on SDK formerly UCC is a build and code generation framework" license = "Apache-2.0" authors = ["Splunk "] diff --git a/splunk_add_on_ucc_framework/__init__.py b/splunk_add_on_ucc_framework/__init__.py index f27336ab8..1d3baf1a9 100644 --- a/splunk_add_on_ucc_framework/__init__.py +++ b/splunk_add_on_ucc_framework/__init__.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "5.36.2" +__version__ = "5.37.0" import logging