chore: Update API key functionality when creating model#5601
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the publisher “Create model” flow to require an API key before a model can be created, and adjusts the React unit tests to reflect the new validation behavior.
Changes:
- Make the API key field editable/required and include API key presence in the submit button disable logic.
- Update
CreateModelFormtests to cover the new “name + API key required” behavior. - Wrap the tested component with a Jotai provider in the test setup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| static/js/publisher/pages/Models/CreateModelForm.tsx | Makes API key required/editable and blocks submit unless API key is present. |
| static/js/publisher/pages/Models/tests/CreateModelForm.test.tsx | Expands test coverage for the new submit-disable conditions and adds Jotai provider wrapping. |
c3b8bd5 to
7f88be3
Compare
7f88be3 to
6ff4295
Compare
ilayda-cp
reviewed
Feb 24, 2026
| !newModel.name || | ||
| checkModelNameExists(newModel.name, modelsList) | ||
| !newModelName || | ||
| apiKey.length !== 50 || |
Contributor
There was a problem hiding this comment.
can we create a constant and use that constant instead of 50?
Contributor
Author
There was a problem hiding this comment.
Good shout - done
6ff4295 to
3a62d53
Compare
ilayda-cp
reviewed
Feb 24, 2026
| setShowNotification, | ||
| setShowErrorNotification, | ||
| }: Props): React.JSX.Element { | ||
| const API_KEY_LENGTH = 50; |
Contributor
There was a problem hiding this comment.
you can ignore this comment: i think it would be nice if we can move it outside of the function as its not a state or ref.
edisile
approved these changes
Feb 24, 2026
| value={newModel.apiKey} | ||
| placeholder="yx6dnxsWQ3XUB5gza8idCuMvwmxtk1xBpa9by8TuMit5dgGnv" | ||
| value={apiKey} | ||
| className="read-only-dark" |
Contributor
There was a problem hiding this comment.
className isn't needed anymore
3a62d53 to
eb0fe34
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Done
Addresses UX improvements around the "API key" field when creating a new model. The requirements were:
How to QA
Testing
Security
Issue / Card
Fixes https://warthogs.atlassian.net/browse/WD-30817
Screenshots
n/a
UX Approval