Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement name validation before server calls on Org creation #18815

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

Closed
Siddhant-K-code wants to merge 1 commit into main from sid/name-validation-org-creation

Conversation

@Siddhant-K-code
Copy link
Member

@Siddhant-K-code Siddhant-K-code commented Sep 27, 2023
edited by github-actions bot
Loading

Description

This PR addresses the need for adding a basic organization name validation before making server calls during the organization creation process.

Impact

The goal is to optimize server load and elevate user experience by confirming that only valid organization names are processed. Currently, calls are made to the createTeam endpoint even when the name is empty. This approach allows users to promptly receive basic error messages for issues like empty fields and character limits, instead of sending a request to the server and then displaying the error on the UI, a process that typically takes approximately 1.2 seconds for updates.

Summary generated by Copilot

🤖 Generated by Copilot at b21dc8e

Added placeholders and validation for team and project names. This enhances the usability and feedback of the dashboard UI.

Related Issue(s)

Fixes #

How to test

  • Open preview
  • Create a new organization
    • Hit Create organization when input box is empty & see error message 👀
    • Now, do same with Org name of characters less than 3 and more than 64

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@Siddhant-K-code Siddhant-K-code changed the title (削除) Validate name pre-server call on org creation (削除ここまで) (追記) Implement name validation before server calls on Org creation (追記ここまで) Sep 27, 2023
@Siddhant-K-code Siddhant-K-code marked this pull request as ready for review September 27, 2023 04:33
value={projectName}
error={badProjectName}
onChange={setProjectName}
placeholder="My Project"
Copy link
Contributor

@svenefftinge svenefftinge Sep 27, 2023

Choose a reason for hiding this comment

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

Did you see a case where the name was empty?

const createTeam = async (event: FormEvent) => {
event.preventDefault();

/* Basic name validation before sending to the server to save time & API calls */
Copy link
Contributor

@svenefftinge svenefftinge Sep 27, 2023

Choose a reason for hiding this comment

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

It's fast enough and not worth maintaining validation logic twice.

Copy link
Contributor

@svenefftinge svenefftinge left a comment

Choose a reason for hiding this comment

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

Thanks @Siddhant-K-code for caring about the UX!
We want to avoid maintaining validation logic and error messages twice, unless there is a good reason. In this case, the UI feedback seems absolutely fine as it is. So I'd rather not add code unnecessarily. Let me know if I have missed something. 🙏

Copy link
Member Author

Absolutely, I'll proceed to close the PR. The main goal was to initiate communication with the server only after conducting fundamental validation on the frontend. However, I understand your concern regarding the management of duplicates. The primary reference for this was:

if (project) {
badProjectName = projectName.length > 0 ? undefined : "Project name can not be blank.";
if (projectName.length > 32) {
badProjectName = "Project name can not be longer than 32 characters.";
}
svenefftinge reacted with thumbs up emoji

@Siddhant-K-code Siddhant-K-code deleted the sid/name-validation-org-creation branch September 27, 2023 06:22
Copy link
Contributor

Thanks! We should definitely be more consistent and rely on server-side validation as much as reasonable.

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

Reviewers

1 more reviewer

@svenefftinge svenefftinge svenefftinge requested changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /