Skip to content

frontend: UploadDialog: Add Storybook stories for UploadDialog#4842

Open
sammy200-ui wants to merge 1 commit intokubernetes-sigs:mainfrom
sammy200-ui:frontend/upload-dialog-stories
Open

frontend: UploadDialog: Add Storybook stories for UploadDialog#4842
sammy200-ui wants to merge 1 commit intokubernetes-sigs:mainfrom
sammy200-ui:frontend/upload-dialog-stories

Conversation

@sammy200-ui
Copy link

@sammy200-ui sammy200-ui commented Mar 8, 2026

Summary

Adds Storybook stories for UploadDialog to increase coverage from 3.89%.

Related Issue

Fixes #4690

Changes

  • Default — empty dialog with Upload File tab active
  • FileSelected — a YAML file picked via the file input, filename shown
  • UploadSuccess — file loaded successfully, setCode/setUploadFiles callbacks fired
  • EmptyFileError — file selected is empty, shows "Error: All of the files are empty"
  • URLValidationError — invalid URL entered, shows "Please enter a valid URL"
  • URLNetworkError — MSW simulates a network failure on URL fetch, shows fetch error

Steps to Test

  1. cd frontend && npm install
  2. npm run frontend:storybook

Notes for the Reviewer

  • The issue title mentions an "upload progress loading bar" story but the current UploadDialog component has no loading or progress state, it reads files synchronously and calls onLoaded directly. There is nothing to show a loading bar for without modifying the component itself, which was not part of this issue.

Copilot AI review requested due to automatic review settings March 8, 2026 15:48
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 8, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: sammy200-ui / name: DuskWarden (4338442)

@k8s-ci-robot
Copy link
Contributor

Welcome @sammy200-ui!

It looks like this is your first PR to kubernetes-sigs/headlamp 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/headlamp has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 8, 2026
@sammy200-ui
Copy link
Author

/easycla

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 8, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds Storybook stories for the UploadDialog component in frontend/src/components/common/Resource/, increasing Storybook coverage from 3.89% for that component. It addresses issue #4690 by providing six story scenarios: a static default state and five interactive play-function stories covering file selection, upload success, empty file error, URL validation error, and URL network error.

Changes:

  • New UploadDialog.stories.tsx with six stories covering all major UI states (default, file selected, upload success, empty file error, URL validation error, URL network error)
  • New UploadDialog.Default.stories.storyshot snapshot file capturing the initial rendering of the dialog

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
frontend/src/components/common/Resource/UploadDialog.stories.tsx New Storybook story file with 6 stories using MSW, play functions, and action stubs to cover UploadDialog UI states
frontend/src/components/common/Resource/__snapshots__/UploadDialog.Default.stories.storyshot Auto-generated HTML snapshot of the Default story's initial render

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +46 to +51
FileSelected.play = async () => {
const file = new File(['apiVersion: v1\nkind: Pod'], 'test.yaml', {
type: 'application/yaml',
});
const input = document.querySelector('input[type="file"]') as HTMLInputElement;
await userEvent.upload(input, file);
@sammy200-ui sammy200-ui force-pushed the frontend/upload-dialog-stories branch from 0a19aa6 to 4338442 Compare March 21, 2026 08:02
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sammy200-ui
Once this PR has been reviewed and has the lgtm label, please assign ashu8912 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sammy200-ui
Copy link
Author

Hello @ashu8912 @vyncent-t just following up of the pr , its ready for review whenever you have some free time do review it and let me know about any changes required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

3 participants