update example.ts, generate-deploy-script.ts, and load-state.ts to support default generateDeployScript values for examples
This commit is contained in:
parent
b9ee504dd6
commit
11f1cf01ee
@ -4,6 +4,8 @@ import { DryRunState } from './dry-run';
|
|||||||
import { EditorState } from './editor';
|
import { EditorState } from './editor';
|
||||||
import { EvaluateFunctionState } from './evaluate-function';
|
import { EvaluateFunctionState } from './evaluate-function';
|
||||||
import { EvaluateValueState } from './evaluate-value';
|
import { EvaluateValueState } from './evaluate-value';
|
||||||
|
import { GenerateDeployScriptState } from './generate-deploy-script';
|
||||||
|
|
||||||
|
|
||||||
export interface ExampleState {
|
export interface ExampleState {
|
||||||
id: string;
|
id: string;
|
||||||
@ -14,4 +16,5 @@ export interface ExampleState {
|
|||||||
deploy: DeployState;
|
deploy: DeployState;
|
||||||
evaluateFunction: EvaluateFunctionState;
|
evaluateFunction: EvaluateFunctionState;
|
||||||
evaluateValue: EvaluateValueState;
|
evaluateValue: EvaluateValueState;
|
||||||
|
generateDeployScript: GenerateDeployScriptState;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { ActionType as ExamplesActionType, ChangeSelectedAction as ChangeSelectedExampleAction } from './examples';
|
||||||
import { Tool, ToolCommand } from './types';
|
import { Tool, ToolCommand } from './types';
|
||||||
|
|
||||||
export enum ActionType {
|
export enum ActionType {
|
||||||
@ -40,7 +41,8 @@ type Action =
|
|||||||
| ChangeToolAction
|
| ChangeToolAction
|
||||||
| ChangeCommandAction
|
| ChangeCommandAction
|
||||||
| ChangeEntrypointAction
|
| ChangeEntrypointAction
|
||||||
| ChangeStorageAction;
|
| ChangeStorageAction
|
||||||
|
| ChangeSelectedExampleAction;
|
||||||
|
|
||||||
const DEFAULT_STATE: GenerateDeployScriptState = {
|
const DEFAULT_STATE: GenerateDeployScriptState = {
|
||||||
tool: Tool.TezosClient,
|
tool: Tool.TezosClient,
|
||||||
@ -56,6 +58,11 @@ export default (
|
|||||||
action: Action
|
action: Action
|
||||||
): GenerateDeployScriptState => {
|
): GenerateDeployScriptState => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
case ExamplesActionType.ChangeSelected:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
...(!action.payload ? DEFAULT_STATE : action.payload.generateDeployScript)
|
||||||
|
};
|
||||||
case ActionType.ChangeTool:
|
case ActionType.ChangeTool:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
@ -28,6 +28,7 @@ export async function loadDefaultState(appBundleDirectory: string) {
|
|||||||
deploy: {},
|
deploy: {},
|
||||||
evaluateValue: {},
|
evaluateValue: {},
|
||||||
evaluateFunction: {},
|
evaluateFunction: {},
|
||||||
|
generateDeployScript: {},
|
||||||
editor: {
|
editor: {
|
||||||
title: ''
|
title: ''
|
||||||
},
|
},
|
||||||
@ -63,6 +64,10 @@ export async function loadDefaultState(appBundleDirectory: string) {
|
|||||||
...defaultState.evaluateFunction,
|
...defaultState.evaluateFunction,
|
||||||
...defaultExample.evaluateFunction
|
...defaultExample.evaluateFunction
|
||||||
};
|
};
|
||||||
|
defaultState.generateDeployScript = {
|
||||||
|
...defaultState.generateDeployScript,
|
||||||
|
...defaultExample.generateDeployScript
|
||||||
|
};
|
||||||
defaultState.editor = {
|
defaultState.editor = {
|
||||||
...defaultState.editor,
|
...defaultState.editor,
|
||||||
...defaultExample.editor,
|
...defaultExample.editor,
|
||||||
|
Loading…
Reference in New Issue
Block a user