mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
This reverts commit 7d9a7636e9.
This commit is contained in:
@@ -173,12 +173,7 @@ describe("api.ts", () => {
|
||||
expect(api.postWorkspaceBuild).toHaveBeenCalledWith(MockWorkspace.id, {
|
||||
transition: "start",
|
||||
template_version_id: MockTemplate.active_version_id,
|
||||
rich_parameter_values: [
|
||||
{
|
||||
name: "first_parameter",
|
||||
value: "mock-abc",
|
||||
},
|
||||
],
|
||||
rich_parameter_values: [],
|
||||
})
|
||||
})
|
||||
|
||||
@@ -227,12 +222,7 @@ describe("api.ts", () => {
|
||||
expect(api.postWorkspaceBuild).toHaveBeenCalledWith(MockWorkspace.id, {
|
||||
transition: "start",
|
||||
template_version_id: MockTemplate.active_version_id,
|
||||
rich_parameter_values: [
|
||||
{
|
||||
name: "first_parameter",
|
||||
value: "mock-abc",
|
||||
},
|
||||
],
|
||||
rich_parameter_values: [],
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
+1
-10
@@ -1041,19 +1041,10 @@ export const updateWorkspace = async (
|
||||
throw new MissingBuildParameters(missingParameters)
|
||||
}
|
||||
|
||||
// Merge parameters using name as key
|
||||
const richParameterValues = newBuildParameters
|
||||
oldBuildParameters.forEach((oldParam) => {
|
||||
const newParam = richParameterValues.find((p) => p.name === oldParam.name)
|
||||
if (newParam === undefined) {
|
||||
richParameterValues.push(oldParam)
|
||||
}
|
||||
})
|
||||
|
||||
return postWorkspaceBuild(workspace.id, {
|
||||
transition: "start",
|
||||
template_version_id: activeVersionId,
|
||||
rich_parameter_values: richParameterValues,
|
||||
rich_parameter_values: newBuildParameters,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -117,32 +117,31 @@ export const checks = {
|
||||
const permissionsToCheck = (
|
||||
workspace: TypesGen.Workspace,
|
||||
template: TypesGen.Template,
|
||||
) =>
|
||||
({
|
||||
[checks.readWorkspace]: {
|
||||
object: {
|
||||
resource_type: "workspace",
|
||||
resource_id: workspace.id,
|
||||
owner_id: workspace.owner_id,
|
||||
},
|
||||
action: "read",
|
||||
) => ({
|
||||
[checks.readWorkspace]: {
|
||||
object: {
|
||||
resource_type: "workspace",
|
||||
resource_id: workspace.id,
|
||||
owner_id: workspace.owner_id,
|
||||
},
|
||||
[checks.updateWorkspace]: {
|
||||
object: {
|
||||
resource_type: "workspace",
|
||||
resource_id: workspace.id,
|
||||
owner_id: workspace.owner_id,
|
||||
},
|
||||
action: "update",
|
||||
action: "read",
|
||||
},
|
||||
[checks.updateWorkspace]: {
|
||||
object: {
|
||||
resource_type: "workspace",
|
||||
resource_id: workspace.id,
|
||||
owner_id: workspace.owner_id,
|
||||
},
|
||||
[checks.updateTemplate]: {
|
||||
object: {
|
||||
resource_type: "template",
|
||||
resource_id: template.id,
|
||||
},
|
||||
action: "update",
|
||||
action: "update",
|
||||
},
|
||||
[checks.updateTemplate]: {
|
||||
object: {
|
||||
resource_type: "template",
|
||||
resource_id: template.id,
|
||||
},
|
||||
} as const)
|
||||
action: "update",
|
||||
},
|
||||
})
|
||||
|
||||
export const workspaceMachine = createMachine(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user