mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: Turn predictable action arguments on (#3964)
* Turn predictable action arguments on * Remove layout strings
This commit is contained in:
@@ -7,6 +7,8 @@ import { assign, createMachine } from "xstate"
|
||||
export const auditMachine = createMachine(
|
||||
{
|
||||
id: "auditMachine",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./auditXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as { auditLogs?: AuditLog[]; count?: number; page: number; limit: number },
|
||||
services: {} as {
|
||||
@@ -29,7 +31,6 @@ export const auditMachine = createMachine(
|
||||
page: number
|
||||
},
|
||||
},
|
||||
tsTypes: {} as import("./auditXService.typegen").Typegen0,
|
||||
initial: "loading",
|
||||
states: {
|
||||
loading: {
|
||||
|
||||
@@ -91,14 +91,8 @@ export const authMachine =
|
||||
/** @xstate-layout N4IgpgJg5mDOIC5QEMCuAXAFgZXc9YAdLAJZQB2kA8hgMTYCSA4gHID6DLioADgPal0JPuW4gAHogBsATimEAzDIAcAFgUB2VTJ26ANCACeiAIwaADKsLKFtu-dsBfRwbRZc+IqQolyUBuS0ECJEvgBufADWXmTkAWL8gsKiSBKICubKhKpSyhoArAbGCGaqGoRSlVXVlfnOrhg4eATEsb7+gWAATl18XYQ8ADb4AGZ9ALatFPGpiSRCImKSCLLySmqa2ro6RaYFAEzWDscK9SBuTZ6EMOhCfgCqsN1BIYThUUQ3ALJgCQLzySW6Uy2VyBV2JXyUhMFRqcLqLnOjQ8LRudygj2e3V6-SGowm1zA6B+fySi1Sy32MnyhHyyksYK2ug0EJM1IURxO9jOFxRnyJ6IACt1xiRYKQRLAXpQ3uQItFCABjTBgRWRYVdUXi5LwWb-BYpUDLZRScygvKFIyIGQaQ4FHnI5r827tDVaiXkKXYvoDYboMaapUqtVusUe3W8fWAimIE1mnIW1l0rImOE1BENdxOwkuvw-LB8CBS4Iy94K75EzCFiMgOYGoEIZRUwgyVT5BQmfaW4omGxZGxcuwOrNXNHtfN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LGm1OUFCHQORGkyEVqoZQbTNly2-poaERy6kh0pYl5LrZpLNIy1l2Sm5dAkPRs4wz+NlDOGcEAA */
|
||||
createMachine(
|
||||
{
|
||||
context: {
|
||||
me: undefined,
|
||||
getUserError: undefined,
|
||||
authError: undefined,
|
||||
updateProfileError: undefined,
|
||||
methods: undefined,
|
||||
getMethodsError: undefined,
|
||||
},
|
||||
id: "authState",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./authXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as AuthContext,
|
||||
@@ -133,7 +127,14 @@ export const authMachine =
|
||||
}
|
||||
},
|
||||
},
|
||||
id: "authState",
|
||||
context: {
|
||||
me: undefined,
|
||||
getUserError: undefined,
|
||||
authError: undefined,
|
||||
updateProfileError: undefined,
|
||||
methods: undefined,
|
||||
getMethodsError: undefined,
|
||||
},
|
||||
initial: "gettingUser",
|
||||
states: {
|
||||
signedOut: {
|
||||
|
||||
@@ -9,6 +9,8 @@ export interface BuildInfoContext {
|
||||
|
||||
export const buildInfoMachine = createMachine(
|
||||
{
|
||||
id: "buildInfoState",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./buildInfoXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as BuildInfoContext,
|
||||
@@ -21,7 +23,6 @@ export const buildInfoMachine = createMachine(
|
||||
context: {
|
||||
buildInfo: undefined,
|
||||
},
|
||||
id: "buildInfoState",
|
||||
initial: "gettingBuildInfo",
|
||||
states: {
|
||||
gettingBuildInfo: {
|
||||
|
||||
@@ -28,7 +28,8 @@ type CreateWorkspaceEvent = {
|
||||
export const createWorkspaceMachine = createMachine(
|
||||
{
|
||||
id: "createWorkspaceState",
|
||||
initial: "gettingTemplates",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./createWorkspaceXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as CreateWorkspaceContext,
|
||||
events: {} as CreateWorkspaceEvent,
|
||||
@@ -44,7 +45,7 @@ export const createWorkspaceMachine = createMachine(
|
||||
}
|
||||
},
|
||||
},
|
||||
tsTypes: {} as import("./createWorkspaceXService.typegen").Typegen0,
|
||||
initial: "gettingTemplates",
|
||||
states: {
|
||||
gettingTemplates: {
|
||||
entry: "clearGetTemplatesError",
|
||||
|
||||
@@ -28,7 +28,8 @@ const emptyEntitlements = {
|
||||
export const entitlementsMachine = createMachine(
|
||||
{
|
||||
id: "entitlementsMachine",
|
||||
initial: "idle",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./entitlementsXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as EntitlementsContext,
|
||||
events: {} as EntitlementsEvent,
|
||||
@@ -38,10 +39,10 @@ export const entitlementsMachine = createMachine(
|
||||
},
|
||||
},
|
||||
},
|
||||
tsTypes: {} as import("./entitlementsXService.typegen").Typegen0,
|
||||
context: {
|
||||
entitlements: emptyEntitlements,
|
||||
},
|
||||
initial: "idle",
|
||||
states: {
|
||||
idle: {
|
||||
on: {
|
||||
|
||||
@@ -19,7 +19,8 @@ type SiteRolesEvent = {
|
||||
export const siteRolesMachine = createMachine(
|
||||
{
|
||||
id: "siteRolesState",
|
||||
initial: "idle",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./siteRolesXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as SiteRolesContext,
|
||||
events: {} as SiteRolesEvent,
|
||||
@@ -29,7 +30,7 @@ export const siteRolesMachine = createMachine(
|
||||
},
|
||||
},
|
||||
},
|
||||
tsTypes: {} as import("./siteRolesXService.typegen").Typegen0,
|
||||
initial: "idle",
|
||||
states: {
|
||||
idle: {
|
||||
on: {
|
||||
|
||||
@@ -26,6 +26,8 @@ export const setupMachine =
|
||||
/** @xstate-layout N4IgpgJg5mDOIC5QGUwBcCuAHZaCGaYAdAJYQA2YAxAMIBKAogIIAqDA+gGICSdyL7AKrIGdRKCwB7WCTQlJAO3EgAHogDMAViKaAnPoDsABgBMRgCy6jpkwBoQAT0QBGI+qIA2N0ePOAHJqa-qYAviH2qJg4+IREAMYATmAEJApQnCQJsGiCsGAJVBCKxKkAbpIA1sSJyYQZWTl5CcpSMnKKymoI6ibuzmZGuiYG6kYemn4eHvZOCObOzjom-X7qHsZGmuq6mmER6Ni4BNVJKWn12bn5VPkJkglEWOQEAGb3ALbxp3WZl00t0lk8iUSFUGl07g8-XMxlWmmsWnUMxcUyIzg86hhPgWvg8JjC4RACkkEDgykihxiJQoYABbWBnUQflcRAMZlc6jWwwMfmRCDM2ksfgMzl0Bisbj85j8exAFOixy+tVS6V+jXydKBHVBXQAtDsiOyeVp-OoFrpnHyzboiKZ1CMDCNzEY-H4xbL5UdYi81VcEjRvpBNe0QaAuoEbZzpfaRh4rFM+eYTOZbcsTBD0b0bB6DgrCMGGTrELrzYajM5jUFVubLY4NIsvKM2eMtKZNOMCSEgA */
|
||||
createMachine(
|
||||
{
|
||||
id: "SetupState",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./setupXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as SetupContext,
|
||||
@@ -36,7 +38,6 @@ export const setupMachine =
|
||||
}
|
||||
},
|
||||
},
|
||||
id: "SetupState",
|
||||
initial: "idle",
|
||||
states: {
|
||||
idle: {
|
||||
|
||||
@@ -33,6 +33,8 @@ export const templateMachine =
|
||||
/** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOhgBdyCoAVMVABwBt1ywBiCAe0JIIDcuAazAk0WPIVIUq+WvWaswCAV0ytcPANoAGALqJQDLrFxUehkAA9EAJgDsOkgGZbO2wE5bANg8BGABZnHR0AgBoQAE9EPx0-Eg9EpIAOe28-D28ggF9siPEcAmI+fDNcdCYASXwAMy4SLCp+MDpGFjYANTAAJ1MeMjBKagBBTCaWhXawLt7NfE4eUVURMQxCqRKyiuq6hrHcZtbFTp6+-AGhuVHxo6mZs5V8QXVzfF0DJBBjU1fLGwQAgF4t4AKzeWzOTIhEEhZIRa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zV12S0jRVzpFwH8F9inM4D03u2Ux6sWvQj2wTjH4qd5PQzrvMG-nYnSYz0TQRNG3gnUyE+zNNv-EevDrUya9mr7kiVexlPRoJxujdE7O7r8gIO+dXtUkyMvVazSfrt8bt7xpgcFttC1nXsROPy-SBH5w1iO6MKwRghAkbH2BSUtHBrTRPeC8rhxKJ30hRKiNF2psEAS3ZCNMkR4R8MOWqfloEIntCvDmnoRzyUIvLRO6VWTYP+F4TCNt0g22REhV6pCYgEJIPVDENsPBpA9GkehmCAHjREtdVmmFPCKy2u6RwcJzaQicMOb0wQ3ALVxNvXSRAmExBUWQvOA5baqXlrbXIuQgA */
|
||||
createMachine(
|
||||
{
|
||||
id: "templateMachine",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./templateXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as TemplateContext,
|
||||
@@ -58,7 +60,6 @@ export const templateMachine =
|
||||
}
|
||||
},
|
||||
},
|
||||
id: "(machine)",
|
||||
initial: "gettingTemplate",
|
||||
states: {
|
||||
gettingTemplate: {
|
||||
|
||||
@@ -7,7 +7,9 @@ export const templateSettingsMachine =
|
||||
/** @xstate-layout N4IgpgJg5mDOIC5QBcwFsAOAbAhqgymMsgJYB2UsAdFgPY4TlQDEEtZYV5AbrQNadUmXASKkK1OgyYIetAMZ4S7ANoAGALqJQGWrBKl22kAA9EANgCMVAKwB2AByWATJbWWAnABYv55w-MAGhAAT0RnAGZnKgibGw9nD3M1JJsHNQiAX0zgoWw8MEJiJmpIAyZmfABBADUAUWNdfUMyYzMESx9bSK8IhwdncwcbF2dgsIRejypzX2dXf09zCLUbbNz0fNFiiSpYHG4Ktg4uMl4BKjyRQrESvYOZOUUW9S0kECbyo3f25KoHOxeDwODx9EYeNTzcYWGxqKgeGw+SJ2cx+VZebI5EBkWgQODGK4FIriSg0eiMCiNPRfVo-RBeMahRAQqhqNnuWERFFeOyedYgQnbEmlRgkqnNZS00DtSwRcz-EY2PzeeYOLk2aEIWJ2WwOIEBNIeBG8-mCm47Un7Q6U96fFptenWRJDIZy+y9AFBJkIEbRbxeWUBRwIyx2U2ba7Eu5WyDimkOhAI2yxSx+foMpWWTV2RLJgIrPoA4bh4RE24SOP2ukdHXOgJq8zuvoozWWBys9nzSydNt2NQYzFAA */
|
||||
createMachine(
|
||||
{
|
||||
initial: "loading",
|
||||
id: "templateSettings",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./templateSettingsXService.typegen").Typegen0,
|
||||
schema: {} as {
|
||||
context: {
|
||||
organizationId: string
|
||||
@@ -26,7 +28,7 @@ export const templateSettingsMachine =
|
||||
}
|
||||
events: { type: "SAVE"; templateSettings: UpdateTemplateMeta }
|
||||
},
|
||||
tsTypes: {} as import("./templateSettingsXService.typegen").Typegen0,
|
||||
initial: "loading",
|
||||
states: {
|
||||
loading: {
|
||||
invoke: {
|
||||
@@ -71,7 +73,6 @@ export const templateSettingsMachine =
|
||||
type: "final",
|
||||
},
|
||||
},
|
||||
id: "templateSettings",
|
||||
},
|
||||
{
|
||||
services: {
|
||||
|
||||
@@ -10,97 +10,88 @@ interface TemplatesContext {
|
||||
getTemplatesError?: Error | unknown
|
||||
}
|
||||
|
||||
export const templatesMachine =
|
||||
/** @xstate-layout N4IgpgJg5mDOIC5QBcwFsAOAbAhq2AysnmAHQzLICWAdlAPIBOUONVAXnlQPY2wDEEXmVoA3bgGsyFJizadqveEhAZusKopqJQAD0QAWAMwHSATgDsANgCsAJgt2rRuwAYAHBYsAaEAE9EAEZAu1IDMwiIm3dXG0DjdwBfRN9UTFx8IhJyMEpaBmZWDi4lfjBGRm5GUmw8ADMqtBzkWSKFHj4dVXVNDq79BGNTS1sHJxcPL18AhBMjUhtXJaWrOzM7O3cDG2TU9FrM4lRm6joAFX2MuEFhUjFJaVyL9JJlUDUNLX6gpeH1wJcIQs7giVmmiBB5kilgM7iMHmcOxSIDSBzgWWOFFOUGeaIE5Uq1QODUYTQouKub26nz6KgGgV+ULsAOZDhBZjB-kQbhspGWSxC0W2VncSORNG4EDgXVRlIxjzydFa8hKnRUH16vG+gzs4IQwTMYWhjgsRjm9l2KMur3lJ3yFNeXQ1XzpiCsVlcpFW4QMFnisJZeo5UMicQsNjMgRsSL2L0O2SENDATp6Lr0QTcFjCa2cfqsgRNeuC7j5-Ncq3WmwMgUtsptRzIBKqKZpWtd+sz2Y5RjzBYceo2WbNw9hrijZtr1vjqBbmu07cC7iLSWSiSAA */
|
||||
createMachine(
|
||||
{
|
||||
tsTypes: {} as import("./templatesXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as TemplatesContext,
|
||||
services: {} as {
|
||||
getOrganizations: {
|
||||
data: TypesGen.Organization[]
|
||||
}
|
||||
getTemplates: {
|
||||
data: TypesGen.Template[]
|
||||
}
|
||||
},
|
||||
},
|
||||
id: "templatesState",
|
||||
initial: "gettingOrganizations",
|
||||
states: {
|
||||
gettingOrganizations: {
|
||||
entry: "clearGetOrganizationsError",
|
||||
invoke: {
|
||||
src: "getOrganizations",
|
||||
id: "getOrganizations",
|
||||
onDone: [
|
||||
{
|
||||
actions: ["assignOrganizations"],
|
||||
target: "gettingTemplates",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: "assignGetOrganizationsError",
|
||||
target: "error",
|
||||
},
|
||||
],
|
||||
},
|
||||
tags: "loading",
|
||||
},
|
||||
gettingTemplates: {
|
||||
entry: "clearGetTemplatesError",
|
||||
invoke: {
|
||||
src: "getTemplates",
|
||||
id: "getTemplates",
|
||||
onDone: [
|
||||
{
|
||||
actions: ["assignTemplates"],
|
||||
target: "done",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: "assignGetTemplatesError",
|
||||
target: "error",
|
||||
},
|
||||
],
|
||||
},
|
||||
tags: "loading",
|
||||
},
|
||||
done: {},
|
||||
error: {},
|
||||
export const templatesMachine = createMachine(
|
||||
{
|
||||
id: "templatesState",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./templatesXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as TemplatesContext,
|
||||
services: {} as {
|
||||
getOrganizations: {
|
||||
data: TypesGen.Organization[]
|
||||
}
|
||||
getTemplates: {
|
||||
data: TypesGen.Template[]
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
actions: {
|
||||
assignOrganizations: assign({
|
||||
organizations: (_, event) => event.data,
|
||||
}),
|
||||
assignGetOrganizationsError: assign({
|
||||
getOrganizationsError: (_, event) => event.data,
|
||||
}),
|
||||
clearGetOrganizationsError: assign((context) => ({
|
||||
...context,
|
||||
getOrganizationsError: undefined,
|
||||
})),
|
||||
assignTemplates: assign({
|
||||
templates: (_, event) => event.data,
|
||||
}),
|
||||
assignGetTemplatesError: assign({
|
||||
getTemplatesError: (_, event) => event.data,
|
||||
}),
|
||||
clearGetTemplatesError: (context) => assign({ ...context, getTemplatesError: undefined }),
|
||||
},
|
||||
services: {
|
||||
getOrganizations: API.getOrganizations,
|
||||
getTemplates: async (context) => {
|
||||
if (!context.organizations || context.organizations.length === 0) {
|
||||
throw new Error("no organizations")
|
||||
}
|
||||
return API.getTemplates(context.organizations[0].id)
|
||||
initial: "gettingOrganizations",
|
||||
states: {
|
||||
gettingOrganizations: {
|
||||
entry: "clearGetOrganizationsError",
|
||||
invoke: {
|
||||
src: "getOrganizations",
|
||||
id: "getOrganizations",
|
||||
onDone: {
|
||||
actions: ["assignOrganizations"],
|
||||
target: "gettingTemplates",
|
||||
},
|
||||
onError: {
|
||||
actions: "assignGetOrganizationsError",
|
||||
target: "error",
|
||||
},
|
||||
},
|
||||
tags: "loading",
|
||||
},
|
||||
gettingTemplates: {
|
||||
entry: "clearGetTemplatesError",
|
||||
invoke: {
|
||||
src: "getTemplates",
|
||||
id: "getTemplates",
|
||||
onDone: {
|
||||
actions: "assignTemplates",
|
||||
target: "done",
|
||||
},
|
||||
onError: {
|
||||
actions: "assignGetTemplatesError",
|
||||
target: "error",
|
||||
},
|
||||
},
|
||||
tags: "loading",
|
||||
},
|
||||
done: {},
|
||||
error: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
actions: {
|
||||
assignOrganizations: assign({
|
||||
organizations: (_, event) => event.data,
|
||||
}),
|
||||
assignGetOrganizationsError: assign({
|
||||
getOrganizationsError: (_, event) => event.data,
|
||||
}),
|
||||
clearGetOrganizationsError: assign((context) => ({
|
||||
...context,
|
||||
getOrganizationsError: undefined,
|
||||
})),
|
||||
assignTemplates: assign({
|
||||
templates: (_, event) => event.data,
|
||||
}),
|
||||
assignGetTemplatesError: assign({
|
||||
getTemplatesError: (_, event) => event.data,
|
||||
}),
|
||||
clearGetTemplatesError: (context) => assign({ ...context, getTemplatesError: undefined }),
|
||||
},
|
||||
services: {
|
||||
getOrganizations: API.getOrganizations,
|
||||
getTemplates: async (context) => {
|
||||
if (!context.organizations || context.organizations.length === 0) {
|
||||
throw new Error("no organizations")
|
||||
}
|
||||
return API.getTemplates(context.organizations[0].id)
|
||||
},
|
||||
},
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
@@ -37,6 +37,8 @@ export const terminalMachine =
|
||||
/** @xstate-layout N4IgpgJg5mDOIC5QBcwCcC2BLAdgQwBsBlZPVAOhmWVygHk0o8csAvMrAex1gGIJuYcrgBunANZCqDJi3Y1u8JCAAOnWFgU5EoAB6IA7AE4AzOSMBGAEwBWCyYAsANgs2bVgDQgAnohNGbcgsnEIcHCwAOBwAGCKMHAF8Er1RMXEISMikwaloZZjYORV50NE40chUCMgAzcoxKHPy5Ip4dVXVNLm1lfQQIiLMIpxMbQYjYo2jXL18EawtyAwGwk1HTMdGklPRsfGJSCioaHCgAdXLxWBU8AGMwfkFhHDFJRuQLtCub+-a1DS07T69icVnILisDhspiccQ2sz8y3INmiqNGsMcBmiNm2IFSewyh2yuVOn2+dwepXKlWqyDqmHeZOuFL+nUBvUQILBEKhMLhowRCAMTkCIzWDkcEyMBhsBlx+PSByy7xO50uzPuAEEYDhkI8cEJRBJiUyfmBtWBdayAd0gZyjCFyFZbKjnC4jKYLIK7GYYqirCYBk5olYDIlknjdorMkccqrTRSLbqSmgyhUqrV6oz1Wak8hrV1uHb5g6nE6XdE3RYPSYvT5EWCA2s7E4sbZhfKo-sY0JbtwDbdVfrDS9jeQ+zgB-nlP9Cz09IhIcLyCZIUYotEDCZNxEDN7peY1ms4gYrNNBp20t2ieP+2BB7QU2maZmGROpwX2QuEEuy6uHOuMRbjue71ggdiLPY4phiYMoWNYl4EkqFDvveqAQLwZwAEoAJIACoAKKfraHI-gYkTkCGAFYmG0TbnWcw2A4YKmGskJno44RWIh0Y3qhg6QLwWEEZqAAixFFqRobViusKngYMpWEGgpQmWUFsSEcSOHRPHXsq-Hobwok4UQADCdAAHIWQRpl4RJ84gH0SmtuQDgTNWMJTDKJgqUEq4RNCljTOs3ERgqekUBAWCwAZgnmVZNl2TObIkd+zplrEYanvY0SwrCESCs6BiuaidGrgGTgekYSQRjgnAQHA7ThYSyrHHkjAFPI3RKKAs5fo5iAxIEXHMSMErWNiTiFa4K6ldi1ayu4FjhjsV4tbGJJql8GpgPZxYWNMDiubBdh2Ju7pGIK-jFW6rYiq4bZOLp63EvGOaJjq069Slknfq4jrOii51udiMpXbC5ATKi1ghNEljNs9yG9neD6nHtUlnhErmgqeIyosKazejNZ7+qMi3BiYiM9rek5oZA6NpeR0ROmGpgnhT0qCmNSxHhKW4BiGERUzeUUxSj6EMwN4HM5ukLLXBViRKGNhXVj64etM0JOG5YTC1kktORlp7hA4CtK2DYEALQQ8M5FKQd27OJTNVAA */
|
||||
createMachine(
|
||||
{
|
||||
id: "terminalState",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./terminalXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as TerminalContext,
|
||||
@@ -53,7 +55,6 @@ export const terminalMachine =
|
||||
}
|
||||
},
|
||||
},
|
||||
id: "terminalState",
|
||||
initial: "gettingWorkspace",
|
||||
states: {
|
||||
gettingWorkspace: {
|
||||
|
||||
@@ -79,6 +79,8 @@ export type UsersEvent =
|
||||
|
||||
export const usersMachine = createMachine(
|
||||
{
|
||||
id: "usersState",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./usersXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as UsersContext,
|
||||
@@ -107,7 +109,6 @@ export const usersMachine = createMachine(
|
||||
}
|
||||
},
|
||||
},
|
||||
id: "usersState",
|
||||
initial: "idle",
|
||||
states: {
|
||||
idle: {
|
||||
|
||||
@@ -81,6 +81,8 @@ const permissionsToCheck = (workspace: TypesGen.Workspace) => ({
|
||||
|
||||
export const workspaceMachine = createMachine(
|
||||
{
|
||||
id: "workspaceState",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./workspaceXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as WorkspaceContext,
|
||||
@@ -124,10 +126,12 @@ export const workspaceMachine = createMachine(
|
||||
}
|
||||
},
|
||||
},
|
||||
id: "workspaceState",
|
||||
initial: "idle",
|
||||
on: {
|
||||
GET_WORKSPACE: "gettingWorkspace",
|
||||
GET_WORKSPACE: {
|
||||
target: ".gettingWorkspace",
|
||||
internal: false,
|
||||
},
|
||||
},
|
||||
states: {
|
||||
idle: {
|
||||
@@ -138,30 +142,38 @@ export const workspaceMachine = createMachine(
|
||||
invoke: {
|
||||
src: "getWorkspace",
|
||||
id: "getWorkspace",
|
||||
onDone: {
|
||||
target: "refreshingTemplate",
|
||||
actions: ["assignWorkspace"],
|
||||
},
|
||||
onError: {
|
||||
target: "error",
|
||||
actions: "assignGetWorkspaceError",
|
||||
},
|
||||
onDone: [
|
||||
{
|
||||
actions: "assignWorkspace",
|
||||
target: "refreshingTemplate",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: "assignGetWorkspaceError",
|
||||
target: "error",
|
||||
},
|
||||
],
|
||||
},
|
||||
tags: "loading",
|
||||
},
|
||||
refreshingTemplate: {
|
||||
entry: ["clearRefreshTemplateError"],
|
||||
entry: "clearRefreshTemplateError",
|
||||
invoke: {
|
||||
id: "refreshTemplate",
|
||||
src: "getTemplate",
|
||||
onDone: {
|
||||
target: "gettingPermissions",
|
||||
actions: ["assignTemplate"],
|
||||
},
|
||||
onError: {
|
||||
target: "error",
|
||||
actions: ["assignRefreshTemplateError", "displayRefreshTemplateError"],
|
||||
},
|
||||
id: "refreshTemplate",
|
||||
onDone: [
|
||||
{
|
||||
actions: "assignTemplate",
|
||||
target: "gettingPermissions",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: ["assignRefreshTemplateError", "displayRefreshTemplateError"],
|
||||
target: "error",
|
||||
},
|
||||
],
|
||||
},
|
||||
tags: "loading",
|
||||
},
|
||||
@@ -172,7 +184,7 @@ export const workspaceMachine = createMachine(
|
||||
id: "checkPermissions",
|
||||
onDone: [
|
||||
{
|
||||
actions: ["assignPermissions"],
|
||||
actions: "assignPermissions",
|
||||
target: "ready",
|
||||
},
|
||||
],
|
||||
@@ -187,22 +199,33 @@ export const workspaceMachine = createMachine(
|
||||
ready: {
|
||||
type: "parallel",
|
||||
states: {
|
||||
// We poll the workspace consistently to know if it becomes outdated and to update build status
|
||||
pollingWorkspace: {
|
||||
initial: "refreshingWorkspace",
|
||||
states: {
|
||||
refreshingWorkspace: {
|
||||
entry: "clearRefreshWorkspaceError",
|
||||
invoke: {
|
||||
id: "refreshWorkspace",
|
||||
src: "refreshWorkspace",
|
||||
onDone: { target: "waiting", actions: ["refreshTimeline", "assignWorkspace"] },
|
||||
onError: { target: "waiting", actions: "assignRefreshWorkspaceError" },
|
||||
id: "refreshWorkspace",
|
||||
onDone: [
|
||||
{
|
||||
actions: ["refreshTimeline", "assignWorkspace"],
|
||||
target: "waiting",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: "assignRefreshWorkspaceError",
|
||||
target: "waiting",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
waiting: {
|
||||
after: {
|
||||
1000: "refreshingWorkspace",
|
||||
"1000": {
|
||||
target: "refreshingWorkspace",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -221,8 +244,12 @@ export const workspaceMachine = createMachine(
|
||||
},
|
||||
askingDelete: {
|
||||
on: {
|
||||
DELETE: "requestingDelete",
|
||||
CANCEL_DELETE: "idle",
|
||||
DELETE: {
|
||||
target: "requestingDelete",
|
||||
},
|
||||
CANCEL_DELETE: {
|
||||
target: "idle",
|
||||
},
|
||||
},
|
||||
},
|
||||
requestingStartWithLatestTemplate: {
|
||||
@@ -243,80 +270,100 @@ export const workspaceMachine = createMachine(
|
||||
requestingStart: {
|
||||
entry: "clearBuildError",
|
||||
invoke: {
|
||||
id: "startWorkspace",
|
||||
src: "startWorkspace",
|
||||
onDone: {
|
||||
target: "idle",
|
||||
actions: ["assignBuild", "refreshTimeline"],
|
||||
},
|
||||
onError: {
|
||||
target: "idle",
|
||||
actions: ["assignBuildError"],
|
||||
},
|
||||
id: "startWorkspace",
|
||||
onDone: [
|
||||
{
|
||||
actions: ["assignBuild", "refreshTimeline"],
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: "assignBuildError",
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
requestingStop: {
|
||||
entry: "clearBuildError",
|
||||
invoke: {
|
||||
id: "stopWorkspace",
|
||||
src: "stopWorkspace",
|
||||
onDone: {
|
||||
target: "idle",
|
||||
actions: ["assignBuild", "refreshTimeline"],
|
||||
},
|
||||
onError: {
|
||||
target: "idle",
|
||||
actions: ["assignBuildError"],
|
||||
},
|
||||
id: "stopWorkspace",
|
||||
onDone: [
|
||||
{
|
||||
actions: ["assignBuild", "refreshTimeline"],
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: "assignBuildError",
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
requestingDelete: {
|
||||
entry: "clearBuildError",
|
||||
invoke: {
|
||||
id: "deleteWorkspace",
|
||||
src: "deleteWorkspace",
|
||||
onDone: {
|
||||
target: "idle",
|
||||
actions: ["assignBuild", "refreshTimeline"],
|
||||
},
|
||||
onError: {
|
||||
target: "idle",
|
||||
actions: ["assignBuildError"],
|
||||
},
|
||||
id: "deleteWorkspace",
|
||||
onDone: [
|
||||
{
|
||||
actions: ["assignBuild", "refreshTimeline"],
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: "assignBuildError",
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
requestingCancel: {
|
||||
entry: ["clearCancellationMessage", "clearCancellationError"],
|
||||
invoke: {
|
||||
id: "cancelWorkspace",
|
||||
src: "cancelWorkspace",
|
||||
onDone: {
|
||||
target: "idle",
|
||||
actions: [
|
||||
"assignCancellationMessage",
|
||||
"displayCancellationMessage",
|
||||
"refreshTimeline",
|
||||
],
|
||||
},
|
||||
onError: {
|
||||
target: "idle",
|
||||
actions: ["assignCancellationError"],
|
||||
},
|
||||
id: "cancelWorkspace",
|
||||
onDone: [
|
||||
{
|
||||
actions: [
|
||||
"assignCancellationMessage",
|
||||
"displayCancellationMessage",
|
||||
"refreshTimeline",
|
||||
],
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: "assignCancellationError",
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
refreshingTemplate: {
|
||||
entry: "clearRefreshTemplateError",
|
||||
invoke: {
|
||||
id: "refreshTemplate",
|
||||
src: "getTemplate",
|
||||
onDone: {
|
||||
target: "requestingStart",
|
||||
actions: "assignTemplate",
|
||||
},
|
||||
onError: {
|
||||
target: "idle",
|
||||
actions: ["assignRefreshTemplateError", "displayRefreshTemplateError"],
|
||||
},
|
||||
id: "refreshTemplate",
|
||||
onDone: [
|
||||
{
|
||||
actions: "assignTemplate",
|
||||
target: "requestingStart",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: ["assignRefreshTemplateError", "displayRefreshTemplateError"],
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -327,20 +374,31 @@ export const workspaceMachine = createMachine(
|
||||
gettingResources: {
|
||||
entry: "clearGetResourcesError",
|
||||
invoke: {
|
||||
id: "getResources",
|
||||
src: "getResources",
|
||||
onDone: { target: "waiting", actions: "assignResources" },
|
||||
onError: { target: "waiting", actions: "assignGetResourcesError" },
|
||||
id: "getResources",
|
||||
onDone: [
|
||||
{
|
||||
actions: "assignResources",
|
||||
target: "waiting",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: "assignGetResourcesError",
|
||||
target: "waiting",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
waiting: {
|
||||
after: {
|
||||
5000: "gettingResources",
|
||||
"5000": {
|
||||
target: "gettingResources",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
timeline: {
|
||||
initial: "gettingBuilds",
|
||||
states: {
|
||||
@@ -349,14 +407,18 @@ export const workspaceMachine = createMachine(
|
||||
entry: "clearGetBuildsError",
|
||||
invoke: {
|
||||
src: "getBuilds",
|
||||
onDone: {
|
||||
actions: ["assignBuilds"],
|
||||
target: "loadedBuilds",
|
||||
},
|
||||
onError: {
|
||||
actions: ["assignGetBuildsError"],
|
||||
target: "idle",
|
||||
},
|
||||
onDone: [
|
||||
{
|
||||
actions: "assignBuilds",
|
||||
target: "loadedBuilds",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: "assignGetBuildsError",
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
loadedBuilds: {
|
||||
@@ -365,24 +427,30 @@ export const workspaceMachine = createMachine(
|
||||
idle: {
|
||||
on: {
|
||||
LOAD_MORE_BUILDS: {
|
||||
target: "loadingMoreBuilds",
|
||||
cond: "hasMoreBuilds",
|
||||
target: "loadingMoreBuilds",
|
||||
},
|
||||
REFRESH_TIMELINE: {
|
||||
target: "#workspaceState.ready.timeline.gettingBuilds",
|
||||
},
|
||||
REFRESH_TIMELINE: "#workspaceState.ready.timeline.gettingBuilds",
|
||||
},
|
||||
},
|
||||
loadingMoreBuilds: {
|
||||
entry: "clearLoadMoreBuildsError",
|
||||
invoke: {
|
||||
src: "loadMoreBuilds",
|
||||
onDone: {
|
||||
actions: ["assignNewBuilds"],
|
||||
target: "idle",
|
||||
},
|
||||
onError: {
|
||||
actions: ["assignLoadMoreBuildsError"],
|
||||
target: "idle",
|
||||
},
|
||||
onDone: [
|
||||
{
|
||||
actions: "assignNewBuilds",
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
actions: "assignLoadMoreBuildsError",
|
||||
target: "idle",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -393,7 +461,9 @@ export const workspaceMachine = createMachine(
|
||||
},
|
||||
error: {
|
||||
on: {
|
||||
GET_WORKSPACE: "gettingWorkspace",
|
||||
GET_WORKSPACE: {
|
||||
target: "gettingWorkspace",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -24,6 +24,8 @@ type LogsEvent = {
|
||||
export const workspaceBuildMachine = createMachine(
|
||||
{
|
||||
id: "workspaceBuildState",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./workspaceBuildXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as LogsContext,
|
||||
events: {} as LogsEvent,
|
||||
@@ -36,7 +38,6 @@ export const workspaceBuildMachine = createMachine(
|
||||
}
|
||||
},
|
||||
},
|
||||
tsTypes: {} as import("./workspaceBuildXService.typegen").Typegen0,
|
||||
initial: "gettingBuild",
|
||||
states: {
|
||||
gettingBuild: {
|
||||
|
||||
@@ -21,11 +21,12 @@ export type WorkspaceScheduleBannerEvent = {
|
||||
|
||||
export const workspaceScheduleBannerMachine = createMachine(
|
||||
{
|
||||
id: "workspaceScheduleBannerState",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./workspaceScheduleBannerXService.typegen").Typegen0,
|
||||
schema: {
|
||||
events: {} as WorkspaceScheduleBannerEvent,
|
||||
},
|
||||
id: "workspaceScheduleBannerState",
|
||||
initial: "idle",
|
||||
states: {
|
||||
idle: {
|
||||
|
||||
@@ -53,6 +53,8 @@ export type WorkspaceScheduleEvent =
|
||||
|
||||
export const workspaceSchedule = createMachine(
|
||||
{
|
||||
id: "workspaceScheduleState",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./workspaceScheduleXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as WorkspaceScheduleContext,
|
||||
@@ -63,7 +65,6 @@ export const workspaceSchedule = createMachine(
|
||||
}
|
||||
},
|
||||
},
|
||||
id: "workspaceScheduleState",
|
||||
initial: "idle",
|
||||
on: {
|
||||
GET_WORKSPACE: "gettingWorkspace",
|
||||
|
||||
@@ -28,6 +28,8 @@ type WorkspaceItemEvent =
|
||||
export const workspaceItemMachine = createMachine(
|
||||
{
|
||||
id: "workspaceItemMachine",
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./workspacesXService.typegen").Typegen0,
|
||||
schema: {
|
||||
context: {} as WorkspaceItemContext,
|
||||
events: {} as WorkspaceItemEvent,
|
||||
@@ -43,7 +45,6 @@ export const workspaceItemMachine = createMachine(
|
||||
}
|
||||
},
|
||||
},
|
||||
tsTypes: {} as import("./workspacesXService.typegen").Typegen0,
|
||||
type: "parallel",
|
||||
|
||||
states: {
|
||||
@@ -196,6 +197,7 @@ type WorkspacesEvent =
|
||||
|
||||
export const workspacesMachine = createMachine(
|
||||
{
|
||||
predictableActionArguments: true,
|
||||
tsTypes: {} as import("./workspacesXService.typegen").Typegen1,
|
||||
schema: {
|
||||
context: {} as WorkspacesContext,
|
||||
|
||||
Reference in New Issue
Block a user