flattentree
filip mertens 11 months ago
parent 9e81449efb
commit 85739c4f3c
  1. 2
      .circleci/config.yml
  2. 16
      apps/remix-ide-e2e/src/tests/remixd.test.ts
  3. 4
      libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
  4. 18
      libs/remix-ui/workspace/src/lib/reducers/workspace.ts
  5. 2
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -3,7 +3,7 @@ version: 2.1
parameters:
run_flaky_tests:
type: boolean
default: false
default: true
orbs:
browser-tools: circleci/browser-tools@1.4.4
win: circleci/windows@5.0

@ -71,7 +71,7 @@ module.exports = {
'@sources': function () {
return sources
},
'run Remixd tests #group4': function (browser) {
'run Remixd tests #flaky #group4': function (browser) {
browser.perform(async (done) => {
remixd = await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts'))
console.log('working directory', process.cwd())
@ -81,7 +81,7 @@ module.exports = {
runTests(browser, done)
})
},
'Import from node_modules #group1': function (browser) {
'Import from node_modules #flaky #group1': function (browser) {
/*
when a relative import is used (i.e import "openzeppelin-solidity/contracts/math/SafeMath.sol")
remix (as well as truffle) try to resolve it against the node_modules and installed_contracts folder.
@ -96,7 +96,7 @@ module.exports = {
.setSolidityCompilerVersion('soljson-v0.5.0+commit.1d4f565a.js')
.testContracts('test_import_node_modules.sol', sources[3]['test_import_node_modules.sol'], ['SafeMath'])
},
'Import from node_modules and reference a github import #group2': function (browser) {
'Import from node_modules and reference a github import #flaky #group2': function (browser) {
browser.perform(async (done) => {
remixd = await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts'))
console.log('working directory', process.cwd())
@ -107,7 +107,7 @@ module.exports = {
.setSolidityCompilerVersion('soljson-v0.8.20+commit.a1b79de6.js') // open-zeppelin moved to pragma ^0.8.20
.testContracts('test_import_node_modules_with_github_import.sol', sources[4]['test_import_node_modules_with_github_import.sol'], ['ERC20', 'test11'])
},
'Static Analysis run with remixd #group3': '' + function (browser) {
'Static Analysis run with remixd #flaky #group3': '' + function (browser) {
browser.testContracts('test_static_analysis_with_remixd_and_hardhat.sol', sources[5]['test_static_analysis_with_remixd_and_hardhat.sol'], ['test5']).pause(2000)
.clickLaunchIcon('solidityStaticAnalysis')
/*
@ -139,7 +139,7 @@ module.exports = {
.scrollAndClick('#pluginManager *[data-id="pluginManagerComponentDeactivateButtonremixd"]')
},
'Should listen on compilation result from hardhat #group5': function (browser: NightwatchBrowser) {
'Should listen on compilation result from hardhat #flaky #group5': function (browser: NightwatchBrowser) {
browser.perform(async (done) => {
remixd = await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/hardhat'))
@ -166,7 +166,7 @@ module.exports = {
},
'Should load compilation result from hardhat when remixd connects #group6': function (browser: NightwatchBrowser) {
'Should load compilation result from hardhat when remixd connects #flaky #group6': function (browser: NightwatchBrowser) {
// artifacts/build-info/c7062fdd360381a85af23eeef31c98f8.json has already been created
browser
@ -194,7 +194,7 @@ module.exports = {
},
'Should listen on compilation result from foundry #group7': function (browser: NightwatchBrowser) {
'Should listen on compilation result from foundry #flaky #group7': function (browser: NightwatchBrowser) {
browser.perform(async (done) => {
remixd = await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/foundry'))
@ -229,7 +229,7 @@ module.exports = {
},
'Should listen on compilation result from truffle #group8': function (browser: NightwatchBrowser) {
'Should listen on compilation result from truffle #flaky #group8': function (browser: NightwatchBrowser) {
browser.perform(async (done) => {
remixd = await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts/truffle'))

@ -337,9 +337,9 @@ export const FileExplorer = (props: FileExplorerProps) => {
}
useEffect(() => {
console.log('fe files changed', ROOT_PATH)
console.log('fe files changed', ROOT_PATH, files, flatTree)
}, [files])
}, [flatTree, files])
useEffect(() => {
console.log('FE RENDER', ROOT_PATH)

@ -191,10 +191,10 @@ export const browserReducer = (state = browserInitialState, action: Actions) =>
console.log('FETCH_DIRECTORY_SUCCESS', payload)
const startTime = new Date().getTime()
const fd = fetchDirectoryContent(state, payload)
const flatTree = flattenTree(fd, state.browser.expandPath)
const flatTree = flattenTree(fd, state.mode === 'browser'? state.browser.expandPath : state.localhost.expandPath)
const endTime = new Date().getTime()
console.log('fetchDirectoryContent tree', endTime - startTime, fd)
console.log('fetchDirectoryContent tree', endTime - startTime, fd, flatTree)
return {
...state,
@ -213,7 +213,7 @@ export const browserReducer = (state = browserInitialState, action: Actions) =>
...state.localhost,
files:
state.mode === 'localhost'
? fetchDirectoryContent(state, payload)
? fd
: state.localhost.files,
flatTree: state.mode === 'localhost' ? flatTree : state.localhost.flatTree,
isRequestingDirectory: false,
@ -266,9 +266,9 @@ export const browserReducer = (state = browserInitialState, action: Actions) =>
}
const startTime = new Date().getTime()
const fd = fetchWorkspaceDirectoryContent(state, payload)
const flatTree = flattenTree(fd, state.browser.expandPath)
const flatTree = flattenTree(fd, state.mode === 'browser'? state.browser.expandPath : state.localhost.expandPath)
const endTime = new Date().getTime()
console.log('fetchDirectoryContent tree', endTime - startTime, fd)
console.log('fetchDirectoryContent tree', endTime - startTime, fd, flatTree)
return {
...state,
@ -454,7 +454,7 @@ export const browserReducer = (state = browserInitialState, action: Actions) =>
case 'ADD_INPUT_FIELD': {
const payload = action.payload
const fd = fetchDirectoryContent(state, payload)
const flatTree = flattenTree(fd, state.browser.expandPath)
const flatTree = flattenTree(fd, state.mode === 'browser'? state.browser.expandPath : state.localhost.expandPath)
return {
...state,
browser: {
@ -480,7 +480,7 @@ export const browserReducer = (state = browserInitialState, action: Actions) =>
case 'REMOVE_INPUT_FIELD': {
const payload = action.payload
const fd = removeInputField(state, payload.path)
const flatTree = flattenTree(fd, state.browser.expandPath)
const flatTree = flattenTree(fd, state.mode === 'browser'? state.browser.expandPath : state.localhost.expandPath)
return {
...state,
browser: {
@ -515,7 +515,7 @@ export const browserReducer = (state = browserInitialState, action: Actions) =>
case 'FILE_RENAMED_SUCCESS': {
const payload = action.payload
const fd = fetchDirectoryContent(state, payload, payload.oldPath)
const flatTree = flattenTree(fd, state.browser.expandPath)
const flatTree = flattenTree(fd, state.mode === 'browser'? state.browser.expandPath : state.localhost.expandPath)
return {
...state,
browser: {
@ -697,7 +697,7 @@ export const browserReducer = (state = browserInitialState, action: Actions) =>
case 'SET_EXPAND_PATH': {
const payload = action.payload as string[]
const flatTree = flattenTree(state.browser.files, payload)
const flatTree = flattenTree(state.mode === 'browser' ? state.browser.files : state.localhost.files, payload)
return {
...state,
browser: {

@ -1123,7 +1123,7 @@ export function Workspace() {
contextMenuItems={global.fs.localhost.contextMenu.registeredMenuItems}
removedContextMenuItems={global.fs.localhost.contextMenu.removedMenuItems}
files={global.fs.localhost.files}
flatTree={global.fs.browser.flatTree}
flatTree={global.fs.localhost.flatTree}
fileState={[]}
workspaceState={state}
expandPath={global.fs.localhost.expandPath}

Loading…
Cancel
Save