Merge branch 'master' into nx3

deps^2
bunsenstraat 2 years ago committed by GitHub
commit 040552bd3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      apps/remix-ide-e2e/src/tests/workspace.test.ts
  2. 55
      apps/remix-ide-e2e/src/tests/workspace_git.test.ts
  3. 8
      apps/remix-ide/src/app/tabs/locales/en/filePanel.json
  4. 2
      apps/remix-ide/src/app/tabs/locales/zh/filePanel.json
  5. 2
      libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx
  6. 10
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  7. 51
      libs/remix-ui/workspace/src/lib/components/workspace-hamburger-item.tsx
  8. 297
      libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx
  9. 1
      libs/remix-ui/workspace/src/lib/contexts/index.ts
  10. 13
      libs/remix-ui/workspace/src/lib/css/remix-ui-workspace.css
  11. 7
      libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx
  12. 21
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
  13. 8
      libs/remixd/src/services/remixdClient.ts

@ -410,12 +410,12 @@ module.exports = {
browser
.useXpath()
.waitForElementPresent({
selector: '//i[@data-icon="workspaceDropdownMenuIcon"]',
selector: '//i[@data-id="workspaceDropdownMenuIcon"]',
locateStrategy: 'xpath',
})
.click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul')
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[3]') // rename workspace_name
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[4]') // rename workspace_name
.useCss()
.waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]')
.waitForElementVisible('*[data-id="modalDialogCustomPromptTextRename"]')

@ -58,19 +58,15 @@ module.exports = {
.waitForElementContainsText('[data-id="workspaceGitBranchesDropdown"]', 'main')
},
// CLONE REPOSITORY E2E START
'Should clone a repository #group2': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('filePanel')
.useXpath()
.click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.useCss()
.waitForElementVisible('[data-id="workspaceMenuDropdown"]')
.click('[data-id="workspaceMenuDropdown"]')
.waitForElementVisible('[data-id="workspaceclone"]')
.click('[data-id="workspaceclone"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystemModalDialogModalBody-react"]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')
@ -93,11 +89,9 @@ module.exports = {
'Should display non-clashing names for duplicate clone #group2': '' + function (browser: NightwatchBrowser) {
browser
.useXpath()
.click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.useCss()
.click('[data-id="workspaceMenuDropdown"]')
.waitForElementVisible('[data-id="workspaceclone"]')
.click('[data-id="workspaceclone"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystemModalDialogModalBody-react"]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')
@ -105,11 +99,9 @@ module.exports = {
.click('[data-id="fileSystem-modal-footer-ok-react"]')
.pause(5000)
.waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix1')
.useXpath()
.click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.useCss()
.click('[data-id="workspaceMenuDropdown"]')
.waitForElementVisible('[data-id="workspaceclone"]')
.click('[data-id="workspaceclone"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystemModalDialogModalBody-react"]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')
@ -117,10 +109,8 @@ module.exports = {
.click('[data-id="fileSystem-modal-footer-ok-react"]')
.pause(5000)
.waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix2')
.useXpath()
.click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.useCss()
.click('[data-id="workspaceMenuDropdown"]')
.waitForElementVisible('[data-id="workspaceDropdownMenuIcon]"')
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystemModalDialogModalBody-react"]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')
@ -136,15 +126,10 @@ module.exports = {
'Should display error message in modal for failed clone #group2': function (browser: NightwatchBrowser) {
browser
.useXpath()
.waitForElementPresent({
selector: '//i[@data-icon="workspaceDropdownMenuIcon"]',
locateStrategy: 'xpath',
})
.click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.useCss()
.waitForElementVisible('[data-id="workspaceDropdownMenuIcon"]')
.click('[data-id="workspaceMenuDropdown"]')
.waitForElementVisible('[data-id="workspaceclone"]')
.click('[data-id="workspaceclone"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystemModalDialogModalBody-react"]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')
@ -163,11 +148,9 @@ module.exports = {
browser
.clickLaunchIcon('filePanel')
.waitForElementNotVisible('[data-id="workspaceGitPanel"]')
.useXpath()
.click('//*[@id="workspacesMenuDropdown"]/span/i')
.waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]')
.useCss()
.click('[data-id="workspaceMenuDropdown"]')
.waitForElementVisible('[data-id="workspaceclone"]')
.click('[data-id="workspaceclone"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]')
.click('[data-id="fileSystemModalDialogModalBody-react"]')
.waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]')

@ -3,16 +3,18 @@
"filePanel.workspace": "WORKSPACES",
"filePanel.create": "Create",
"filePanel.clone": "Clone",
"filePanel.download": "Download",
"filePanel.download": "Backup",
"filePanel.restore": "Restore",
"filePanel.workspace.create": "Create Workspace",
"filePanel.workspace.rename": "Rename Workspace",
"filePanel.workspace.delete": "Delete Workspace",
"filePanel.workspace.deleteConfirm": "Are you sure to delete the current workspace?",
"filePanel.workspace.deleteAll": "Delete All Workspaces",
"filePanel.workspace.deleteAllConfirm": "Are you absolutely sure you want to delete all your workspaces? Deleted workspaces can not be restored in any manner.",
"filePanel.workspace.name": "Workspace name",
"filePanel.workspace.chooseTemplate": "Choose a template",
"filePanel.workspace.download": "Download Workspace",
"filePanel.workspace.restore": "Restore Workspace Backup",
"filePanel.workspace.download": "Backup Workspaces",
"filePanel.workspace.restore": "Restore Workspaces from the Backup",
"filePanel.workspace.clone": "Clone Git Repository",
"filePanel.workspace.cloneMessage": "Please provide a valid git repository url.",
"filePanel.workspace.enterGitUrl": "Enter git repository url",

@ -9,6 +9,8 @@
"filePanel.workspace.rename": "重命名工作空间",
"filePanel.workspace.delete": "删除工作空间",
"filePanel.workspace.deleteConfirm": "确定要删除当前工作空间?",
"filePanel.workspace.deleteAll": "Delete All Workspaces",
"filePanel.workspace.deleteAllConfirm": "Are you absolutely sure you want to delete all your workspaces? Deleted workspaces can not be restored in any manner.",
"filePanel.workspace.name": "工作空间名称",
"filePanel.workspace.chooseTemplate": "选择一个工作空间模板",
"filePanel.workspace.download": "下载工作空间",

@ -30,7 +30,7 @@ export const CustomIconsToggle = React.forwardRef(({ onClick, icon, className =
className={`${className.replace('dropdown-toggle', '')} mb-0 pb-0 d-flex justify-content-end align-items-end remixuimenuicon_shadow fs-3`}
data-id="workspaceMenuDropdown"
>
{ icon && <i style={{ fontSize: 'large' }} className={`${icon}`} data-icon="workspaceDropdownMenuIcon"></i> }
{ icon && <i style={{ fontSize: 'large' }} className={`${icon}`} data-id="workspaceDropdownMenuIcon"></i> }
</span>
))

@ -311,6 +311,14 @@ export const deleteWorkspace = async (workspaceName: string, cb?: (err: Error, r
cb && cb(null, workspaceName)
}
export const deleteAllWorkspaces = async () => {
await (await getWorkspaces()).map(async workspace => {
await deleteWorkspaceFromProvider(workspace.name)
await dispatch(setDeleteWorkspace(workspace.name))
plugin.workspaceDeleted(workspace.name)
})
}
const deleteWorkspaceFromProvider = async (workspaceName: string) => {
const workspacesPath = plugin.fileProviders.workspace.workspacesPath
@ -450,7 +458,6 @@ export const cloneRepository = async (url: string) => {
if (!isActive) await plugin.call('manager', 'activatePlugin', 'dgit')
await fetchWorkspaceDirectory(ROOT_PATH)
const workspacesPath = plugin.fileProviders.workspace.workspacesPath
console.log('go in to promise')
const branches = await getGitRepoBranches(workspacesPath + '/' + repoName)
dispatch(setCurrentWorkspaceBranches(branches))
@ -481,7 +488,6 @@ export const cloneRepository = async (url: string) => {
}
}
export const checkGit = async () => {
const isGitRepo = await plugin.fileManager.isGitRepo()
dispatch(setCurrentWorkspaceIsGitRepo(isGitRepo))

@ -0,0 +1,51 @@
import React from 'react'
import { CustomTooltip } from '@remix-ui/helper'
import { Dropdown } from 'react-bootstrap'
import { FormattedMessage } from 'react-intl'
const _paq = window._paq = window._paq || []
export interface HamburgerMenuItemProps {
hideOption: boolean
kind: string
actionOnClick: () => void
fa: string
}
export function HamburgerMenuItem (props: HamburgerMenuItemProps) {
const { hideOption } = props
const uid = 'workspace' + props.kind
return (
<>
<Dropdown.Item>
<CustomTooltip
placement="right-start"
tooltipId={uid + "Tooltip"}
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id={'filePanel.workspace.' + props.kind} />}
>
<div
data-id={uid}
key={uid + '-fe-ws'}
onClick={() => {
props.actionOnClick()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', {uid}])
}}
>
<span
hidden={hideOption}
id={uid}
data-id={uid}
className={props.fa + ' pl-2'}
style={{width: '1.4rem'}}
>
</span>
<span className="px-2">
<FormattedMessage id={'filePanel.' + props.kind } />
</span>
</div>
</CustomTooltip>
</Dropdown.Item>
</>
)
}

@ -1,13 +1,11 @@
import React from 'react'
import { CustomTooltip } from '@remix-ui/helper'
import { Dropdown } from 'react-bootstrap'
import { FormattedMessage } from 'react-intl'
const _paq = window._paq = window._paq || []
import { HamburgerMenuItem } from './workspace-hamburger-item'
export interface HamburgerMenuProps {
createWorkspace: () => void,
deleteCurrentWorkspace: () => void,
deleteAllWorkspaces: () => void,
renameCurrentWorkspace: () => void,
cloneGitRepository: () => void,
downloadWorkspaces: () => void,
@ -25,292 +23,49 @@ export function HamburgerMenu (props: HamburgerMenuProps) {
const { showIconsMenu, hideWorkspaceOptions, hideLocalhostOptions } = props
return (
<>
<Dropdown.Item>
<CustomTooltip
placement="right"
tooltipId="createWorkspaceTooltip"
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id='filePanel.workspace.create' />}
>
<div
data-id='workspaceCreate'
onClick={() => {
props.createWorkspace()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceCreate'])
props.hideIconsMenu(!showIconsMenu)
}}
key={`workspacesCreate-fe-ws`}
>
<span
hidden={hideWorkspaceOptions}
id='workspaceCreate'
data-id='workspaceCreate'
onClick={() => {
<HamburgerMenuItem kind='create' fa='far fa-plus' hideOption={hideWorkspaceOptions} actionOnClick={() => {
props.createWorkspace()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceCreate'])
props.hideIconsMenu(!showIconsMenu)
}}
className='far fa-plus pl-2'
>
</span>
<span className="pl-3"><FormattedMessage id='filePanel.create' /></span>
</div>
</CustomTooltip>
</Dropdown.Item>
<Dropdown.Item>
<CustomTooltip
placement="right-start"
tooltipId="createWorkspaceTooltip"
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id='filePanel.workspace.delete' />}
>
<div
data-id='workspaceDelete'
onClick={() => {
}}></HamburgerMenuItem>
<HamburgerMenuItem kind='delete' fa='far fa-trash' hideOption={hideWorkspaceOptions || hideLocalhostOptions} actionOnClick={() => {
props.deleteCurrentWorkspace()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceDelete'])
props.hideIconsMenu(!showIconsMenu)
}}
key={`workspacesDelete-fe-ws`}
>
<span
hidden={ hideWorkspaceOptions || hideLocalhostOptions }
id='workspaceDelete'
data-id='workspaceDelete'
onClick={() => {
props.deleteCurrentWorkspace()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceDelete'])
}}></HamburgerMenuItem>
<HamburgerMenuItem kind='deleteAll' fa='far fa-trash-alt' hideOption={hideWorkspaceOptions || hideLocalhostOptions} actionOnClick={() => {
props.deleteAllWorkspaces()
props.hideIconsMenu(!showIconsMenu)
}}
className='far fa-trash pl-2'
>
</span>
<span className="pl-3"><FormattedMessage id='filePanel.delete' /></span>
</div>
</CustomTooltip>
</Dropdown.Item>
<Dropdown.Item>
<CustomTooltip
placement='right-start'
tooltipClasses="text-nowrap"
tooltipId="workspaceRenametooltip"
tooltipText={<FormattedMessage id='filePanel.workspace.rename' />}
>
<div onClick={() => {
}}></HamburgerMenuItem>
<HamburgerMenuItem kind='rename' fa='far fa-edit' hideOption={hideWorkspaceOptions || hideLocalhostOptions} actionOnClick={() => {
props.renameCurrentWorkspace()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceRename'])
props.hideIconsMenu(!showIconsMenu)
}}
data-id='workspaceRename'
key={`workspacesRename-fe-ws`}
>
<span
hidden={ hideWorkspaceOptions || hideLocalhostOptions }
id='workspaceRename'
data-id='workspaceRename'
onClick={() => {
props.renameCurrentWorkspace()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceRename'])
props.hideIconsMenu(!showIconsMenu)
}}
className='far fa-edit pl-2'>
</span>
<span className="pl-3"><FormattedMessage id='filePanel.rename' /></span>
</div>
</CustomTooltip>
</Dropdown.Item>
<Dropdown.Item><Dropdown.Divider className="border mb-0 mt-0" /></Dropdown.Item>
<Dropdown.Item>
<CustomTooltip
placement="right-start"
tooltipId="cloneWorkspaceTooltip"
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id='filePanel.workspace.clone' />}
>
<div
data-id='cloneGitRepository'
onClick={() => {
props.cloneGitRepository()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'cloneGitRepository'])
props.hideIconsMenu(!showIconsMenu)
}}
key={`cloneGitRepository-fe-ws`}
>
<span
hidden={ hideWorkspaceOptions }
id='cloneGitRepository'
data-id='cloneGitRepository'
onClick={() => {
}}></HamburgerMenuItem>
<Dropdown.Divider className="border mb-0 mt-0 remixui_menuhr" style={{ pointerEvents: 'none' }} />
<HamburgerMenuItem kind='clone' fa='fab fa-github' hideOption={hideWorkspaceOptions} actionOnClick={() => {
props.cloneGitRepository()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'cloneGitRepository'])
props.hideIconsMenu(!showIconsMenu)
}}
className='fab fa-github pl-2'
>
</span>
<span className="pl-3"><FormattedMessage id='filePanel.clone' /></span>
</div>
</CustomTooltip>
</Dropdown.Item>
<Dropdown.Item><Dropdown.Divider className="border mt-0 mb-0 remixui_menuhr" style={{ pointerEvents: 'none' }}/></Dropdown.Item>
<Dropdown.Item>
<CustomTooltip
placement="right-start"
tooltipId="createWorkspaceTooltip"
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id='filePanel.workspace.download' />}
>
<div
data-id='workspacesDownload'
onClick={() => {
props.downloadWorkspaces()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspacesDownload'])
props.hideIconsMenu(!showIconsMenu)
}}
key={`workspacesDownload-fe-ws`}
>
<span
hidden={ hideWorkspaceOptions || hideLocalhostOptions }
id='workspacesDownload'
data-id='workspacesDownload'
onClick={() => {
}}></HamburgerMenuItem>
<Dropdown.Divider className="border mt-0 mb-0 remixui_menuhr" style={{ pointerEvents: 'none' }}/>
<HamburgerMenuItem kind='download' fa='far fa-download' hideOption={hideWorkspaceOptions || hideLocalhostOptions} actionOnClick={() => {
props.downloadWorkspaces()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspacesDownload'])
props.hideIconsMenu(!showIconsMenu)
}}
className='far fa-download pl-2 '
>
</span>
<span className="pl-3"><FormattedMessage id='filePanel.download' /></span>
</div>
</CustomTooltip>
</Dropdown.Item>
<Dropdown.Item>
<CustomTooltip
placement="right-start"
tooltipId="createWorkspaceTooltip"
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id='filePanel.workspace.restore' />}
>
<div
data-id='workspacesRestore'
onClick={() => {
props.restoreBackup()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspacesRestore'])
props.hideIconsMenu(!showIconsMenu)
}}
key={`workspacesRestore-fe-ws`}
>
<span
hidden={ hideWorkspaceOptions }
id='workspacesRestore'
data-id='workspacesRestore'
onClick={() => {
}}></HamburgerMenuItem>
<HamburgerMenuItem kind='restore' fa='far fa-upload' hideOption={hideWorkspaceOptions} actionOnClick={() => {
props.restoreBackup()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspacesRestore'])
props.hideIconsMenu(!showIconsMenu)
}}
className='far fa-upload pl-2'
>
</span>
<span className="pl-3"><FormattedMessage id='filePanel.restore' /></span>
</div>
</CustomTooltip>
</Dropdown.Item>
<Dropdown.Item><Dropdown.Divider className="border mt-0 mb-0 remixui_menuhr" style={{ pointerEvents: 'none' }}/></Dropdown.Item>
<Dropdown.Item>
<CustomTooltip
placement="right-start"
tooltipId="createSolGHActionTooltip"
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id='filePanel.workspace.solghaction' />}
>
<div
data-id='soliditygithubaction'
onClick={() => {
props.addGithubAction()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addSolidityTesting'])
props.hideIconsMenu(!showIconsMenu)
}}
>
<span
hidden={ hideWorkspaceOptions }
id='soliditygithubaction'
data-id='soliditygithubaction'
onClick={() => {
}}></HamburgerMenuItem>
<Dropdown.Divider className="border mt-0 mb-0 remixui_menuhr" style={{ pointerEvents: 'none' }}/>
<HamburgerMenuItem kind='solghaction' fa='fak fa-solidity-mono' hideOption={hideWorkspaceOptions} actionOnClick={() => {
props.addGithubAction()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addSolidityTesting'])
props.hideIconsMenu(!showIconsMenu)
}}
className='fak fa-solidity-mono pl-2'
>
</span>
<span className="pl-3">{<FormattedMessage id='filePanel.solghaction' />}</span>
</div>
</CustomTooltip>
</Dropdown.Item>
<Dropdown.Item>
<CustomTooltip
placement="right-start"
tooltipId="createTsSolTestGHActionTooltip"
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id='filePanel.workspace.tssoltestghaction' />}
>
<div
data-id='typescriptsoliditygithubtestaction'
onClick={() => {
}}></HamburgerMenuItem>
<HamburgerMenuItem kind='tssoltestghaction' fa='fab fa-js' hideOption={hideWorkspaceOptions} actionOnClick={() => {
props.addTsSolTestGithubAction()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addTsSolTestingAction'])
props.hideIconsMenu(!showIconsMenu)
}}
>
<span
hidden={ hideWorkspaceOptions }
id='tssoliditygithubaction'
data-id='tssoliditygithubaction'
onClick={() => {
props.addTsSolTestGithubAction()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addTsSolTestingAction'])
props.hideIconsMenu(!showIconsMenu)
}}
className='fab fa-js pl-2'
>
</span>
<span className="pl-3">{<FormattedMessage id='filePanel.tssoltestghaction' />}</span>
</div>
</CustomTooltip>
</Dropdown.Item>
<Dropdown.Item>
<CustomTooltip
placement="right-start"
tooltipId="createSlitherGHActionTooltip"
tooltipClasses="text-nowrap"
tooltipText={<FormattedMessage id='filePanel.workspace.slitherghaction' />}
>
<div
data-id='slithergithubtestaction'
onClick={() => {
props.addSlitherGithubAction()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addSlitherAction'])
props.hideIconsMenu(!showIconsMenu)
}}
>
<span
hidden={ hideWorkspaceOptions }
id='slithergithubaction'
data-id='slithergithubaction'
onClick={() => {
}}></HamburgerMenuItem>
<HamburgerMenuItem kind='slitherghaction' fa='far fa-shield' hideOption={hideWorkspaceOptions} actionOnClick={() => {
props.addSlitherGithubAction()
_paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addSlitherAction'])
props.hideIconsMenu(!showIconsMenu)
}}
className='far fa-shield pl-2'
>
</span>
<span className="pl-3">{<FormattedMessage id='filePanel.slitherghaction' />}</span>
</div>
</CustomTooltip>
</Dropdown.Item>
}}></HamburgerMenuItem>
</>
)
}

@ -15,6 +15,7 @@ export const FileSystemContext = createContext<{
dispatchSwitchToWorkspace: (name: string) => Promise<void>,
dispatchRenameWorkspace: (oldName: string, workspaceName: string) => Promise<void>,
dispatchDeleteWorkspace: (workspaceName: string) => Promise<void>,
dispatchDeleteAllWorkspaces: () => Promise<void>,
dispatchPublishToGist: (path?: string, type?: string) => Promise<void>,
dispatchUploadFile: (target?: SyntheticEvent, targetFolder?: string) => Promise<void>,
dispatchCreateNewFile: (path: string, rootDir: string) => Promise<void>,

@ -115,21 +115,8 @@
min-width: 8rem;
}
.remixui_menuhr{
}
#workspacesMenuDropdown>div>ul>a:nth-child(6):hover {
background-color: rgba(0,0,0,0)
}
#workspacesMenuDropdown>div>ul>a:nth-child(4):hover {
background-color: rgba(0, 0, 0, 0)
}
#workspacesMenuDropdown > div > ul > a:hover {
background-color: var(--secondary);
/* border: 1px solid var(--secondary); */
border-radius: 2px;
color: var(--text)
}

@ -5,7 +5,7 @@ import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { FileSystemContext } from '../contexts'
import { browserReducer, browserInitialState } from '../reducers/workspace'
import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder,
import { initWorkspace, fetchDirectory, removeInputField, deleteWorkspace, deleteAllWorkspaces, clearPopUp, publishToGist, createNewFile, setFocusElement, createNewFolder,
deletePath, renamePath, downloadPath, copyFile, copyFolder, runScript, emitContextMenuEvent, handleClickFile, handleExpandPath, addInputField, createWorkspace,
fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile, handleDownloadFiles, restoreBackupZip, cloneRepository, moveFile, moveFolder,
showAllBranches, switchBranch, createNewBranch, checkoutRemoteBranch, createSolidityGithubAction, createTsSolGithubAction, createSlitherGithubAction
@ -67,6 +67,10 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
await deleteWorkspace(workspaceName)
}
const dispatchDeleteAllWorkspaces = async () => {
await deleteAllWorkspaces()
}
const dispatchPublishToGist = async (path?: string, type?: string) => {
await publishToGist(path, type)
}
@ -258,6 +262,7 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
dispatchSwitchToWorkspace,
dispatchRenameWorkspace,
dispatchDeleteWorkspace,
dispatchDeleteAllWorkspaces,
dispatchPublishToGist,
dispatchUploadFile,
dispatchCreateNewFile,

@ -90,6 +90,16 @@ export function Workspace () {
)
}
const deleteAllWorkspaces = () => {
global.modal(
intl.formatMessage({ id: 'filePanel.workspace.deleteAll' }),
intl.formatMessage({ id: 'filePanel.workspace.deleteAllConfirm' }),
intl.formatMessage({ id: 'filePanel.ok' }),
onFinishDeleteAllWorkspaces,
''
)
}
const cloneGitRepository = () => {
global.modal(
intl.formatMessage({ id: 'filePanel.workspace.clone' }),
@ -175,7 +185,15 @@ export function Workspace () {
console.error(e)
}
}
/** ** ****/
const onFinishDeleteAllWorkspaces = async () => {
try {
await global.dispatchDeleteAllWorkspaces()
} catch (e) {
global.modal(intl.formatMessage({ id: 'filePanel.workspace.deleteAll' }), e.message, intl.formatMessage({ id: 'filePanel.ok' }), () => {}, '')
console.error(e)
}
}
const resetFocus = () => {
global.dispatchSetFocusElement([{ key: '', type: 'folder' }])
@ -433,6 +451,7 @@ export function Workspace () {
<HamburgerMenu
createWorkspace={createWorkspace}
deleteCurrentWorkspace={deleteCurrentWorkspace}
deleteAllWorkspaces={deleteAllWorkspaces}
renameCurrentWorkspace={renameCurrentWorkspace}
cloneGitRepository={cloneGitRepository}
downloadWorkspaces={downloadWorkspaces}

@ -5,12 +5,14 @@ import * as utils from '../utils'
import * as chokidar from 'chokidar'
import * as fs from 'fs-extra'
import * as isbinaryfile from 'isbinaryfile'
import * as pathModule from 'path'
export class RemixdClient extends PluginClient {
methods: Array<string>
websocket: WS
currentSharedFolder: string
watcher: chokidar.FSWatcher
trackDownStreamUpdate: Record<string, string> = {}
constructor (private readOnly = false) {
super()
@ -105,6 +107,7 @@ export class RemixdClient extends PluginClient {
this.createDir({ path: args.path.substr(0, args.path.lastIndexOf('/')) })
}
try {
this.trackDownStreamUpdate[path] = args.content
fs.writeFile(path, args.content, 'utf8', (error: Error) => {
if (error) {
console.log(error)
@ -263,8 +266,9 @@ export class RemixdClient extends PluginClient {
})
*/
this.watcher.on('change', async (f: string) => {
const currentContent = await this.call('editor', 'getText' as any, f)
const newContent = fs.readFileSync(f)
const path = pathModule.resolve(f)
const currentContent = this.trackDownStreamUpdate[path]
const newContent = fs.readFileSync(f, 'utf-8')
if (currentContent !== newContent && this.isLoaded) {
this.emit('changed', utils.relativePath(f, this.currentSharedFolder))
}

Loading…
Cancel
Save