Simplify the contract details renderer

pull/1/head
Alex Beregszaszi 8 years ago
parent 1b2a5689a3
commit e190996dac
  1. 17
      src/app/ui-helper.js

@ -21,6 +21,13 @@ module.exports = {
cls); cls);
}, },
preRow: function (description, data) {
return this.tableRowItems(
$('<span/>').text(description),
$('<pre/>').text(data)
);
},
formatAssemblyText: function (asm, prefix, source) { formatAssemblyText: function (asm, prefix, source) {
var self = this; var self = this;
if (typeof asm === typeof '' || asm === null || asm === undefined) { if (typeof asm === typeof '' || asm === null || asm === undefined) {
@ -133,13 +140,11 @@ module.exports = {
for (var fun in contract.functionHashes) { for (var fun in contract.functionHashes) {
funHashes += contract.functionHashes[fun] + ' ' + fun + '\n'; funHashes += contract.functionHashes[fun] + ' ' + fun + '\n';
} }
details.append($('<span class="col1">Functions</span>')); details.append(this.preRow('Functions', funHashes));
details.append($('<pre/>').text(funHashes));
var gasEstimates = this.formatGasEstimates(contract.gasEstimates); var gasEstimates = this.formatGasEstimates(contract.gasEstimates);
if (gasEstimates) { if (gasEstimates) {
details.append($('<span class="col1">Gas Estimates</span>')); details.append(this.preRow('Gas Estimates', gasEstimates));
details.append($('<pre/>').text(gasEstimates));
} }
if (contract.runtimeBytecode && contract.runtimeBytecode.length > 0) { if (contract.runtimeBytecode && contract.runtimeBytecode.length > 0) {
@ -147,9 +152,7 @@ module.exports = {
} }
if (contract.assembly !== null) { if (contract.assembly !== null) {
details.append($('<span class="col1">Assembly</span>')); details.append(this.preRow('Assembly', this.formatAssemblyText(contract.assembly, '', source)));
var assembly = $('<pre/>').text(this.formatAssemblyText(contract.assembly, '', source));
details.append(assembly);
} }
var self = this; var self = this;

Loading…
Cancel
Save