|
|
@ -143,20 +143,14 @@ class Terminal { |
|
|
|
dependencies: {'all transactions': ['only remix transactions'], 'only remix transactions': ['all transactions']} |
|
|
|
dependencies: {'all transactions': ['only remix transactions'], 'only remix transactions': ['all transactions']} |
|
|
|
}) |
|
|
|
}) |
|
|
|
self._components.dropdown.event.register('deselect', function (label) { |
|
|
|
self._components.dropdown.event.register('deselect', function (label) { |
|
|
|
if (label === 'only remix transactions') { |
|
|
|
self.event.trigger('filterChanged', ['deselect', label]) |
|
|
|
self.updateJournal({ type: 'select', value: 'unknownTransaction' }) |
|
|
|
if (label === 'script') { |
|
|
|
} else if (label === 'all transactions') { |
|
|
|
|
|
|
|
self.updateJournal({ type: 'deselect', value: 'unknownTransaction' }) |
|
|
|
|
|
|
|
} else { // script
|
|
|
|
|
|
|
|
self.updateJournal({ type: 'deselect', value: label }) |
|
|
|
self.updateJournal({ type: 'deselect', value: label }) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
self._components.dropdown.event.register('select', function (label) { |
|
|
|
self._components.dropdown.event.register('select', function (label) { |
|
|
|
if (label === 'only remix transactions') { |
|
|
|
self.event.trigger('filterChanged', ['select', label]) |
|
|
|
self.updateJournal({ type: 'deselect', value: 'unknownTransaction' }) |
|
|
|
if (label === 'script') { |
|
|
|
} else if (label === 'all transactions') { |
|
|
|
|
|
|
|
self.updateJournal({ type: 'select', value: 'unknownTransaction' }) |
|
|
|
|
|
|
|
} else { // script
|
|
|
|
|
|
|
|
self.updateJournal({ type: 'select', value: label }) |
|
|
|
self.updateJournal({ type: 'select', value: label }) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -171,10 +165,10 @@ class Terminal { |
|
|
|
self._INDEX.commandsMain = {} |
|
|
|
self._INDEX.commandsMain = {} |
|
|
|
self.registerCommand('banner', function (args, scopedCommands, append) { |
|
|
|
self.registerCommand('banner', function (args, scopedCommands, append) { |
|
|
|
append(args[0]) |
|
|
|
append(args[0]) |
|
|
|
}) |
|
|
|
}, { activate: true }) |
|
|
|
self.registerCommand('log', self._blocksRenderer('log')) |
|
|
|
self.registerCommand('log', self._blocksRenderer('log'), { activate: true }) |
|
|
|
self.registerCommand('info', self._blocksRenderer('info')) |
|
|
|
self.registerCommand('info', self._blocksRenderer('info'), { activate: true }) |
|
|
|
self.registerCommand('error', self._blocksRenderer('error')) |
|
|
|
self.registerCommand('error', self._blocksRenderer('error'), { activate: true }) |
|
|
|
self.registerCommand('script', function execute (args, scopedCommands, append) { |
|
|
|
self.registerCommand('script', function execute (args, scopedCommands, append) { |
|
|
|
var script = String(args[0]) |
|
|
|
var script = String(args[0]) |
|
|
|
scopedCommands.log(`> ${script}`) |
|
|
|
scopedCommands.log(`> ${script}`) |
|
|
@ -182,12 +176,11 @@ class Terminal { |
|
|
|
if (error) scopedCommands.error(error) |
|
|
|
if (error) scopedCommands.error(error) |
|
|
|
else scopedCommands.log(output) |
|
|
|
else scopedCommands.log(output) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, { activate: true }) |
|
|
|
self._jsSandboxContext = {} |
|
|
|
self._jsSandboxContext = {} |
|
|
|
self._jsSandbox = vm.createContext(self._jsSandboxContext) |
|
|
|
self._jsSandbox = vm.createContext(self._jsSandboxContext) |
|
|
|
if (opts.shell) self._shell = opts.shell |
|
|
|
if (opts.shell) self._shell = opts.shell |
|
|
|
register(self) |
|
|
|
register(self) |
|
|
|
self.updateJournal({ type: 'select', value: 'knownTransaction' }) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
render () { |
|
|
|
render () { |
|
|
|
var self = this |
|
|
|
var self = this |
|
|
@ -545,7 +538,7 @@ class Terminal { |
|
|
|
}) |
|
|
|
}) |
|
|
|
return scopedCommands |
|
|
|
return scopedCommands |
|
|
|
} |
|
|
|
} |
|
|
|
registerCommand (name, command) { |
|
|
|
registerCommand (name, command, opts) { |
|
|
|
var self = this |
|
|
|
var self = this |
|
|
|
name = String(name) |
|
|
|
name = String(name) |
|
|
|
if (self._commands[name]) throw new Error(`command "${name}" exists already`) |
|
|
|
if (self._commands[name]) throw new Error(`command "${name}" exists already`) |
|
|
@ -584,6 +577,7 @@ class Terminal { |
|
|
|
].join('\n') |
|
|
|
].join('\n') |
|
|
|
self.commands[name].toString = _ => { return help } |
|
|
|
self.commands[name].toString = _ => { return help } |
|
|
|
self.commands[name].help = help |
|
|
|
self.commands[name].help = help |
|
|
|
|
|
|
|
self.data.activeFilters.commands[name] = opts && opts.activate |
|
|
|
return self.commands[name] |
|
|
|
return self.commands[name] |
|
|
|
} |
|
|
|
} |
|
|
|
_shell (script, scopedCommands, done) { // default shell
|
|
|
|
_shell (script, scopedCommands, done) { // default shell
|
|
|
@ -616,6 +610,7 @@ function findDeep (object, fn, found = { break: false, value: undefined }) { |
|
|
|
for (var i in object) { |
|
|
|
for (var i in object) { |
|
|
|
if (found.break) break |
|
|
|
if (found.break) break |
|
|
|
var el = object[i] |
|
|
|
var el = object[i] |
|
|
|
|
|
|
|
if (el && el.innerText !== undefined && el.innerText !== null) el = el.innerText |
|
|
|
if (!fn(el, i, object)) findDeep(el, fn, found) |
|
|
|
if (!fn(el, i, object)) findDeep(el, fn, found) |
|
|
|
else if (found.break = true) return found.value = el // eslint-disable-line
|
|
|
|
else if (found.break = true) return found.value = el // eslint-disable-line
|
|
|
|
} |
|
|
|
} |
|
|
|