diff --git a/src/app/ui-helper.js b/src/app/ui-helper.js index 9d0f62310a..29a64a745f 100644 --- a/src/app/ui-helper.js +++ b/src/app/ui-helper.js @@ -21,6 +21,13 @@ module.exports = { cls); }, + preRow: function (description, data) { + return this.tableRowItems( + $('').text(description), + $('
').text(data) + ); + }, + formatAssemblyText: function (asm, prefix, source) { var self = this; if (typeof asm === typeof '' || asm === null || asm === undefined) { @@ -96,7 +103,11 @@ module.exports = { if (data.creation === undefined && data.external === undefined && data.internal === undefined) { return; } - var gasToText = function (g) { return g === null ? 'unknown' : g; }; + + var gasToText = function (g) { + return g === null ? 'unknown' : g; + }; + var text = ''; var fun; if ('creation' in data) { @@ -125,35 +136,34 @@ module.exports = { var details = $('') .append(this.tableRow('Solidity Interface', contract.solidity_interface)); - if (contract.opcodes !== '') { - details.append(this.tableRow('Opcodes', contract.opcodes)); - } - var funHashes = ''; for (var fun in contract.functionHashes) { funHashes += contract.functionHashes[fun] + ' ' + fun + '\n'; } - details.append($('Functions')); - details.append($('').text(funHashes)); + details.append(this.preRow('Functions', funHashes)); var gasEstimates = this.formatGasEstimates(contract.gasEstimates); if (gasEstimates) { - details.append($('Gas Estimates')); - details.append($('').text(gasEstimates)); + details.append(this.preRow('Gas Estimates', gasEstimates)); } if (contract.runtimeBytecode && contract.runtimeBytecode.length > 0) { details.append(this.tableRow('Runtime Bytecode', contract.runtimeBytecode)); } + if (contract.opcodes !== undefined && contract.opcodes !== '') { + details.append(this.tableRow('Opcodes', contract.opcodes)); + } + if (contract.assembly !== null) { - details.append($('Assembly')); - var assembly = $('').text(this.formatAssemblyText(contract.assembly, '', source)); - details.append(assembly); + details.append(this.preRow('Assembly', this.formatAssemblyText(contract.assembly, '', source))); } var self = this; - button.click(function () { self.detailsOpen[contractName] = !self.detailsOpen[contractName]; details.toggle(); }); + button.click(function () { + self.detailsOpen[contractName] = !self.detailsOpen[contractName]; + details.toggle(); + }); if (this.detailsOpen[contractName]) { details.show(); }