Last active
February 2, 2021 02:10
-
-
Save johnnydecimal/b712e2c27aa049101961ad16e91258fa to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const determining_requirements = { | |
type: "parallel", | |
states: { | |
"consulting with BOM team": { | |
initial: "consulting", | |
states: { | |
consulting: { | |
on: { | |
OK: "ok", | |
ABANDON: "#fetch.abandoned", | |
}, | |
}, | |
ok: { | |
type: "final", | |
}, | |
}, | |
}, | |
"consulting with Capacity Managers": { | |
initial: "consulting", | |
states: { | |
consulting: { | |
on: { | |
OK: "ok", | |
ABANDON: "#fetch.abandoned", | |
}, | |
}, | |
ok: { | |
type: "final", | |
}, | |
}, | |
}, | |
"project determining requirements": { | |
initial: "determining", | |
states: { | |
determining: { | |
on: { | |
OK: "ok", | |
ABANDON: "#fetch.abandoned", | |
}, | |
}, | |
ok: { | |
type: "final", | |
}, | |
}, | |
}, | |
}, | |
onDone: "confirming rack space availability", | |
}; | |
const confirming_rack_space_availability = { | |
type: "parallel", | |
states: { | |
"confirming rack space availability": { | |
initial: "confirming", | |
states: { | |
confirming: { | |
on: { | |
CONFIRMED: "ok", | |
ABANDON: "#fetch.abandoned", | |
}, | |
}, | |
ok: { | |
type: "final", | |
}, | |
}, | |
}, | |
}, | |
onDone: "purchasing the equipment", | |
}; | |
const receive_equipment = { | |
type: "parallel", | |
states: { | |
test1: {}, | |
test2: {}, | |
}, | |
onDone: "install equipment", | |
}; | |
const just_demo = { | |
type: "parallel", | |
states: { | |
"determine requirements with BOM team": { | |
on: { | |
DETERMINED: "parallel tasks", | |
ABANDONED: "#fetch.abandoned", | |
}, | |
}, | |
"parallel tasks": { | |
type: "parallel", | |
states: { | |
"is there DC capacity?": { | |
type: "compound", | |
initial: "finding out", | |
states: { | |
"finding out": { | |
on: { | |
yes: "success", | |
no: "#fetch.abandoned", | |
}, | |
}, | |
success: { | |
type: "final", | |
}, | |
}, | |
}, | |
"is the Capacity Manager cool?": { | |
type: "compound", | |
initial: "asking Mark Lahiff", | |
states: { | |
"asking Mark Lahiff": { | |
on: { | |
"he's cool": "success", | |
no: "#fetch.abandoned", | |
}, | |
}, | |
success: { | |
type: "final", | |
}, | |
}, | |
}, | |
}, | |
onDone: "#fetch.what does it cost?", | |
}, | |
}, | |
}; | |
const machine = Machine({ | |
id: "fetch", | |
initial: "idle", | |
states: { | |
idle: { | |
type: "atomic", | |
on: { | |
START: "determining requirements", | |
}, | |
}, | |
"determining requirements": { | |
// ...determining_requirements, | |
...just_demo, | |
}, | |
"confirming rack space availability": { | |
...determining_requirements, | |
// ...confirming_rack_space_availability, | |
}, | |
"purchasing the equipment": {}, | |
"prepare the site": {}, | |
"prepare for installation": {}, | |
"receive equipment": { | |
...receive_equipment, | |
}, | |
"install equipment": {}, | |
"remove and decommission old equipment": {}, | |
"cmdb updates and closure": {}, | |
"what does it cost?": { | |
type: "compound", | |
initial: "getting a quote from a vendor", | |
states: { | |
"getting a quote from a vendor": { | |
on: { | |
"got quote": "and so on", | |
}, | |
}, | |
"and so on": { | |
on: {}, | |
}, | |
}, | |
}, | |
abandoned: { | |
type: "final", | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment