Skip to content
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

[UI v2] Add ability to create new variables #15962

Merged
merged 5 commits into from
Nov 11, 2024
Merged

[UI v2] Add ability to create new variables #15962

merged 5 commits into from
Nov 11, 2024

Conversation

desertaxle
Copy link
Member

@desertaxle desertaxle commented Nov 8, 2024

This PR adds the ability to create new variables to the v2 UI.

To support this functionality the following shadcn/ui component groups were added:

  • Dialog
  • Badge
  • Form

This PR also adds a base TagsInput component for adding tags to variables and introduces CodeMirror as an input for code and code adjacent inputs. CodeMirror is used for the value input for a variable in this PR.

Here are the changes in action:
create-variable

Listing variables will be in a subsequent PR.

Comment on lines +54 to +62
try:
model = await models.variables.create_variable(
session=session, variable=variable
)
except sa.exc.IntegrityError:
raise HTTPException(
status_code=409,
detail=f"A variable with the name {variable.name!r} already exists.",
)
Copy link
Member Author

Choose a reason for hiding this comment

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

This API change ensures a useful error is returned when a variable with the same name already exists.

@desertaxle desertaxle marked this pull request as ready for review November 8, 2024 21:52
Copy link

codspeed-hq bot commented Nov 8, 2024

CodSpeed Performance Report

Merging #15962 will not alter performance

Comparing ui-v2-variables (2f20ea2) with main (0a623a6)

Summary

✅ 3 untouched benchmarks

body: variable,
});
},
onSuccess: () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here is where onMutate we should hydrate the variable list view client-side cache, and then OnSettled invalidate the query set. See, e.g. https://tanstack.com/query/latest/docs/framework/react/guides/optimistic-updates

this isn't blocking at all. This is just one of those magical optimistic update things that we can go around and do later.

Base automatically changed from side-bar to main November 11, 2024 16:47
@desertaxle desertaxle added the development Tech debt, refactors, CI, tests, and other related work. label Nov 11, 2024
@desertaxle desertaxle merged commit 10d5d62 into main Nov 11, 2024
39 checks passed
@desertaxle desertaxle deleted the ui-v2-variables branch November 11, 2024 17:31
mthatt pushed a commit to mthatt/prefect-mihir-docs that referenced this pull request Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Tech debt, refactors, CI, tests, and other related work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants