37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
import { helpHandler } from "../button/support.js"
|
|
|
|
export const WorkflowState = {
|
|
INCORRECT_START_NODE: "Delete me and click\n'Generate'! Woof!",
|
|
INSUFFICIENT_CREDITS: "Borked.\nNot enough credits to\nrun another workflow.\nPress 'Account' to top up. ",
|
|
IDLE: "No workflows running.\nLet's generate something! Woof.",
|
|
CREATING: "Creating new workflow.\nThis may take a while. Woof.",
|
|
SYNCING: "Syncing dependencies to the cloud.\nWoof.",
|
|
UPDATING: "Updating workflows with the cloud.\nWoof.",
|
|
PROCESSING: "Processing workflow for execution.\nClick 'View Results' to see its progress.",
|
|
RUNNING: "Workflow's running.\nLet's get a coffeee. Woof.",
|
|
FINISHED: "Workflow's done,\nlet's have a peep!",
|
|
};
|
|
|
|
class State {
|
|
constructor() {
|
|
if (!State.instance) {
|
|
this.state = {workflowState: WorkflowState.IDLE};
|
|
State.instance = this;
|
|
}
|
|
return State.instance;
|
|
}
|
|
|
|
getState(key) {
|
|
helpHandler("assistant")
|
|
return this.state[key];
|
|
}
|
|
|
|
setState(key, value) {
|
|
this.state[key] = value;
|
|
}
|
|
}
|
|
|
|
const instance = new State();
|
|
Object.freeze(instance);
|
|
|
|
export default instance; |