Skip to content

feat(site): support match option for auto create workspace flow #13836

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

Merged
merged 6 commits into from
Jul 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve parameters name
  • Loading branch information
BrunoQuaresma committed Jul 9, 2024
commit dac8ada11786e5afb03d61b57cbe295a4f78f9a2
14 changes: 7 additions & 7 deletions site/src/api/queries/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const createWorkspace = (queryClient: QueryClient) => {
type AutoCreateWorkspaceOptions = {
organizationId: string;
templateName: string;
name: string;
workspaceName: string;
/**
* If provided, the auto-create workspace feature will attempt to find a
* matching workspace. If found, it will return the existing workspace instead
Expand All @@ -66,7 +66,7 @@ type AutoCreateWorkspaceOptions = {
* multiple values are returned, the first one will be returned.
*/
match: string | null;
versionId?: string;
templateVersionId?: string;
buildParameters?: WorkspaceBuildParameter[];
};

Expand All @@ -75,8 +75,8 @@ export const autoCreateWorkspace = (queryClient: QueryClient) => {
mutationFn: async ({
organizationId,
templateName,
name,
versionId,
workspaceName,
templateVersionId,
buildParameters,
match,
}: AutoCreateWorkspaceOptions) => {
Expand All @@ -91,8 +91,8 @@ export const autoCreateWorkspace = (queryClient: QueryClient) => {

let templateVersionParameters;

if (versionId) {
templateVersionParameters = { template_version_id: versionId };
if (templateVersionId) {
templateVersionParameters = { template_version_id: templateVersionId };
} else {
const template = await API.getTemplateByName(
organizationId,
Expand All @@ -103,7 +103,7 @@ export const autoCreateWorkspace = (queryClient: QueryClient) => {

return API.createWorkspace(organizationId, "me", {
...templateVersionParameters,
name,
name: workspaceName,
rich_parameter_values: buildParameters,
});
},
Expand Down
Loading