From 2f4625c143dde92fad3d2fb548da122255e0718f Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 6 Nov 2018 14:57:06 -0500 Subject: [PATCH 1/2] hide interfaces in contract deployment page --- embark-ui/src/components/ContractsDeployment.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/embark-ui/src/components/ContractsDeployment.js b/embark-ui/src/components/ContractsDeployment.js index 22f1ff915..766db7cb6 100644 --- a/embark-ui/src/components/ContractsDeployment.js +++ b/embark-ui/src/components/ContractsDeployment.js @@ -81,7 +81,7 @@ const DeploymentResult = ({deployment}) => { DeploymentResult.propTypes = { deployment: PropTypes.object -} +}; const GasEstimateResult = ({gasEstimate}) => { if (gasEstimate.running) { @@ -249,6 +249,9 @@ ContractsHeader.propTypes = { }; const Contract = ({web3, contract, deploymentPipeline, web3Deploy, web3EstimateGas, web3Deployments, web3GasEstimates, toggleContractOverview}) => { + if (!contract.code && !contract.deploy) { + return ; + } const deployment = web3Deployments[contract.className]; const gasEstimate = web3GasEstimates[contract.className]; switch (deploymentPipeline) { @@ -262,7 +265,7 @@ const Contract = ({web3, contract, deploymentPipeline, web3Deploy, web3EstimateG web3Deploy={web3Deploy} web3EstimateGas={web3EstimateGas}/>; default: - return ; + return ; } }; From 24e3da65b259e2a0f0b63a7f19e7dc148c040dd6 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 6 Nov 2018 15:55:57 -0500 Subject: [PATCH 2/2] fix proptypes warnings and fix indexes --- .../src/components/ContractsDeployment.js | 40 ++++++++++++------- .../src/containers/DeploymentContainer.js | 5 ++- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/embark-ui/src/components/ContractsDeployment.js b/embark-ui/src/components/ContractsDeployment.js index 766db7cb6..1a33ec3aa 100644 --- a/embark-ui/src/components/ContractsDeployment.js +++ b/embark-ui/src/components/ContractsDeployment.js @@ -42,7 +42,7 @@ const LayoutContract = ({contract, children, cardTitle}) => ( - {contract.index + 1} + {contract.deployIndex + 1} {cardTitle} @@ -55,7 +55,7 @@ const LayoutContract = ({contract, children, cardTitle}) => ( LayoutContract.propTypes = { contract: PropTypes.object, children: PropTypes.array, - cardTitle: PropTypes.string + cardTitle: PropTypes.object }; const DeploymentResult = ({deployment}) => { @@ -244,14 +244,14 @@ const ContractsHeader = ({deploymentPipeline, updateDeploymentPipeline}) => ( ); ContractsHeader.propTypes = { - deploymentPipeline: PropTypes.object, + deploymentPipeline: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.string + ]), updateDeploymentPipeline: PropTypes.func }; const Contract = ({web3, contract, deploymentPipeline, web3Deploy, web3EstimateGas, web3Deployments, web3GasEstimates, toggleContractOverview}) => { - if (!contract.code && !contract.deploy) { - return ; - } const deployment = web3Deployments[contract.className]; const gasEstimate = web3GasEstimates[contract.className]; switch (deploymentPipeline) { @@ -271,7 +271,10 @@ const Contract = ({web3, contract, deploymentPipeline, web3Deploy, web3EstimateG Contract.propTypes = { contract: PropTypes.object, - deploymentPipeline: PropTypes.object, + deploymentPipeline: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.string + ]), toggleContractOverview: PropTypes.func, web3: PropTypes.object, web3Deploy: PropTypes.func, @@ -302,13 +305,16 @@ class ContractsDeployment extends React.Component { - {this.props.contracts.sort((a, b) => a.index - b.index).map(contract => ( - this.toggleContractOverview(contract)} - {...this.props} /> - ))} + updateDeploymentPipeline={this.props.updateDeploymentPipeline}/> + {this.props.contracts.filter(contract => contract.code || contract.deploy) + .sort((a, b) => a.index - b.index).map((contract, index) => { + contract.deployIndex = index; + return ( this.toggleContractOverview(contract)} + {...this.props} />); + } + )} {this.isContractOverviewOpen() && @@ -325,9 +331,13 @@ class ContractsDeployment extends React.Component { } } + ContractsDeployment.propTypes = { contracts: PropTypes.array, - deploymentPipeline: PropTypes.string, + deploymentPipeline: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.string + ]), updateDeploymentPipeline: PropTypes.func, web3Deployments: PropTypes.object, web3GasEstimates: PropTypes.object, diff --git a/embark-ui/src/containers/DeploymentContainer.js b/embark-ui/src/containers/DeploymentContainer.js index ce7c18eea..8fbee6988 100644 --- a/embark-ui/src/containers/DeploymentContainer.js +++ b/embark-ui/src/containers/DeploymentContainer.js @@ -46,7 +46,10 @@ function mapStateToProps(state) { DeploymentContainer.propTypes = { contracts: PropTypes.array, - deploymentPipeline: PropTypes.object, + deploymentPipeline: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.string + ]), fetchContracts: PropTypes.func, updateDeploymentPipeline: PropTypes.func, web3: PropTypes.object,