desktopmerge
filip mertens 1 year ago
parent fc0a02ad0b
commit c1fabe8ee3
  1. 170
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
  2. 58
      libs/remix-ui/workspace/src/lib/actions/workspace.ts

@ -575,63 +575,63 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
return ( return (
( !props.visible? <></>: ( !props.visible? <></>:
<div style={{ flexGrow: 1 }} className="remix_ui_terminal_panel" ref={panelRef}> <div style={{ flexGrow: 1 }} className="remix_ui_terminal_panel" ref={panelRef}>
<div className="remix_ui_terminal_bar d-flex"> <div className="remix_ui_terminal_bar d-flex">
<div className="remix_ui_terminal_menu d-flex w-100 align-items-center position-relative border-top border-dark bg-light" ref={terminalMenu} data-id="terminalToggleMenu"> <div className="remix_ui_terminal_menu d-flex w-100 align-items-center position-relative border-top border-dark bg-light" ref={terminalMenu} data-id="terminalToggleMenu">
<CustomTooltip <CustomTooltip
placement="top" placement="top"
tooltipId="terminalToggle" tooltipId="terminalToggle"
tooltipClasses="text-nowrap" tooltipClasses="text-nowrap"
tooltipText={isOpen ? <FormattedMessage id="terminal.hideTerminal" /> : <FormattedMessage id="terminal.showTerminal" />} tooltipText={isOpen ? <FormattedMessage id="terminal.hideTerminal" /> : <FormattedMessage id="terminal.showTerminal" />}
> >
<i <i
className={`mx-2 remix_ui_terminal_toggleTerminal fas ${isOpen ? 'fa-angle-double-down' : 'fa-angle-double-up'}`} className={`mx-2 remix_ui_terminal_toggleTerminal fas ${isOpen ? 'fa-angle-double-down' : 'fa-angle-double-up'}`}
data-id="terminalToggleIcon" data-id="terminalToggleIcon"
onClick={handleToggleTerminal} onClick={handleToggleTerminal}
></i> ></i>
</CustomTooltip>
<div className="mx-2 remix_ui_terminal_console" id="clearConsole" data-id="terminalClearConsole" onClick={handleClearConsole}>
<CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText={<FormattedMessage id="terminal.clearConsole" />}>
<i className="fas fa-ban" aria-hidden="true"></i>
</CustomTooltip>
</div>
<CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText={<FormattedMessage id="terminal.pendingTransactions" />}>
<div className="mx-2">0</div>
</CustomTooltip>
<div className="h-80 mx-3 align-items-center remix_ui_terminal_listenOnNetwork custom-control custom-checkbox">
<CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText={intl.formatMessage({ id: 'terminal.listenTitle' })}>
<input className="custom-control-input" id="listenNetworkCheck" onChange={listenOnNetwork} type="checkbox" />
</CustomTooltip> </CustomTooltip>
<CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText={intl.formatMessage({ id: 'terminal.listenTitle' })}> <div className="mx-2 remix_ui_terminal_console" id="clearConsole" data-id="terminalClearConsole" onClick={handleClearConsole}>
<label <CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText={<FormattedMessage id="terminal.clearConsole" />}>
className="form-check-label custom-control-label text-nowrap" <i className="fas fa-ban" aria-hidden="true"></i>
style={{ paddingTop: '0.125rem' }} </CustomTooltip>
htmlFor="listenNetworkCheck" </div>
data-id="listenNetworkCheckInput" <CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText={<FormattedMessage id="terminal.pendingTransactions" />}>
> <div className="mx-2">0</div>
<FormattedMessage id="terminal.listen" />
</label>
</CustomTooltip> </CustomTooltip>
</div> <div className="h-80 mx-3 align-items-center remix_ui_terminal_listenOnNetwork custom-control custom-checkbox">
<div className="remix_ui_terminal_search d-flex align-items-center h-100"> <CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText={intl.formatMessage({ id: 'terminal.listenTitle' })}>
<i className="remix_ui_terminal_searchIcon d-flex align-items-center justify-content-center fas fa-search bg-light" aria-hidden="true"></i> <input className="custom-control-input" id="listenNetworkCheck" onChange={listenOnNetwork} type="checkbox" />
<input </CustomTooltip>
onChange={(event) => setSearchInput(event.target.value.trim())} <CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText={intl.formatMessage({ id: 'terminal.listenTitle' })}>
type="text" <label
className="remix_ui_terminal_filter border form-control" className="form-check-label custom-control-label text-nowrap"
id="searchInput" style={{ paddingTop: '0.125rem' }}
placeholder={intl.formatMessage({ id: 'terminal.search' })} htmlFor="listenNetworkCheck"
data-id="terminalInputSearch" data-id="listenNetworkCheckInput"
/> >
<FormattedMessage id="terminal.listen" />
</label>
</CustomTooltip>
</div>
<div className="remix_ui_terminal_search d-flex align-items-center h-100">
<i className="remix_ui_terminal_searchIcon d-flex align-items-center justify-content-center fas fa-search bg-light" aria-hidden="true"></i>
<input
onChange={(event) => setSearchInput(event.target.value.trim())}
type="text"
className="remix_ui_terminal_filter border form-control"
id="searchInput"
placeholder={intl.formatMessage({ id: 'terminal.search' })}
data-id="terminalInputSearch"
/>
</div>
</div> </div>
</div> </div>
</div> <div tabIndex={-1} className="remix_ui_terminal_container d-flex h-100 m-0 flex-column" data-id="terminalContainer">
<div tabIndex={-1} className="remix_ui_terminal_container d-flex h-100 m-0 flex-column" data-id="terminalContainer"> {handleAutoComplete()}
{handleAutoComplete()} <div className="position-relative d-flex flex-column-reverse h-100">
<div className="position-relative d-flex flex-column-reverse h-100"> <div id="journal" className="remix_ui_terminal_journal d-flex flex-column pt-3 pb-4 px-2 mx-2 mr-0" data-id="terminalJournal">
<div id="journal" className="remix_ui_terminal_journal d-flex flex-column pt-3 pb-4 px-2 mx-2 mr-0" data-id="terminalJournal"> {!clearConsole && <TerminalWelcomeMessage storage={storage} packageJson={version} />}
{!clearConsole && <TerminalWelcomeMessage storage={storage} packageJson={version} />} {newstate.journalBlocks &&
{newstate.journalBlocks &&
newstate.journalBlocks.map((x, index) => { newstate.journalBlocks.map((x, index) => {
if (x.name === EMPTY_BLOCK) { if (x.name === EMPTY_BLOCK) {
return ( return (
@ -768,41 +768,41 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
} }
} }
})} })}
<div ref={messagesEndRef} /> <div ref={messagesEndRef} />
</div>
{isOpen && (
<div id="terminalCli" data-id="terminalCli" className="remix_ui_terminal_cli position-absolute w-100" onClick={focusinput}>
<span className="remix_ui_terminal_prompt blink mx-1 font-weight-bold text-dark">{'>'}</span>
<input
className="remix_ui_terminal_input ml-1 text-dark text-break border-0"
ref={inputEl}
spellCheck="false"
contentEditable="true"
id="terminalCliInput"
data-id="terminalCliInput"
onChange={(event) => onChange(event)}
onKeyDown={(event) => handleKeyDown(event)}
value={autoCompletState.userInput}
onPaste={handlePaste}
></input>
</div> </div>
)} {isOpen && (
<div id="terminalCli" data-id="terminalCli" className="remix_ui_terminal_cli position-absolute w-100" onClick={focusinput}>
<span className="remix_ui_terminal_prompt blink mx-1 font-weight-bold text-dark">{'>'}</span>
<input
className="remix_ui_terminal_input ml-1 text-dark text-break border-0"
ref={inputEl}
spellCheck="false"
contentEditable="true"
id="terminalCliInput"
data-id="terminalCliInput"
onChange={(event) => onChange(event)}
onKeyDown={(event) => handleKeyDown(event)}
value={autoCompletState.userInput}
onPaste={handlePaste}
></input>
</div>
)}
</div>
</div> </div>
<ModalDialog
id="terminal"
title={modalState.title}
message={modalState.message}
hide={modalState.hide}
okLabel={modalState.okLabel}
cancelLabel={modalState.cancelLabel}
cancelFn={modalState.cancelFn}
handleHide={handleHideModal}
/>
{toaster && <Toaster message={intl.formatMessage({id: 'terminal.toasterMsg1'})} />}
{toastProvider.show && <Toaster message={intl.formatMessage({id: 'terminal.toasterMsg2'}, {fileName: toastProvider.fileName})} />}
</div> </div>
<ModalDialog ))
id="terminal"
title={modalState.title}
message={modalState.message}
hide={modalState.hide}
okLabel={modalState.okLabel}
cancelLabel={modalState.cancelLabel}
cancelFn={modalState.cancelFn}
handleHide={handleHideModal}
/>
{toaster && <Toaster message={intl.formatMessage({id: 'terminal.toasterMsg1'})} />}
{toastProvider.show && <Toaster message={intl.formatMessage({id: 'terminal.toasterMsg2'}, {fileName: toastProvider.fileName})} />}
</div>
))
} }
const typewrite = (elementsRef, message, callback) => { const typewrite = (elementsRef, message, callback) => {

@ -597,37 +597,37 @@ export const cloneRepository = async (url: string) => {
dispatch(cloneRepositoryRequest()) dispatch(cloneRepositoryRequest())
promise promise
.then(async () => { .then(async () => {
const isActive = await plugin.call('manager', 'isActive', 'dgit') const isActive = await plugin.call('manager', 'isActive', 'dgit')
if (!isActive) await plugin.call('manager', 'activatePlugin', 'dgit') if (!isActive) await plugin.call('manager', 'activatePlugin', 'dgit')
await fetchWorkspaceDirectory(ROOT_PATH) await fetchWorkspaceDirectory(ROOT_PATH)
const workspacesPath = plugin.fileProviders.workspace.workspacesPath const workspacesPath = plugin.fileProviders.workspace.workspacesPath
const branches = await getGitRepoBranches(workspacesPath + '/' + repoName) const branches = await getGitRepoBranches(workspacesPath + '/' + repoName)
dispatch(setCurrentWorkspaceBranches(branches)) dispatch(setCurrentWorkspaceBranches(branches))
const currentBranch = await getGitRepoCurrentBranch(workspacesPath + '/' + repoName) const currentBranch = await getGitRepoCurrentBranch(workspacesPath + '/' + repoName)
dispatch(setCurrentWorkspaceCurrentBranch(currentBranch)) dispatch(setCurrentWorkspaceCurrentBranch(currentBranch))
dispatch(cloneRepositorySuccess()) dispatch(cloneRepositorySuccess())
}).catch(() => { }).catch(() => {
const cloneModal = { const cloneModal = {
id: 'cloneGitRepository', id: 'cloneGitRepository',
title: 'Clone Git Repository', title: 'Clone Git Repository',
message: message:
'An error occurred: Please check that you have the correct URL for the repo. If the repo is private, you need to add your github credentials (with the valid token permissions) in Settings plugin', 'An error occurred: Please check that you have the correct URL for the repo. If the repo is private, you need to add your github credentials (with the valid token permissions) in Settings plugin',
modalType: 'modal', modalType: 'modal',
okLabel: 'OK', okLabel: 'OK',
okFn: async () => { okFn: async () => {
await deleteWorkspace(repoName) await deleteWorkspace(repoName)
dispatch(cloneRepositoryFailed()) dispatch(cloneRepositoryFailed())
}, },
hideFn: async () => { hideFn: async () => {
await deleteWorkspace(repoName) await deleteWorkspace(repoName)
dispatch(cloneRepositoryFailed()) dispatch(cloneRepositoryFailed())
}
} }
} plugin.call('notification', 'modal', cloneModal)
plugin.call('notification', 'modal', cloneModal) })
})
} catch (e) { } catch (e) {
dispatch(displayPopUp('An error occured: ' + e)) dispatch(displayPopUp('An error occured: ' + e))
} }

Loading…
Cancel
Save