Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add CheckboxTree component #1495

Merged
merged 65 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
e22c7bd
test(ui): added unit test case for enable count
rohanm-crest Nov 15, 2024
f47cbf1
Merge branch 'develop' of https://github.com/splunk/addonfactory-ucc-…
rohanm-crest Nov 20, 2024
d256182
Merge branch 'develop' of https://github.com/splunk/addonfactory-ucc-…
rohanm-crest Nov 21, 2024
9e22d4f
feat(checkboxTree): added the layout for new component for checkbox tree
rohanm-crest Nov 29, 2024
bd7fd13
feat(storybook): added storybook and sample in input service
rohanm-crest Dec 4, 2024
0ae19f7
Merge branch 'develop' of https://github.com/splunk/addonfactory-ucc-…
rohanm-crest Dec 4, 2024
f23a4c0
chore: remove unwanted files
rohanm-crest Dec 4, 2024
ca2a5eb
Merge branch 'develop' into feat/checkbox-tree-component
rohanm-crest Dec 4, 2024
0cb0bb7
test: added jest test case for checkboxtree
rohanm-crest Dec 4, 2024
0b6d995
Merge branch 'feat/checkbox-tree-component' of https://github.com/spl…
rohanm-crest Dec 4, 2024
a8c4f68
update screenshots
srv-rr-github-token Dec 4, 2024
4bba2e1
feat: added UTC and documentation for checkboxtree component
rohanm-crest Dec 9, 2024
a1d0212
Merge branch 'develop' of https://github.com/splunk/addonfactory-ucc-…
rohanm-crest Dec 9, 2024
4a2512c
Merge branch 'develop' into feat/checkbox-tree-component
rohanm-crest Dec 9, 2024
6bc85b8
update screenshots
srv-rr-github-token Dec 9, 2024
b274197
fix: added dependency for the variable in input.conf
rohanm-crest Dec 9, 2024
5d0501d
Merge branch 'feat/checkbox-tree-component' of https://github.com/spl…
rohanm-crest Dec 9, 2024
53a7753
refactor: update the logic for search to collapse/expand on input
rohanm-crest Dec 10, 2024
627510f
update screenshots
srv-rr-github-token Dec 10, 2024
1685dc7
revert(search): remove the search functionality from checkboxtree
rohanm-crest Dec 12, 2024
08ba881
refactor: change styling and storybook
rohanm-crest Dec 13, 2024
e4ccd69
update screenshots
srv-rr-github-token Dec 13, 2024
7f4e6f7
docs: change screenshot for checkboxtree
rohanm-crest Dec 13, 2024
ed56993
Merge branch 'feat/checkbox-tree-component' of https://github.com/spl…
rohanm-crest Dec 13, 2024
0dba61a
revert: delete search screenshot
rohanm-crest Dec 13, 2024
3df9abb
Merge branch 'develop' into feat/checkbox-tree-component
rohanm-crest Dec 13, 2024
b502f45
update screenshots
srv-rr-github-token Dec 13, 2024
4631fb4
feat: add support for disable and prisma
rohanm-crest Dec 18, 2024
aeed161
Merge branch 'feat/checkbox-tree-component' of https://github.com/spl…
rohanm-crest Dec 18, 2024
7611965
update screenshots
srv-rr-github-token Dec 18, 2024
7666043
Merge branch 'develop' into feat/checkbox-tree-component
rohanm-crest Dec 18, 2024
d8b278c
fix: resolve issue for disable in group checkbox
rohanm-crest Dec 18, 2024
ac152cf
update screenshots
srv-rr-github-token Dec 18, 2024
e9fe08e
revert(disable): remove the disable, disableonedit is already present
rohanm-crest Dec 26, 2024
bf69c7e
Merge branch 'feat/checkbox-tree-component' of https://github.com/spl…
rohanm-crest Dec 26, 2024
7fbbbea
update screenshots
srv-rr-github-token Dec 26, 2024
12ea7b6
Merge branch 'develop' of https://github.com/splunk/addonfactory-ucc-…
rohanm-crest Jan 2, 2025
ca81a15
Merge branch 'develop' of https://github.com/splunk/addonfactory-ucc-…
rohanm-crest Jan 3, 2025
31f117c
Merge branch 'develop' of https://github.com/splunk/addonfactory-ucc-…
rohanm-crest Jan 7, 2025
de57812
Merge branch 'develop' into feat/checkbox-tree-component
rohanm-crest Jan 7, 2025
215f3f7
revert: indeterminate state in the checkboxtree
rohanm-crest Jan 8, 2025
77c69ab
Merge branch 'develop' into feat/checkbox-tree-component
rohanm-crest Jan 8, 2025
ec50104
update screenshots
srv-rr-github-token Jan 8, 2025
fd2fa61
fix: style for parent checkboxtree
rohanm-crest Jan 8, 2025
40d3424
Merge branch 'feat/checkbox-tree-component' of https://github.com/spl…
rohanm-crest Jan 8, 2025
556ce96
update screenshots
srv-rr-github-token Jan 8, 2025
a1132c1
trigger ci
vtsvetkov-splunk Jan 8, 2025
df4c5d9
adjust for compact view
vtsvetkov-splunk Jan 8, 2025
a40fd2f
update screenshots
srv-rr-github-token Jan 8, 2025
4ec5210
fix field
vtsvetkov-splunk Jan 8, 2025
6702f4e
wipe all images to regenerate stale
vtsvetkov-splunk Jan 8, 2025
0fa3862
update screenshots
srv-rr-github-token Jan 8, 2025
d0155ef
trigger ci
vtsvetkov-splunk Jan 8, 2025
1d73484
Merge remote-tracking branch 'origin/develop' into feat/checkbox-tree…
vtsvetkov-splunk Jan 8, 2025
c5b363f
eslint fix
vtsvetkov-splunk Jan 8, 2025
f489854
fix path
vtsvetkov-splunk Jan 8, 2025
674410e
fix unit tests
vtsvetkov-splunk Jan 8, 2025
15afc57
fix unit tests
vtsvetkov-splunk Jan 8, 2025
e0427d0
refactor: optimise and refactored the function
rohanm-crest Jan 17, 2025
71125c1
Merge branch 'develop' of https://github.com/splunk/addonfactory-ucc-…
rohanm-crest Jan 17, 2025
6fcffb5
Merge branch 'develop' into feat/checkbox-tree-component
rohanm-crest Jan 17, 2025
cd6b8b0
test: refactor test case for checkboxtree
rohanm-crest Jan 21, 2025
93c72ed
Merge branch 'develop' of https://github.com/splunk/addonfactory-ucc-…
rohanm-crest Jan 21, 2025
08dfd34
Merge branch 'develop' into feat/checkbox-tree-component
rohanm-crest Jan 21, 2025
b32af08
update extends BaseCheckboxProps
vtsvetkov-splunk Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions docs/entity/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,80 @@ This is how it looks in the UI:

