From 4b43a446b2c566a01713fe52e18270c467c91ebc Mon Sep 17 00:00:00 2001 From: hetangmodi-crest Date: Tue, 24 Dec 2024 10:47:59 +0530 Subject: [PATCH] chore: update the argument name --- docs/inputs/index.md | 2 +- .../conf_files/create_inputs_conf.py | 2 +- .../schema/schema.json | 14 ++-- .../globalConfig.json | 4 +- .../conf_files/test_create_inputs_conf.py | 2 +- tests/unit/testdata/valid_config.json | 67 ++++++++++++------- ui/src/types/globalConfig/pages.ts | 2 +- 7 files changed, 54 insertions(+), 39 deletions(-) diff --git a/docs/inputs/index.md b/docs/inputs/index.md index b09dc42e9..09ccfcf00 100644 --- a/docs/inputs/index.md +++ b/docs/inputs/index.md @@ -43,7 +43,7 @@ provided, a dropdown field will appear on the Inputs page. In contrast, a button | [restHandlerModule](../advanced/custom_rest_handler.md) | string | It specify name of the REST handler script that implements the custom actions to be performed on CRUD operations for the given input. (Use with restHandlerClass) | | [restHandlerClass](../advanced/custom_rest_handler.md) | string | It specify name of the class present in the restHandlerModule, which implements methods like handleCreate, handleEdit, handleList, handleDelete and is child class of splunktaucclib.rest_handler.admin_external.AdminExternalHandler. (Use with restHandlerModule) | | hideForPlatform | string | Defines for which platform element should be hidden from UI perspective. Currently only two platforms are supported `cloud` or `enterprise`. | -| disabled | boolean | Specifies whether a service should be disabled by default or not. If set to `True`, any new input created from the service will remain disabled until manually enabled by the user. | +| disableNewInput | boolean | Specifies whether a service's new input should be disabled on creation or not. If set to `True`, any new input created from the service will remain disabled until manually enabled by the user. Default: false | ### Usage diff --git a/splunk_add_on_ucc_framework/generators/conf_files/create_inputs_conf.py b/splunk_add_on_ucc_framework/generators/conf_files/create_inputs_conf.py index 0a2fe43e7..41f53048c 100644 --- a/splunk_add_on_ucc_framework/generators/conf_files/create_inputs_conf.py +++ b/splunk_add_on_ucc_framework/generators/conf_files/create_inputs_conf.py @@ -33,7 +33,7 @@ def _set_attributes(self, **kwargs: Any) -> None: if self._global_config: for service in self._global_config.inputs: properties = [] - if service.get("disabled") is True: + if service.get("disableNewInput"): self.disable = True self.service_name = service["name"] if service.get("conf") is not None: diff --git a/splunk_add_on_ucc_framework/schema/schema.json b/splunk_add_on_ucc_framework/schema/schema.json index e91c5955f..1999b670f 100644 --- a/splunk_add_on_ucc_framework/schema/schema.json +++ b/splunk_add_on_ucc_framework/schema/schema.json @@ -807,7 +807,7 @@ "encrypted": { "$ref": "#/definitions/encrypted" }, - "validators":{ + "validators": { "$ref": "#/definitions/AnyValidator" }, "options": { @@ -2299,7 +2299,7 @@ "modifyFieldsOnValue": { "$ref": "#/definitions/modifyFieldsOnValue" }, - "validators":{ + "validators": { "$ref": "#/definitions/AnyValidator" } }, @@ -2544,7 +2544,7 @@ ], "additionalProperties": false }, - "AnyValidator":{ + "AnyValidator": { "type": "array", "description": "It is used to validate the values of fields using various validators.", "items": { @@ -3094,9 +3094,9 @@ "warning": { "$ref": "#/definitions/WarningMessage" }, - "disabled": { + "disableNewInput": { "type": "boolean", - "description": "Declares if service should be disabled by default", + "description": "Defines whether a newly created input of a service should be disabled by default.", "default": false }, "hideForPlatform": { @@ -3221,7 +3221,7 @@ "table", "entity" ] - }, + }, "hideForPlatform": { "$ref": "#/definitions/HideForPlatform" } @@ -3340,7 +3340,7 @@ ], "additionalProperties": false }, - "HideForPlatform":{ + "HideForPlatform": { "description": "Defines for which platform element should be hidden from UI perspective.", "anyOf": [ { diff --git a/tests/testdata/test_addons/package_global_config_everything/globalConfig.json b/tests/testdata/test_addons/package_global_config_everything/globalConfig.json index 6da202855..8ec3bff2d 100644 --- a/tests/testdata/test_addons/package_global_config_everything/globalConfig.json +++ b/tests/testdata/test_addons/package_global_config_everything/globalConfig.json @@ -1607,7 +1607,7 @@ } ], "title": "Example Input Four", - "disabled": true + "disableNewInput": true }, { "name": "service_hidden_for_cloud", @@ -1907,7 +1907,7 @@ "meta": { "name": "Splunk_TA_UCCExample", "restRoot": "splunk_ta_uccexample", - "version": "5.55.0+cdd3f31ed", + "version": "5.55.0+e45124ce1", "displayName": "Splunk UCC test Add-on", "schemaVersion": "0.0.9", "_uccVersion": "5.55.0", diff --git a/tests/unit/generators/conf_files/test_create_inputs_conf.py b/tests/unit/generators/conf_files/test_create_inputs_conf.py index 8ce39017b..1e0f2d040 100644 --- a/tests/unit/generators/conf_files/test_create_inputs_conf.py +++ b/tests/unit/generators/conf_files/test_create_inputs_conf.py @@ -87,7 +87,7 @@ def test_set_attributes_without_conf_key_and_name_field( ) inputs_conf._global_config = MagicMock() inputs_conf._global_config.inputs = [ - {"name": "service1", "entity": [{"field": "name"}], "disabled": True} + {"name": "service1", "entity": [{"field": "name"}], "disableNewInput": True} ] inputs_conf._set_attributes() diff --git a/tests/unit/testdata/valid_config.json b/tests/unit/testdata/valid_config.json index 26f361187..e98ed556a 100644 --- a/tests/unit/testdata/valid_config.json +++ b/tests/unit/testdata/valid_config.json @@ -890,7 +890,9 @@ "options": { "isExpandable": true }, - "fields": ["collectFolderMetadata"] + "fields": [ + "collectFolderMetadata" + ] } ], "rows": [ @@ -902,7 +904,10 @@ "validators": [ { "type": "number", - "range": [1, 1200] + "range": [ + 1, + 1200 + ] } ] } @@ -968,7 +973,10 @@ "validators": [ { "type": "number", - "range": [1, 1200] + "range": [ + 1, + 1200 + ] } ] } @@ -1009,7 +1017,9 @@ "isExpandable": true, "expand": true }, - "fields": ["collectFolderCollaboration"] + "fields": [ + "collectFolderCollaboration" + ] }, { "label": "Group 3", @@ -1017,7 +1027,9 @@ "isExpandable": true, "expand": true }, - "fields": ["collectFolderMetadata"] + "fields": [ + "collectFolderMetadata" + ] } ], "rows": [ @@ -1090,7 +1102,10 @@ "validators": [ { "type": "number", - "range": [1, 60] + "range": [ + 1, + 60 + ] } ] } @@ -1100,7 +1115,7 @@ } ], "title": "Example Input Two", - "disabled": true + "disableNewInput": true } ], "title": "Inputs", @@ -1316,29 +1331,29 @@ "schemaVersion": "0.0.3", "os-dependentLibraries": [ { - "name": "cryptography", - "version": "41.0.5", - "platform": "win_amd64", - "python_version": "37", - "os": "windows", - "target": "3rdparty/windows" + "name": "cryptography", + "version": "41.0.5", + "platform": "win_amd64", + "python_version": "37", + "os": "windows", + "target": "3rdparty/windows" }, { - "name": "cryptography", - "version": "41.0.5", - "platform": "macosx_10_12_universal2", - "python_version": "37", - "os": "darwin", - "target": "3rdparty/darwin" + "name": "cryptography", + "version": "41.0.5", + "platform": "macosx_10_12_universal2", + "python_version": "37", + "os": "darwin", + "target": "3rdparty/darwin" }, { - "name": "cryptography", - "version": "41.0.5", - "dependencies": true, - "platform": "manylinux2014_x86_64", - "python_version": "37", - "os": "linux", - "target": "3rdparty/linux" + "name": "cryptography", + "version": "41.0.5", + "dependencies": true, + "platform": "manylinux2014_x86_64", + "python_version": "37", + "os": "linux", + "target": "3rdparty/linux" } ] } diff --git a/ui/src/types/globalConfig/pages.ts b/ui/src/types/globalConfig/pages.ts index aaa257ccb..aed9c7704 100644 --- a/ui/src/types/globalConfig/pages.ts +++ b/ui/src/types/globalConfig/pages.ts @@ -94,7 +94,7 @@ export const TableLessServiceSchema = z.object({ restHandlerClass: z.string().optional(), warning: WarningSchema, inputHelperModule: z.string().optional(), - disabled: z.boolean().optional(), + disableNewInput: z.boolean().optional(), hideForPlatform: z.enum(['cloud', 'enterprise']).optional(), });