55 lines
766 B
JavaScript
55 lines
766 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
export default {
|
|
id: 'data-loader',
|
|
initial: 'load',
|
|
on: {
|
|
OPEN: {
|
|
target: 'load',
|
|
},
|
|
ERROR: {
|
|
target: 'disconnected',
|
|
},
|
|
LOAD: [
|
|
{
|
|
target: 'idle',
|
|
cond: 'loaded',
|
|
},
|
|
{
|
|
target: 'loading',
|
|
},
|
|
],
|
|
},
|
|
states: {
|
|
load: {},
|
|
loading: {
|
|
on: {
|
|
SUCCESS: {
|
|
target: 'idle',
|
|
},
|
|
ERROR: {
|
|
target: 'error',
|
|
},
|
|
},
|
|
},
|
|
idle: {},
|
|
error: {
|
|
on: {
|
|
RETRY: {
|
|
target: 'load',
|
|
},
|
|
},
|
|
},
|
|
disconnected: {
|
|
on: {
|
|
RETRY: {
|
|
target: 'load',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|