Skip to content

feat: added user-friendly storybook component #1759

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

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

Conversation

rohanm-crest
Copy link
Contributor

@rohanm-crest rohanm-crest commented May 22, 2025

Issue number: ADDON-78948

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

Changes

Introduced a dedicated playground for entity validation within Storybook. This update allows users to dynamically modify the input arguments of each entity and instantly validate the configuration. The main goal is to ensure that only allowed key-value pairs are used, helping to catch unknown or unsupported properties early in the development process.

User experience

With this playground in place, users can interactively experiment with entity inputs directly in Storybook. By tweaking the arguments, they can immediately see if any invalid keys are present, streamlining the debugging process and improving schema adherence. This makes the validation workflow more intuitive and efficient, reducing the chances of misconfigured entities and also reduce the efforts to build and check the entities in UI.

Checklist

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

Review

  • self-review - I have performed a self-review of this change according to the development guidelines
  • Changes are documented. The documentation is understandable, examples work (more info)
  • PR title and description follows the contributing principles
  • meeting - I have scheduled a meeting or recorded a demo to explain these changes (if there is a video, put a link below and in the ticket)

Tests

See the testing doc.

  • Unit - tests have been added/modified to cover the changes
  • Smoke - tests have been added/modified to cover the changes
  • UI - tests have been added/modified to cover the changes
  • coverage - I have checked the code coverage of my changes (see more)

Demo/meeting:

Reviewers are encouraged to request meetings or demos if any part of the change is unclear

@soleksy-splunk
Copy link
Contributor

Plus please make it 🟢 and fix title

@rohanm-crest rohanm-crest changed the title Feat/user storybook feat: added user-friendly storybook component May 23, 2025
@rohanm-crest
Copy link
Contributor Author

I have read the Code of Conduct and I hereby accept the Terms

@rohanm-crest
Copy link
Contributor Author

I have read the CLA Document and I hereby accept the CLA

@rohanm-crest rohanm-crest marked this pull request as ready for review May 27, 2025 14:22
@rohanm-crest rohanm-crest requested review from a team as code owners May 27, 2025 14:22
options?: {
items: ValueLabelPairInterface[];
};
}
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 reason for creating all those interfaces?

As I believe for userPlayground we can use code like this

        if (item.type === 'index') {
            const migrated = migrateIndexTypeEntity(item as IndexEntity);
            result = SingleSelectEntity.safeParse(migrated);
        } else if (item.type === 'interval') {
            const migrated = migrateIntervalTypeEntity(item as IntervalEntity);
            result = TextEntity.safeParse(migrated);
        } else {
            result = AnyOfEntity.safeParse(item);
        }

using existing zod types and elements

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can rely on Zod inference alone, but defining explicit TypeScript interfaces and using satisfies helps enforce stricter type alignment. This has been especially helpful in Storybook, where strict validation ensures type errors surface clearly during development.

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.

Just wondering why those interface introduction is necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants