|
|
|
@ -12,9 +12,19 @@ export const RemixUITerminalMenuButtons = (props: RemixUiTerminalProps) => { |
|
|
|
|
dispatch({ type: SET_OPEN, payload: true }) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function showTerminal(event: any): void { |
|
|
|
|
const showTerminal = async(event: any): Promise<void> => { |
|
|
|
|
props.plugin.call('layout', 'minimize', props.plugin.profile.name, false) |
|
|
|
|
if( xtermState.terminals.length === 0) { |
|
|
|
|
const start_time = Date.now() |
|
|
|
|
const pid = await props.plugin.call('xterm', 'createTerminal', xtermState.workingDir, null) |
|
|
|
|
const end_time = Date.now() |
|
|
|
|
console.log(`createTerminal took ${end_time - start_time} ms`) |
|
|
|
|
dispatchXterm({ type: 'HIDE_ALL_TERMINALS', payload: null }) |
|
|
|
|
dispatchXterm({ type: 'SHOW_OUTPUT', payload: false }) |
|
|
|
|
dispatchXterm({ type: 'ADD_TERMINAL', payload: { pid, queue: '', timeStamp: Date.now(), ref: null, hidden: false } }) |
|
|
|
|
} else { |
|
|
|
|
dispatchXterm({ type: 'SHOW_OUTPUT', payload: false }) |
|
|
|
|
} |
|
|
|
|
dispatch({ type: SET_OPEN, payload: true }) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -23,7 +33,8 @@ export const RemixUITerminalMenuButtons = (props: RemixUiTerminalProps) => { |
|
|
|
|
<button id="tabOutput" data-id="tabOutput" className={`xtermButton btn btn-sm border-secondary mr-2 border ${!xtermState.showOutput ? '' : 'd-flex btn-secondary'}`} onClick={selectOutput}> |
|
|
|
|
Output |
|
|
|
|
</button> |
|
|
|
|
<button data-id="tabXTerm" id="tabXTerm" className={`xtermButton btn btn-sm border-secondary ${xtermState.terminalsEnabled ? 'd-block' : 'd-none'} ${xtermState.showOutput ? 'd-none' : 'btn-secondary'}`} onClick={showTerminal}> |
|
|
|
|
<button data-id="tabXTerm" id="tabXTerm" className={`xtermButton btn btn-sm border-secondary ${xtermState.terminalsEnabled ? 'd-block' : 'd-none'} ${xtermState.showOutput ? 'd-none' : 'btn-secondary'}`}
|
|
|
|
|
onClick={async(e) => await showTerminal(e)}> |
|
|
|
|
<span className="far fa-terminal border-0 ml-1"></span> |
|
|
|
|
</button> |
|
|
|
|
</div> |
|
|
|
|