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 option to disable inputs on creation #1510

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

hetangmodi-crest
Copy link
Contributor

@hetangmodi-crest hetangmodi-crest commented Dec 20, 2024

Issue number: ADDON-75879

PR Type

What kind of change does this PR introduce?

  • Feature
  • Bug Fix
  • Refactoring (no functional or API changes)
  • Documentation Update
  • Maintenance (dependency updates, CI, etc.)

Summary

Added a new argument so that users can disable their newly created input of a service.

Changes

Introduced a new argument (disableNewInput) in services, so that users can specify whether a service's new input should be disabled on creation or not.

User experience

Users can now have disabled inputs on creation, If they mention disableNewInput = True in their globalConfig.

Checklist

If an item doesn't apply to your changes, leave it unchecked.

@hetangmodi-crest hetangmodi-crest added the enhancement New feature or request label Dec 20, 2024
@hetangmodi-crest hetangmodi-crest self-assigned this Dec 20, 2024
@hetangmodi-crest hetangmodi-crest requested review from a team as code owners December 20, 2024 13:14
@@ -43,6 +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. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the default?

Copy link
Contributor Author

@hetangmodi-crest hetangmodi-crest Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default is set to false. I'll add it in the docs.

@@ -1,4 +1,7 @@
{% for input_name in input_names %}
{{ "[" ~ input_name ~ "]"}}
python.version = python3
{% if disabled and service_name == input_name%}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there is this comparison. Wouldn't it be easier to edit input's rest handler and use default in the RestField?

    field.RestField(
        'disabled',
        required=False,
        validator=None,
        default={{ disabled }}
    )

Copy link
Contributor Author

@hetangmodi-crest hetangmodi-crest Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding it in the RH file would require the disabled property to be explicitly sent in the payload. Moreover, to enable or disable inputs, they have a dedicated endpoint which triggers the enabling and disabling of the input, hence we'd require to set it in inputs.conf as to define the nature of newly created inputs.

@hetangmodi-crest hetangmodi-crest requested a review from a team as a code owner December 23, 2024 09:35
@hetangmodi-crest hetangmodi-crest changed the title feat: disable services feat: add option to disable inputs on creation Dec 23, 2024
@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants