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: make configuration page as optional #1521

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

Conversation

hetangmodi-crest
Copy link
Contributor

Issue number:
ADDON-76819

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

Set configuration as an optional key in globalConfig.json.

Changes

Made configuration page optional in schema.json, So that users can have an add-on UI without Configuration page.
Also added a smoke testcase which captures this behaviour.

User experience

Now, user can build their add-on without specifying configuration in their globalConfig.json. Users now can have a UI without Configuration page for their add-on.

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 Jan 3, 2025
@hetangmodi-crest hetangmodi-crest self-assigned this Jan 3, 2025
soleksy-splunk
soleksy-splunk previously approved these changes Jan 8, 2025
Copy link
Contributor

@soleksy-splunk soleksy-splunk left a comment

Choose a reason for hiding this comment

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

seems good just one minor thing that configuration page is technically handled, so there isn't any entry point but if you directly type url it displays empty page. We can handle it in separate PR

docs/generated_files.md Outdated Show resolved Hide resolved
docs/generated_files.md Outdated Show resolved Hide resolved
docs/generated_files.md Outdated Show resolved Hide resolved
Signed-off-by: Viktor Tsvetkov <142901247+vtsvetkov-splunk@users.noreply.github.com>
Copy link
Contributor

Choose a reason for hiding this comment

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

what's weird we keep generated file in git

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree. It is present in other expected add-ons as well. I think we can clean up all the files altogether in a separate PR.

@hetangmodi-crest
Copy link
Contributor Author

@soleksy-splunk

seems good just one minor thing that configuration page is technically handled, so there isn't any entry point but if you directly type url it displays empty page. We can handle it in separate PR

I had checked it in my VM, when we add configuration in the URL, Splunk web presents Page Not Found error.

@soleksy-splunk
Copy link
Contributor

@soleksy-splunk

seems good just one minor thing that configuration page is technically handled, so there isn't any entry point but if you directly type url it displays empty page. We can handle it in separate PR

I had checked it in my VM, when we add configuration in the URL, Splunk web presents Page Not Found error.

Ok, then it has to be caching on my side, i will double check but thats a minor problem as there shouldn't be any access point to this page anyway.

Copy link
Contributor

@vtsvetkov-splunk vtsvetkov-splunk left a comment

Choose a reason for hiding this comment

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

🚀

@artemrys
Copy link
Member

artemrys commented Jan 10, 2025

If configuration, inputs and dashboard pages are optional - should we make pages optional as well?

So that we can support globalConfig file like this?

{
    "meta": {
        "name": "<name>",
        "version": "<version>",
        "displayName": "<display name>",
        "schemaVersion": "0.0.9"
    }
}

EDIT: if we decide so - it deserves a separate small PR.

@hetangmodi-crest
Copy link
Contributor Author

If configuration, inputs and dashboard pages are optional - should we make pages optional as well?

So that we can support globalConfig file like this?

{
    "meta": {
        "name": "<name>",
        "version": "<version>",
        "displayName": "<display name>",
        "schemaVersion": "0.0.9"
    }
}

EDIT: if we decide so - it deserves a separate small PR.

Yes, we will be covering that in .conf only TA PR.

@@ -40,14 +43,20 @@ def generate_nav_default_xml(
"""
nav = ET.Element("nav")
if include_inputs:
if default_view == "inputs":
if (
not (include_configuration) and default_view == "configuration"
Copy link
Contributor

Choose a reason for hiding this comment

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

not (include_configuration) and default_view == "configuration"

This is a strange condition. It would be good to change _validate_meta_default_view method in global_config_validator.py to not allow this value when there is no configuration page and change this condition.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Kamil. _validate_meta_default_view already checks, for input and dashboard, if default view is present in the global config and raises an error if not, so in my opinion it would be the best to expand it to configuration as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have updated the logic and added validation in _validate_meta_default_view function

@@ -40,14 +43,20 @@ def generate_nav_default_xml(
"""
nav = ET.Element("nav")
if include_inputs:
if default_view == "inputs":
if (
not (include_configuration) and default_view == "configuration"
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Kamil. _validate_meta_default_view already checks, for input and dashboard, if default view is present in the global config and raises an error if not, so in my opinion it would be the best to expand it to configuration as well.

splunk_add_on_ucc_framework/global_config.py Show resolved Hide resolved
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/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants