From 862cccb064cfb11fa30c5f914cfee2371cc271d9 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 15 Feb 2023 12:25:25 +0100 Subject: [PATCH 01/12] added Delete All for workspaces --- .../src/app/tabs/locales/en/filePanel.json | 2 ++ .../src/app/tabs/locales/zh/filePanel.json | 2 ++ .../workspace/src/lib/actions/workspace.ts | 9 ++++- .../lib/components/workspace-hamburger.tsx | 33 +++++++++++++++++++ .../workspace/src/lib/contexts/index.ts | 1 + .../src/lib/providers/FileSystemProvider.tsx | 7 +++- .../workspace/src/lib/remix-ui-workspace.tsx | 21 +++++++++++- 7 files changed, 72 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json index a063529231..6148b791ae 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json @@ -9,6 +9,8 @@ "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 workspace?", "filePanel.workspace.name": "Workspace name", "filePanel.workspace.chooseTemplate": "Choose a template", "filePanel.workspace.download": "Download Workspace", diff --git a/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json b/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json index a0a1e1b0c7..467a556792 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json @@ -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 workspace?", "filePanel.workspace.name": "工作空间名称", "filePanel.workspace.chooseTemplate": "选择一个工作空间模板", "filePanel.workspace.download": "下载工作空间", diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index 8b3b1f14e6..f25827373c 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -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)) diff --git a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx index 02e9989aed..083c8b13ee 100644 --- a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx +++ b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx @@ -8,6 +8,7 @@ const _paq = window._paq = window._paq || [] export interface HamburgerMenuProps { createWorkspace: () => void, deleteCurrentWorkspace: () => void, + deleteAllWorkspaces: () => void, renameCurrentWorkspace: () => void, cloneGitRepository: () => void, downloadWorkspaces: () => void, @@ -89,6 +90,38 @@ export function HamburgerMenu (props: HamburgerMenuProps) { + + } + > +
{ + props.deleteAllWorkspaces() + _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceDeleteAll']) + props.hideIconsMenu(!showIconsMenu) + }} + key={`workspacesDelete-fe-ws`} + > + + +
+
+
Promise, dispatchRenameWorkspace: (oldName: string, workspaceName: string) => Promise, dispatchDeleteWorkspace: (workspaceName: string) => Promise, + dispatchDeleteAllWorkspaces: () => Promise, dispatchPublishToGist: (path?: string, type?: string) => Promise, dispatchUploadFile: (target?: SyntheticEvent, targetFolder?: string) => Promise, dispatchCreateNewFile: (path: string, rootDir: string) => Promise, diff --git a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx index 2921ebe308..887a0f1afd 100644 --- a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx +++ b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx @@ -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, diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 07c1b8ca85..4a1f8fdd83 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -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 () { Date: Wed, 15 Feb 2023 16:24:29 +0100 Subject: [PATCH 02/12] fixing data-id --- .../remix-ide-e2e/src/tests/workspace.test.ts | 2 +- .../src/tests/workspace_git.test.ts | 22 +++++++++---------- .../lib/components/workspace-hamburger.tsx | 16 +++++++------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index 633b387365..41a3aa531a 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -415,7 +415,7 @@ module.exports = { }) .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"]') diff --git a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts index e2293f4153..7f09d2cca5 100644 --- a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts @@ -68,8 +68,8 @@ module.exports = { .clickLaunchIcon('filePanel') .useXpath() .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') + .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') @@ -95,8 +95,8 @@ module.exports = { browser .useXpath() .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') + .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') @@ -107,8 +107,8 @@ module.exports = { .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]') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') + .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') @@ -119,7 +119,7 @@ module.exports = { .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix2') .useXpath() .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') @@ -142,8 +142,8 @@ module.exports = { locateStrategy: 'xpath', }) .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') + .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') @@ -165,8 +165,8 @@ module.exports = { .waitForElementNotVisible('[data-id="workspaceGitPanel"]') .useXpath() .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[5]') + .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') + .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') diff --git a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx index 083c8b13ee..b0976a49f2 100644 --- a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx +++ b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx @@ -98,24 +98,24 @@ export function HamburgerMenu (props: HamburgerMenuProps) { tooltipText={} >
{ props.deleteAllWorkspaces() _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceDeleteAll']) props.hideIconsMenu(!showIconsMenu) }} - key={`workspacesDelete-fe-ws`} + key={`workspacesDeleteAll-fe-ws`} > @@ -152,7 +152,7 @@ export function HamburgerMenu (props: HamburgerMenuProps) {
- + - + - + Date: Thu, 16 Feb 2023 12:30:50 +0100 Subject: [PATCH 03/12] mburger refactoring --- .../workspace/src/lib/actions/workspace.ts | 1 - .../lib/components/workspace-hamburger.tsx | 376 +++--------------- 2 files changed, 49 insertions(+), 328 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index f25827373c..a37759044e 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -488,7 +488,6 @@ export const cloneRepository = async (url: string) => { } } - export const checkGit = async () => { const isGitRepo = await plugin.fileManager.isGitRepo() dispatch(setCurrentWorkspaceIsGitRepo(isGitRepo)) diff --git a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx index b0976a49f2..0dc1e37fc6 100644 --- a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx +++ b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx @@ -1,9 +1,6 @@ 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, @@ -24,326 +21,51 @@ export interface HamburgerMenuProps { export function HamburgerMenu (props: HamburgerMenuProps) { const { showIconsMenu, hideWorkspaceOptions, hideLocalhostOptions } = props - return ( - <> - - } - > -
{ - props.createWorkspace() - _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceCreate']) - props.hideIconsMenu(!showIconsMenu) - }} - key={`workspacesCreate-fe-ws`} - > - - -
-
-
- - } - > -
{ - props.deleteCurrentWorkspace() - _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceDelete']) - props.hideIconsMenu(!showIconsMenu) - }} - key={`workspacesDelete-fe-ws`} - > - - -
-
-
- - } - > -
{ - props.deleteAllWorkspaces() - _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceDeleteAll']) - props.hideIconsMenu(!showIconsMenu) - }} - key={`workspacesDeleteAll-fe-ws`} - > - - -
-
-
- - } - > -
{ - props.renameCurrentWorkspace() - _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspaceRename']) - props.hideIconsMenu(!showIconsMenu) - }} - data-id='workspaceRename' - key={`workspacesRename-fe-ws`} - > - - -
-
-
- - - } - > -
{ - props.cloneGitRepository() - _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'cloneGitRepository']) - props.hideIconsMenu(!showIconsMenu) - }} - key={`cloneGitRepository-fe-ws`} - > - - -
-
-
- - - } - > -
{ - props.downloadWorkspaces() - _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspacesDownload']) - props.hideIconsMenu(!showIconsMenu) - }} - key={`workspacesDownload-fe-ws`} - > - - -
-
-
- - } - > -
{ - props.restoreBackup() - _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'workspacesRestore']) - props.hideIconsMenu(!showIconsMenu) - }} - key={`workspacesRestore-fe-ws`} - > - - -
-
-
- - - } - > -
{ - props.addGithubAction() - _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addSolidityTesting']) - props.hideIconsMenu(!showIconsMenu) - }} - > - - {} -
-
-
- - } - > -
{ - props.addTsSolTestGithubAction() - _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addTsSolTestingAction']) - props.hideIconsMenu(!showIconsMenu) - }} - > - - {} -
-
-
- - } - > -
{ - props.addSlitherGithubAction() - _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', 'addSlitherAction']) - props.hideIconsMenu(!showIconsMenu) - }} - > - - {} -
-
-
- - ) - } + return ( + <> + { + props.createWorkspace() + props.hideIconsMenu(!showIconsMenu) + }}> + { + props.deleteCurrentWorkspace() + props.hideIconsMenu(!showIconsMenu) + }}> + { + props.deleteAllWorkspaces() + props.hideIconsMenu(!showIconsMenu) + }}> + { + props.renameCurrentWorkspace() + props.hideIconsMenu(!showIconsMenu) + }}> + + { + props.cloneGitRepository() + props.hideIconsMenu(!showIconsMenu) + }}> + + { + props.downloadWorkspaces() + props.hideIconsMenu(!showIconsMenu) + }}> + { + props.restoreBackup() + props.hideIconsMenu(!showIconsMenu) + }}> + + { + props.addGithubAction() + props.hideIconsMenu(!showIconsMenu) + }}> + { + props.addTsSolTestGithubAction() + props.hideIconsMenu(!showIconsMenu) + }}> + { + props.addSlitherGithubAction() + props.hideIconsMenu(!showIconsMenu) + }}> + + ) + } \ No newline at end of file From 974713323a93e281e5af4814d97b6da5f7d753cc Mon Sep 17 00:00:00 2001 From: lianahus Date: Thu, 16 Feb 2023 12:39:51 +0100 Subject: [PATCH 04/12] adding the component file --- .../components/workspace-hamburger-item.tsx | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 libs/remix-ui/workspace/src/lib/components/workspace-hamburger-item.tsx diff --git a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger-item.tsx b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger-item.tsx new file mode 100644 index 0000000000..dc80908b9a --- /dev/null +++ b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger-item.tsx @@ -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 ( + <> + + } + > +
{ + props.actionOnClick() + _paq.push(['trackEvent', 'fileExplorer', 'workspaceMenu', {uid}]) + }} + > + + + + +
+
+
+ + ) + } From 3b27cb1db7d0c097813c8b6f4f14efa0d5a8662a Mon Sep 17 00:00:00 2001 From: lianahus Date: Thu, 16 Feb 2023 15:00:27 +0100 Subject: [PATCH 05/12] updated the warning msg e2e --- .../remix-ide-e2e/src/tests/workspace.test.ts | 2 +- .../src/tests/workspace_git.test.ts | 40 +++++++++---------- .../src/app/tabs/locales/en/filePanel.json | 2 +- .../src/app/tabs/locales/zh/filePanel.json | 2 +- .../src/lib/components/custom-dropdown.tsx | 4 +- 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index 41a3aa531a..7cda455c74 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -410,7 +410,7 @@ module.exports = { browser .useXpath() .waitForElementPresent({ - selector: '//i[@data-icon="workspaceDropdownMenuIcon"]', + selector: '//i[@data-id="workspaceDropdownMenuIcon"]', locateStrategy: 'xpath', }) .click('//*[@id="workspacesMenuDropdown"]/span/i') diff --git a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts index 7f09d2cca5..a60a3fb776 100644 --- a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts @@ -58,18 +58,16 @@ 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[6]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') + .waitForElementVisible('[data-id="workspaceDropdownMenuIcon"]') + .click('[data-id="workspaceDropdownMenuIcon"]') + .waitForElementVisible('[data-id="initGitRepositoryLabel"]') + .click('[data-id="workspaceclone]"') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') @@ -94,9 +92,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[6]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') + .click('[data-id="workspaceDropdownMenuIcon"]') + .waitForElementVisible('[data-id="workspaceclone]"') + .click('[data-id="workspaceclone]"') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') @@ -106,9 +104,9 @@ module.exports = { .pause(5000) .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix1') .useXpath() - .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') + .click('[data-id="workspaceDropdownMenuIcon"]') + .waitForElementVisible('[data-id="workspaceclone]"') + .click('[data-id="workspaceclone]"') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') @@ -118,8 +116,8 @@ module.exports = { .pause(5000) .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix2') .useXpath() - .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') + .click('[data-id="workspaceDropdownMenuIcon"]') + .waitForElementVisible('[data-id="workspaceclone]"') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') @@ -138,12 +136,12 @@ module.exports = { browser .useXpath() .waitForElementPresent({ - selector: '//i[@data-icon="workspaceDropdownMenuIcon"]', + selector: '[data-id="workspaceDropdownMenuIcon"]', locateStrategy: 'xpath', }) - .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') + .click('[data-id="workspaceDropdownMenuIcon"]') + .waitForElementVisible('[data-id="workspaceclone]"') + .click('[data-id="workspaceclone]"') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') @@ -164,9 +162,9 @@ module.exports = { .clickLaunchIcon('filePanel') .waitForElementNotVisible('[data-id="workspaceGitPanel"]') .useXpath() - .click('//*[@id="workspacesMenuDropdown"]/span/i') - .waitForElementVisible('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') - .click('//*[@id="workspacesMenuDropdown"]/div/ul/a[6]') + .click('[data-id="workspaceDropdownMenuIcon"]') + .waitForElementVisible('[data-id="workspaceclone]"') + .click('[data-id="workspaceclone]"') .useCss() .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') diff --git a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json index 6148b791ae..df659f9820 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json @@ -10,7 +10,7 @@ "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 workspace?", + "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", diff --git a/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json b/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json index 467a556792..94129f0d31 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json @@ -10,7 +10,7 @@ "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 workspace?", + "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": "下载工作空间", diff --git a/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx b/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx index 04d31c4839..5322b4c61a 100644 --- a/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx +++ b/libs/remix-ui/helper/src/lib/components/custom-dropdown.tsx @@ -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 && } + { icon && } )) @@ -48,7 +48,7 @@ export const CustomMenu = React.forwardRef( >
    { - children + children }
From fd7a03776ede96e289722f55eb2ea91c9aed3572 Mon Sep 17 00:00:00 2001 From: lianahus Date: Mon, 20 Feb 2023 12:04:51 +0100 Subject: [PATCH 06/12] fixing hover --- .../workspace/src/lib/css/remix-ui-workspace.css | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/css/remix-ui-workspace.css b/libs/remix-ui/workspace/src/lib/css/remix-ui-workspace.css index b52432b403..020c7807cc 100644 --- a/libs/remix-ui/workspace/src/lib/css/remix-ui-workspace.css +++ b/libs/remix-ui/workspace/src/lib/css/remix-ui-workspace.css @@ -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) } From 18f8045fcf1ffc7bb092386760c59146a92807e7 Mon Sep 17 00:00:00 2001 From: lianahus Date: Mon, 20 Feb 2023 12:33:50 +0100 Subject: [PATCH 07/12] e2e --- .../src/tests/workspace_git.test.ts | 53 +++++++------------ 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts index a60a3fb776..fd2c261493 100644 --- a/apps/remix-ide-e2e/src/tests/workspace_git.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace_git.test.ts @@ -63,12 +63,10 @@ module.exports = { 'Should clone a repository #group2': function (browser: NightwatchBrowser) { browser .clickLaunchIcon('filePanel') - .useXpath() - .waitForElementVisible('[data-id="workspaceDropdownMenuIcon"]') - .click('[data-id="workspaceDropdownMenuIcon"]') - .waitForElementVisible('[data-id="initGitRepositoryLabel"]') - .click('[data-id="workspaceclone]"') - .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"]') @@ -91,11 +89,9 @@ module.exports = { 'Should display non-clashing names for duplicate clone #group2': '' + function (browser: NightwatchBrowser) { browser - .useXpath() - .click('[data-id="workspaceDropdownMenuIcon"]') - .waitForElementVisible('[data-id="workspaceclone]"') - .click('[data-id="workspaceclone]"') - .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"]') @@ -103,11 +99,9 @@ module.exports = { .click('[data-id="fileSystem-modal-footer-ok-react"]') .pause(5000) .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix1') - .useXpath() - .click('[data-id="workspaceDropdownMenuIcon"]') - .waitForElementVisible('[data-id="workspaceclone]"') - .click('[data-id="workspaceclone]"') - .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"]') @@ -115,10 +109,8 @@ module.exports = { .click('[data-id="fileSystem-modal-footer-ok-react"]') .pause(5000) .waitForElementContainsText('[data-id="workspacesSelect"]', 'awesome-remix2') - .useXpath() - .click('[data-id="workspaceDropdownMenuIcon"]') - .waitForElementVisible('[data-id="workspaceclone]"') - .useCss() + .click('[data-id="workspaceMenuDropdown"]') + .waitForElementVisible('[data-id="workspaceDropdownMenuIcon]"') .waitForElementVisible('[data-id="fileSystemModalDialogModalBody-react"]') .click('[data-id="fileSystemModalDialogModalBody-react"]') .waitForElementVisible('[data-id="modalDialogCustomPromptTextClone"]') @@ -134,15 +126,10 @@ module.exports = { 'Should display error message in modal for failed clone #group2': function (browser: NightwatchBrowser) { browser - .useXpath() - .waitForElementPresent({ - selector: '[data-id="workspaceDropdownMenuIcon"]', - locateStrategy: 'xpath', - }) - .click('[data-id="workspaceDropdownMenuIcon"]') - .waitForElementVisible('[data-id="workspaceclone]"') - .click('[data-id="workspaceclone]"') - .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"]') @@ -161,11 +148,9 @@ module.exports = { browser .clickLaunchIcon('filePanel') .waitForElementNotVisible('[data-id="workspaceGitPanel"]') - .useXpath() - .click('[data-id="workspaceDropdownMenuIcon"]') - .waitForElementVisible('[data-id="workspaceclone]"') - .click('[data-id="workspaceclone]"') - .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"]') From 941c9ba56775feff757a28985892b95884cb26b0 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 22 Feb 2023 09:46:53 +0100 Subject: [PATCH 08/12] label changed for Backup --- apps/remix-ide/src/app/tabs/locales/en/filePanel.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json index df659f9820..e8af327d89 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json @@ -13,8 +13,8 @@ "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", From b4a2575bf67e75c68ae6fb7f62fc944b2f31a8ab Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 22 Feb 2023 09:52:58 +0100 Subject: [PATCH 09/12] changed the label in the Ws dropdown --- apps/remix-ide/src/app/tabs/locales/en/filePanel.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json index e8af327d89..fa9e3500c1 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json @@ -3,7 +3,7 @@ "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", From 8b8f5005e61ea4a6d08b013c7cb6d0179e245152 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Wed, 22 Feb 2023 08:37:23 +0100 Subject: [PATCH 10/12] Update solidityImport.test.ts fix test --- apps/remix-ide-e2e/src/tests/solidityImport.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/solidityImport.test.ts b/apps/remix-ide-e2e/src/tests/solidityImport.test.ts index 2b75395e2a..79272841cf 100644 --- a/apps/remix-ide-e2e/src/tests/solidityImport.test.ts +++ b/apps/remix-ide-e2e/src/tests/solidityImport.test.ts @@ -31,8 +31,7 @@ module.exports = { .isVisible({ selector: "//span[contains(.,'not found Untitled11')]", locateStrategy: 'xpath', - timeout: 120000, - suppressNotFoundErrors: true + timeout: 120000 }) }, From 3c6447f2479e4179a0f25b37de9e4cd87c383dc2 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Wed, 22 Feb 2023 12:00:33 +0100 Subject: [PATCH 11/12] Fixed down stream update sync --- libs/remixd/src/services/remixdClient.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/remixd/src/services/remixdClient.ts b/libs/remixd/src/services/remixdClient.ts index a3f3d9dd8f..4718cfbcf1 100644 --- a/libs/remixd/src/services/remixdClient.ts +++ b/libs/remixd/src/services/remixdClient.ts @@ -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 websocket: WS currentSharedFolder: string watcher: chokidar.FSWatcher + trackDownStreamUpdate: Record = {} 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)) } From b865e91e71e259052c383fd76162ab59f98b7027 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Wed, 22 Feb 2023 12:00:33 +0100 Subject: [PATCH 12/12] Remove external commit --- apps/remix-ide-e2e/src/tests/solidityImport.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/solidityImport.test.ts b/apps/remix-ide-e2e/src/tests/solidityImport.test.ts index 79272841cf..2b75395e2a 100644 --- a/apps/remix-ide-e2e/src/tests/solidityImport.test.ts +++ b/apps/remix-ide-e2e/src/tests/solidityImport.test.ts @@ -31,7 +31,8 @@ module.exports = { .isVisible({ selector: "//span[contains(.,'not found Untitled11')]", locateStrategy: 'xpath', - timeout: 120000 + timeout: 120000, + suppressNotFoundErrors: true }) },