The component maps and unmaps values into a single field in the format `fieldName1/fieldValue1,fieldName2/fieldValue2`, but only for checked rows. For the given example, it emits the following value: `rowUnderGroup1/1200,requiredField/10`.

## `CheckboxTree`

See the following example usage:

```json
{
"type": "checkboxTree",
"label": "CheckboxTreeTitle",
"field": "api3",
"options": {
"groups": [
{
"label": "Group 1",
"options": {
"isExpandable": true,
"expand": true
},
"fields": ["rowUnderGroup1"]
},
{
"label": "Group 3",
"options": {
"isExpandable": true,
"expand": true,
},
"fields": ["firstRowUnderGroup3", "secondRowUnderGroup3", "thirdRowUnderGroup3"]
}
],
"rows": [
{
"field": "rowWithoutGroup",
"checkbox": {
"label": "Row without group",
"defaultValue": true
}
},
{
"field": "rowUnderGroup1",
"checkbox": {
"label": "Row under Group 1",
"defaultValue": true
}
},
{
"field": "firstRowUnderGroup3",
"checkbox": {
"label": "first row under group 3",
"defaultValue": true
}
},
{
"field": "secondRowUnderGroup3",
"checkbox": {
"label": "second row under group 3"
}
},
{
"field": "thirdRowUnderGroup3",
"checkbox": {
"label": "third row checked under group 3",
"defaultValue": true,
}
}
]
}
}
```

This is how it looks in the UI:

![image](../images/components/checkbox_tree_mixed_example.png)

The component maps and unmaps values into a single field in the format `fieldName1,fieldName2,fieldName3`, but only for checked rows. For the given example, it emits the following value: `rowWithoutGroup,rowUnderGroup1,firstRowUnderGroup3`.

## `Multiple Select`

