From 2bf34e9ff5f5ac4baf2db33fed2686a5a53a75c9 Mon Sep 17 00:00:00 2001 From: Edmond Lee Date: Thu, 21 May 2020 15:50:10 -0700 Subject: [PATCH] updating generate command to generate deploy script --- .../components/configure/configure-tab.tsx | 6 ++--- .../configure/generate-deploy-script-pane.tsx | 18 +++++++-------- .../src/components/output/output-tab.tsx | 2 +- .../redux/actions/generate-deploy-script.ts | 20 ++++++++--------- tools/webide/packages/client/src/redux/app.ts | 6 ++--- .../client/src/redux/generate-command.ts | 22 +++++++++---------- .../webide/packages/client/src/redux/types.ts | 2 +- 7 files changed, 38 insertions(+), 38 deletions(-) diff --git a/tools/webide/packages/client/src/components/configure/configure-tab.tsx b/tools/webide/packages/client/src/components/configure/configure-tab.tsx index 4ec2bb5a9..138b04fab 100644 --- a/tools/webide/packages/client/src/components/configure/configure-tab.tsx +++ b/tools/webide/packages/client/src/components/configure/configure-tab.tsx @@ -76,7 +76,7 @@ function createAction(command: Command) { return new EvaluateValueAction(); case Command.EvaluateFunction: return new EvaluateFunctionAction(); - case Command.GenerateCommand: + case Command.GenerateDeployScript: return new GenerateDeployScript(); default: throw new Error('Unsupported command'); @@ -113,7 +113,7 @@ export const ConfigureTabComponent = (props: { - + )) || - (command === Command.GenerateCommand && ( + (command === Command.GenerateDeployScript && ( ))} diff --git a/tools/webide/packages/client/src/components/configure/generate-deploy-script-pane.tsx b/tools/webide/packages/client/src/components/configure/generate-deploy-script-pane.tsx index ffd9d9575..929e7acf7 100644 --- a/tools/webide/packages/client/src/components/configure/generate-deploy-script-pane.tsx +++ b/tools/webide/packages/client/src/components/configure/generate-deploy-script-pane.tsx @@ -8,7 +8,7 @@ import { ChangeEntrypointAction, ChangeStorageAction, ChangeToolAction, - GenerateCommandState, + GenerateDeployScriptState, } from '../../redux/generate-command'; import { Tool, ToolCommand } from '../../redux/types'; import { AccessFunctionLabel, Group, Input, Label, Textarea } from '../form/inputs'; @@ -21,20 +21,20 @@ const Container = styled.div` export const GenerateDeployScriptPane = () => { const dispatch = useDispatch(); - const tool = useSelector( - state => state.generateCommand.tool + const tool = useSelector( + state => state.generateDeployScript.tool ); - const command = useSelector( - state => state.generateCommand.command + const command = useSelector( + state => state.generateDeployScript.command ); - const entrypoint = useSelector( - state => state.generateCommand.entrypoint + const entrypoint = useSelector( + state => state.generateDeployScript.entrypoint ); - const storage = useSelector( - state => state.generateCommand.storage + const storage = useSelector( + state => state.generateDeployScript.storage ); return ( diff --git a/tools/webide/packages/client/src/components/output/output-tab.tsx b/tools/webide/packages/client/src/components/output/output-tab.tsx index 9f365b9a1..1c7122d9c 100644 --- a/tools/webide/packages/client/src/components/output/output-tab.tsx +++ b/tools/webide/packages/client/src/components/output/output-tab.tsx @@ -55,7 +55,7 @@ export const OutputTab = (props: { return ; } else if (command === Command.Deploy) { return ; - } else if (command === Command.GenerateCommand) { + } else if (command === Command.GenerateDeployScript) { return ; } diff --git a/tools/webide/packages/client/src/redux/actions/generate-deploy-script.ts b/tools/webide/packages/client/src/redux/actions/generate-deploy-script.ts index bc4fe5fd3..049cbd1a0 100644 --- a/tools/webide/packages/client/src/redux/actions/generate-deploy-script.ts +++ b/tools/webide/packages/client/src/redux/actions/generate-deploy-script.ts @@ -28,19 +28,19 @@ export class GenerateDeployScript extends CancellableAction { dispatch({ ...new UpdateLoadingAction('Compiling contract...') }); try { - const { editor, generateCommand } = getState(); + const { editor, generateDeployScript } = getState(); const michelsonCodeJson = await compileContract( editor.language, editor.code, - generateCommand.entrypoint, + generateDeployScript.entrypoint, MichelsonFormat.Json ); const michelsonCode = await compileContract( editor.language, editor.code, - generateCommand.entrypoint + generateDeployScript.entrypoint ); if (this.isCancelled()) { @@ -51,16 +51,16 @@ export class GenerateDeployScript extends CancellableAction { const michelsonStorageJson = await compileStorage( editor.language, editor.code, - generateCommand.entrypoint, - generateCommand.storage, + generateDeployScript.entrypoint, + generateDeployScript.storage, MichelsonFormat.Json ); const michelsonStorage = await compileStorage( editor.language, editor.code, - generateCommand.entrypoint, - generateCommand.storage + generateDeployScript.entrypoint, + generateDeployScript.storage ); if (this.isCancelled()) { @@ -82,7 +82,7 @@ export class GenerateDeployScript extends CancellableAction { const title = slugify(editor.title).toLowerCase() || 'untitled'; const output = `tezos-client \\ - ${generateCommand.command} \\ + ${generateDeployScript.command} \\ contract \\ ${title} \\ transferring 0 \\ @@ -92,7 +92,7 @@ export class GenerateDeployScript extends CancellableAction { --burn-cap ${estimate.burnFeeMutez / 1000000}`; dispatch({ - ...new ChangeOutputAction(output, Command.GenerateCommand) + ...new ChangeOutputAction(output, Command.GenerateDeployScript) }); } catch (ex) { if (this.isCancelled()) { @@ -101,7 +101,7 @@ export class GenerateDeployScript extends CancellableAction { dispatch({ ...new ChangeOutputAction( `Error: ${getErrorMessage(ex)}`, - Command.GenerateCommand + Command.GenerateDeployScript ) }); } diff --git a/tools/webide/packages/client/src/redux/app.ts b/tools/webide/packages/client/src/redux/app.ts index 33ec56a65..ff4ed423d 100644 --- a/tools/webide/packages/client/src/redux/app.ts +++ b/tools/webide/packages/client/src/redux/app.ts @@ -8,7 +8,7 @@ import editor, { EditorState } from './editor'; import evaluateFunction, { EvaluateFunctionState } from './evaluate-function'; import evaluateValue, { EvaluateValueState } from './evaluate-value'; import examples, { ExamplesState } from './examples'; -import generateCommand, { GenerateCommandState } from './generate-command'; +import generateDeployScript, { GenerateDeployScriptState } from './generate-command'; import loading, { LoadingState } from './loading'; import result, { ResultState } from './result'; import share, { ShareState } from './share'; @@ -23,7 +23,7 @@ export interface AppState { deploy: DeployState; evaluateFunction: EvaluateFunctionState; evaluateValue: EvaluateValueState; - generateCommand: GenerateCommandState; + generateDeployScript: GenerateDeployScriptState; result: ResultState; command: CommandState; examples: ExamplesState; @@ -38,7 +38,7 @@ export default combineReducers({ deploy, evaluateFunction, evaluateValue, - generateCommand, + generateDeployScript, result, command, examples, diff --git a/tools/webide/packages/client/src/redux/generate-command.ts b/tools/webide/packages/client/src/redux/generate-command.ts index dadd00163..0bbf7168a 100644 --- a/tools/webide/packages/client/src/redux/generate-command.ts +++ b/tools/webide/packages/client/src/redux/generate-command.ts @@ -1,13 +1,13 @@ import { Tool, ToolCommand } from './types'; export enum ActionType { - ChangeTool = 'generate-command-change-tool', - ChangeCommand = 'generate-command-change-command', - ChangeEntrypoint = 'generate-command-change-entrypoint', - ChangeStorage = 'generate-command-change-storage' + ChangeTool = 'generate-deploy-script-change-tool', + ChangeCommand = 'generate-deploy-script-change-command', + ChangeEntrypoint = 'generate-deploy-script-change-entrypoint', + ChangeStorage = 'generate-deploy-script-change-storage' } -export interface GenerateCommandState { +export interface GenerateDeployScriptState { tool: Tool; command: ToolCommand; entrypoint: string; @@ -18,22 +18,22 @@ export interface GenerateCommandState { export class ChangeToolAction { public readonly type = ActionType.ChangeTool; - constructor(public payload: GenerateCommandState['tool']) {} + constructor(public payload: GenerateDeployScriptState['tool']) {} } export class ChangeCommandAction { public readonly type = ActionType.ChangeCommand; - constructor(public payload: GenerateCommandState['command']) {} + constructor(public payload: GenerateDeployScriptState['command']) {} } export class ChangeEntrypointAction { public readonly type = ActionType.ChangeEntrypoint; - constructor(public payload: GenerateCommandState['entrypoint']) {} + constructor(public payload: GenerateDeployScriptState['entrypoint']) {} } export class ChangeStorageAction { public readonly type = ActionType.ChangeStorage; - constructor(public payload: GenerateCommandState['storage']) {} + constructor(public payload: GenerateDeployScriptState['storage']) {} } type Action = @@ -42,7 +42,7 @@ type Action = | ChangeEntrypointAction | ChangeStorageAction; -const DEFAULT_STATE: GenerateCommandState = { +const DEFAULT_STATE: GenerateDeployScriptState = { tool: Tool.TezosClient, command: ToolCommand.Originate, entrypoint: '', @@ -54,7 +54,7 @@ const DEFAULT_STATE: GenerateCommandState = { export default ( state = DEFAULT_STATE, action: Action -): GenerateCommandState => { +): GenerateDeployScriptState => { switch (action.type) { case ActionType.ChangeTool: return { diff --git a/tools/webide/packages/client/src/redux/types.ts b/tools/webide/packages/client/src/redux/types.ts index 3aab55c08..90700cb15 100644 --- a/tools/webide/packages/client/src/redux/types.ts +++ b/tools/webide/packages/client/src/redux/types.ts @@ -10,7 +10,7 @@ export enum Command { EvaluateValue = 'evaluate-value', EvaluateFunction = 'evaluate-function', Deploy = 'deploy', - GenerateCommand = 'generate-command' + GenerateDeployScript = 'generate-deploy-script' } export enum Tool {