|
|
@ -125,11 +125,9 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
scrollToBottom() |
|
|
|
scrollToBottom() |
|
|
|
console.log({ messagesEndRef: messagesEndRef.current }, ' onScroll') |
|
|
|
|
|
|
|
}, [newstate.journalBlocks.length, props.logHtml.length]) |
|
|
|
}, [newstate.journalBlocks.length, props.logHtml.length]) |
|
|
|
|
|
|
|
|
|
|
|
function execute (file, cb) { |
|
|
|
function execute (file, cb) { |
|
|
|
console.log('called execute scriptRunner') |
|
|
|
|
|
|
|
function _execute (content, cb) { |
|
|
|
function _execute (content, cb) { |
|
|
|
if (!content) { |
|
|
|
if (!content) { |
|
|
|
// toolTip('no content to execute')
|
|
|
|
// toolTip('no content to execute')
|
|
|
@ -231,22 +229,17 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const cmds = vm.createContext(context) |
|
|
|
const cmds = vm.createContext(context) |
|
|
|
const result = vm.runInContext(script, cmds) |
|
|
|
const result = vm.runInContext(script, cmds) |
|
|
|
console.log(done, ' done func') |
|
|
|
|
|
|
|
return done(null, result) |
|
|
|
return done(null, result) |
|
|
|
} catch (error) { |
|
|
|
} catch (error) { |
|
|
|
return done(error.message) |
|
|
|
return done(error.message) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
console.log(' remix command by david 2') |
|
|
|
|
|
|
|
let result: any |
|
|
|
let result: any |
|
|
|
if (script.trim().startsWith('git')) { |
|
|
|
if (script.trim().startsWith('git')) { |
|
|
|
// result = await this.call('git', 'execute', script)
|
|
|
|
// result = await this.call('git', 'execute', script)
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
console.log(' remix command by david 3') |
|
|
|
|
|
|
|
result = await props.thisState.call('scriptRunner', 'execute', script) |
|
|
|
result = await props.thisState.call('scriptRunner', 'execute', script) |
|
|
|
|
|
|
|
|
|
|
|
console.log({ result }, ' me ') |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
console.log({ result }) |
|
|
|
console.log({ result }) |
|
|
|
done() |
|
|
|
done() |
|
|
@ -314,7 +307,6 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
event.preventDefault() |
|
|
|
event.preventDefault() |
|
|
|
event.stopPropagation() |
|
|
|
event.stopPropagation() |
|
|
|
if (toggleDownUp === 'fa-angle-double-down') { |
|
|
|
if (toggleDownUp === 'fa-angle-double-down') { |
|
|
|
console.log('clikced down') |
|
|
|
|
|
|
|
setToggleDownUp('fa-angle-double-up') |
|
|
|
setToggleDownUp('fa-angle-double-up') |
|
|
|
props.event.trigger('resize', []) |
|
|
|
props.event.trigger('resize', []) |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -355,10 +347,8 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
if (autoCompletState.userInput.length === 1) { |
|
|
|
if (autoCompletState.userInput.length === 1) { |
|
|
|
setAutoCompleteState(prevState => ({ ...prevState, activeSuggestion: 0, showSuggestions: false, userInput: Object.keys(autoCompletState.data._options[0]).toString() })) |
|
|
|
setAutoCompleteState(prevState => ({ ...prevState, activeSuggestion: 0, showSuggestions: false, userInput: Object.keys(autoCompletState.data._options[0]).toString() })) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
console.log(autoCompletState.activeSuggestion, 'autoCompletState.userInput.length') |
|
|
|
|
|
|
|
setAutoCompleteState(prevState => ({ ...prevState, activeSuggestion: 0, showSuggestions: false, userInput: inputEl.current.value })) |
|
|
|
setAutoCompleteState(prevState => ({ ...prevState, activeSuggestion: 0, showSuggestions: false, userInput: inputEl.current.value })) |
|
|
|
} |
|
|
|
} |
|
|
|
console.log({ autoCompletState }, 'autoCompletState') |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (event.which === 13 && !autoCompletState.showSuggestions) { |
|
|
|
if (event.which === 13 && !autoCompletState.showSuggestions) { |
|
|
|
if (event.ctrlKey) { // <ctrl+enter>
|
|
|
|
if (event.ctrlKey) { // <ctrl+enter>
|
|
|
@ -379,10 +369,8 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
setAutoCompleteState(prevState => ({ ...prevState, showSuggestions: false })) |
|
|
|
setAutoCompleteState(prevState => ({ ...prevState, showSuggestions: false })) |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (newstate._commandHistory.length && event.which === 38 && !autoCompletState.showSuggestions && (autoCompletState.userInput === '')) { |
|
|
|
} else if (newstate._commandHistory.length && event.which === 38 && !autoCompletState.showSuggestions && (autoCompletState.userInput === '')) { |
|
|
|
console.log('previous command up') |
|
|
|
|
|
|
|
// if (autoCompletState.commandHistoryIndex < 1) {
|
|
|
|
// if (autoCompletState.commandHistoryIndex < 1) {
|
|
|
|
event.preventDefault() |
|
|
|
event.preventDefault() |
|
|
|
console.log(newstate._commandHistory[0], ' up value') |
|
|
|
|
|
|
|
setAutoCompleteState(prevState => ({ ...prevState, userInput: newstate._commandHistory[0] })) |
|
|
|
setAutoCompleteState(prevState => ({ ...prevState, userInput: newstate._commandHistory[0] })) |
|
|
|
} else if (event.which === 38 && autoCompletState.showSuggestions) { |
|
|
|
} else if (event.which === 38 && autoCompletState.showSuggestions) { |
|
|
|
event.preventDefault() |
|
|
|
event.preventDefault() |
|
|
@ -390,14 +378,12 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
setAutoCompleteState(prevState => ({ ...prevState, activeSuggestion: suggestionCount - 1, userInput: Object.keys(autoCompletState.data._options[autoCompletState.activeSuggestion]).toString() })) |
|
|
|
setAutoCompleteState(prevState => ({ ...prevState, activeSuggestion: suggestionCount - 1, userInput: Object.keys(autoCompletState.data._options[autoCompletState.activeSuggestion]).toString() })) |
|
|
|
console.log({ autoCompletState }, 'disable up an down key in input box') |
|
|
|
|
|
|
|
} else if (event.which === 38 && !autoCompletState.showSuggestions) { // <arrowUp>
|
|
|
|
} else if (event.which === 38 && !autoCompletState.showSuggestions) { // <arrowUp>
|
|
|
|
// const len = _cmdHistory.length
|
|
|
|
// const len = _cmdHistory.length
|
|
|
|
// if (len === 0) event.preventDefault()
|
|
|
|
// if (len === 0) event.preventDefault()
|
|
|
|
if (cmdHistory.length - 1 > _cmdIndex) { |
|
|
|
if (cmdHistory.length - 1 > _cmdIndex) { |
|
|
|
setCmdIndex(prevState => prevState++) |
|
|
|
setCmdIndex(prevState => prevState++) |
|
|
|
} |
|
|
|
} |
|
|
|
// console.log({ _cmdIndex }, 'history')
|
|
|
|
|
|
|
|
inputEl.current.innerText = cmdHistory[_cmdIndex] |
|
|
|
inputEl.current.innerText = cmdHistory[_cmdIndex] |
|
|
|
inputEl.current.focus() |
|
|
|
inputEl.current.focus() |
|
|
|
} else if (event.which === 40 && autoCompletState.showSuggestions) { |
|
|
|
} else if (event.which === 40 && autoCompletState.showSuggestions) { |
|
|
@ -585,7 +571,6 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
const block = data.receipt ? data.receipt.blockNumber : data.blockNumber || '' |
|
|
|
const block = data.receipt ? data.receipt.blockNumber : data.blockNumber || '' |
|
|
|
const i = data.receipt ? data.transactionIndex : data.transactionIndex |
|
|
|
const i = data.receipt ? data.transactionIndex : data.transactionIndex |
|
|
|
const value = val ? typeConversion.toInt(val) : 0 |
|
|
|
const value = val ? typeConversion.toInt(val) : 0 |
|
|
|
console.log({ blockChainProvider: blockchain.getProvider() }, ' blockChain Provider') |
|
|
|
|
|
|
|
if (blockchain.getProvider() === 'vm') { |
|
|
|
if (blockchain.getProvider() === 'vm') { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div> |
|
|
|
<div> |
|
|
@ -1401,9 +1386,6 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div style={{ height: '323px', flexGrow: 1 }} className='panel'> |
|
|
|
<div style={{ height: '323px', flexGrow: 1 }} className='panel'> |
|
|
|
{console.log({ newstate })} |
|
|
|
|
|
|
|
{console.log({ _cmdIndex })} |
|
|
|
|
|
|
|
{console.log({ cmdHistory })} |
|
|
|
|
|
|
|
<div className="bar"> |
|
|
|
<div className="bar"> |
|
|
|
{/* ${self._view.dragbar} */} |
|
|
|
{/* ${self._view.dragbar} */} |
|
|
|
<div className="dragbarHorizontal" onMouseDown={mousedown} id='dragId'></div> |
|
|
|
<div className="dragbarHorizontal" onMouseDown={mousedown} id='dragId'></div> |
|
|
@ -1476,7 +1458,6 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else if (x.name === 'knownTransaction') { |
|
|
|
} else if (x.name === 'knownTransaction') { |
|
|
|
return x.message.map((trans) => { |
|
|
|
return x.message.map((trans) => { |
|
|
|
console.log({ trans }, ' resolveData') |
|
|
|
|
|
|
|
return (<div className='px-4 block' data-id={`block_tx${trans.tx.hash}`} key={index}> { trans.tx.isCall ? renderCall(trans.tx, trans.resolvedData, trans.logs, index) : renderKnownTransactions(trans.tx, trans.receipt, trans.resolvedData, trans.logs, index)} </div>) |
|
|
|
return (<div className='px-4 block' data-id={`block_tx${trans.tx.hash}`} key={index}> { trans.tx.isCall ? renderCall(trans.tx, trans.resolvedData, trans.logs, index) : renderKnownTransactions(trans.tx, trans.receipt, trans.resolvedData, trans.logs, index)} </div>) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|