See the underlying `@splunk/react-ui` component: [`Multiselect`](https://splunkui.splunk.com/Packages/react-ui/Multiselect).
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion splunk_add_on_ucc_framework/global_config_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,10 @@ def _validate_checkbox_group(self) -> None:
services = inputs["services"]
for service in services:
for entity in service["entity"]:
if entity["type"] == "checkboxGroup":
if (
entity["type"] == "checkboxGroup"
or entity["type"] == "checkboxTree"
):
row_field_names = []
for row in entity["options"]["rows"]:
if row["field"] in row_field_names:
Expand Down
124 changes: 124 additions & 0 deletions splunk_add_on_ucc_framework/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,127 @@
],
"additionalProperties": false
},
"CheckboxTreeEntity": {
"type": "object",
"properties": {
"field": {
"$ref": "#/definitions/Field"
},
"label": {
"type": "string",
"maxLength": 30,
"description": "Text displayed next to entity field"
},
"type": {
"const": "checkboxTree",
"type": "string",
"description": "Exactly: checkboxTree"
},
"disabled": {
"type": "boolean",
"default": false
},
"options": {
"type": "object",
"properties": {
"groups": {
"type": "array",
"items": {
"type": "object",
"properties": {
"label": {
"type": "string",
"maxLength": 30,
"description": "Text displayed next to entity field"
},
"options": {
"type": "object",
"properties": {
"isExpandable": {
"type": "boolean",
"default": false
},
"expand": {
"type": "boolean",
"default": false
},
"disabled": {
"type": "boolean",
"default": false
}
},
"additionalProperties": false
},
"fields": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
},
"uniqueItems": true
}
},
"required": ["label", "fields"],
"additionalProperties": false
}
},
"rows": {
"type": "array",
"items": {
"type": "object",
"properties": {
"field": {
"type": "string"
},
"checkbox": {
"type": "object",
"properties": {
"label": {
"type": "string",
"maxLength": 30,
"description": "Text displayed next to entity field"
},
"defaultValue": {
"type": "boolean",
"description": "The initial input value."
},
"disabled": {
"type": "boolean",
"default": false
}
},
"additionalProperties": false
}
},
"required": ["field"],
"additionalProperties": false
},
"minItems": 1
},
"disableonEdit": {
"$ref": "#/definitions/disableonEdit"
}
},
"required": ["rows"],
"additionalProperties": false
},
"validators": {
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/RegexValidator"
}
]
}
},
"required": {
"type": "boolean"
}
},
"required": ["field", "label", "type", "options"],
"additionalProperties": false
},
"RadioEntity": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1867,6 +1988,9 @@
{
"$ref": "#/definitions/CheckboxGroupEntity"
},
{
"$ref": "#/definitions/CheckboxTreeEntity"
},
{
"$ref": "#/definitions/TextEntity"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ start_date = The date and time, in "YYYY-MM-DDThh:mm:ss.000z" format, after whic
use_existing_checkpoint = Data input already exists. Select `No` if you want to reset the data collection. Default: yes

[example_input_three://<name>]
event_filters =
interval = Time interval of the data input, in seconds.

[example_input_four://<name>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
'disabled',
required=False,
validator=None
),

field.RestField(
'event_filters',
required=False,
encrypted=False,
default=None,
validator=None
)

]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,81 @@
"label": "Interval",
"help": "Time interval of the data input, in seconds.",
"required": true
},
{
"type": "checkboxTree",
"label": "Event Filters",
"field": "event_filters",
"required": true,
"options": {
"groups": [
{
"label": "Transactions",
"options": {
"isExpandable": true,
"expand": true
},
"fields": [
"slow_request",
"transaction_stall"
]
},
{
"label": "others",
"options": {
"isExpandable": true,
"expand": true
},
"fields": [
"custom_events",
"cluster_events",
"network_events"
]
}
],
"rows": [
{
"field": "code_problems",
"checkbox": {
"label": "Code Problems",
"defaultValue": true
}
},
{
"field": "slow_request",
"checkbox": {
"label": "Slow Request",
"defaultValue": true
}
},
{
"field": "transaction_stall",
"checkbox": {
"label": "Transactions Stall",
"defaultValue": false
}
},
{
"field": "custom_events",
"checkbox": {
"label": "Custom Events",
"defaultValue": true
}
},
{
"field": "cluster_events",
"checkbox": {
"label": "Cluster Events"
}
},
{
"field": "network_events",
"checkbox": {
"label": "Network Events"
}
}
]
}
}
],
"title": "Example Input Three"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
'disabled',
required=False,
validator=None
),

field.RestField(
'event_filters',
required=False,
encrypted=False,
default=None,
validator=None
)

]
Expand Down
Loading
Loading