Skip to content

Instantly share code, notes, and snippets.

@orther
Created April 29, 2021 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orther/39e93c0a2eedcde2165f6e0122804668 to your computer and use it in GitHub Desktop.
Save orther/39e93c0a2eedcde2165f6e0122804668 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const what_can_i_order = {
id: 'what_can_i_order',
type: 'compound',
initial: 'consulting_bom_team',
states: {
consulting_bom_team: {
on: {
CONSULTED: 'done'
}
},
done: {
type: 'final'
}
}
}
const where_will_it_go = {
id: 'where_will_it_go',
type: 'compound',
initial: 'consulting_capacity_management',
states: {
consulting_capacity_management: {
on: {
CAP_MGT_HAPPY: 'recording_rack_allocation_details'
}
},
recording_rack_allocation_details: {
on: {
RECORDED: 'done'
}
},
done: {
type: 'final'
}
}
}
const determining_requirements = {
id: 'determining_requirements',
type: 'parallel',
states: {
what_can_i_order: {
...what_can_i_order
},
where_will_it_go: {
...where_will_it_go
},
},
onDone: 'sourcing'
}
const purchasing_equipment = {
id: 'purchasing_equipment',
type: 'compound',
initial: 'obtaining_funding',
states: {
obtaining_funding: {
on: {
OBTAINED: 'raising_purchase_order'
}
},
raising_purchase_order: {
on: {
RAISED: 'done'
}
},
done: {
type: 'final'
}
}
}
const recording_details = {
id: 'recording_details',
type: 'compound',
initial: 'recording_details',
states: {
recording_details: {
on: {
RECORDED: 'done'
}
},
done: {
type: 'final'
}
}
}
const purchasing_and_recording = {
id: 'purchasing_and_recording',
type: 'parallel',
states: {
purchasing_equipment: {
...purchasing_equipment
},
recording_details: {
...recording_details
}
},
onDone: '#preparation_and_receipt'
}
const sourcing = {
id: 'sourcing',
type: 'compound',
initial: 'getting_a_quote',
states: {
getting_a_quote: {
on: {
QUOTE_RECEIVED: 'approving_quote'
}
},
approving_quote: {
on: {
QUOTE_APPROVED: 'purchasing_and_recording',
QUOTE_REJECTED: '#abandoned'
}
},
purchasing_and_recording: {
...purchasing_and_recording
},
}
}
const structured_cabling = {
id: 'structured_cabling',
type: 'compound',
initial: 'installing_structured_cabling',
states: {
installing_structured_cabling: {
on: {
INSTALLED: 'done'
}
},
done: {
type: 'final'
}
}
}
const power_and_cooling = {
id: 'power_and_cooling',
type: 'compound',
initial: 'making_ready_power_and_cooling',
states: {
making_ready_power_and_cooling: {
on: {
MADE_READY: 'done',
}
},
done: {
type: 'final'
}
}
}
const preparing_site = {
id: 'preparing_site',
type: 'parallel',
states: {
structured_cabling: {
...structured_cabling
},
power_and_cooling: {
...power_and_cooling
}
}
}
const receiving_hardware = {
id: 'receiving_hardware',
type: 'compound',
initial: 'awaiting_shipment_notification',
states: {
awaiting_shipment_notification: {
on: {
NOTIFICATION_RECEIVED: 'raising_delivery_request'
}
},
raising_delivery_request: {
on: {
RAISED: 'receiving_hardware'
}
},
receiving_hardware: {
on: {
RECEIVED: 'done'
}
},
done: {
type: 'final'
}
}
}
const raising_changes = {
id: 'raising_changes',
type: 'compound',
initial: 'raising_change_request',
states: {
raising_change_request: {
on: {
SUBMIT_CHANGE: 'tcab_approval',
}
},
tcab_approval: {
on: {
TCAB_APPROVED: 'dcab_approval'
}
},
dcab_approval: {
on: {
DCAB_APPROVED: 'approved'
}
},
approved: {
type: 'final'
}
}
}
const preparation_and_receipt = {
id: 'preparation_and_receipt',
type: 'parallel',
states: {
preparing_site: {
...preparing_site
},
receiving_hardware: {
...receiving_hardware
},
raising_changes: {
...raising_changes
}
},
onDone: '#installation'
}
const installation = {
id: 'installation',
type: 'compound',
initial: 'installing_kit',
states: {
installing_kit: {
on: {
INSTALLED: 'done'
}
},
done: {
type: 'final'
}
},
onDone: 'closure'
}
const closure = {
id: 'closure',
type: 'compound',
initial: 'updating_cmdb',
states: {
updating_cmdb: {
on: {
UPDATED: 'done'
}
},
done: {
type: 'final'
},
},
onDone: '#complete'
}
const hardwareMachine = Machine({
id: 'hardware',
type: 'compound',
initial: 'determining_requirements',
states: {
determining_requirements: {
...determining_requirements
},
sourcing: {
...sourcing
},
preparation_and_receipt: {
...preparation_and_receipt
},
installation: {
...installation
},
closure: {
...closure
},
complete: {
id: 'complete',
type: 'final'
},
abandoned: {
id: 'abandoned',
type: 'final'
},
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment