Last active
December 22, 2020 19:17
-
-
Save saabi/82bb56549ea7059f8d2e5df0715693a3 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
| Machine({ | |
| "id": "Form", | |
| "initial": "CheckingSelection", | |
| "on": { | |
| "SELECTION_CHANGED": { | |
| "target": "CheckingSelection", | |
| "actions": [ | |
| "clearQuery", | |
| "setSelection", | |
| "sendEdited", | |
| "sendFormChanged" | |
| ] | |
| }, | |
| "RENAME": { | |
| "type": "internal", | |
| "actions": "rename" | |
| }, | |
| "DISCARDED": { | |
| "target": "Stopped" | |
| } | |
| }, | |
| "states": { | |
| "CheckingSelection": { | |
| "entry": "computeLists", | |
| "on": { | |
| "": [ | |
| { | |
| "target": "SelectionComplete", | |
| "cond": "isSelectionComplete", | |
| "actions": "sendSelectionComplete" | |
| }, | |
| { | |
| "target": "SelectionIncomplete" | |
| } | |
| ] | |
| } | |
| }, | |
| "SelectionIncomplete": { | |
| "entry": [ | |
| "clearQuery", | |
| "clearTypings", | |
| "sendSelectionIncomplete", | |
| "sendEdited" | |
| ] | |
| }, | |
| "SelectionComplete": { | |
| "initial": "CheckingQuery", | |
| "entry": [ | |
| "computeTypings", | |
| "computeDefaultValues" | |
| ], | |
| "on": { | |
| "JSON_EDIT": { | |
| "target": "SelectionComplete.QueryReady", | |
| "actions": [ | |
| "setJSON" | |
| ] | |
| }, | |
| "QUERY_CHANGED": { | |
| "target": "SelectionComplete.CheckingQuery", | |
| "actions": [ | |
| "setQuery", | |
| "sendEdited", | |
| "sendFormChanged" | |
| ] | |
| }, | |
| "TREE_CHANGED": { | |
| "target": "#Inactive", | |
| "actions": "sendFormChanged" | |
| } | |
| }, | |
| "states": { | |
| "Inactive": { | |
| "id": "Inactive", | |
| "on": { | |
| "ACTIVATED": "CheckingQuery" | |
| } | |
| }, | |
| "CheckingQuery": { | |
| "id": "CheckingQuery", | |
| "entry": "computeRequest", | |
| "on": { | |
| "": [ | |
| { | |
| "target": "QueryReady", | |
| "cond": "isQueryReady" | |
| }, | |
| { | |
| "target": "QueryNotReady" | |
| } | |
| ] | |
| } | |
| }, | |
| "QueryNotReady": { | |
| "id": "QueryNotReady" | |
| }, | |
| "QueryReady": { | |
| "id": "QueryReady", | |
| "initial": "CheckMatching", | |
| "exit": "setNotReadyStatus", | |
| "states": { | |
| "CheckMatching": { | |
| "on": { | |
| "": [ | |
| { | |
| "target": "Matching", | |
| "cond": "isMatching" | |
| }, | |
| { | |
| "target": "Dirty" | |
| } | |
| ] | |
| } | |
| }, | |
| "Matching": { | |
| "id": "Matching", | |
| "entry": "setMatchingStatus" | |
| }, | |
| "Dirty": { | |
| "id": "Dirty", | |
| "initial": "Idle", | |
| "on": { | |
| "QUERY_EXECUTED": { | |
| "target": "Dirty.CheckingCache" | |
| } | |
| }, | |
| "states": { | |
| "Idle": { | |
| "on": { | |
| "": [ | |
| { | |
| "target": "CheckingCache", | |
| "cond": "isAutoExecute" | |
| } | |
| ] | |
| } | |
| }, | |
| "CheckingCache": { | |
| "entry": [ | |
| "computeCacheKey", | |
| "sendCommitted" | |
| ], | |
| "on": { | |
| "": [ | |
| { | |
| "target": "#Matching", | |
| "cond": "isInCache", | |
| "actions": [ | |
| "loadFromCache", | |
| "setMatchingStatus" | |
| ] | |
| }, | |
| { | |
| "target": "Pending" | |
| } | |
| ] | |
| } | |
| }, | |
| "Pending": { | |
| "entry": "setPendingStatus", | |
| "invoke": { | |
| "id": "Pending", | |
| "src": "apiRequest", | |
| "onDone": { | |
| "target": "#Matching", | |
| "actions": [ | |
| "storeInCache", | |
| "setResponse" | |
| ] | |
| }, | |
| "onError": { | |
| "target": "#Error" | |
| } | |
| } | |
| }, | |
| "Error": { | |
| "id": "Error", | |
| "entry": [ | |
| "setErrorResponse", | |
| "setErrorStatus" | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "Stopped": { | |
| "type": "final" | |
| } | |
| }, | |
| "context": { | |
| "autoExecute": false, | |
| "cached": false, | |
| "hideDisabledAxes": true, | |
| "hideDisabledAggs": false, | |
| "hideDisabledDatasets": false, | |
| "hideDisabledItems": true, | |
| "matching": false, | |
| "selectionComplete": false, | |
| "showFullResponse": false, | |
| "queryReady": false | |
| } | |
| }, { | |
| "actions": { | |
| "toggleAutoExecute": { | |
| "type": "xstate.assign", | |
| "assignment": { | |
| "autoExecute": ctx => !ctx.autoExecute | |
| } | |
| }, | |
| "toggleCached": { | |
| "type": "xstate.assign", | |
| "assignment": { | |
| "cached": ctx => !ctx.cached | |
| } | |
| }, | |
| "toggleHideDisabledAxes": { | |
| "type": "xstate.assign", | |
| "assignment": { | |
| "hideDisabledAxes": ctx => !ctx.hideDisabledAxes | |
| } | |
| }, | |
| "toggleHideDisabledAggs": { | |
| "type": "xstate.assign", | |
| "assignment": { | |
| "hideDisabledAggs": ctx => !ctx.hideDisabledAggs | |
| } | |
| }, | |
| "toggleHideDisabledDatasets": { | |
| "type": "xstate.assign", | |
| "assignment": { | |
| "hideDisabledDatasets": ctx => !ctx.hideDisabledDatasets | |
| } | |
| }, | |
| "toggleHideDisabledItems": { | |
| "type": "xstate.assign", | |
| "assignment": { | |
| "hideDisabledItems": ctx => !ctx.hideDisabledItems | |
| } | |
| }, | |
| "toggleShowFullResponse": { | |
| "type": "xstate.assign", | |
| "assignment": { | |
| "showFullResponse": ctx => !ctx.showFullResponse | |
| } | |
| }, | |
| "toggleMatching": { | |
| "type": "xstate.assign", | |
| "assignment": { | |
| "matching": ctx => !ctx.matching | |
| } | |
| }, | |
| "toggleSelectionComplete": { | |
| "type": "xstate.assign", | |
| "assignment": { | |
| "selectionComplete": ctx => !ctx.selectionComplete | |
| } | |
| }, | |
| "toggleQueryReady": { | |
| "type": "xstate.assign", | |
| "assignment": { | |
| "queryReady": ctx => !ctx.queryReady | |
| } | |
| } | |
| }, | |
| "guards": { | |
| "isAutoExecute": ctx => ctx.autoExecute, | |
| "isInCache": ctx => ctx.cached, | |
| "isMatching": ctx => ctx.matching, | |
| "isSelectionComplete": ctx => ctx.selectionComplete, | |
| "isQueryReady": ctx => ctx.queryReady | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment