-
Notifications
You must be signed in to change notification settings - Fork 887
feat: Add form to modify managed Template variables #6257
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
Conversation
This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity. |
What are the diff between this form and the settings form? |
I guess that this are the most important parts. |
Why create a diff form for the variables and not use them in the settings one? |
I'm not sure if I understand your question. Could you please elaborate a bit more? I created the new form/page as there were many changes between both, and variables are submitted using a different endpoint than Template Settings. Variables are strictly Terraform vars. |
const permissions = usePermissions() | ||
|
||
if (!template || !templatePermissions) { |
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.
I think those only should be loaded in the page form. You can also use react-query
for them. Way easier IMO. But not a blocker.
} | ||
const organizationId = useOrganizationId() | ||
const navigate = useNavigate() | ||
const [state, send] = useMachine(templateVariablesMachine, { |
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.
I said that previously but maybe would be interesting to use react-query
but no big deal.
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.
I think that I will leave it for further improvement as I'd like to deliver this PR as is, as it just works. I will try to frame more time for react-query
to play with it.
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.
There are a few things in the FE we could improve but not blockers.
About react-query, you can see how we are using it here
coder/site/src/pages/WorkspacesPage/WorkspacesPage.tsx
Lines 13 to 16 in 6304bfb
const { data, error, queryKey } = useWorkspacesData({ | |
...pagination, | |
...filter, | |
}) |
Related: #5980
As this PR is growing, I will keep introducing follow-ups in separate PRs.
This PR introduces a form to modify the Terraform variables. Once a user submits the form, the browser will check the status of the provisioning job every 2 secs, and if the job succeeds, it will redirect to the template view.
Button:

Sample form:

Template:
Follow-ups: