Skip to content

feat: auto-generate workspace slug from display name - #1333

Open
Snehadas2005 wants to merge 2 commits into
kubeflow:notebooks-v2from
Snehadas2005:feature-workspace-slugging
Open

feat: auto-generate workspace slug from display name#1333
Snehadas2005 wants to merge 2 commits into
kubeflow:notebooks-v2from
Snehadas2005:feature-workspace-slugging

Conversation

@Snehadas2005

@Snehadas2005 Snehadas2005 commented Aug 17, 2026

Copy link
Copy Markdown
Member

This PR introduces automatic slugging for the Workspace Name input derived from the Workspace Display Name, eliminating the friction of manually generating Kubernetes RFC1123-compliant names, alongside strict validation and form flow safety fixes.

Key Changes:

  • Slugging Utility (generateWorkspaceSlug):

    • Added a pure utility function that transforms display names into valid Kubernetes DNS subdomain names according to RFC1123 rules.
    • Strips invalid characters outside [0-9, a-z, A-Z, -, ., _, space].
    • Collapses consecutive dashes/spaces/underscores into a single dash (-).
    • Converts strings to lowercase and trims leading/trailing non-alphanumeric characters.
    • Truncates resulting slug to the 253-character RFC1123 limit.
    • Fallback mechanism (workspace-1) if the display name contains only emojis/special characters.
  • Validation & UI Integration (WorkspaceFormPropertiesSelection.tsx):

    • Added Display Name input field and wired auto-slugging to update workspaceName live until the user manually edits the slug field or when in update mode.
    • Added strict RFC1123 regex validation and character-restriction highlighting on manual edits.
    • Exposed onValidityChange callback to propagate properties validation state to the parent form.
  • Form Logic & Navigation Fixes (WorkspaceForm.tsx):

    • Wired properties validity flag into form navigation steps and submit button state.
    • Fixed submit button isDisabled condition logic to prevent submission with invalid custom slugs.
  • Type Safety & Component Tests:

    • Fixed TypeScript generic declaration syntax in form components (React.FC).
    • Added unit tests (slugify.spec.ts) for standard, special character, length limit, collapse, and fallback scenarios.
    • Added component test skeleton (WorkspaceFormPropertiesSelection.spec.tsx) for auto-slugging and manual lock behaviour.

Testing Strategy:

  • Ran unit tests: npm run test:unit -- slugify.spec.ts
  • Verified type safety and linting locally (npm run type-check, npm run lint).
  • Manually verified auto-slugging, manual override lock, error states on invalid RFC1123 manual input, and submit button disabling behavior in local frontend server.

closes: #1304

@github-project-automation github-project-automation Bot moved this to Needs Triage in Kubeflow Notebooks Aug 17, 2026
@google-oss-prow google-oss-prow Bot added the area/frontend area - related to frontend components label Aug 17, 2026
@google-oss-prow google-oss-prow Bot added the area/v2 area - version - kubeflow notebooks v2 label Aug 17, 2026
@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign paulovmr for approval. For more information see the Kubernetes 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

@Snehadas2005

Copy link
Copy Markdown
Member Author

/cc @christian-heusel

@christian-heusel christian-heusel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please fix the CI 🤗

@Snehadas2005
Snehadas2005 force-pushed the feature-workspace-slugging branch from 854cd38 to c8b273b Compare August 17, 2026 19:53
@google-oss-prow google-oss-prow Bot added size/L and removed size/M labels Aug 17, 2026
@Snehadas2005
Snehadas2005 force-pushed the feature-workspace-slugging branch 5 times, most recently from 2f6a90c to d0b4052 Compare August 17, 2026 23:49
Signed-off-by: Sneha Das <154408198+Snehadas2005@users.noreply.github.com>
@Snehadas2005
Snehadas2005 force-pushed the feature-workspace-slugging branch from d0b4052 to 2060072 Compare August 18, 2026 00:08
Signed-off-by: Sneha Das <154408198+Snehadas2005@users.noreply.github.com>
@Snehadas2005
Snehadas2005 force-pushed the feature-workspace-slugging branch from c0557e6 to 72a6b79 Compare August 18, 2026 12:15
@christian-heusel

Copy link
Copy Markdown
Member

@Snehadas2005 Just to keep you in the loop on the current status: We now went with a different implementation (see #1335 (to be merged)) in the meantime in order to hit something for the upcoming beta release, we will revisit the complete version of the feature (which your PR can serve as a base for) after the release! 🤗

Please rebase your changes on top of that (once it got merged) and adapt a few of the patterns that it establishes 😊

@christian-heusel

Copy link
Copy Markdown
Member

/hold

@Snehadas2005

Snehadas2005 commented Aug 18, 2026

Copy link
Copy Markdown
Member Author

Thank you for the update, @christian-heusel! I completely understand the need for a quick stopgap for the beta release. I will rebase on top of #1335 once it's merged and adjust to the new patterns for the full feature. 🙇‍♀️

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

Labels

area/frontend area - related to frontend components area/v2 area - version - kubeflow notebooks v2 do-not-merge/hold size/L

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants