display pending transaction count in terminal

pull/3094/head
yann300 6 years ago
parent 217613d52d
commit c8e13fa472
  1. 14
      src/app/panels/editor-panel.js
  2. 11
      src/app/panels/terminal.js
  3. 4
      src/universal-dapp.js

@ -26,7 +26,8 @@ class EditorPanel {
self._deps = {
config: self._components.registry.get('config').api,
txlistener: self._components.registry.get('txlistener').api,
fileManager: self._components.registry.get('filemanager').api
fileManager: self._components.registry.get('filemanager').api,
udapp: self._components.registry.get('udapp').api
}
self.data = {
_FILE_SCROLL_DELTA: 200,
@ -46,9 +47,11 @@ class EditorPanel {
contextualListener: contextualListener,
contextView: new ContextView({contextualListener: contextualListener, editor: editor}),
terminal: new Terminal({
api: {
cmdInterpreter: new CommandInterpreter(), // @TODO: put into editorpanel
getPosition (event) {
udapp: self._deps.udapp,
cmdInterpreter: new CommandInterpreter()
},
{
getPosition: (event) => {
var limitUp = 36
var limitDown = 20
var height = window.innerHeight
@ -56,8 +59,7 @@ class EditorPanel {
newpos = (newpos < height - limitDown) ? newpos : height - limitDown
return newpos
}
}
})
})
}
self._components.terminal.event.register('filterChanged', (type, value) => {

@ -24,9 +24,11 @@ function register (api) { KONSOLES.push(api) }
var ghostbar = yo`<div class=${css.ghostbar}></div>`
class Terminal {
constructor (opts = { auto: true }) {
constructor (opts, api) {
var self = this
self.event = new EventManager()
self._api = api
self._opts = opts
self.data = {
lineLength: opts.lineLength || 80,
session: [],
@ -72,7 +74,7 @@ class Terminal {
self.registerCommand('script', function execute (args, scopedCommands, append) {
var script = String(args[0])
scopedCommands.log(`> ${script}`)
if (self._api.cmdInterpreter && self._api.cmdInterpreter.interpret(script)) return
if (self._opts.cmdInterpreter && self.opts.cmdInterpreter.interpret(script)) return
self._shell(script, scopedCommands, function (error, output) {
if (error) scopedCommands.error(error)
else scopedCommands.log(output)
@ -110,7 +112,7 @@ class Terminal {
self._view.dragbar = yo`
<div onmousedown=${mousedown} class=${css.dragbarHorizontal}></div>`
self._view.dropdown = self._components.dropdown.render()
self._view.pendingTxCount = yo`<div class=${css.pendingTx} title='Pending Transactions'>${self._view.pendingTxCount}</div>`
self._view.pendingTxCount = yo`<div class=${css.pendingTx} title='Pending Transactions'>0</div>`
self._view.bar = yo`
<div class=${css.bar}>
${self._view.dragbar}
@ -134,6 +136,9 @@ class Terminal {
</div>
</div>
`
setInterval(() => {
self._view.pendingTxCount.innerHTML = self._opts.udapp.pendingTransactionsCount()
}, 1000)
function listenOnNetwork (ev) {
self.event.trigger('listenOnNetWork', [ev.currentTarget.checked])

@ -182,6 +182,10 @@ UniversalDApp.prototype.pendingTransactions = function () {
return this.txRunner.pendingTxs
}
UniversalDApp.prototype.pendingTransactionsCount = function () {
return Object.keys(this.txRunner.pendingTxs).length
}
UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly, outputCb) {
const self = this
var logMsg

Loading…
Cancel
Save