-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Conversation
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.", | ||
) |
There was a problem hiding this comment.
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.
CodSpeed Performance ReportMerging #15962 will not alter performanceComparing Summary
|
body: variable, | ||
}); | ||
}, | ||
onSuccess: () => { |
There was a problem hiding this comment.
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.
e4e95e2
to
cf9c4b8
Compare
cf9c4b8
to
2f20ea2
Compare
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: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:

Listing variables will be in a subsequent PR.