From 0e86b3c0cea062ded7a7892ccce50237e69722b5 Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Tue, 10 Sep 2024 18:11:58 +0200 Subject: [PATCH 01/14] fix: cusotm row loading on many tabs --- ui/src/components/table/CustomTable.tsx | 7 ++++++- ui/src/components/table/TableExpansionRow.jsx | 9 +-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ui/src/components/table/CustomTable.tsx b/ui/src/components/table/CustomTable.tsx index 065977e98..ecfe88f82 100644 --- a/ui/src/components/table/CustomTable.tsx +++ b/ui/src/components/table/CustomTable.tsx @@ -270,7 +270,12 @@ const CustomTable: React.FC = ({ handleToggleActionClick={handleToggleActionClick} {...(moreInfo ? { - expansionRow: getExpansionRow(columns.length, row, moreInfo), + expansionRow: getExpansionRow( + columns.length, + row, + moreInfo, + tableConfig?.customRow + ), } : {})} /> diff --git a/ui/src/components/table/TableExpansionRow.jsx b/ui/src/components/table/TableExpansionRow.jsx index a2e4cb7c8..ab032785d 100644 --- a/ui/src/components/table/TableExpansionRow.jsx +++ b/ui/src/components/table/TableExpansionRow.jsx @@ -4,20 +4,13 @@ import Table from '@splunk/react-ui/Table'; import styled from 'styled-components'; import CustomTableControl from './CustomTableControl'; -import { getUnifiedConfigs } from '../../util/util'; import { getExpansionRowData } from './TableExpansionRowData'; const TableCellWrapper = styled(Table.Cell)` border-top: none; `; -export function getExpansionRow(colSpan, row, moreInfo) { - const inputs = getUnifiedConfigs().pages?.inputs; - - const customRow = inputs?.table - ? inputs.table.customRow - : inputs.services.find((service) => service.name === row.serviceName).table?.customRow; - +export function getExpansionRow(colSpan, row, moreInfo, customRow) { return ( From 61da8b8283ef8e748b471afa463b254a91cd306b Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Mon, 16 Sep 2024 04:15:50 +0200 Subject: [PATCH 02/14] test: add tab for config custom row --- .../Splunk_TA_UCCExample/default/server.conf | 3 +- .../README/alert_actions.conf.spec | 3 +- .../default/alert_actions.conf | 3 +- .../Splunk_TA_UCCExample/default/app.conf | 5 +- .../default/eventtypes.conf | 3 +- .../Splunk_TA_UCCExample/default/restmap.conf | 9 +- .../Splunk_TA_UCCExample/default/server.conf | 4 +- .../Splunk_TA_UCCExample/default/tags.conf | 3 +- .../Splunk_TA_UCCExample/default/web.conf | 8 ++ .../globalConfig.json | 100 +++++++++++++++++- .../build/custom/custom_input_row_replace.js | 25 +++++ 11 files changed, 156 insertions(+), 10 deletions(-) create mode 100644 tests/testdata/test_addons/package_global_config_everything/package/appserver/static/js/build/custom/custom_input_row_replace.js diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf index 5a7326859..a9c28078c 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf @@ -1,4 +1,5 @@ [shclustering] conf_replication_include.splunk_ta_uccexample_settings = true conf_replication_include.splunk_ta_uccexample_account = true -conf_replication_include.splunk_ta_uccexample_oauth = true \ No newline at end of file +conf_replication_include.splunk_ta_uccexample_oauth = true + diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec index 46492994d..41b3fda28 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec @@ -5,4 +5,5 @@ param.description = Description. It's a required parameter. It's defaul param.all_incidents = All Incidents. param.table_list = Table List. It's default value is problem. param.action = Action:. It's a required parameter. It's default value is update. -param.account = Select Account. It's a required parameter. \ No newline at end of file +param.account = Select Account. It's a required parameter. + diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf index 57834810c..a50d253a6 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf @@ -11,4 +11,5 @@ param.description = some sample description param.all_incidents = 0 param.table_list = problem param.action = update -param.account = \ No newline at end of file +param.account = + diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf index 51a81dada..086cefa69 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf @@ -22,6 +22,9 @@ name = Splunk_TA_UCCExample version = 5.5.8R5fd76615 [triggers] +reload.splunk_ta_uccexample_settings = simple +reload.splunk_ta_uccexample_custom_row_tab = simple reload.splunk_ta_uccexample_account = simple reload.splunk_ta_uccexample_oauth = simple -reload.splunk_ta_uccexample_settings = simple \ No newline at end of file +reload.splunk_ta_uccexample_settings = simple + diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf index d691df4e0..7f976cb9b 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf @@ -1,2 +1,3 @@ [test_alert_modaction_result] -search = sourcetype="test:incident" \ No newline at end of file +search = sourcetype="test:incident" + diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf index 8c8d7c47c..c82d760c0 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf @@ -1,6 +1,6 @@ [admin:splunk_ta_uccexample] match = / -members = splunk_ta_uccexample_account, splunk_ta_uccexample_example_input_four, splunk_ta_uccexample_example_input_one, splunk_ta_uccexample_example_input_three, splunk_ta_uccexample_example_input_two, splunk_ta_uccexample_oauth, splunk_ta_uccexample_settings +members = splunk_ta_uccexample_account, splunk_ta_uccexample_oauth, splunk_ta_uccexample_custom_row_tab, splunk_ta_uccexample_settings, splunk_ta_uccexample_example_input_one, splunk_ta_uccexample_example_input_two, splunk_ta_uccexample_example_input_three, splunk_ta_uccexample_example_input_four [admin_external:splunk_ta_uccexample_account] handlertype = python @@ -16,6 +16,13 @@ handlerfile = splunk_ta_uccexample_rh_oauth.py handleractions = edit handlerpersistentmode = true +[admin_external:splunk_ta_uccexample_custom_row_tab] +handlertype = python +python.version = python3 +handlerfile = splunk_ta_uccexample_rh_custom_row_tab.py +handleractions = edit, list, remove, create +handlerpersistentmode = true + [admin_external:splunk_ta_uccexample_settings] handlertype = python python.version = python3 diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf index 5a7326859..eeb2e8701 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf @@ -1,4 +1,6 @@ [shclustering] conf_replication_include.splunk_ta_uccexample_settings = true conf_replication_include.splunk_ta_uccexample_account = true -conf_replication_include.splunk_ta_uccexample_oauth = true \ No newline at end of file +conf_replication_include.splunk_ta_uccexample_custom_row_tab = true +conf_replication_include.splunk_ta_uccexample_oauth = true + diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf index fb7c5a919..2f56dc25a 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf @@ -1,2 +1,3 @@ [eventtype=test_alert_modaction_result] -modaction_result = enabled \ No newline at end of file +modaction_result = enabled + diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf index 5804f293f..55b9e5ee3 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf @@ -14,6 +14,14 @@ methods = POST, GET pattern = splunk_ta_uccexample_oauth/* methods = POST, GET, DELETE +[expose:splunk_ta_uccexample_custom_row_tab] +pattern = splunk_ta_uccexample_custom_row_tab +methods = POST, GET + +[expose:splunk_ta_uccexample_custom_row_tab_specified] +pattern = splunk_ta_uccexample_custom_row_tab/* +methods = POST, GET, DELETE + [expose:splunk_ta_uccexample_settings] pattern = splunk_ta_uccexample_settings methods = POST, GET 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 1bd01ef1e..8c9846200 100644 --- a/tests/testdata/test_addons/package_global_config_everything/globalConfig.json +++ b/tests/testdata/test_addons/package_global_config_everything/globalConfig.json @@ -625,6 +625,102 @@ ] } ] + }, + { + "name": "custom_row_tab", + "table": { + "actions": [ + "edit", + "delete", + "clone" + ], + "header": [ + { + "label": "Name", + "field": "name" + }, + { + "label": "Text Test", + "field": "text_test" + } + ], + "moreInfo": [ + { + "field": "name", + "label": "Name" + }, + { + "field": "text_test", + "label": "Text Test" + } + ], + "customRow": { + "src": "custom_input_row_replace", + "type": "external" + } + }, + "entity": [ + { + "type": "text", + "label": "Name", + "validators": [ + { + "type": "string", + "errorMsg": "Length of ID should be between 1 and 50", + "minLength": 1, + "maxLength": 50 + }, + { + "type": "regex", + "errorMsg": "Name must begin with a letter and consist exclusively of alphanumeric characters and underscores.", + "pattern": "^[a-zA-Z]\\w*$" + } + ], + "field": "name", + "help": "Enter a unique name for this account.", + "required": true + }, + { + "field": "example_help_link", + "label": "", + "type": "helpLink", + "options": { + "text": "Help Link", + "link": "https://docs.splunk.com/Documentation" + } + }, + { + "field": "config1_help_link", + "type": "helpLink", + "options": { + "text": "Add-on configuration documentation", + "link": "https://docs.splunk.com/Documentation" + } + }, + { + "field": "config2_help_link", + "type": "helpLink", + "options": { + "text": "SSL configuration documentation", + "link": "https://docs.splunk.com/Documentation" + } + }, + { + "field": "text_test", + "label": "Text Test", + "help": "This is a text test", + "type": "text", + "validators": [ + { + "type": "string", + "minLength": 1, + "maxLength": 100 + } + ], + "required": true + } + ], + "title": "Custom table row" } ], "title": "Configuration", @@ -1551,10 +1647,10 @@ "meta": { "name": "Splunk_TA_UCCExample", "restRoot": "splunk_ta_uccexample", - "version": "5.48.2Ra94cdc9a8", + "version": "5.49.0Rcc63ee532", "displayName": "Splunk UCC test Add-on", "schemaVersion": "0.0.8", - "_uccVersion": "5.48.2", + "_uccVersion": "5.49.0", "supportedThemes": [ "light", "dark" diff --git a/tests/testdata/test_addons/package_global_config_everything/package/appserver/static/js/build/custom/custom_input_row_replace.js b/tests/testdata/test_addons/package_global_config_everything/package/appserver/static/js/build/custom/custom_input_row_replace.js new file mode 100644 index 000000000..9cfa56614 --- /dev/null +++ b/tests/testdata/test_addons/package_global_config_everything/package/appserver/static/js/build/custom/custom_input_row_replace.js @@ -0,0 +1,25 @@ +class CustomInputRow { + /** + * Custom Row Cell + * @constructor + * @param {Object} globalConfig - Global configuration. + * @param {string} serviceName - Input service name. + * @param {element} el - The element of the custom cell. + * @param {Object} row - custom row object, + * use this.row., where is a field name + */ + constructor(globalConfig, serviceName, el, row) { + this.globalConfig = globalConfig; + this.serviceName = serviceName; + this.el = el; + this.row = row; + } + + render() { + const content_html_template = "Custom Input Row"; + this.el.innerHTML = content_html_template; + return this; + } +} + +export default CustomInputRow; From b1b36c66ae3ab1576fb0aa512ffb5e6c0a9ca27f Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Mon, 16 Sep 2024 04:58:10 +0200 Subject: [PATCH 03/14] test: fix tests --- .../README/splunk_ta_uccexample_account.conf.spec | 3 ++- .../README/splunk_ta_uccexample_settings.conf.spec | 3 ++- .../Splunk_TA_UCCExample/default/restmap.conf | 3 ++- .../default/splunk_ta_uccexample_settings.conf | 3 ++- .../Splunk_TA_UCCExample/default/web.conf | 3 ++- .../Splunk_TA_UCCExample/README/inputs.conf.spec | 1 + .../README/splunk_ta_uccexample_account.conf.spec | 4 +++- .../README/splunk_ta_uccexample_settings.conf.spec | 3 ++- .../Splunk_TA_UCCExample/default/inputs.conf | 3 ++- .../Splunk_TA_UCCExample/default/restmap.conf | 5 +++-- .../Splunk_TA_UCCExample/default/server.conf | 2 +- .../default/splunk_ta_uccexample_settings.conf | 3 ++- .../Splunk_TA_UCCExample/default/web.conf | 3 ++- 13 files changed, 26 insertions(+), 13 deletions(-) diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec index 67a64483e..c411b3e4f 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec @@ -14,4 +14,5 @@ password = redirect_url = refresh_token = token = -username = \ No newline at end of file +username = + \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec index a359f3958..aa7b1832a 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec @@ -17,4 +17,5 @@ testIpv4 = testNumber = testRegex = testString = -testUrl = \ No newline at end of file +testUrl = + \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/restmap.conf b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/restmap.conf index 411bf07f8..3cc86aab3 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/restmap.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/restmap.conf @@ -21,4 +21,5 @@ handlertype = python python.version = python3 handlerfile = splunk_ta_uccexample_rh_settings.py handleractions = edit, list -handlerpersistentmode = true \ No newline at end of file +handlerpersistentmode = true + \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf index 13a8a4c5d..dcf15fb65 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf @@ -17,4 +17,5 @@ testRegex = testEmail = testIpv4 = testDate = -testUrl = \ No newline at end of file +testUrl = + \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/web.conf b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/web.conf index c1495c278..b8ca64414 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/web.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/web.conf @@ -20,4 +20,5 @@ methods = POST, GET [expose:splunk_ta_uccexample_settings_specified] pattern = splunk_ta_uccexample_settings/* -methods = POST, GET, DELETE \ No newline at end of file +methods = POST, GET, DELETE + \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/inputs.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/inputs.conf.spec index d1d44e2c8..519799126 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/inputs.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/inputs.conf.spec @@ -36,3 +36,4 @@ interval = Time interval of the data input, in seconds. [example_input_four://] interval = Time interval of the data input, in seconds. + \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec index f922e33d2..6c229fb98 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec @@ -21,4 +21,6 @@ redirect_url = refresh_token = token = url = -username = \ No newline at end of file +username = +text_test = + \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec index a359f3958..aa7b1832a 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec @@ -17,4 +17,5 @@ testIpv4 = testNumber = testRegex = testString = -testUrl = \ No newline at end of file +testUrl = + \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/inputs.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/inputs.conf index d4a3fafbc..29962a595 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/inputs.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/inputs.conf @@ -8,4 +8,5 @@ python.version = python3 python.version = python3 [example_input_four] -python.version = python3 \ No newline at end of file +python.version = python3 + \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf index c82d760c0..d2bb9e6cd 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf @@ -1,6 +1,6 @@ [admin:splunk_ta_uccexample] match = / -members = splunk_ta_uccexample_account, splunk_ta_uccexample_oauth, splunk_ta_uccexample_custom_row_tab, splunk_ta_uccexample_settings, splunk_ta_uccexample_example_input_one, splunk_ta_uccexample_example_input_two, splunk_ta_uccexample_example_input_three, splunk_ta_uccexample_example_input_four +members = splunk_ta_uccexample_account, splunk_ta_uccexample_custom_row_tab, splunk_ta_uccexample_example_input_four, splunk_ta_uccexample_example_input_one, splunk_ta_uccexample_example_input_three, splunk_ta_uccexample_example_input_two, splunk_ta_uccexample_oauth, splunk_ta_uccexample_settings [admin_external:splunk_ta_uccexample_account] handlertype = python @@ -56,4 +56,5 @@ handlertype = python python.version = python3 handlerfile = splunk_ta_uccexample_rh_example_input_four.py handleractions = edit, list, remove, create -handlerpersistentmode = true \ No newline at end of file +handlerpersistentmode = true + \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf index eeb2e8701..5231d58f4 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf @@ -1,6 +1,6 @@ [shclustering] conf_replication_include.splunk_ta_uccexample_settings = true -conf_replication_include.splunk_ta_uccexample_account = true conf_replication_include.splunk_ta_uccexample_custom_row_tab = true +conf_replication_include.splunk_ta_uccexample_account = true conf_replication_include.splunk_ta_uccexample_oauth = true diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf index 13a8a4c5d..dcf15fb65 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf @@ -17,4 +17,5 @@ testRegex = testEmail = testIpv4 = testDate = -testUrl = \ No newline at end of file +testUrl = + \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf index 55b9e5ee3..d341e79ce 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf @@ -60,4 +60,5 @@ methods = POST, GET [expose:splunk_ta_uccexample_example_input_four_specified] pattern = splunk_ta_uccexample_example_input_four/* -methods = POST, GET, DELETE \ No newline at end of file +methods = POST, GET, DELETE + \ No newline at end of file From 5eab7588b74610c9a2bffa0263c36622385414c3 Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Mon, 16 Sep 2024 05:09:46 +0200 Subject: [PATCH 04/14] Revert "test: fix tests" This reverts commit b1b36c66ae3ab1576fb0aa512ffb5e6c0a9ca27f. --- .../README/splunk_ta_uccexample_account.conf.spec | 3 +-- .../README/splunk_ta_uccexample_settings.conf.spec | 3 +-- .../Splunk_TA_UCCExample/default/restmap.conf | 3 +-- .../default/splunk_ta_uccexample_settings.conf | 3 +-- .../Splunk_TA_UCCExample/default/web.conf | 3 +-- .../Splunk_TA_UCCExample/README/inputs.conf.spec | 1 - .../README/splunk_ta_uccexample_account.conf.spec | 4 +--- .../README/splunk_ta_uccexample_settings.conf.spec | 3 +-- .../Splunk_TA_UCCExample/default/app.conf | 1 - .../Splunk_TA_UCCExample/default/inputs.conf | 3 +-- .../Splunk_TA_UCCExample/default/restmap.conf | 5 ++--- .../Splunk_TA_UCCExample/default/server.conf | 2 +- .../default/splunk_ta_uccexample_settings.conf | 3 +-- .../Splunk_TA_UCCExample/default/web.conf | 3 +-- 14 files changed, 13 insertions(+), 27 deletions(-) diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec index c411b3e4f..67a64483e 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec @@ -14,5 +14,4 @@ password = redirect_url = refresh_token = token = -username = - \ No newline at end of file +username = \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec index aa7b1832a..a359f3958 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec @@ -17,5 +17,4 @@ testIpv4 = testNumber = testRegex = testString = -testUrl = - \ No newline at end of file +testUrl = \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/restmap.conf b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/restmap.conf index 3cc86aab3..411bf07f8 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/restmap.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/restmap.conf @@ -21,5 +21,4 @@ handlertype = python python.version = python3 handlerfile = splunk_ta_uccexample_rh_settings.py handleractions = edit, list -handlerpersistentmode = true - \ No newline at end of file +handlerpersistentmode = true \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf index dcf15fb65..13a8a4c5d 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf @@ -17,5 +17,4 @@ testRegex = testEmail = testIpv4 = testDate = -testUrl = - \ No newline at end of file +testUrl = \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/web.conf b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/web.conf index b8ca64414..c1495c278 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/web.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/web.conf @@ -20,5 +20,4 @@ methods = POST, GET [expose:splunk_ta_uccexample_settings_specified] pattern = splunk_ta_uccexample_settings/* -methods = POST, GET, DELETE - \ No newline at end of file +methods = POST, GET, DELETE \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/inputs.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/inputs.conf.spec index 519799126..d1d44e2c8 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/inputs.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/inputs.conf.spec @@ -36,4 +36,3 @@ interval = Time interval of the data input, in seconds. [example_input_four://] interval = Time interval of the data input, in seconds. - \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec index 6c229fb98..f922e33d2 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec @@ -21,6 +21,4 @@ redirect_url = refresh_token = token = url = -username = -text_test = - \ No newline at end of file +username = \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec index aa7b1832a..a359f3958 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_settings.conf.spec @@ -17,5 +17,4 @@ testIpv4 = testNumber = testRegex = testString = -testUrl = - \ No newline at end of file +testUrl = \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf index 086cefa69..31fe65f34 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf @@ -26,5 +26,4 @@ reload.splunk_ta_uccexample_settings = simple reload.splunk_ta_uccexample_custom_row_tab = simple reload.splunk_ta_uccexample_account = simple reload.splunk_ta_uccexample_oauth = simple -reload.splunk_ta_uccexample_settings = simple diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/inputs.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/inputs.conf index 29962a595..d4a3fafbc 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/inputs.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/inputs.conf @@ -8,5 +8,4 @@ python.version = python3 python.version = python3 [example_input_four] -python.version = python3 - \ No newline at end of file +python.version = python3 \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf index d2bb9e6cd..c82d760c0 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf @@ -1,6 +1,6 @@ [admin:splunk_ta_uccexample] match = / -members = splunk_ta_uccexample_account, splunk_ta_uccexample_custom_row_tab, splunk_ta_uccexample_example_input_four, splunk_ta_uccexample_example_input_one, splunk_ta_uccexample_example_input_three, splunk_ta_uccexample_example_input_two, splunk_ta_uccexample_oauth, splunk_ta_uccexample_settings +members = splunk_ta_uccexample_account, splunk_ta_uccexample_oauth, splunk_ta_uccexample_custom_row_tab, splunk_ta_uccexample_settings, splunk_ta_uccexample_example_input_one, splunk_ta_uccexample_example_input_two, splunk_ta_uccexample_example_input_three, splunk_ta_uccexample_example_input_four [admin_external:splunk_ta_uccexample_account] handlertype = python @@ -56,5 +56,4 @@ handlertype = python python.version = python3 handlerfile = splunk_ta_uccexample_rh_example_input_four.py handleractions = edit, list, remove, create -handlerpersistentmode = true - \ No newline at end of file +handlerpersistentmode = true \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf index 5231d58f4..eeb2e8701 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf @@ -1,6 +1,6 @@ [shclustering] conf_replication_include.splunk_ta_uccexample_settings = true -conf_replication_include.splunk_ta_uccexample_custom_row_tab = true conf_replication_include.splunk_ta_uccexample_account = true +conf_replication_include.splunk_ta_uccexample_custom_row_tab = true conf_replication_include.splunk_ta_uccexample_oauth = true diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf index dcf15fb65..13a8a4c5d 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/splunk_ta_uccexample_settings.conf @@ -17,5 +17,4 @@ testRegex = testEmail = testIpv4 = testDate = -testUrl = - \ No newline at end of file +testUrl = \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf index d341e79ce..55b9e5ee3 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/web.conf @@ -60,5 +60,4 @@ methods = POST, GET [expose:splunk_ta_uccexample_example_input_four_specified] pattern = splunk_ta_uccexample_example_input_four/* -methods = POST, GET, DELETE - \ No newline at end of file +methods = POST, GET, DELETE \ No newline at end of file From b06e6611daa5ed28b375f261776c133098ca8d25 Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Mon, 16 Sep 2024 05:22:01 +0200 Subject: [PATCH 05/14] fix: add be handler for custom row tab --- .../splunk_ta_uccexample_rh_custom_row_tab.py | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/bin/splunk_ta_uccexample_rh_custom_row_tab.py diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/bin/splunk_ta_uccexample_rh_custom_row_tab.py b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/bin/splunk_ta_uccexample_rh_custom_row_tab.py new file mode 100644 index 000000000..6d8c90702 --- /dev/null +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/bin/splunk_ta_uccexample_rh_custom_row_tab.py @@ -0,0 +1,65 @@ + +import import_declare_test + +from splunktaucclib.rest_handler.endpoint import ( + field, + validator, + RestModel, + SingleModel, +) +from splunktaucclib.rest_handler import admin_external, util +from splunktaucclib.rest_handler.admin_external import AdminExternalHandler +import logging + +util.remove_http_proxy_env_vars() + + +fields = [ + field.RestField( + 'example_help_link', + required=False, + encrypted=False, + default=None, + validator=None + ), + field.RestField( + 'config1_help_link', + required=False, + encrypted=False, + default=None, + validator=None + ), + field.RestField( + 'config2_help_link', + required=False, + encrypted=False, + default=None, + validator=None + ), + field.RestField( + 'text_test', + required=True, + encrypted=False, + default=None, + validator=validator.String( + max_len=100, + min_len=1, + ) + ) +] +model = RestModel(fields, name=None) + + +endpoint = SingleModel( + 'splunk_ta_uccexample_custom_row_tab', + model, + config_name='custom_row_tab' +) + + +if __name__ == '__main__': + logging.getLogger().addHandler(logging.NullHandler()) + admin_external.handle( + endpoint, + handler=AdminExternalHandler, + ) From 28aa6f8a3f1f5107416d95002311c97324e25cce Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Mon, 16 Sep 2024 05:28:46 +0200 Subject: [PATCH 06/14] fix: tests --- .../Splunk_TA_UCCExample/default/server.conf | 1 - .../Splunk_TA_UCCExample/README/alert_actions.conf.spec | 1 - .../README/splunk_ta_uccexample_account.conf.spec | 3 ++- .../Splunk_TA_UCCExample/default/alert_actions.conf | 1 - .../Splunk_TA_UCCExample/default/eventtypes.conf | 1 - .../Splunk_TA_UCCExample/default/server.conf | 3 +-- .../Splunk_TA_UCCExample/default/tags.conf | 1 - 7 files changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf index a9c28078c..f89d933c0 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf @@ -2,4 +2,3 @@ conf_replication_include.splunk_ta_uccexample_settings = true conf_replication_include.splunk_ta_uccexample_account = true conf_replication_include.splunk_ta_uccexample_oauth = true - diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec index 41b3fda28..10f1e74db 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec @@ -6,4 +6,3 @@ param.all_incidents = All Incidents. param.table_list = Table List. It's default value is problem. param.action = Action:. It's a required parameter. It's default value is update. param.account = Select Account. It's a required parameter. - diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec index f922e33d2..2ec909f53 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/splunk_ta_uccexample_account.conf.spec @@ -21,4 +21,5 @@ redirect_url = refresh_token = token = url = -username = \ No newline at end of file +username = +text_test = \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf index a50d253a6..039818c39 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf @@ -12,4 +12,3 @@ param.all_incidents = 0 param.table_list = problem param.action = update param.account = - diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf index 7f976cb9b..053deadaf 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf @@ -1,3 +1,2 @@ [test_alert_modaction_result] search = sourcetype="test:incident" - diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf index eeb2e8701..f671cc8f5 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf @@ -1,6 +1,5 @@ [shclustering] conf_replication_include.splunk_ta_uccexample_settings = true -conf_replication_include.splunk_ta_uccexample_account = true conf_replication_include.splunk_ta_uccexample_custom_row_tab = true +conf_replication_include.splunk_ta_uccexample_account = true conf_replication_include.splunk_ta_uccexample_oauth = true - diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf index 2f56dc25a..dc27f8eeb 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf @@ -1,3 +1,2 @@ [eventtype=test_alert_modaction_result] modaction_result = enabled - From b9b763bc8a61c3e15d5feaa56cf9beebed23f7d5 Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Mon, 16 Sep 2024 05:38:48 +0200 Subject: [PATCH 07/14] fix: tests --- .../Splunk_TA_UCCExample/default/server.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf index f671cc8f5..4b6d9efc2 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf @@ -1,5 +1,5 @@ [shclustering] conf_replication_include.splunk_ta_uccexample_settings = true -conf_replication_include.splunk_ta_uccexample_custom_row_tab = true conf_replication_include.splunk_ta_uccexample_account = true -conf_replication_include.splunk_ta_uccexample_oauth = true +conf_replication_include.splunk_ta_uccexample_custom_row_tab = true +conf_replication_include.splunk_ta_uccexample_oauth = true \ No newline at end of file From 6232869cafe2e482215555d5810efc7dfde3b6fd Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Mon, 16 Sep 2024 05:54:49 +0200 Subject: [PATCH 08/14] fix: tests --- .../Splunk_TA_UCCExample/default/restmap.conf | 2 +- .../Splunk_TA_UCCExample/default/server.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf index c82d760c0..bb52c332d 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/restmap.conf @@ -1,6 +1,6 @@ [admin:splunk_ta_uccexample] match = / -members = splunk_ta_uccexample_account, splunk_ta_uccexample_oauth, splunk_ta_uccexample_custom_row_tab, splunk_ta_uccexample_settings, splunk_ta_uccexample_example_input_one, splunk_ta_uccexample_example_input_two, splunk_ta_uccexample_example_input_three, splunk_ta_uccexample_example_input_four +members = splunk_ta_uccexample_account, splunk_ta_uccexample_custom_row_tab, splunk_ta_uccexample_example_input_four, splunk_ta_uccexample_example_input_one, splunk_ta_uccexample_example_input_three, splunk_ta_uccexample_example_input_two, splunk_ta_uccexample_oauth, splunk_ta_uccexample_settings [admin_external:splunk_ta_uccexample_account] handlertype = python diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf index 4b6d9efc2..ce69ebee2 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf @@ -1,5 +1,5 @@ [shclustering] conf_replication_include.splunk_ta_uccexample_settings = true -conf_replication_include.splunk_ta_uccexample_account = true conf_replication_include.splunk_ta_uccexample_custom_row_tab = true +conf_replication_include.splunk_ta_uccexample_account = true conf_replication_include.splunk_ta_uccexample_oauth = true \ No newline at end of file From fb34d58d2b5a89abfb4e6de9baf417f373ced514 Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Mon, 16 Sep 2024 17:23:15 +0200 Subject: [PATCH 09/14] chore: remove unwanted code --- .../globalConfig.json | 25 ------------------- 1 file changed, 25 deletions(-) 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 8c9846200..f2f30b427 100644 --- a/tests/testdata/test_addons/package_global_config_everything/globalConfig.json +++ b/tests/testdata/test_addons/package_global_config_everything/globalConfig.json @@ -680,31 +680,6 @@ "help": "Enter a unique name for this account.", "required": true }, - { - "field": "example_help_link", - "label": "", - "type": "helpLink", - "options": { - "text": "Help Link", - "link": "https://docs.splunk.com/Documentation" - } - }, - { - "field": "config1_help_link", - "type": "helpLink", - "options": { - "text": "Add-on configuration documentation", - "link": "https://docs.splunk.com/Documentation" - } - }, - { - "field": "config2_help_link", - "type": "helpLink", - "options": { - "text": "SSL configuration documentation", - "link": "https://docs.splunk.com/Documentation" - } - }, { "field": "text_test", "label": "Text Test", From 6aa516983071f04cb3782cedd289923f7df09d1f Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Mon, 16 Sep 2024 20:53:46 +0200 Subject: [PATCH 10/14] fix: configs file names use List considering order instead of Set --- .../commands/rest_builder/global_config_builder_schema.py | 8 +++++--- .../Splunk_TA_UCCExample/default/server.conf | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/splunk_add_on_ucc_framework/commands/rest_builder/global_config_builder_schema.py b/splunk_add_on_ucc_framework/commands/rest_builder/global_config_builder_schema.py index 8551d9f5c..2ea61b697 100644 --- a/splunk_add_on_ucc_framework/commands/rest_builder/global_config_builder_schema.py +++ b/splunk_add_on_ucc_framework/commands/rest_builder/global_config_builder_schema.py @@ -55,7 +55,7 @@ class GlobalConfigBuilderSchema: def __init__(self, global_config: global_config_lib.GlobalConfig): self.global_config = global_config self._settings_conf_file_names: Set[str] = set() - self._configs_conf_file_names: Set[str] = set() + self._configs_conf_file_names: List[str] = list() self._oauth_conf_file_names: Set[str] = set() self._endpoints: Dict[str, RestEndpointBuilder] = {} self._parse_builder_schema() @@ -73,7 +73,7 @@ def settings_conf_file_names(self) -> Set[str]: return self._settings_conf_file_names @property - def configs_conf_file_names(self) -> Set[str]: + def configs_conf_file_names(self) -> List[str]: return self._configs_conf_file_names @property @@ -125,7 +125,9 @@ def _builder_configs(self) -> None: ) self._endpoints["oauth"] = oauth_endpoint self._oauth_conf_file_names.add(oauth_endpoint.conf_name) - self._configs_conf_file_names.add(endpoint.conf_name) + + if endpoint.conf_name not in self._configs_conf_file_names: + self._configs_conf_file_names.append(endpoint.conf_name) def _builder_settings(self) -> None: if not self.global_config.settings: diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf index ce69ebee2..4b6d9efc2 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/server.conf @@ -1,5 +1,5 @@ [shclustering] conf_replication_include.splunk_ta_uccexample_settings = true -conf_replication_include.splunk_ta_uccexample_custom_row_tab = true conf_replication_include.splunk_ta_uccexample_account = true +conf_replication_include.splunk_ta_uccexample_custom_row_tab = true conf_replication_include.splunk_ta_uccexample_oauth = true \ No newline at end of file From 339183ca3f2a2212e2b9e81b6ac064d08fb7a334 Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Mon, 16 Sep 2024 21:04:13 +0200 Subject: [PATCH 11/14] test: fix test, adjust to List --- .../rest_builder/test_global_config_builder_schema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/commands/rest_builder/test_global_config_builder_schema.py b/tests/unit/commands/rest_builder/test_global_config_builder_schema.py index 8923b0436..6f561e9bc 100644 --- a/tests/unit/commands/rest_builder/test_global_config_builder_schema.py +++ b/tests/unit/commands/rest_builder/test_global_config_builder_schema.py @@ -17,9 +17,9 @@ def test_global_config_builder_schema(global_config_all_json): assert global_config_builder_schema.settings_conf_file_names == { "splunk_ta_uccexample_settings" } - assert global_config_builder_schema.configs_conf_file_names == { + assert global_config_builder_schema.configs_conf_file_names == [ "splunk_ta_uccexample_account" - } + ] assert global_config_builder_schema.oauth_conf_file_names == { "splunk_ta_uccexample_oauth" } From 4d8a73d3d51f4e212ee0ad24a4a7061145e42c99 Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Wed, 18 Sep 2024 13:42:22 +0200 Subject: [PATCH 12/14] chore: remove unnecessary changes --- .../Splunk_TA_UCCExample/default/server.conf | 2 +- .../Splunk_TA_UCCExample/README/alert_actions.conf.spec | 2 +- .../Splunk_TA_UCCExample/default/alert_actions.conf | 2 +- .../Splunk_TA_UCCExample/default/app.conf | 3 +-- .../Splunk_TA_UCCExample/default/eventtypes.conf | 2 +- .../Splunk_TA_UCCExample/default/tags.conf | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf index f89d933c0..5a7326859 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_configuration/Splunk_TA_UCCExample/default/server.conf @@ -1,4 +1,4 @@ [shclustering] conf_replication_include.splunk_ta_uccexample_settings = true conf_replication_include.splunk_ta_uccexample_account = true -conf_replication_include.splunk_ta_uccexample_oauth = true +conf_replication_include.splunk_ta_uccexample_oauth = true \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec index 10f1e74db..46492994d 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/README/alert_actions.conf.spec @@ -5,4 +5,4 @@ param.description = Description. It's a required parameter. It's defaul param.all_incidents = All Incidents. param.table_list = Table List. It's default value is problem. param.action = Action:. It's a required parameter. It's default value is update. -param.account = Select Account. It's a required parameter. +param.account = Select Account. It's a required parameter. \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf index 039818c39..57834810c 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/alert_actions.conf @@ -11,4 +11,4 @@ param.description = some sample description param.all_incidents = 0 param.table_list = problem param.action = update -param.account = +param.account = \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf index 31fe65f34..8a88ee4ab 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/app.conf @@ -25,5 +25,4 @@ version = 5.5.8R5fd76615 reload.splunk_ta_uccexample_settings = simple reload.splunk_ta_uccexample_custom_row_tab = simple reload.splunk_ta_uccexample_account = simple -reload.splunk_ta_uccexample_oauth = simple - +reload.splunk_ta_uccexample_oauth = simple \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf index 053deadaf..d691df4e0 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/eventtypes.conf @@ -1,2 +1,2 @@ [test_alert_modaction_result] -search = sourcetype="test:incident" +search = sourcetype="test:incident" \ No newline at end of file diff --git a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf index dc27f8eeb..fb7c5a919 100644 --- a/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf +++ b/tests/testdata/expected_addons/expected_output_global_config_everything/Splunk_TA_UCCExample/default/tags.conf @@ -1,2 +1,2 @@ [eventtype=test_alert_modaction_result] -modaction_result = enabled +modaction_result = enabled \ No newline at end of file From 790b149cd060d4ef0e9733012a6d036737fa61d6 Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Wed, 18 Sep 2024 17:38:12 +0200 Subject: [PATCH 13/14] chore: align rest of configs schemas --- .../rest_builder/global_config_builder_schema.py | 16 +++++++++------- .../test_global_config_builder_schema.py | 8 ++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/splunk_add_on_ucc_framework/commands/rest_builder/global_config_builder_schema.py b/splunk_add_on_ucc_framework/commands/rest_builder/global_config_builder_schema.py index 2ea61b697..657db66da 100644 --- a/splunk_add_on_ucc_framework/commands/rest_builder/global_config_builder_schema.py +++ b/splunk_add_on_ucc_framework/commands/rest_builder/global_config_builder_schema.py @@ -14,7 +14,7 @@ # limitations under the License. # import json -from typing import Dict, List, Set, Any +from typing import Dict, List, Any from splunk_add_on_ucc_framework import global_config as global_config_lib @@ -54,9 +54,9 @@ def _is_true(val: Any) -> bool: class GlobalConfigBuilderSchema: def __init__(self, global_config: global_config_lib.GlobalConfig): self.global_config = global_config - self._settings_conf_file_names: Set[str] = set() + self._settings_conf_file_names: List[str] = list() self._configs_conf_file_names: List[str] = list() - self._oauth_conf_file_names: Set[str] = set() + self._oauth_conf_file_names: List[str] = list() self._endpoints: Dict[str, RestEndpointBuilder] = {} self._parse_builder_schema() @@ -69,7 +69,7 @@ def namespace(self) -> str: return self.global_config.namespace @property - def settings_conf_file_names(self) -> Set[str]: + def settings_conf_file_names(self) -> List[str]: return self._settings_conf_file_names @property @@ -77,7 +77,7 @@ def configs_conf_file_names(self) -> List[str]: return self._configs_conf_file_names @property - def oauth_conf_file_names(self) -> Set[str]: + def oauth_conf_file_names(self) -> List[str]: return self._oauth_conf_file_names @property @@ -124,7 +124,8 @@ def _builder_configs(self) -> None: log_level_field=log_details.get("entity", [{}])[0].get("field"), ) self._endpoints["oauth"] = oauth_endpoint - self._oauth_conf_file_names.add(oauth_endpoint.conf_name) + if oauth_endpoint.conf_name not in self._oauth_conf_file_names: + self._oauth_conf_file_names.append(oauth_endpoint.conf_name) if endpoint.conf_name not in self._configs_conf_file_names: self._configs_conf_file_names.append(endpoint.conf_name) @@ -148,7 +149,8 @@ def _builder_settings(self) -> None: fields, ) endpoint.add_entity(entity) - self._settings_conf_file_names.add(endpoint.conf_name) + if endpoint.conf_name not in self._settings_conf_file_names: + self._settings_conf_file_names.append(endpoint.conf_name) def _builder_inputs(self) -> None: for input_item in self.global_config.inputs: diff --git a/tests/unit/commands/rest_builder/test_global_config_builder_schema.py b/tests/unit/commands/rest_builder/test_global_config_builder_schema.py index 6f561e9bc..5a2812458 100644 --- a/tests/unit/commands/rest_builder/test_global_config_builder_schema.py +++ b/tests/unit/commands/rest_builder/test_global_config_builder_schema.py @@ -14,15 +14,15 @@ def test_global_config_builder_schema(global_config_all_json): # TODO: add more tests to check the endpoints. assert global_config_builder_schema.product == "Splunk_TA_UCCExample" assert global_config_builder_schema.namespace == "splunk_ta_uccexample" - assert global_config_builder_schema.settings_conf_file_names == { + assert global_config_builder_schema.settings_conf_file_names == [ "splunk_ta_uccexample_settings" - } + ] assert global_config_builder_schema.configs_conf_file_names == [ "splunk_ta_uccexample_account" ] - assert global_config_builder_schema.oauth_conf_file_names == { + assert global_config_builder_schema.oauth_conf_file_names == [ "splunk_ta_uccexample_oauth" - } + ] def test_global_config_builder_schema_custom_rh_config(global_config_all_json): From 4d9d0505dc3b21864d0edf96c1c0c7f7503c10b5 Mon Sep 17 00:00:00 2001 From: Szymon Oleksy Date: Thu, 19 Sep 2024 16:57:54 +0200 Subject: [PATCH 14/14] docs: update --- docs/custom_ui_extensions/custom_row.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/custom_ui_extensions/custom_row.md b/docs/custom_ui_extensions/custom_row.md index cac848dbe..6a84a515f 100644 --- a/docs/custom_ui_extensions/custom_row.md +++ b/docs/custom_ui_extensions/custom_row.md @@ -1,4 +1,4 @@ -When a row is expanded on the Inputs table, Custom Row is utilized to incorporate a customized element. By clicking on the icon provided on the left side of each row, the input-specific details are displayed. +When a row is expanded on the Inputs table or Configuration Table, Custom Row is utilized to incorporate a customized element. By clicking on the icon provided on the left side of each row, the input-specific details are displayed. ### Properties