feat(cockpit/contracts): don't display contracts marked as silent

This commit is contained in:
Jonathan Rainville 2019-03-01 09:19:24 -05:00
parent d80641c4e1
commit 0e63d6bcf9
4 changed files with 13 additions and 1 deletions

View File

@ -204,6 +204,9 @@ const filterContractFunctions = (contractFunctions, contractName, method) => {
const ContractOverview = (props) => {
const {contractProfile, contract} = props;
const contractDisplay = formatContractForDisplay(contract);
if (!contractDisplay) {
return '';
}
return (
<div>

View File

@ -17,6 +17,9 @@ const Contracts = ({contracts, title = "Contracts"}) => (
{
contracts.map((contract, key) => {
const contractDisplay = formatContractForDisplay(contract);
if (!contractDisplay) {
return '';
}
return (
<div className="explorer-row border-top" key={`contract-${key}`}>
@ -31,7 +34,7 @@ const Contracts = ({contracts, title = "Contracts"}) => (
<Col>
<strong>State</strong>
<div className={contractDisplay.stateColor}>
{formatContractForDisplay(contract).state}
{contractDisplay.state}
</div>
</Col>
</Row>

View File

@ -17,6 +17,9 @@ const ContractsList = ({contracts}) => (
{
contracts.map((contract) => {
const contractDisplay = formatContractForDisplay(contract);
if (!contractDisplay) {
return '';
}
return (
<tr key={contract.className} className={contractDisplay.stateColor}>
<td><Link to={`/explorer/contracts/${contract.className}`}>{contract.className}</Link></td>

View File

@ -1,4 +1,7 @@
export function formatContractForDisplay(contract) {
if (contract.silent) {
return;
}
let address = (contract.address || contract.deployedAddress);
let state = 'Deployed';
let stateColor = 'success';